@Override void process() throws Exception { initProcessAndTask(context); action.execute(context); } }.run();
public void read(Element element, JpdlXmlReader jpdlReader) { Delegation delegation = jpdlReader.readMailDelegation(element); this.action = new Action(delegation); }
private void writeAction(Element parentElement, Action action) { String actionName = ActionTypes.getActionName(action.getClass()); Element actionElement = parentElement.addElement(actionName); if (action.getName() != null) { actionElement.addAttribute("name", action.getName()); } if (!action.acceptsPropagatedEvents()) { actionElement.addAttribute("accept-propagated-events", "false"); } action.write(actionElement); }
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()); }
private List getNamedProcessActions(Map actions) { List namedProcessActions = new ArrayList(); for (Iterator iter = actions.values().iterator(); iter.hasNext();) { Action action = (Action) iter.next(); if (action.getEvent() == null && action.getName() != null) { namedProcessActions.add(action); } } return namedProcessActions; }
Action action = new Action(delegation); action.setProcessDefinition(processDefinition); action.setName(task.getName());
public boolean execute(JbpmContext jbpmContext) throws Exception { Token token = getToken(); ExecutionContext executionContext = new ExecutionContext(token); executionContext.setAction(action); executionContext.setEvent(action.getEvent()); Node node; if (token != null && (node = token.getNode()) != null) { node.executeAction(action, executionContext); } else { action.execute(executionContext); } return true; }
private void executeActions(List actions, ExecutionContext executionContext, boolean isPropagated) { if (actions == null) return; for (Iterator iter = actions.iterator(); iter.hasNext();) { Action action = (Action) iter.next(); if (!action.acceptsPropagatedEvents() && isPropagated) continue; if (action.isAsync()) { ExecuteActionJob job = createAsyncActionExecutionJob(executionContext.getToken(), action); MessageService messageService = executionContext.getJbpmContext() .getServices() .getMessageService(); messageService.send(job); } else { executeAction(action, executionContext); } } }
/** * creates a bidirectional relation between this process definition and the given action. * * @throws IllegalArgumentException if action is null or if action.getName() is null. */ public Action addAction(Action action) { if (action == null) { throw new IllegalArgumentException("action is null"); } if (action.getName() == null) { throw new IllegalArgumentException("action is unnamed"); } if (actions == null) actions = new HashMap(); actions.put(action.getName(), action); action.processDefinition = this; return action; }
public void setAction(Action action) { this.action = action; if (action != null) this.event = action.getEvent(); }
public void saveJob(Job job) { try { session.save(job); if (job instanceof Timer) { Timer timer = (Timer) job; Action action = timer.getAction(); // if action is transient, save it if (action != null && action.getId() == 0L) session.save(action); } } catch (HibernateException e) { throw new JbpmPersistenceException("could not save " + job, e); } }
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()); }
Action action = new Action(delegation); action.setProcessDefinition(processDefinition); action.setName(task.getName());
public boolean execute(JbpmContext jbpmContext) throws Exception { Token token = getToken(); ExecutionContext executionContext = new ExecutionContext(token); executionContext.setAction(action); executionContext.setEvent(action.getEvent()); Node node; if (token != null && (node = token.getNode()) != null) { node.executeAction(action, executionContext); } else { action.execute(executionContext); } return true; }
private List getNamedProcessActions(Map actions) { List namedProcessActions = new ArrayList(); for (Iterator iter = actions.values().iterator(); iter.hasNext();) { Action action = (Action) iter.next(); if (action.getEvent() == null && action.getName() != null) { namedProcessActions.add(action); } } return namedProcessActions; }
private void executeActions(List actions, ExecutionContext executionContext, boolean isPropagated) { if (actions == null) return; for (Iterator iter = actions.iterator(); iter.hasNext();) { Action action = (Action) iter.next(); if (!action.acceptsPropagatedEvents() && isPropagated) continue; if (action.isAsync()) { ExecuteActionJob job = createAsyncActionExecutionJob(executionContext.getToken(), action); MessageService messageService = executionContext.getJbpmContext() .getServices() .getMessageService(); messageService.send(job); } else { executeAction(action, executionContext); } } }
/** * creates a bidirectional relation between this process definition and the given action. * * @throws IllegalArgumentException if action is null or if action.getName() is null. */ public Action addAction(Action action) { if (action == null) { throw new IllegalArgumentException("action is null"); } if (action.getName() == null) { throw new IllegalArgumentException("action is unnamed"); } if (actions == null) actions = new HashMap(); actions.put(action.getName(), action); action.processDefinition = this; return action; }
public void setAction(Action action) { this.action = action; if (action != null) this.event = action.getEvent(); }
public void saveJob(Job job) { try { session.save(job); if (job instanceof Timer) { Timer timer = (Timer) job; Action action = timer.getAction(); // if action is transient, save it if (action != null && action.getId() == 0L) session.save(action); } } catch (HibernateException e) { throw new JbpmPersistenceException("could not save " + job, e); } }
public void executeAction(final Action action, final ExecutionContext context) throws Exception { if ( isPageflow(context) ) { action.execute(context); } else { new ContextualCall() { @Override void process() throws Exception { initProcessAndTask(context); action.execute(context); } }.run(); } }