AnsweredAssumed Answered

<List> of Process Models

Question asked by dcmccain on Sep 21, 2016
Hello:

Using Java/Spring-boot, I have created a rest service for workflow using methods from the Activiti API. I am having a problem getting a list of Process Models known to the Activiti engine. My process specifications are located in my /src/main/resources/processes directory and as a .bpmn file created with the eclipse Activiti diagram editor. I have attempted to get a list of Process Models using the RepositoryService API using the createModelQuery. There are no errors from this call, but no entries are returned. Any insight as to what I may doing wrong would be appreciated. My code is listed below:

public ArrayNode getProcessTypes(){
       init();
        ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine();
        RepositoryService repoService = processEngine.getRepositoryService();
        List<Model> mdlLst = repoService.createModelQuery().list();
       ObjectMapper mapper = new ObjectMapper();
       ArrayNode models = mapper.createArrayNode();
       for(Model mdl:mdlLst){
          ObjectNode mdlObj = mapper.createObjectNode();
          mdlObj.put("DeploymentID", mdl.getDeploymentId());
          mdlObj.put("Id", mdl.getId());
          mdlObj.put("Name", mdl.getName());
          mdlObj.put("MetaInfo", mdl.getMetaInfo());
          models.add(mdlObj);
       }
}

regards,
Derrick

Outcomes