/** * Get a string to identify this activity in a tool such as the debugger. * @return A unique but nicely readable name. */ public String getBreakpointId() { String name = getName(); if(name==null) name = getActivityType()+"("+getId()+")"; return name; }
public Object createObject(IContext context, Map<String, String> rawattributes) throws Exception { MActivity ret = null; Object at = rawattributes.get("activityType"); if (at == null || MTask.TASK.equals(at)) { ret = new MTask(); } else { ret = new MActivity(); } return ret; } }, new ActivityPostProcessor()),
/** * Helper method connecting two activities using this edge. * The previous connection is removed. * * @param source New source of the edge. * @param target New target of the edge. */ public void connect(MActivity source, MActivity target) { if (this.source != null) { this.source.removeOutgoingMessagingEdge(this); } if (this.target != null) { this.target.removeIncomingMessagingEdge(this); } this.source = source; this.target = target; source.addOutgoingMessagingEdge(this); target.addIncomingMessagingEdge(this); }
/** * Helper method connecting two activities using this edge. * The previous connection is removed. * * @param source New source of the edge. * @param target New target of the edge. */ public void connect(MActivity source, MActivity target) { if (this.source != null) { this.source.removeOutgoingSequenceEdge(this); } if (this.target != null) { this.target.removeIncomingSequenceEdge(this); } this.source = source; this.target = target; source.addOutgoingSequenceEdge(this); target.addIncomingSequenceEdge(this); }
String indesc = act.getIncomingSequenceEdgesDescription(); if(indesc!=null) act.addIncomingSequenceEdge(edge); edge.setTarget(act); String outdesc = act.getOutgoingSequenceEdgesDescription(); if(outdesc!=null) act.addOutgoingSequenceEdge(edge); edge.setSource(act); List inmsgs = act.getIncomingMessagesDescriptions(); if(inmsgs!=null) act.addIncomingMessagingEdge(msg); msg.setTarget(act); List outmsgs = act.getOutgoingMessagesDescriptions(); if(outmsgs!=null) act.addOutgoingMessagingEdge(msg); msg.setTarget(act); act.setThrowing(true); if(act.getDescription()!=null) StringTokenizer stok = new StringTokenizer(act.getDescription(), "\r\n");
if(activity.isEventHandler() && evthandlerref==null) continue; if (activity.getOutgoingDataEdges() != null) dataedges.addAll(activity.getOutgoingDataEdges()); if (activity.getOutgoingSequenceEdges() != null) seqedges.addAll(activity.getOutgoingSequenceEdges()); if (activity.getOutgoingMessagingEdges() != null) medges.addAll(activity.getOutgoingMessagingEdges()); String mappedacttype = ACT_TYPE_MAPPING.get(activity.getActivityType()); if(activity.getActivityType().startsWith("Event")) if(activity.getActivityType().contains("Intermediate")) if (activity.isEventHandler()) else if(activity.isThrowing()) if (activity.getName() != null && activity.getName().length() > 0) out.print(escapeString(activity.getName())); out.print("\"");
act = new MActivity(); act.setName(attrs.get("name")); act.setId(attrs.get("id")); act.setActivityType(ACT_TYPE_MAPPING.get(tag.getLocalPart())); act.setClazz(new ClassInfo((String) buffer.remove("class"))); act.addParameter(param); act.addProperty(prop); MActivity evt = new MActivity(); evt.setName(attrs.get("name")); evt.setId(attrs.get("id")); evt.setClazz(new ClassInfo((String) buffer.remove("class"))); evt.setThrowing(true); evt.setEventHandler(true); Map<String, String> ehpm = (Map<String, String>) buffer.get("eventhandlerparentmap"); ehpm.put(evt.getId(), attrs.get("attachedToRef")); evt.addProperty(mprop);
MBpmnModel.SUBPROCESS.equals(((MActivity) ((VActivity) targetcell).getBpmnElement()).getActivityType()))) mactivity.setClazz(new ClassInfo("")); mactivity = new MActivity(); mactivity.setId(modelcontainer.getIdGenerator().generateId()); mactivity.setActivityType(ModelContainer.ACTIVITY_MODES_TO_TYPES.containsKey(mode) ? ModelContainer.ACTIVITY_MODES_TO_TYPES.get(mode) : mode); mactivity.setName("Ext. Sub-Process"); UnparsedExpression exp = new UnparsedExpression("filename", String.class, "\"\"", null); MProperty mprop = new MProperty(exp.getClazz(), exp.getName(), exp); mactivity.addProperty(mprop); vactivity = new VExternalSubProcess(modelcontainer.getGraph()); mactivity.setActivityType(MBpmnModel.SUBPROCESS); vactivity = new VSubProcess(modelcontainer.getGraph()); ((MSubProcess) mactivity).setSubprocessType(MSubProcess.SUBPROCESSTYPE_EVENT); Dimension ds = BpmnStylesheetColor.DEFAULT_ACTIVITY_SIZES.containsKey(mactivity.getActivityType()) ? BpmnStylesheetColor.DEFAULT_ACTIVITY_SIZES.get(mactivity.getActivityType()) : BpmnStylesheetColor.DEFAULT_ACTIVITY_SIZES.get(vactivity.getStyle()); BpmnStylesheetColor.COLLAPSED_SIZES.containsKey(mactivity.getActivityType())) BpmnStylesheetColor.COLLAPSED_SIZES.get(mactivity.getActivityType())); vactivity.getGeometry().setAlternateBounds( new mxGeometry(p.getX(),
public void run() { // To schedule a step an implicit activity is created. // In order to put the step parameter value it is necessary // to have an edge with a mapping. Otherwise the parameter // value with be deleted in process thread updateParametersBeforeStep(). MActivity act = new MActivity(); act.setName("External Step Activity: "+(cnt++)); act.setClazz(new ClassInfo(ExecuteStepTask.class)); act.addParameter(new MParameter(MParameter.DIRECTION_IN, new ClassInfo(Object[].class), "step", null)); act.setActivityType(MBpmnModel.TASK); MSequenceEdge edge = new MSequenceEdge(); edge.setTarget(act); UnparsedExpression exp = new UnparsedExpression(null, (Class<?>) null, "step", null); SJavaParser.parseExpression(exp, null, null); // edge.addParameterMapping("step", SJavaParser.parseExpression("step", null, null), null); edge.addParameterMapping("step", exp, null); act.addIncomingSequenceEdge(edge); MPool pl = pool!=null? bpmnmodel.getPool(pool): (MPool)bpmnmodel.getPools().get(0); act.setPool(pl); ProcessThread thread = new ProcessThread(""+idcnt++, act, context, BpmnInterpreter.this); thread.setLastEdge(edge); thread.setParameterValue("step", new Object[]{step, ret}); context.addExternalThread(thread); } });
/** * Get the activity handler for an activity. * @param actvity The activity. * @return The activity handler. */ public IActivityHandler getActivityHandler(MActivity activity) { return (IActivityHandler)activityhandlers.get(activity.getActivityType()); }
for (MActivity mactivity : acts) List<MSequenceEdge> edges = mactivity.getOutgoingSequenceEdges(); if (edges != null) if (pact.getEventHandlers() != null && pact.getEventHandlers().contains(edge.getSource())) edges = mactivity.getIncomingSequenceEdges(); if (edges != null) if (edge.getSource().isEventHandler()) if (pact.getEventHandlers() != null && pact.getEventHandlers().contains(edge.getSource())) if (!targetpool.getBpmnElement().equals(mactivity.getPool()) && hasoutedge) if (!msubproc.getPool().getId().equals(mactivity.getPool().getId()) && hasoutedge) MBpmnModel.EVENT_START_EMPTY.equals(mactivity.getActivityType()))
MLane lane = lanemap.get(act.getId()); if (act.isEventHandler()) act.setPool(pool); act.setLane(lane); Map<String, String> ehpm = (Map<String, String>) buffer.get("eventhandlerparentmap"); ((MActivity) emap.get(ehpm.get(act.getId()))).addEventHandler(act); if (!sps.isEmpty()) act.setPool(pool); act.setLane(lane); sps.peek().addActivity(act); Map<String, MSubProcess> spem = (Map<String, MSubProcess>) buffer.get("subprocesselementmap"); spem.put(act.getId(), sps.peek()); act.setPool(pool); act.setLane(lane); act.setPool(pool); emap.put(act.getId(), act);
/** * Get an activity per id. */ public MActivity getActivity(String id) { MActivity ret = null; if(activities!=null) { for(MActivity act: activities) { if(act.getId().equals(id)) { ret = act; break; } } } return ret; }
public boolean filter(Object obj) { boolean ret = false; if (obj instanceof VActivity) { VActivity vactivity = (VActivity) obj; MActivity mactivity = (MActivity) vactivity.getBpmnElement(); if (activitytype.endsWith("Handler")) { String shortat = activitytype.substring(0, activitytype.length() - 7); ret = mactivity.getActivityType() != null && mactivity.getActivityType().equals(shortat) && mactivity.isEventHandler(); } else { ret = mactivity.getActivityType() != null && mactivity.getActivityType().equals(activitytype) && !mactivity.isEventHandler(); } } return ret; } }
MActivity mevt2 = (MActivity) evt2.getBpmnElement(); if (mevt1.getActivityType() != null && mevt1.getActivityType().endsWith("Message") && mevt2.getActivityType() != null && mevt2.getActivityType().endsWith("Message")) boolean conv1 = mevt1.isThrowing(); conv1 |= (mevt1.getIncomingMessagingEdges() == null? 0 : mevt1.getIncomingMessagingEdges().size()) == 0; boolean conv2 = !mevt2.isThrowing(); conv2 |= (mevt1.getOutgoingMessagingEdges() == null? 0 : mevt1.getOutgoingMessagingEdges().size()) == 0; ret = conv1 && conv2 && (mevt1.getPool() != mevt2.getPool());
List<Tuple3<String, String, Icon>> endlist = null; if (event.getMActivity().isEventHandler()) if (event.getMActivity().getIncomingSequenceEdges() == null || event.getMActivity().getIncomingSequenceEdges().size() == 0) if (event.getMActivity().getOutgoingSequenceEdges() == null || event.getMActivity().getOutgoingSequenceEdges().size() == 0) !task.mode.equals(event.getMActivity().getActivityType())) !task.mode.equals(event.getMActivity().getActivityType()) && !task.mode.contains(ModelContainer.BOUNDARY_EVENT)) !task.mode.equals(event.getMActivity().getActivityType()) && task.mode.contains(ModelContainer.BOUNDARY_EVENT)) !task.mode.equals(event.getMActivity().getActivityType())) if (startlist != null) if (event.getMActivity().getActivityType() != null && event.getMActivity().getActivityType().startsWith("EventStart")) if (event.getMActivity().getActivityType() != null && event.getMActivity().getActivityType().startsWith("EventIntermediate")) if (event.getMActivity().isEventHandler()) if (event.getMActivity().getActivityType() != null && event.getMActivity().getActivityType().startsWith("EventEnd"))
Map<String, Tuple3<Integer, mxICell, mxICell>> elements, mxICell vparent, int depth) Tuple3<Integer, mxICell, mxICell> tup = elements.get(mactivity.getId()); if(tup!=null) elements.put(mactivity.getId(), new Tuple3<Integer, mxICell, mxICell>(Integer.valueOf(depth), tup.getSecondEntity(), vparent)); if(mactivity.getOutgoingSequenceEdges() != null) sseqedges.addAll(mactivity.getOutgoingSequenceEdges()); VActivity vactivity = mactivity instanceof MSubProcess? mactivity.hasProperty("file") || mactivity.hasProperty("filename")? new VExternalSubProcess(graph): new VSubProcess(graph): new VActivity(graph); vactivity.setBpmnElement(mactivity); elements.put(mactivity.getId(), new Tuple3<Integer, mxICell, mxICell>(Integer.valueOf(depth), vactivity, vparent)); genActivity(graph, activity, sseqedges, elements, elements.get(mactivity.getId()).getSecondEntity(), depth+1); List<MActivity> evthandlers = mactivity.getEventHandlers(); if(evthandlers != null && evthandlers.size() > 0) if(evthandler.getOutgoingSequenceEdges() != null && sseqedges != null) sseqedges.addAll(evthandler.getOutgoingSequenceEdges()); genActivity(graph, evthandler, sseqedges, elements, elements.get(mactivity.getId()).getSecondEntity(), depth+1);
List<MSequenceEdge> outedges = activity.getOutgoingSequenceEdges(); if(outedges!=null && outedges.size()==1) List<MSequenceEdge> outgoing = activity.getOutgoingSequenceEdges(); if(outgoing!=null && outgoing.size()==1) List<MActivity> handlers = activity.getEventHandlers(); for(int i=0; handlers!=null && next==null && i<handlers.size(); i++) if(handler.getActivityType().equals(MBpmnModel.EVENT_INTERMEDIATE_ERROR))//"EventIntermediateError")) if (handler.getClazz() == null || SReflect.isSupertype(handler.getClazz().getType(instance.getClassLoader()), ex.getClass())) List<MActivity> handlers = activity.getEventHandlers(); for(int i=0; handlers!=null && i<handlers.size(); i++)
if(MBpmnModel.EVENT_START_MULTIPLE.equals(act.getActivityType()) && info.getName().equals(act.getName())) List<MSequenceEdge> edges = act.getOutgoingSequenceEdges(); for(int k=0; k<edges.size(); k++) if(MBpmnModel.EVENT_INTERMEDIATE_SIGNAL.equals(target.getActivityType())) events.put(target.getName(), target); else if(MBpmnModel.EVENT_START_SIGNAL.equals(act.getActivityType()) && act.getName().startsWith(info.getName()+".")) events.put(act.getName().substring(info.getName().length()+1), act); if(event.getPropertyNames().length==meths[i].getParameterTypes().length)
if(!ret && thread.getActivity()!=null && MBpmnModel.EVENT_INTERMEDIATE_MULTIPLE.equals(thread.getActivity().getActivityType())) List<MSequenceEdge> outedges = thread.getActivity().getOutgoingSequenceEdges(); for(int i=0; i<outedges.size() && !ret; i++) ret = edge.getTarget().equals(activity); if(!ret && thread.getActivity()!=null && MBpmnModel.SUBPROCESS.equals(thread.getActivity().getActivityType())) List<MActivity> handlers = thread.getActivity().getEventHandlers(); for(int i=0; !ret && handlers!=null && i<handlers.size(); i++) ret = activity.equals(handler) && handler.getActivityType().equals("EventIntermediateTimer");