Search in sources :

Example 16 with ModelQuery

use of org.activiti.engine.repository.ModelQuery in project Activiti by Activiti.

the class ModelQueryTest method testQueryByInvalidName.

public void testQueryByInvalidName() {
    ModelQuery query = repositoryService.createModelQuery().modelName("invalid");
    assertThat(query.singleResult()).isNull();
    assertThat(query.list()).hasSize(0);
    assertThat(query.count()).isEqualTo(0);
}
Also used : ModelQuery(org.activiti.engine.repository.ModelQuery)

Example 17 with ModelQuery

use of org.activiti.engine.repository.ModelQuery in project Activiti by Activiti.

the class ModelQueryEscapeClauseTest method testQueryByNameLike.

public void testQueryByNameLike() throws Exception {
    ModelQuery query = repositoryService.createModelQuery().modelNameLike("%\\%%");
    Model model = query.singleResult();
    assertThat(model).isNotNull();
    assertThat(model.getKey()).isEqualTo("someKey1");
    assertThat(new String(repositoryService.getModelEditorSource(model.getId()), "utf-8")).isEqualTo("bytes");
    assertThat(query.list()).hasSize(1);
    assertThat(query.count()).isEqualTo(1);
    query = repositoryService.createModelQuery().modelNameLike("%\\_%");
    model = query.singleResult();
    assertThat(model).isNotNull();
    assertThat(model.getKey()).isEqualTo("someKey2");
    assertThat(new String(repositoryService.getModelEditorSource(model.getId()), "utf-8")).isEqualTo("bytes");
    assertThat(query.list()).hasSize(1);
    assertThat(query.count()).isEqualTo(1);
}
Also used : Model(org.activiti.engine.repository.Model) ModelQuery(org.activiti.engine.repository.ModelQuery)

Example 18 with ModelQuery

use of org.activiti.engine.repository.ModelQuery in project Activiti by Activiti.

the class ModelQueryTest method testQueryByCategoryLike.

public void testQueryByCategoryLike() {
    ModelQuery query = repositoryService.createModelQuery().modelCategoryLike("%te%");
    assertThat(query.list()).hasSize(1);
    assertThat(query.count()).isEqualTo(1);
}
Also used : ModelQuery(org.activiti.engine.repository.ModelQuery)

Example 19 with ModelQuery

use of org.activiti.engine.repository.ModelQuery in project Activiti by Activiti.

the class ModelQueryTest method testByInvalidDeploymentId.

public void testByInvalidDeploymentId() {
    ModelQuery query = repositoryService.createModelQuery().deploymentId("invalid");
    assertThat(query.singleResult()).isNull();
    assertThat(query.count()).isEqualTo(0);
}
Also used : ModelQuery(org.activiti.engine.repository.ModelQuery)

Example 20 with ModelQuery

use of org.activiti.engine.repository.ModelQuery in project Activiti by Activiti.

the class ModelQueryTest method testQueryByKey.

public void testQueryByKey() {
    ModelQuery query = repositoryService.createModelQuery().modelName("my model").modelKey("someKey");
    Model model = query.singleResult();
    assertThat(model).isNotNull();
    assertThat(query.list()).hasSize(1);
    assertThat(query.count()).isEqualTo(1);
}
Also used : Model(org.activiti.engine.repository.Model) ModelQuery(org.activiti.engine.repository.ModelQuery)

Aggregations

ModelQuery (org.activiti.engine.repository.ModelQuery)23 Model (org.activiti.engine.repository.Model)9 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 List (java.util.List)1 GET (javax.ws.rs.GET)1 Path (javax.ws.rs.Path)1 Produces (javax.ws.rs.Produces)1 RepositoryService (org.activiti.engine.RepositoryService)1 RestResponseFactory (org.wso2.carbon.bpmn.rest.common.RestResponseFactory)1 DataResponse (org.wso2.carbon.bpmn.rest.model.common.DataResponse)1 ModelResponse (org.wso2.carbon.bpmn.rest.model.repository.ModelResponse)1 ModelsPaginateList (org.wso2.carbon.bpmn.rest.model.repository.ModelsPaginateList)1