Package org.activiti.engine.repository

Examples of org.activiti.engine.repository.ModelQuery


    allowedSortProperties.put("tenantId", ModelQueryProperty.MODEL_TENANT_ID);
  }
 
  @RequestMapping(value="/repository/models", method = RequestMethod.GET, produces = "application/json")
  public DataResponse getModels(@RequestParam Map<String,String> allRequestParams, HttpServletRequest request) {
    ModelQuery modelQuery = repositoryService.createModelQuery();
   
    if (allRequestParams.containsKey("id")) {
      modelQuery.modelId(allRequestParams.get("id"));
    }
    if (allRequestParams.containsKey("category")) {
      modelQuery.modelCategory(allRequestParams.get("category"));
    }
    if (allRequestParams.containsKey("categoryLike")) {
      modelQuery.modelCategoryLike(allRequestParams.get("categoryLike"));
    }
    if (allRequestParams.containsKey("categoryNotEquals")) {
      modelQuery.modelCategoryNotEquals(allRequestParams.get("categoryNotEquals"));
    }
    if (allRequestParams.containsKey("name")) {
      modelQuery.modelName(allRequestParams.get("name"));
    }
    if (allRequestParams.containsKey("nameLike")) {
      modelQuery.modelNameLike(allRequestParams.get("nameLike"));
    }
    if (allRequestParams.containsKey("key")) {
      modelQuery.modelKey(allRequestParams.get("key"));
    }
    if (allRequestParams.containsKey("version")) {
      modelQuery.modelVersion(Integer.valueOf(allRequestParams.get("version")));
    }
    if (allRequestParams.containsKey("latestVersion")) {
      boolean isLatestVersion = Boolean.valueOf(allRequestParams.get("latestVersion"));
      if (isLatestVersion) {
        modelQuery.latestVersion();
      }
    }
    if (allRequestParams.containsKey("deploymentId")) {
      modelQuery.deploymentId(allRequestParams.get("deploymentId"));
    }
    if (allRequestParams.containsKey("deployed")) {
      boolean isDeployed = Boolean.valueOf(allRequestParams.get("deployed"));
      if (isDeployed) {
        modelQuery.deployed();
      } else {
        modelQuery.notDeployed();
      }
    }
    if (allRequestParams.containsKey("tenantId")) {
      modelQuery.modelTenantId(allRequestParams.get("tenantId"));
    }
    if (allRequestParams.containsKey("tenantIdLike")) {
      modelQuery.modelTenantIdLike(allRequestParams.get("tenantIdLike"));
    }
    if (allRequestParams.containsKey("withoutTenantId")) {
      boolean withoutTenantId = Boolean.valueOf(allRequestParams.get("withoutTenantId"));
      if (withoutTenantId) {
        modelQuery.modelWithoutTenantId();
      }
    }
    return new ModelsPaginateList(restResponseFactory, request.getRequestURL().toString().replace("/repository/models", ""))
        .paginateList(allRequestParams, modelQuery, "id", allowedSortProperties);
  }
View Full Code Here


    super.tearDown();
    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());
View Full Code Here

    assertNotNull(model.getCreateTime());
    assertNotNull(model.getLastUpdateTime());
  }
 
  public void testQueryNoCriteria() {
    ModelQuery query = repositoryService.createModelQuery();
    assertEquals(1, query.list().size());
    assertEquals(1, query.count());
  }
View Full Code Here

    assertEquals(1, query.list().size());
    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(1, query.list().size());
    assertEquals(1, query.count());
  }
 
  public void testQueryByInvalidName() {
    ModelQuery query = repositoryService.createModelQuery().modelName("invalid");
    assertNull(query.singleResult());
    assertEquals(0, query.list().size());
    assertEquals(0, query.count());
  }
View Full Code Here

    assertEquals(0, query.list().size());
    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(1, query.list().size());
    assertEquals(1, query.count());
  }
 
  public void testQueryByInvalidNameLike() {
    ModelQuery query = repositoryService.createModelQuery().modelNameLike("%invalid%");
    assertNull(query.singleResult());
    assertEquals(0, query.list().size());
    assertEquals(0, query.count());
  }
View Full Code Here

    assertEquals(0, query.list().size());
    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.list().size());
    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(1, query.list().size());
    assertEquals(1, query.count());
  }
 
  public void testQueryByInvalidKey() {
    ModelQuery query = repositoryService.createModelQuery().modelKey("invalid");
    assertNull(query.singleResult());
    assertEquals(0, query.list().size());
    assertEquals(0, query.count());
  }
View Full Code Here

TOP

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

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.