public void read(Element decisionElement, JpdlXmlReader jpdlReader) { String expression = decisionElement.attributeValue("expression"); Element decisionHandlerElement = decisionElement.element("handler"); if (expression != null) { decisionExpression = expression; } else if (decisionHandlerElement != null) { decisionDelegation = new Delegation(); decisionDelegation.read(decisionHandlerElement, jpdlReader); } }
public boolean equals(Object o) { if (this == o) return true; if (!(o instanceof Delegation)) return false; Delegation other = (Delegation) o; if (id != 0 && id == other.getId()) return true; return className.equals(other.getClassName()) && (configuration != null ? configuration.equals(other.getConfiguration()) : other.getConfiguration() == null); }
public Object getInstance() { if (instance == null) { instance = instantiate(); } return instance; }
private Delegation createMailDelegation(Element config) { // read mail class name String mailClassName; if (Configs.hasObject("jbpm.mail.class.name")) { mailClassName = Configs.getString("jbpm.mail.class.name"); } else { mailClassName = Mail.class.getName(); } Delegation delegation = new Delegation(mailClassName); delegation.setProcessDefinition(processDefinition); delegation.setConfiguration(writeElementContent(config)); return delegation; }
protected Delegation readAssignmentDelegation(Element assignmentElement) { Delegation assignmentDelegation = new Delegation(); assignmentDelegation.setProcessDefinition(processDefinition); String expression = assignmentElement.attributeValue("expression"); if (expression != null) { // read assigment expression Element config = DocumentHelper.createElement("expression"); config.setText(expression); assignmentDelegation.setClassName("org.jbpm.identity.assignment.ExpressionAssignmentHandler"); assignmentDelegation.setConfiguration(writeElement(config)); } else { String actorId = assignmentElement.attributeValue("actor-id"); String pooledActors = assignmentElement.attributeValue("pooled-actors"); if (actorId != null || pooledActors != null) { // read assignment actors Element config = DocumentHelper.createElement("configuration"); if (actorId != null) config.addElement("actorId").setText(actorId); if (pooledActors != null) config.addElement("pooledActors").setText(pooledActors); assignmentDelegation.setClassName("org.jbpm.taskmgmt.assignment.ActorAssignmentHandler"); assignmentDelegation.setConfiguration(writeElementContent(config)); } else { // parse custom assignment handler assignmentDelegation.read(assignmentElement, this); } } return assignmentDelegation; }
public void execute(ExecutionContext executionContext) throws Exception { Thread currentThread = Thread.currentThread(); ClassLoader contextClassLoader = currentThread.getContextClassLoader(); try { // set context class loader correctly for delegation class // (https://jira.jboss.org/jira/browse/JBPM-1448) ClassLoader processClassLoader = JbpmConfiguration.getProcessClassLoader(executionContext.getProcessDefinition()); currentThread.setContextClassLoader(processClassLoader); if (referencedAction != null) { referencedAction.execute(executionContext); } else if (actionExpression != null) { JbpmExpressionEvaluator.evaluate(actionExpression, executionContext); } else if (actionDelegation != null) { ActionHandler actionHandler = (ActionHandler) actionDelegation.getInstance(); actionHandler.execute(executionContext); } } finally { currentThread.setContextClassLoader(contextClassLoader); } }
public String toString() { return "MailAction(" + actionDelegation.getConfiguration() + ')'; } }
public boolean equals(Object o) { if (this == o) return true; if (!(o instanceof Action)) return false; Action other = (Action) o; if (id != 0 && id == other.getId()) return true; if (name != null) { // named actions are unique at the process definition level return name.equals(other.getName()) && processDefinition.equals(other.getProcessDefinition()); } return (actionDelegation != null ? actionDelegation.equals(other.getActionDelegation()) : actionExpression != null ? actionExpression.equals(other.getActionExpression()) : referencedAction != null ? referencedAction.equals(other.getReferencedAction()) : false) && event.equals(other.getEvent()); }
public int hashCode() { int result = 1397928647; if (name != null) { // named actions are unique at the process definition level result += name.hashCode(); result = 1290535769 * result + processDefinition.hashCode(); } else { if (actionDelegation != null) { result += actionDelegation.hashCode(); } else if (actionExpression != null) { result += actionExpression.hashCode(); } else if (referencedAction != null) { result += referencedAction.hashCode(); } result = 1290535769 * result + event.hashCode(); } return result; }
protected Delegation readAssignmentDelegation(Element assignmentElement) { Delegation assignmentDelegation = new Delegation(); assignmentDelegation.setProcessDefinition(processDefinition); String expression = assignmentElement.attributeValue("expression"); if (expression != null) { // read assigment expression Element config = DocumentHelper.createElement("expression"); config.setText(expression); assignmentDelegation.setClassName("org.jbpm.identity.assignment.ExpressionAssignmentHandler"); assignmentDelegation.setConfiguration(writeElement(config)); } else { String actorId = assignmentElement.attributeValue("actor-id"); String pooledActors = assignmentElement.attributeValue("pooled-actors"); if (actorId != null || pooledActors != null) { // read assignment actors Element config = DocumentHelper.createElement("configuration"); if (actorId != null) config.addElement("actorId").setText(actorId); if (pooledActors != null) config.addElement("pooledActors").setText(pooledActors); assignmentDelegation.setClassName("org.jbpm.taskmgmt.assignment.ActorAssignmentHandler"); assignmentDelegation.setConfiguration(writeElementContent(config)); } else { // parse custom assignment handler assignmentDelegation.read(assignmentElement, this); } } return assignmentDelegation; }
private Delegation createMailDelegation(Element config) { // read mail class name String mailClassName; if (Configs.hasObject("jbpm.mail.class.name")) { mailClassName = Configs.getString("jbpm.mail.class.name"); } else { mailClassName = Mail.class.getName(); } Delegation delegation = new Delegation(mailClassName); delegation.setProcessDefinition(processDefinition); delegation.setConfiguration(writeElementContent(config)); return delegation; }
public void execute(ExecutionContext executionContext) throws Exception { Thread currentThread = Thread.currentThread(); ClassLoader contextClassLoader = currentThread.getContextClassLoader(); try { // set context class loader correctly for delegation class // (https://jira.jboss.org/jira/browse/JBPM-1448) ClassLoader processClassLoader = JbpmConfiguration.getProcessClassLoader(executionContext.getProcessDefinition()); currentThread.setContextClassLoader(processClassLoader); if (referencedAction != null) { referencedAction.execute(executionContext); } else if (actionExpression != null) { JbpmExpressionEvaluator.evaluate(actionExpression, executionContext); } else if (actionDelegation != null) { ActionHandler actionHandler = (ActionHandler) actionDelegation.getInstance(); actionHandler.execute(executionContext); } } finally { currentThread.setContextClassLoader(contextClassLoader); } }
public String toString() { return "MailAction(" + actionDelegation.getConfiguration() + ')'; } }
public boolean equals(Object o) { if (this == o) return true; if (!(o instanceof Action)) return false; Action other = (Action) o; if (id != 0 && id == other.getId()) return true; if (name != null) { // named actions are unique at the process definition level return name.equals(other.getName()) && processDefinition.equals(other.getProcessDefinition()); } return (actionDelegation != null ? actionDelegation.equals(other.getActionDelegation()) : actionExpression != null ? actionExpression.equals(other.getActionExpression()) : referencedAction != null ? referencedAction.equals(other.getActionExpression()) : false) && event.equals(other.getEvent()); }
public int hashCode() { int result = 1397928647; if (name != null) { // named actions are unique at the process definition level result += name.hashCode(); result = 1290535769 * result + processDefinition.hashCode(); } else { if (actionDelegation != null) { result += actionDelegation.hashCode(); } else if (actionExpression != null) { result += actionExpression.hashCode(); } else if (referencedAction != null) { result += referencedAction.hashCode(); } result = 1290535769 * result + event.hashCode(); } return result; }
public void read(Element decisionElement, JpdlXmlReader jpdlReader) { String expression = decisionElement.attributeValue("expression"); Element decisionHandlerElement = decisionElement.element("handler"); if (expression != null) { decisionExpression = expression; } else if (decisionHandlerElement != null) { decisionDelegation = new Delegation(); decisionDelegation.read(decisionHandlerElement, jpdlReader); } }
public boolean equals(Object o) { if (this == o) return true; if (!(o instanceof Delegation)) return false; Delegation other = (Delegation) o; if (id != 0 && id == other.getId()) return true; return className.equals(other.getClassName()) && (configuration != null ? configuration.equals(other.getConfiguration()) : other.getConfiguration() == null); }
public Object getInstance() { if (instance == null) { instance = instantiate(); } return instance; }
private Transition handleDecision(ExecutionContext executionContext) { // invoke handler to obtain transition name DecisionHandler decisionHandler = (DecisionHandler) decisionDelegation.getInstance(); String transitionName; try { transitionName = decisionHandler.decide(executionContext); } catch (Exception e) { raiseException(e, executionContext); return null; } // resolve transition from name Transition transition = getLeavingTransition(transitionName); if (transition == null) { throw new JbpmException("no such transition: " + transitionName); } return transition; }
protected TaskController readTaskController(Element taskControllerElement) { TaskController taskController = new TaskController(); if (taskControllerElement.attributeValue("class") != null) { Delegation taskControllerDelegation = new Delegation(); taskControllerDelegation.read(taskControllerElement, this); taskController.setTaskControllerDelegation(taskControllerDelegation); } else { List variableAccesses = readVariableAccesses(taskControllerElement); taskController.setVariableAccesses(variableAccesses); } return taskController; }