public void setSwimlanes(Collection<Swimlane> swimlanes) { this.swimlanes.clear(); for (Swimlane swimlane: swimlanes) { addSwimlane(swimlane); } }
public Context resolveContext(Object param) { if (param instanceof String) { return getSwimlane((String) param) == null ? null : this; } throw new IllegalArgumentException( "Swimlanes can only resolve swimlane names: " + param); }
public void addSwimlane(Swimlane swimlane) { this.swimlanes.put(swimlane.getName(), swimlane); }
public RuleFlowProcessFactory swimlane(String name) { Swimlane swimlane = new Swimlane(); swimlane.setName(name); getRuleFlowProcess().getSwimlaneContext().addSwimlane(swimlane); return this; }
process.getVariableScope().setVariables(variables); Swimlane swimlane = new Swimlane(); swimlane.setName("actor1"); process.getSwimlaneContext().addSwimlane(swimlane); swimlane = new Swimlane(); swimlane.setName("actor2"); process.getSwimlaneContext().addSwimlane(swimlane); assertEquals(2, process.getGlobals().size()); assertEquals(4, process.getVariableScope().getVariables().size()); assertEquals(2, process.getSwimlaneContext().getSwimlanes().size()); assertEquals(2, process.getExceptionScope().getExceptionHandlers().size());
private void visitLanes(WorkflowProcess process, StringBuilder xmlDump) { // lanes Collection<Swimlane> swimlanes = ((SwimlaneContext) ((org.jbpm.workflow.core.WorkflowProcess) process) .getDefaultContext(SwimlaneContext.SWIMLANE_SCOPE)).getSwimlanes(); if (!swimlanes.isEmpty()) { xmlDump.append(" <laneSet>" + EOL); for (Swimlane swimlane: swimlanes) { xmlDump.append(" <lane name=\"" + XmlBPMNProcessDumper.replaceIllegalCharsAttribute(swimlane.getName()) + "\" >" + EOL); visitLane(process, swimlane.getName(), xmlDump); xmlDump.append(" </lane>" + EOL); } xmlDump.append(" </laneSet>" + EOL); } }
protected void visitHeader(WorkflowProcess process, StringBuilder xmlDump, boolean includeMeta) { xmlDump.append(" <header>" + EOL); visitImports(((org.jbpm.process.core.Process) process).getImports(), xmlDump); visitGlobals(((org.jbpm.process.core.Process) process).getGlobals(), xmlDump); visitFunctionImports(((org.jbpm.process.core.Process) process).getFunctionImports(), xmlDump); VariableScope variableScope = (VariableScope) ((org.jbpm.process.core.Process) process).getDefaultContext(VariableScope.VARIABLE_SCOPE); if (variableScope != null) { visitVariables(variableScope.getVariables(), xmlDump); } SwimlaneContext swimlaneContext = (SwimlaneContext) ((org.jbpm.process.core.Process) process).getDefaultContext(SwimlaneContext.SWIMLANE_SCOPE); if (swimlaneContext != null) { visitSwimlanes(swimlaneContext.getSwimlanes(), xmlDump); } ExceptionScope exceptionScope = (ExceptionScope) ((org.jbpm.process.core.Process) process).getDefaultContext(ExceptionScope.EXCEPTION_SCOPE); if (exceptionScope != null) { visitExceptionHandlers(exceptionScope.getExceptionHandlers(), xmlDump); } xmlDump.append(" </header>" + EOL + EOL); }
public RuleFlowProcess() { setType(RULEFLOW_TYPE); // TODO create contexts on request ? VariableScope variableScope = new VariableScope(); addContext(variableScope); setDefaultContext(variableScope); SwimlaneContext swimLaneContext = new SwimlaneContext(); addContext(swimLaneContext); setDefaultContext(swimLaneContext); ExceptionScope exceptionScope = new ExceptionScope(); addContext(exceptionScope); setDefaultContext(exceptionScope); }
private void assignLanes(RuleFlowProcess process, List<Lane> lanes) { List<String> laneNames = new ArrayList<String>(); Map<String, String> laneMapping = new HashMap<String, String>(); if (lanes != null) { for (Lane lane: lanes) { String name = lane.getName(); if (name != null) { Swimlane swimlane = new Swimlane(); swimlane.setName(name); process.getSwimlaneContext().addSwimlane(swimlane); laneNames.add(name); for (String flowElementRef: lane.getFlowElements()) { laneMapping.put(flowElementRef, name); } } } } assignLanes(process, laneMapping); }
private void visitLanes(WorkflowProcess process, StringBuilder xmlDump) { // lanes Collection<Swimlane> swimlanes = ((SwimlaneContext) ((org.jbpm.workflow.core.WorkflowProcess) process) .getDefaultContext(SwimlaneContext.SWIMLANE_SCOPE)).getSwimlanes(); if (!swimlanes.isEmpty()) { xmlDump.append(" <laneSet>" + EOL); for (Swimlane swimlane: swimlanes) { xmlDump.append(" <lane name=\"" + XmlBPMNProcessDumper.replaceIllegalCharsAttribute(swimlane.getName()) + "\" >" + EOL); visitLane(process, swimlane.getName(), xmlDump); xmlDump.append(" </lane>" + EOL); } xmlDump.append(" </laneSet>" + EOL); } }
private void visitSwimlanes(Collection<Swimlane> swimlanes, StringBuilder xmlDump) { if (swimlanes != null && swimlanes.size() > 0) { xmlDump.append(" <swimlanes>" + EOL); for (Swimlane swimlane: swimlanes) { xmlDump.append(" <swimlane name=\"" + swimlane.getName() + "\" />" + EOL); } xmlDump.append(" </swimlanes>" + EOL); } }
public void setSwimlanes(Collection<Swimlane> swimlanes) { this.swimlanes.clear(); for (Swimlane swimlane: swimlanes) { addSwimlane(swimlane); } }
public Context resolveContext(Object param) { if (param instanceof String) { return getSwimlane((String) param) == null ? null : this; } throw new IllegalArgumentException( "Swimlanes can only resolve swimlane names: " + param); }
public RuleFlowProcess() { setType(RULEFLOW_TYPE); // TODO create contexts on request ? VariableScope variableScope = new VariableScope(); addContext(variableScope); setDefaultContext(variableScope); SwimlaneContext swimLaneContext = new SwimlaneContext(); addContext(swimLaneContext); setDefaultContext(swimLaneContext); ExceptionScope exceptionScope = new ExceptionScope(); addContext(exceptionScope); setDefaultContext(exceptionScope); }
public Object start(final String uri, final String localName, final Attributes attrs, final ExtensibleXmlParser parser) throws SAXException { parser.startElementBuilder( localName, attrs ); WorkflowProcessImpl process = (WorkflowProcessImpl) parser.getParent(); final String name = attrs.getValue("name"); emptyAttributeCheck(localName, "name", name, parser); SwimlaneContext swimlaneContext = (SwimlaneContext) process.getDefaultContext(SwimlaneContext.SWIMLANE_SCOPE); if (swimlaneContext != null) { Swimlane swimlane = new Swimlane(); swimlane.setName(name); swimlaneContext.addSwimlane(swimlane); } else { throw new SAXParseException( "Could not find default swimlane context.", parser.getLocator()); } return null; }
public void addSwimlane(Swimlane swimlane) { this.swimlanes.put(swimlane.getName(), swimlane); }
public RuleFlowProcessFactory swimlane(String name) { Swimlane swimlane = new Swimlane(); swimlane.setName(name); getRuleFlowProcess().getSwimlaneContext().addSwimlane(swimlane); return this; }
private void visitSwimlanes(Collection<Swimlane> swimlanes, StringBuilder xmlDump) { if (swimlanes != null && swimlanes.size() > 0) { xmlDump.append(" <swimlanes>" + EOL); for (Swimlane swimlane: swimlanes) { xmlDump.append(" <swimlane name=\"" + swimlane.getName() + "\" />" + EOL); } xmlDump.append(" </swimlanes>" + EOL); } }
private void assignLanes(RuleFlowProcess process, List<Lane> lanes) { List<String> laneNames = new ArrayList<String>(); Map<String, String> laneMapping = new HashMap<String, String>(); if (lanes != null) { for (Lane lane: lanes) { String name = lane.getName(); if (name != null) { Swimlane swimlane = new Swimlane(); swimlane.setName(name); process.getSwimlaneContext().addSwimlane(swimlane); laneNames.add(name); for (String flowElementRef: lane.getFlowElements()) { laneMapping.put(flowElementRef, name); } } } } assignLanes(process, laneMapping); }
public Object start(final String uri, final String localName, final Attributes attrs, final ExtensibleXmlParser parser) throws SAXException { parser.startElementBuilder( localName, attrs ); WorkflowProcessImpl process = (WorkflowProcessImpl) parser.getParent(); final String name = attrs.getValue("name"); emptyAttributeCheck(localName, "name", name, parser); SwimlaneContext swimlaneContext = (SwimlaneContext) process.getDefaultContext(SwimlaneContext.SWIMLANE_SCOPE); if (swimlaneContext != null) { Swimlane swimlane = new Swimlane(); swimlane.setName(name); swimlaneContext.addSwimlane(swimlane); } else { throw new SAXParseException( "Could not find default swimlane context.", parser.getLocator()); } return null; }