Skip to content

Commit

Permalink
cleanup test code, docu
Browse files Browse the repository at this point in the history
Issue #823
  • Loading branch information
rsoika committed Sep 2, 2024
1 parent 93bc82b commit 19627eb
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 232 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,11 @@ public ItemCollection process(ItemCollection workitem) throws PluginException, M
*/
private ItemCollection processEvent(ItemCollection workitem, ItemCollection event)
throws ModelException, PluginException {

BPMNModel model = this.ctx.getModelManager().getModel(workitem.getModelVersion());

// Update the intermediate processing status
updateIntermediateEvent(workitem, event);
// set $lastEventDate
workitem.replaceItemValue(LASTEVENTDATE, new Date());
// Execute Plugins and Adapters....
Expand Down Expand Up @@ -460,7 +464,7 @@ private ItemCollection processEvent(ItemCollection workitem, ItemCollection even
logEvent(workitem.getTaskID(), workitem.getEventID(), workitem.getTaskID(), workitem);
event = nextElement;
workitem.event(event.getItemValueInteger(BPMNUtil.EVENT_ITEM_EVENTID));
updateIntermediateEvent(workitem, event);

// return the next event element to be processed....
return event;
}
Expand Down Expand Up @@ -614,12 +618,8 @@ public ItemCollection eval(final ItemCollection _workitem) throws PluginExceptio
int intermediateEvent = workitem.getItemValueInteger(WorkflowKernel.INTERMEDIATE_EVENTID);
if (intermediateEvent > 0) {
BPMNModel model = this.ctx.getModelManager().findModelByWorkitem(workitem);
BPMNElementNode inteEventElement = model.findElementNodeById(intermediateEventElementID);
// ItemCollection intermediateEventItemCol =
// BPMNEntityBuilder.build(inteEventElement);
// event = this.ctx.getModelManager().nextModelElement(intermediateEventItemCol,
// workitem);
event = BPMNEntityBuilder.build(inteEventElement);
BPMNElementNode intermediateEventElement = model.findElementNodeById(intermediateEventElementID);
event = BPMNEntityBuilder.build(intermediateEventElement);
} else {
event = this.ctx.getModelManager().loadEvent(workitem);
}
Expand Down Expand Up @@ -828,23 +828,25 @@ private void updateWorkflowStatus(ItemCollection workitem, ItemCollection itemCo
}

/**
* Helper method to update the item $intermediateEventID.
* Helper method to update the item <code>$intermediateEvent</code> and
* <code>$intermediateEvent.elementId</code>.
* The given Element must be a Event. Otherwise the method throws a
* ModelException.
* <p>
* This method is called by the method processEvent() and indicates that we are
* currently in an active processing life cycle. This status is evaluated by the
* eval() method to avoid invalid calls of loadEvent().
*
* @throws ModelException
*/
private void updateIntermediateEvent(ItemCollection workitem, ItemCollection itemColNextEvent)
throws ModelException {
boolean debug = logger.isLoggable(Level.FINE);
if (!ModelManager.EVENT_ELEMENT.equals(itemColNextEvent.getType())) {
throw new ModelException(ModelException.INVALID_MODEL,
"Invalid Model Element - BPMN Event Element was expected to update the intermediate event status.");
}

workitem.setItemValue(INTERMEDIATE_EVENTID, itemColNextEvent.getItemValueInteger(BPMNUtil.EVENT_ITEM_EVENTID));
workitem.setItemValue(INTERMEDIATE_EVENT_ELEMENTID, itemColNextEvent.getItemValueString("id"));

}

/**
Expand Down

This file was deleted.

Loading

0 comments on commit 19627eb

Please sign in to comment.