private void writeEvent(Element eventElement, Event event) { eventElement.addAttribute("type", event.getEventType()); if (event.hasActions()) { for (Iterator actionIter = event.getActions().iterator(); actionIter.hasNext();) { Action action = (Action) actionIter.next(); writeAction(eventElement, action); } } }
public boolean equals(Object o) { if (this == o) return true; if (!(o instanceof Event)) return false; Event other = (Event) o; if (id != 0 && id == other.getId()) return true; return eventType.equals(other.getEventType()) && graphElement.equals(other.getGraphElement()); }
/** * creates a runtime action. Look up the event with * {@link GraphElement#getEvent(String)} and the action with * {@link ProcessDefinition#getAction(String)}. You can only lookup named * actions easily. */ public RuntimeAction(Event event, Action action) { this.graphElement = event.getGraphElement(); this.eventType = event.getEventType(); this.action = action; }
private void writeTransition(Element transitionElement, Transition transition) { if (transition.getTo() != null) { transitionElement.addAttribute("to", transition.getTo().getName()); } if (transition.getName() != null) { transitionElement.addAttribute("name", transition.getName()); } Event transitionEvent = transition.getEvent(Event.EVENTTYPE_TRANSITION); if (transitionEvent != null && transitionEvent.hasActions()) { writeActions(transitionElement, transitionEvent.getActions()); } }
/** * Process events defined in the pageflow. * * @param type one of: "process-validations", "update-model-values", * "invoke-application", "render-response" */ public void processEvents(String type) { Event event = getNode().getEvent(type); if (event!=null) { for ( Action action: (List<Action>) event.getActions() ) { try { action.execute( ExecutionContext.currentExecutionContext() ); } catch (Exception e) { throw new RuntimeException(e); } } } }
public Event addEvent(Event event) { if (event == null) { throw new IllegalArgumentException("event is null"); } if (event.getEventType() == null) { throw new IllegalArgumentException("event type is null"); } if (events == null) { events = new HashMap(); } events.put(event.getEventType(), event); event.graphElement = this; return event; }
protected void readEvents(Element parentElement, GraphElement graphElement) { for (Iterator iter = parentElement.elementIterator("event"); iter.hasNext();) { Element eventElement = (Element) iter.next(); // register event of the defined type String eventType = eventElement.attributeValue("type"); if (!graphElement.hasEvent(eventType)) graphElement.addEvent(new Event(eventType)); // parse any actions associated to the event readActions(eventElement, graphElement, eventType); } }
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; }
if (event != null && (graphElement = event.getGraphElement()) != null) { try { executionContext.setTimer(timer);
private void writeTransition(Element transitionElement, Transition transition) { if (transition.getTo() != null) { transitionElement.addAttribute("to", transition.getTo().getName()); } if (transition.getName() != null) { transitionElement.addAttribute("name", transition.getName()); } Event transitionEvent = transition.getEvent(Event.EVENTTYPE_TRANSITION); if (transitionEvent != null && transitionEvent.hasActions()) { writeActions(transitionElement, transitionEvent.getActions()); } }
/** * creates a runtime action. Look up the event with * {@link GraphElement#getEvent(String)} and the action with * {@link ProcessDefinition#getAction(String)}. You can only lookup named * actions easily. */ public RuntimeAction(Event event, Action action) { this.graphElement = event.getGraphElement(); this.eventType = event.getEventType(); this.action = action; }
public void fireAndPropagateEvent(String eventType, ExecutionContext executionContext) { // check whether the event was fired on this element // or propagated from another element boolean isPropagated = !equals(executionContext.getEventSource()); // execute static actions Event event = getEvent(eventType); if (event != null) { // update the context executionContext.setEvent(event); // execute the static actions specified in the process definition executeActions(event.getActions(), executionContext, isPropagated); } // execute the runtime actions List runtimeActions = getRuntimeActionsForEvent(executionContext, eventType); executeActions(runtimeActions, executionContext, isPropagated); // remove the event from the context executionContext.setEvent(null); // propagate the event to the parent element GraphElement parent = getParent(); if (parent != null) { parent.fireAndPropagateEvent(eventType, executionContext); } }
public Event removeEvent(Event event) { Event removedEvent = null; if (event == null) { throw new IllegalArgumentException("event is null"); } if (event.getEventType() == null) { throw new IllegalArgumentException("event type is null"); } if (events != null) { removedEvent = (Event) events.remove(event.getEventType()); if (removedEvent != null) { event.graphElement = null; } } return removedEvent; }
protected void readEvents(Element parentElement, GraphElement graphElement) { for (Iterator iter = parentElement.elementIterator("event"); iter.hasNext();) { Element eventElement = (Element) iter.next(); // register event of the defined type String eventType = eventElement.attributeValue("type"); if (!graphElement.hasEvent(eventType)) graphElement.addEvent(new Event(eventType)); // parse any actions associated to the event readActions(eventElement, graphElement, eventType); } }
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; }
if (event != null && (graphElement = event.getGraphElement()) != null) { try { executionContext.setTimer(timer);
private void writeEvent(Element eventElement, Event event) { eventElement.addAttribute("type", event.getEventType()); if (event.hasActions()) { for (Iterator actionIter = event.getActions().iterator(); actionIter.hasNext();) { Action action = (Action) actionIter.next(); writeAction(eventElement, action); } } }