Skip to content

Commit

Permalink
fixed
Browse files Browse the repository at this point in the history
Issue #885
  • Loading branch information
rsoika committed Nov 25, 2024
1 parent c17af14 commit b3b0d07
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -911,6 +911,9 @@ private ItemCollection lookupDefinition(final BPMNModel model) {
* @return
*/
private Activity lookupTaskElementByID(final BPMNModel model, int taskID) {
if (model == null) {
return null;
}
Set<Activity> activities = model.findAllActivities();
// filter the imixs activity with the corresponding id
for (Activity activity : activities) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,12 @@ private BPMNUtil() {
* @return
*/
public static String getVersion(BPMNModel model) {
List<String> valueList = getItemValueList(model, model.getDefinitions(), "txtworkflowmodelversion",
null);
if (valueList != null && valueList.size() > 0) {
return valueList.get(0);
if (model != null) {
List<String> valueList = getItemValueList(model, model.getDefinitions(), "txtworkflowmodelversion",
null);
if (valueList != null && valueList.size() > 0) {
return valueList.get(0);
}
}
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -373,22 +373,22 @@ public ItemCollection run(ItemCollection configItemCollection) throws SchedulerE
// processWorkListByEvent(version, taskID, EventID, Group)

BPMNModel model = modelService.getModelManager().getModel(version);

// find all tasks
Set<Activity> activities = model.findAllActivities();
for (Activity task : activities) {
if (BPMNUtil.isImixsTaskElement(task)) {

ItemCollection taskEntity = BPMNEntityBuilder.build(task);
int taskID = taskEntity.getItemValueInteger(BPMNUtil.TASK_ITEM_TASKID);
// iterate through all scheduled events
List<ItemCollection> events = modelService.getModelManager().findEventsByTask(model,
taskID);
for (ItemCollection eventEntity : events) {
// test if this is a scheduled event...
if (eventEntity.getItemValueBoolean(BPMNUtil.EVENT_ITEM_TIMER_ACTIVE)) {
// eventID = eventEntity.getItemValueInteger(BPMNUtil.EVENT_ITEM_EVENTID);
processWorkListByEvent(model, taskEntity, eventEntity, configItemCollection);
if (model != null) {
// find all tasks
Set<Activity> activities = model.findAllActivities();
for (Activity task : activities) {
if (BPMNUtil.isImixsTaskElement(task)) {
ItemCollection taskEntity = BPMNEntityBuilder.build(task);
int taskID = taskEntity.getItemValueInteger(BPMNUtil.TASK_ITEM_TASKID);
// iterate through all scheduled events
List<ItemCollection> events = modelService.getModelManager().findEventsByTask(model,
taskID);
for (ItemCollection eventEntity : events) {
// test if this is a scheduled event...
if (eventEntity.getItemValueBoolean(BPMNUtil.EVENT_ITEM_TIMER_ACTIVE)) {
// eventID = eventEntity.getItemValueInteger(BPMNUtil.EVENT_ITEM_EVENTID);
processWorkListByEvent(model, taskEntity, eventEntity, configItemCollection);
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ public String getModelXML() {
StringBuffer sb = new StringBuffer();
sb.append("<model>");
try {
col = modelService.getVersions();
col = modelService.getModelManager().getVersions();

for (String aversion : col) {
sb.append("<version>" + aversion + "</version>");
Expand All @@ -200,7 +200,7 @@ public Response findAllTasks(@PathParam("version") String version, @QueryParam("

try {
BPMNModel model;
model = modelService.getModel(version);
model = modelService.getModelManager().getModel(version);

// find all tasks
Set<Activity> activities = model.findAllActivities();
Expand Down Expand Up @@ -229,7 +229,7 @@ public Response findAllTasks(@PathParam("version") String version, @QueryParam("
public Response getModelFile(@PathParam("version") String version, @Context UriInfo uriInfo) {
try {
// lookup model
BPMNModel model = modelService.getModel(version);
BPMNModel model = modelService.getModelManager().getModel(version);
if (model != null) {
StreamingOutput stream = output -> {
try {
Expand Down Expand Up @@ -328,7 +328,7 @@ public Response findTasksByGroup(@PathParam("version") String version, @PathPara
@QueryParam("items") String items, @QueryParam("format") String format) {
List<ItemCollection> result = new ArrayList<>();
try {
BPMNModel model = modelService.getModel(version);
BPMNModel model = modelService.getModelManager().getModel(version);
BPMNProcess process = model.findProcessByName(group);
process.init();
Set<Activity> tasks = process.getActivities();
Expand Down Expand Up @@ -442,7 +442,7 @@ public void putModelByVersion(@PathParam("version") final String _modelVersion,

// delete old model if a modelversion is available
if (!"".equals(sModelVersion))
modelService.removeModel(sModelVersion);
modelService.getModelManager().removeModel(sModelVersion);

// save new entities into database and update modelversion.....
for (int i = 0; i < ecol.getDocument().length; i++) {
Expand Down Expand Up @@ -515,7 +515,7 @@ public void postModel(XMLDataCollection ecol) {
* @throws ModelException
*/
private String modelVersionTableToString(String rootContext) throws ModelException {
List<String> modelVersionList = modelService.getVersions();
List<String> modelVersionList = modelService.getModelManager().getVersions();
StringBuffer buffer = new StringBuffer();

for (String modelVersion : modelVersionList) {
Expand Down

0 comments on commit b3b0d07

Please sign in to comment.