cancel
Showing results for 
Search instead for 
Did you mean: 

Getting process definitions by deployment id does not return all definitions

joshting
Champ in-the-making
Champ in-the-making
I need to obtain all the process definitions based on the deployment id as I wanted to treat a deployment as a single process which can contain many subprocesses (sub bpmns).  There are 16 bpmns files with one of them as the main top level bpmn.  When I use the following REST service:

repository/process-definitions/?deploymentId=XXXX

It returned only 10 processes out of the 16.  At the end of the json message is this:

"total":16,"start":0,"sort":"name","order":"asc","size":10

This doesn't make sense.  The total of process definitions is 16 but the size is 10.  Is there a bug in the REST api or is there something in the BPMN rules that I might have missed?
3 REPLIES 3

joshting
Champ in-the-making
Champ in-the-making
Some extra information:

Here is the error reported:
10:55:28,559 [http-nio-8080-exec-8] WARN  org.activiti.engine.impl.bpmn.deployer.BpmnDeployer  - Error while generating process diagram, image will not be stored in repository
java.lang.NullPointerException
at org.activiti.image.impl.DefaultProcessDiagramGenerator.connectionPerfectionizer(DefaultProcessDiagramGenerator.java:681)
at org.activiti.image.impl.DefaultProcessDiagramGenerator$22.draw(DefaultProcessDiagramGenerator.java:380)
at org.activiti.image.impl.DefaultProcessDiagramGenerator.drawArtifact(DefaultProcessDiagramGenerator.java:768)
at org.activiti.image.impl.DefaultProcessDiagramGenerator.generateProcessDiagram(DefaultProcessDiagramGenerator.java:500)
at org.activiti.image.impl.DefaultProcessDiagramGenerator.generateDiagram(DefaultProcessDiagramGenerator.java:404)
at org.activiti.image.impl.DefaultProcessDiagramGenerator.generateDiagram(DefaultProcessDiagramGenerator.java:426)
at org.activiti.engine.impl.bpmn.deployer.BpmnDeployer.deploy(BpmnDeployer.java:131)
at org.activiti.engine.impl.persistence.deploy.DeploymentManager.deploy(DeploymentManager.java:57)

And attached is the BPMN file that has the problem (which I rename some of the elements due to confidentiality)

vasile_dirla
Star Contributor
Star Contributor
Hi,
this <code>
"total":16,"start":0,"sort":"name","order":"asc","size":10
</code>

should be because of the paginated response.
the default page size being set to 10 even you have 16 records in the DB the first page is starting from 0 with a size of PAGE_SIZE (10 in your case)
and then the second page must be starting from 11 with a size of 6

for details see:
<code>
ProcessDefinitionCollectionResource.java
</code>
method:
<code>
@RequestMapping(value="/repository/process-definitions", method = RequestMethod.GET, produces = "application/json")
  public DataResponse getProcessDefinitions(@RequestParam Map<String,String> allRequestParams, HttpServletRequest request) {
</code>

there you can see a sequence of code which is used for preparing the pagination setup:

<code>
  // In case pagination request is incomplete, fill with values found in URL if possible
   if (paginateRequest.getStart() == null) {
    paginateRequest.setStart(RequestUtil.getInteger(requestParams, "start", 0));
   }
  
   if (paginateRequest.getSize() == null) {
    paginateRequest.setSize(RequestUtil.getInteger(requestParams, "size", 10));
   }
  
   if (paginateRequest.getOrder() == null) {
    paginateRequest.setOrder(requestParams.get("order"));
   }
  
   if (paginateRequest.getSort() == null) {
    paginateRequest.setSort(requestParams.get("sort"));
   }
</code>

joshting
Champ in-the-making
Champ in-the-making
Thank you so much … I should checked at the code. 

So here I just add size=20 to my request URL and I get all the definitions at once.

Thanks again,
Joshua