public void read(Element element, JpdlXmlReader jpdlReader) { jpdlReader.readNodes(element, this); }
/** * parse a process definition from an xml input stream. * * @throws org.jbpm.jpdl.JpdlException if parsing reported an error. */ public static ProcessDefinition parseXmlInputStream(InputStream inputStream) { JpdlXmlReader jpdlReader = new JpdlXmlReader(new InputSource(inputStream)); return jpdlReader.readProcessDefinition(); }
/** Reads actions associated to the given event. */ public void readActions(Element eventElement, GraphElement graphElement, String eventType) { // for all the elements in the event element for (Iterator iter = eventElement.elementIterator(); iter.hasNext();) { Element actionElement = (Element) iter.next(); if (ActionTypes.hasActionName(actionElement.getName())) { Action action = createAction(actionElement); if (graphElement != null && eventType != null) { // add the action to the event addAction(graphElement, eventType, action); } } } }
public void read(Element delegateElement, JpdlXmlReader jpdlReader) { processDefinition = jpdlReader.getProcessDefinition(); className = delegateElement.attributeValue("class"); if (className == null) { jpdlReader.addWarning("no class specified in delegation: " + delegateElement.getPath()); } configType = delegateElement.attributeValue("config-type"); if (delegateElement.hasContent()) { configuration = jpdlReader.writeElementContent(delegateElement); } }
private String writeElement(Element element) { StringWriter stringWriter = new StringWriter(); XMLWriter xmlWriter = getXmlWriter(); xmlWriter.setWriter(stringWriter); try { xmlWriter.write(element); } catch (IOException e) { // cannot happen, writing to memory addError("failed to write mail configuration", e); } return stringWriter.toString(); }
parseProcessDefinitionAttributes(root); readSwimlanes(root); readActions(root, null, null); readNodes(root, processDefinition); readEvents(root, processDefinition); readExceptionHandlers(root, processDefinition); readTasks(root, null); resolveTransitionDestinations(); resolveActionReferences(); verifySwimlaneAssignments();
readTaskTimers(taskElement, task); readEvents(taskElement, task); readExceptionHandlers(taskElement, task); task.setBlocking(readBoolean(blockingText, false)); task.setSignalling(readBoolean(signallingText, true)); Swimlane swimlane = taskMgmtDefinition.getSwimlane(swimlaneName); if (swimlane == null) { addWarning("task references unknown swimlane: " + taskElement.getPath()); Delegation assignmentDelegation = readAssignmentDelegation(assignmentElement); task.setAssignmentDelegation(assignmentDelegation); addProblem(new Problem(Problem.LEVEL_INFO, "no assignment specified for task: " + taskElement.getPath())); if (readBoolean(notificationsText, false)) { Delegation delegation = createMailDelegation(Event.EVENTTYPE_TASK_ASSIGN); Action action = new Action(delegation); action.setProcessDefinition(processDefinition); addAction(task, Event.EVENTTYPE_TASK_ASSIGN, action); task.setTaskController(readTaskController(taskControllerElement));
node.setAsyncExclusive(true); else if (readBoolean(asyncText, false)) { node.setAsync(true); readNodeTimers(nodeElement, node); readEvents(nodeElement, node); readExceptionHandlers(nodeElement, node); addUnresolvedTransitionDestination(nodeElement, node);
protected void readTaskTimer(Element timerElement, Task task) { String name = timerElement.attributeValue("name", task.getName()); if (name == null) name = generateTimerName(); Action action = null; if ("timer".equals(timerElement.getName())) { action = readSingleAction(timerElement); Delegation mailDelegation = createMailDelegation("task-reminder"); action = new Action(mailDelegation); addAction(task, Event.EVENTTYPE_TASK_CREATE, createTimerAction); CancelTimerAction cancelTimerAction = new CancelTimerAction(); cancelTimerAction.setTimerName(name); addAction(task, cancelEventTypes[i], cancelTimerAction); addAction(task, Event.EVENTTYPE_TASK_END, cancelTimerAction);
simpleClassName = simpleClassName.substring(simpleClassName.lastIndexOf('.') + 1); addError("conditions on transitions used leaving a " + simpleClassName + ", conditions on transitions only usable leaving decisions." ); addWarning("node '" + node.getFullyQualifiedName() + "' has a transition without a 'to'-attribute"); Node to = parent.findNode(toName); if (to == null) { addWarning("failed to resolve destination '" + toName + "' of transition '" + transitionName + "' leaving from " + node); readActions(transitionElement, transition, Event.EVENTTYPE_TRANSITION); readExceptionHandlers(transitionElement, transition); return transition;
protected void readNodeTimer(Element timerElement, Node node) { String name = timerElement.attributeValue("name", node.getName()); if (name == null) name = generateTimerName(); CreateTimerAction createTimerAction = new CreateTimerAction(); createTimerAction.read(timerElement, this); createTimerAction.setTimerName(name); createTimerAction.setTimerAction(readSingleAction(timerElement)); addAction(node, Event.EVENTTYPE_NODE_ENTER, createTimerAction); CancelTimerAction cancelTimerAction = new CancelTimerAction(); cancelTimerAction.setTimerName(name); addAction(node, Event.EVENTTYPE_NODE_LEAVE, cancelTimerAction); }
public void read(Element actionElement, JpdlXmlReader jpdlReader) { timerName = actionElement.attributeValue("name"); timerAction = jpdlReader.readSingleAction(actionElement); dueDate = actionElement.attributeValue("duedate"); if (dueDate == null) { jpdlReader.addWarning("due date not specified on create timer: " + actionElement.getPath()); } repeat = actionElement.attributeValue("repeat"); if (jpdlReader.readBoolean(repeat, false)) { repeat = dueDate; } transitionName = actionElement.attributeValue("transition"); if (transitionName != null && repeat != null) { repeat = null; jpdlReader.addWarning("ignoring repeat on create timer with transition: " + actionElement.getPath()); } }
addWarning("node '" + node.getFullyQualifiedName() + "' has a transition without a 'to'-attribute"); Node to = parent.findNode(toName); if (to == null) { addWarning("failed to resolve destination '" + toName + "' of transition '" + transitionName + "' leaving from " + node); readActions(transitionElement, transition, Event.EVENTTYPE_TRANSITION); readExceptionHandlers(transitionElement, transition); return transition;
public void read(Element actionElement, JpdlXmlReader jpdlReader) { timerName = actionElement.attributeValue("name"); if (timerName == null) { jpdlReader.addWarning("timer name not specified on cancel timer: " + actionElement.getPath()); } }
public void read(Element actionElement, JpdlXmlReader jpdlReader) { String expression = actionElement.attributeValue("expression"); if (expression != null) { actionExpression = expression; } else if (actionElement.attribute("ref-name") != null) { jpdlReader.addUnresolvedActionReference(actionElement, this); } else if (actionElement.attribute("class") != null) { actionDelegation = new Delegation(); actionDelegation.read(actionElement, jpdlReader); } else { jpdlReader.addWarning("action does not have class nor ref-name attribute: " + actionElement.getPath()); } }
if (bccActors != null) config.addElement("bccActors").setText("bcc-actors"); String subject = getProperty("subject", element); if (subject != null) config.addElement("subject").setText(subject); String text = getProperty("text", element); if (text != null) config.addElement("text").setText(text); return createMailDelegation(config);
String swimlaneName = swimlaneElement.attributeValue("name"); if (swimlaneName == null) { addWarning("unnamed swimlane detected"); Delegation assignmentDelegation = readAssignmentDelegation(assignmentElement); swimlane.setAssignmentDelegation(assignmentDelegation); Task startTask = taskMgmtDefinition.getStartTask(); if (startTask == null || startTask.getSwimlane() != swimlane) { addWarning("swimlane '" + swimlaneName + "' does not have an assignment");
public void addWarning(String description) { addProblem(new Problem(Problem.LEVEL_WARNING, description)); }
/** Reads the action associated to the given node. */ public Action readSingleAction(Element nodeElement) { // search for the first action element in the node for (Iterator iter = nodeElement.elementIterator(); iter.hasNext();) { Element candidate = (Element) iter.next(); if (ActionTypes.hasActionName(candidate.getName())) { // parse the action and assign it to this node return createAction(candidate); } } return null; }