protected void buildAction(DroolsAction droolsAction, ProcessBuildContext context, NodeImpl node) { DroolsConsequenceAction action = (DroolsConsequenceAction) droolsAction; ActionDescr actionDescr = new ActionDescr(); actionDescr.setText( action.getConsequence() ); actionDescr.setResource(context.getProcessDescr().getResource()); ProcessDialect dialect = ProcessDialectRegistry.getDialect( action.getDialect() ); dialect.getActionBuilder().build( context, action, actionDescr, node); }
final InternalKnowledgePackage pkg = new KnowledgePackageImpl( "pkg1" ); ActionDescr actionDescr = new ActionDescr(); actionDescr.setText( "list.add( 'hello world' )" );
final InternalKnowledgePackage pkg = new KnowledgePackageImpl( "pkg1" ); ActionDescr actionDescr = new ActionDescr(); actionDescr.setText( "list.add( 'hello world' )" );
public void build(Process process, ProcessDescr processDescr, ProcessBuildContext context, Node node) { ActionNode actionNode = ( ActionNode ) node; DroolsConsequenceAction action = (DroolsConsequenceAction) actionNode.getAction(); ActionDescr actionDescr = new ActionDescr(); actionDescr.setText( action.getConsequence() ); actionDescr.setResource(processDescr.getResource()); ProcessDialect dialect = ProcessDialectRegistry.getDialect( action.getDialect() ); dialect.getActionBuilder().build( context, action, actionDescr, (NodeImpl) node ); }
final InternalKnowledgePackage pkg = new KnowledgePackageImpl( "pkg1" ); ActionDescr actionDescr = new ActionDescr(); actionDescr.setText( "list.add( \"hello world\" );" );
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 void buildContexts(ContextContainer contextContainer, ProcessBuildContext buildContext) { List<Context> exceptionScopes = contextContainer.getContexts(ExceptionScope.EXCEPTION_SCOPE); if (exceptionScopes != null) { for (Context context: exceptionScopes) { // TODO: OCRAM: add compensation scope to process builder???? ExceptionScope exceptionScope = (ExceptionScope) context; for (ExceptionHandler exceptionHandler: exceptionScope.getExceptionHandlers().values()) { if (exceptionHandler instanceof ActionExceptionHandler) { DroolsConsequenceAction action = (DroolsConsequenceAction) ((ActionExceptionHandler) exceptionHandler).getAction(); ActionDescr actionDescr = new ActionDescr(); actionDescr.setText( action.getConsequence() ); actionDescr.setResource(buildContext.getProcessDescr().getResource()); ProcessDialect dialect = ProcessDialectRegistry.getDialect( action.getDialect() ); dialect.getActionBuilder().build( buildContext, action, actionDescr, (ProcessImpl) buildContext.getProcess() ); } } } } }
final InternalKnowledgePackage pkg = new KnowledgePackageImpl("pkg1"); ActionDescr actionDescr = new ActionDescr(); actionDescr.setText( "var testString; print('Hello')" );
protected AnalysisResult getAnalysis(final PackageBuildContext context, final ActionDescr actionDescr) { JavaDialect dialect = (JavaDialect) context.getDialect( "java" ); Map<String, Class<?>> variables = new HashMap<String,Class<?>>(); BoundIdentifiers boundIdentifiers = new BoundIdentifiers(variables, context); AnalysisResult analysis = dialect.analyzeBlock( context, actionDescr, actionDescr.getText(), boundIdentifiers); return analysis; }
public void build(Process process, ProcessDescr processDescr, ProcessBuildContext context, Node node) { super.build(process, processDescr, context, node); ActionNode actionNode = ( ActionNode ) node; DroolsConsequenceAction action = (DroolsConsequenceAction) actionNode.getAction(); ActionDescr actionDescr = new ActionDescr(); actionDescr.setText( action.getConsequence() ); actionDescr.setResource(processDescr.getResource()); ProcessDialect dialect = ProcessDialectRegistry.getDialect( action.getDialect() ); dialect.getActionBuilder().build( context, action, actionDescr, (NodeImpl) node ); Transformation transformation = (Transformation) node.getMetaData().get("Transformation"); if (transformation != null) { WorkflowProcess wfProcess = (WorkflowProcess) process; Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("imports", wfProcess.getImports()); parameters.put("classloader", context.getConfiguration().getClassLoader()); DataTransformer transformer = DataTransformerRegistry.get().find(transformation.getLanguage()); transformation.setCompiledExpression(transformer.compile(transformation.getExpression(), parameters)); } }
protected void buildAction(final PackageBuildContext context, final DroolsAction action, final ActionDescr actionDescr, final ContextResolver contextResolver, String className, AnalysisResult analysis) { Set<String> identifiers = analysis.getBoundIdentifiers().getGlobals().keySet(); final Map map = createVariableContext( className, actionDescr.getText(), (ProcessBuildContext) context, (String[]) identifiers.toArray( new String[identifiers.size()] ), analysis.getNotBoundedIdentifiers(), contextResolver); map.put( "text", ProcessKnowledgeHelperFixer.fix( actionDescr.getText() )); generateTemplates( "actionMethod", "actionInvoker", (ProcessBuildContext)context, className, map, action, actionDescr ); collectTypes("JavaDialect", analysis, (ProcessBuildContext)context); }
protected void buildAction(DroolsAction droolsAction, ProcessBuildContext context, NodeImpl node) { DroolsConsequenceAction action = (DroolsConsequenceAction) droolsAction; ActionDescr actionDescr = new ActionDescr(); actionDescr.setText( action.getConsequence() ); actionDescr.setResource(context.getProcessDescr().getResource()); ProcessDialect dialect = ProcessDialectRegistry.getDialect( action.getDialect() ); dialect.getActionBuilder().build( context, action, actionDescr, node); }
public void build(final PackageBuildContext context, final DroolsAction action, final ActionDescr actionDescr, final ContextResolver contextResolver) { String text = processMacros( actionDescr.getText() ); Map<String, Class<?>> variables = new HashMap<String,Class<?>>(); try { MVELDialect dialect = (MVELDialect) context.getDialect( "mvel" ); MVELAnalysisResult analysis = getAnalysis(context, actionDescr, dialect, text, variables); if ( analysis == null ) { // not possible to get the analysis results return; } buildAction(context, action, actionDescr, contextResolver, dialect, analysis, text, variables); } catch ( final Exception e ) { context.getErrors().add( new DescrBuildError( context.getParentDescr(), actionDescr, null, "Unable to build expression for action '" + actionDescr.getText() + "' :" + e ) ); } }
public void build(Process process, ProcessDescr processDescr, ProcessBuildContext context, Node node) { ActionNode actionNode = ( ActionNode ) node; DroolsConsequenceAction action = (DroolsConsequenceAction) actionNode.getAction(); ActionDescr actionDescr = new ActionDescr(); actionDescr.setText( action.getConsequence() ); actionDescr.setResource(processDescr.getResource()); ProcessDialect dialect = ProcessDialectRegistry.getDialect( action.getDialect() ); dialect.getActionBuilder().build( context, action, actionDescr, (NodeImpl) node ); }
null, "Could not find variable '" + variableName + "' " + "for action '" + actionDescr.getText() + "'" ) ); } else { variables.put(variableName,
public void buildContexts(ContextContainer contextContainer, ProcessBuildContext buildContext) { List<Context> exceptionScopes = contextContainer.getContexts(ExceptionScope.EXCEPTION_SCOPE); if (exceptionScopes != null) { for (Context context: exceptionScopes) { // TODO: OCRAM: add compensation scope to process builder???? ExceptionScope exceptionScope = (ExceptionScope) context; for (ExceptionHandler exceptionHandler: exceptionScope.getExceptionHandlers().values()) { if (exceptionHandler instanceof ActionExceptionHandler) { DroolsConsequenceAction action = (DroolsConsequenceAction) ((ActionExceptionHandler) exceptionHandler).getAction(); ActionDescr actionDescr = new ActionDescr(); actionDescr.setText( action.getConsequence() ); actionDescr.setResource(buildContext.getProcessDescr().getResource()); ProcessDialect dialect = ProcessDialectRegistry.getDialect( action.getDialect() ); dialect.getActionBuilder().build( buildContext, action, actionDescr, (ProcessImpl) buildContext.getProcess() ); } } } } }
public void build(Process process, ProcessDescr processDescr, ProcessBuildContext context, Node node) { super.build(process, processDescr, context, node); ActionNode actionNode = ( ActionNode ) node; DroolsConsequenceAction action = (DroolsConsequenceAction) actionNode.getAction(); ActionDescr actionDescr = new ActionDescr(); actionDescr.setText( action.getConsequence() ); actionDescr.setResource(processDescr.getResource()); ProcessDialect dialect = ProcessDialectRegistry.getDialect( action.getDialect() ); dialect.getActionBuilder().build( context, action, actionDescr, (NodeImpl) node ); Transformation transformation = (Transformation) node.getMetaData().get("Transformation"); if (transformation != null) { WorkflowProcess wfProcess = (WorkflowProcess) process; Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("imports", wfProcess.getImports()); parameters.put("classloader", context.getConfiguration().getClassLoader()); DataTransformer transformer = DataTransformerRegistry.get().find(transformation.getLanguage()); transformation.setCompiledExpression(transformer.compile(transformation.getExpression(), parameters)); } }
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 ); }