public void wire(Object object) { setMetaData( "Action", object ); }
private void triggerTimer(TimerInstance timerInstance) { for (Map.Entry<Timer, DroolsAction> entry: getEventBasedNode().getTimers().entrySet()) { if (entry.getKey().getId() == timerInstance.getTimerId()) { executeAction((Action) entry.getValue().getMetaData("Action")); return; } } }
public ActionNodeFactory action(Action action) { DroolsAction droolsAction = new DroolsAction(); droolsAction.setMetaData("Action", action); getActionNode().setAction(droolsAction); return this; } }
public void writeExternal(ObjectOutput out) throws IOException { super.writeExternal( out ); out.writeObject( dialect ); out.writeObject( consequence ); }
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { super.readExternal( in ); dialect = (String) in.readObject(); consequence = (String) in.readObject(); }
public void writeExternal(ObjectOutput out) throws IOException { super.writeExternal( out ); out.writeObject( dialect ); out.writeObject( consequence ); }
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { super.readExternal( in ); dialect = (String) in.readObject(); consequence = (String) in.readObject(); }
@SuppressWarnings("unchecked") public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { this.name = (String) in.readObject(); this.metaData = (Map<String, Object>) in.readObject(); Object action = in.readObject(); setMetaData( "Action", action ); }
public ActionNodeFactory action(String dialect, String action, boolean isDroolsAction) { if(isDroolsAction) { DroolsAction droolsAction = new DroolsAction(); droolsAction.setMetaData("Action", action); getActionNode().setAction(droolsAction); } else { getActionNode().setAction(new DroolsConsequenceAction(dialect, action)); } return this; }
protected void triggerEvent(String type) { ExtendedNodeImpl extendedNode = getExtendedNode(); if (extendedNode == null) { return; } List<DroolsAction> actions = extendedNode.getActions(type); if (actions != null) { for (DroolsAction droolsAction: actions) { Action action = (Action) droolsAction.getMetaData("Action"); executeAction(action); } } }
public void writeExternal(ObjectOutput out) throws IOException { out.writeObject( name ); Object action = this.metaData.remove( "Action" ); out.writeObject( this.metaData ); if ( action instanceof CompiledInvoker ) { out.writeObject( null ); } else { out.writeObject(action); } setMetaData( "Action", action ); }
public ActionNodeFactory action(Action action) { DroolsAction droolsAction = new DroolsAction(); droolsAction.setMetaData("Action", action); getActionNode().setAction(droolsAction); return this; } }
public void internalTrigger(final NodeInstance from, String type) { if (!org.jbpm.workflow.core.Node.CONNECTION_DEFAULT_TYPE.equals(type)) { throw new IllegalArgumentException( "An ActionNode only accepts default incoming connections!"); } Action action = (Action) getActionNode().getAction().getMetaData("Action"); try { ProcessContext context = new ProcessContext(getProcessInstance().getKnowledgeRuntime()); context.setNodeInstance(this); executeAction(action); } catch( WorkflowRuntimeException wre) { throw wre; } catch (Exception e) { // for the case that one of the following throws an exception // - the ProcessContext() constructor // - or context.setNodeInstance(this) throw new WorkflowRuntimeException(this, getProcessInstance(), "Unable to execute Action: " + e.getMessage(), e); } triggerCompleted(); }
public void build(final PackageBuildContext context, final DroolsAction action, final ActionDescr actionDescr, final ContextResolver contextResolver) { String text = actionDescr.getText(); JavaScriptAction expr = new JavaScriptAction(text); action.setMetaData("Action", expr ); }
public ActionNodeFactory action(String dialect, String action, boolean isDroolsAction) { if(isDroolsAction) { DroolsAction droolsAction = new DroolsAction(); droolsAction.setMetaData("Action", action); getActionNode().setAction(droolsAction); } else { getActionNode().setAction(new DroolsConsequenceAction(dialect, action)); } return this; }
public void handleException(ExceptionHandler handler, String exception, Object params) { if (handler instanceof ActionExceptionHandler) { ActionExceptionHandler exceptionHandler = (ActionExceptionHandler) handler; Action action = (Action) exceptionHandler.getAction().getMetaData("Action"); try { ProcessInstance processInstance = getProcessInstance(); ProcessContext processContext = new ProcessContext(processInstance.getKnowledgeRuntime()); ContextInstanceContainer contextInstanceContainer = getContextInstanceContainer(); if (contextInstanceContainer instanceof NodeInstance) { processContext.setNodeInstance((NodeInstance) contextInstanceContainer); } else { processContext.setProcessInstance(processInstance); } String faultVariable = exceptionHandler.getFaultVariable(); if (faultVariable != null) { processContext.setVariable(faultVariable, params); } action.execute(processContext); } catch (Exception e) { throw new RuntimeException("unable to execute Action", e); } } else { throw new IllegalArgumentException("Unknown exception handler " + handler); } }
MVELCompilationUnit.Scope.EXPRESSION); MVELAction expr = new MVELAction( unit, context.getDialect().getId() ); action.setMetaData("Action", expr );
((MVELAction) actionNode.getAction().getMetaData("Action")).compile( data ); ((Action)actionNode.getAction().getMetaData("Action")).execute( processContext );
actionNode.setName("Execute"); DroolsAction action = new DroolsConsequenceAction("java", null); action.setMetaData("Action", new Action() { public void execute(ProcessContext context) throws Exception { eventList.add("action" + id);
((MVELAction) actionNode.getAction().getMetaData("Action")).compile( data ); ((Action) actionNode.getAction().getMetaData("Action")).execute( processContext );