Skip to content

Commit

Permalink
OpenBPMN upgrade, minor improvements
Browse files Browse the repository at this point in the history
issue #823
  • Loading branch information
rsoika committed Sep 7, 2024
1 parent 7e2b4cb commit c0bff42
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -745,18 +745,21 @@ public List<ItemCollection> findEndTasks(final BPMNModel model, String processGr
*
*/
public List<ItemCollection> findEventsByTask(final BPMNModel model, int taskID) {
Activity taskElement = lookupTaskElementByID(model, taskID);
BPMNLinkedFlowIterator<BPMNElementNode> elementNavigator = new BPMNLinkedFlowIterator<BPMNElementNode>(
taskElement,
node -> ((BPMNUtil.isImixsEventElement(node))));
List<ItemCollection> result = new ArrayList<>();
while (elementNavigator.hasNext()) {
result.add(BPMNEntityBuilder.build(elementNavigator.next()));
}
// next we also add all initEvent nodes
List<BPMNElementNode> initEventNodes = findInitEventNodes(taskElement);
for (BPMNElementNode element : initEventNodes) {
result.add(BPMNEntityBuilder.build(element));
Activity taskElement = lookupTaskElementByID(model, taskID);
if (taskElement != null) {
BPMNLinkedFlowIterator<BPMNElementNode> elementNavigator = new BPMNLinkedFlowIterator<BPMNElementNode>(
taskElement,
node -> ((BPMNUtil.isImixsEventElement(node))));

while (elementNavigator.hasNext()) {
result.add(BPMNEntityBuilder.build(elementNavigator.next()));
}
// next we also add all initEvent nodes
List<BPMNElementNode> initEventNodes = findInitEventNodes(taskElement);
for (BPMNElementNode element : initEventNodes) {
result.add(BPMNEntityBuilder.build(element));
}
}
return result;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -431,11 +431,15 @@ public List<ItemCollection> getWorkListByRef(String aref) {
* <p>
* If the model version does not exist the model is resolved by regular
* expressions using the method findModelByWorkitem
* <p>
* If not model can be found or the $taskID is not defined by the model a
* ModelException is thrown.
*
* @see imixs-bpmn
* @param workitem
* @return
* @throws ModelException
* @throws ModelException if model is not found or task is not defined by the
* given model
*/
@SuppressWarnings("unchecked")
public List<ItemCollection> getEvents(ItemCollection workitem) throws ModelException {
Expand All @@ -447,10 +451,16 @@ public List<ItemCollection> getEvents(ItemCollection workitem) throws ModelExcep
BPMNModel model = modelService.getModelManager().findModelByWorkitem(workitem);
if (model == null) {
throw new ModelException(
ModelException.INVALID_MODEL, "Model '" + workitem.getModelVersion() + "' not found!");
ModelException.INVALID_MODEL, "Model '" + workitem.getModelVersion() + "' not found.");
}

int processID = workitem.getTaskID();
ItemCollection task = modelService.getModelManager().findTaskByID(model, processID);
if (task == null) {
throw new ModelException(
ModelException.UNDEFINED_MODEL_ENTRY,
"Task " + processID + " not defined in model '" + workitem.getModelVersion() + "'.");
}
List<ItemCollection> eventList = modelService.getModelManager().findEventsByTask(model, processID);

String username = getUserName();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -443,9 +443,8 @@ && getWorkitem().getItemValueString(WorkflowKernel.WORKFLOWGROUP).isEmpty())) {
try {
activities = workflowService.getEvents(getWorkitem());
} catch (ModelException e) {
logger.log(Level.WARNING, "Unable to resolve workflow event list: {0}",
e.getMessage());
throw new InvalidAccessException(ModelException.INVALID_MODEL,
// Just print out a warning!
logger.log(Level.WARNING, "Unable to resolve event list: {0}",
e.getMessage());
}
}
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<microprofile.version>6.0</microprofile.version>
<microprofile-metrics.version>5.0.0</microprofile-metrics.version>
<lucene.version>7.7.3</lucene.version>
<openbpmn.version>1.2.1</openbpmn.version>
<openbpmn.version>1.2.2</openbpmn.version>
<graalvm.version>22.3.2</graalvm.version>
<!-- test dependencies -->
<junit.jupiter.version>5.9.2</junit.jupiter.version>
Expand Down

0 comments on commit c0bff42

Please sign in to comment.