Package org.activiti.engine.repository

Examples of org.activiti.engine.repository.Model


  /**
   * Returns the {@link Model} that is requested. Throws the right exceptions
   * when bad request was made or model is not found.
   */
  protected Model getModelFromRequest(String modelId) {
    Model model = repositoryService.createModelQuery().modelId(modelId).singleResult();
  
    if (model == null) {
      throw new ActivitiObjectNotFoundException("Could not find a model with id '" + modelId + "'.", ProcessDefinition.class);
    }
    return model;
View Full Code Here


 
  private String modelOneId;
 
  @Override
  protected void setUp() throws Exception {
    Model model = repositoryService.newModel();
    model.setName("my model");
    model.setKey("someKey");
    model.setCategory("test");
    repositoryService.saveModel(model);
    modelOneId = model.getId();
   
    repositoryService.addModelEditorSource(modelOneId, "bytes".getBytes("utf-8"));
   
    super.setUp();
  }
View Full Code Here

    repositoryService.deleteModel(modelOneId);
  }
 
  public void testModelProperties() {
    ModelQuery query = repositoryService.createModelQuery();
    Model model = query.singleResult();
    assertNotNull(model.getId());
    assertNotNull(model.getCategory());
    assertNotNull(model.getKey());
    assertNotNull(model.getName());
    assertNotNull(model.getVersion());
    assertNotNull(model.getCreateTime());
    assertNotNull(model.getLastUpdateTime());
  }
View Full Code Here

    assertEquals(1, query.count());
  }
 
  public void testQueryByName() throws Exception {
    ModelQuery query = repositoryService.createModelQuery().modelName("my model");
    Model model = query.singleResult();
    assertNotNull(model);
    assertEquals("bytes", new String(repositoryService.getModelEditorSource(model.getId()), "utf-8"));
    assertEquals(1, query.list().size());
    assertEquals(1, query.count());
  }
View Full Code Here

    assertEquals(0, query.count());
  }
 
  public void testQueryByNameLike() throws Exception {
    ModelQuery query = repositoryService.createModelQuery().modelNameLike("%model%");
    Model model = query.singleResult();
    assertNotNull(model);
    assertEquals("bytes", new String(repositoryService.getModelEditorSource(model.getId()), "utf-8"));
    assertEquals(1, query.list().size());
    assertEquals(1, query.count());
  }
View Full Code Here

    assertEquals(0, query.count());
  }
 
  public void testQueryByKey() {
    ModelQuery query = repositoryService.createModelQuery().modelName("my model").modelKey("someKey");
    Model model = query.singleResult();
    assertNotNull(model);
    assertEquals(1, query.list().size());
    assertEquals(1, query.count());
  }
View Full Code Here

    assertEquals(1, query.count());
  }
 
  public void testQueryByNameAndKey() {
    ModelQuery query = repositoryService.createModelQuery().modelKey("someKey");
    Model model = query.singleResult();
    assertNotNull(model);
    assertEquals(1, query.list().size());
    assertEquals(1, query.count());
  }
View Full Code Here

   
    assertEquals(0, repositoryService.createModelQuery().deploymentId(deployment.getId()).count());
    assertEquals(0, repositoryService.createModelQuery().deployed().count());
    assertEquals(1, repositoryService.createModelQuery().notDeployed().count());
   
    Model model = repositoryService.createModelQuery().singleResult();
    model.setDeploymentId(deployment.getId());
    repositoryService.saveModel(model);
   
    assertEquals(1, repositoryService.createModelQuery().deploymentId(deployment.getId()).count());
    assertEquals(1, repositoryService.createModelQuery().deployed().count());
    assertEquals(0, repositoryService.createModelQuery().notDeployed().count());
View Full Code Here

    assertEquals(1, query.orderByModelKey().desc().count());
  }
 
  public void testByLatestVersion() {
    ModelQuery query = repositoryService.createModelQuery().latestVersion().modelKey("someKey");
    Model model = query.singleResult();
    assertNotNull(model);
   
    // Add a new version of the model
    Model newVersion = repositoryService.newModel();
    newVersion.setName("my model");
    newVersion.setKey("someKey");
    newVersion.setCategory("test");
    newVersion.setVersion(model.getVersion() + 1);
    repositoryService.saveModel(newVersion);
   
    // Verify query
    model = query.singleResult();
    assertNotNull(model);
View Full Code Here

    List<Model> models = repositoryService.createModelQuery()
      .orderByModelName()
      .asc()
      .list();
   
    Model modelOne = models.get(0);
    assertEquals("my model", modelOne.getName());
    assertEquals(modelOneId, modelOne.getId());

    models = repositoryService.createModelQuery()
      .modelNameLike("%model%")
      .orderByModelName()
      .asc()
View Full Code Here

TOP

Related Classes of org.activiti.engine.repository.Model

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.