Codota Logo
org.drools.compiler.lang.descr
Code IndexAdd Codota to your IDE (free)

How to use org.drools.compiler.lang.descr

Best Java code snippets using org.drools.compiler.lang.descr (Showing top 20 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
StringBuilder s =
  • Codota Iconnew StringBuilder()
  • Codota Iconnew StringBuilder(32)
  • Codota IconString str;new StringBuilder(str)
  • Smart code suggestions by Codota
}
origin: kiegroup/jbpm

       final ContextResolver contextResolver) {
String text = processMacros( actionDescr.getText() );
                         actionDescr,
                         null,
                         "Unable to build expression for action '" + actionDescr.getText() + "' :" + e ) );
origin: kiegroup/jbpm

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 );
}
origin: kiegroup/jbpm

StringUtils.ucFirst(context.getProcessDescr().getClassName()));
context.getProcessDescr().getClassName() + StringUtils.ucFirst(className) + "Invoker");
origin: kiegroup/jbpm

PackageRegistry pkgRegistry = this.knowledgeBuilder.getOrCreatePackageRegistry(new PackageDescr(process.getPackageName()));
if (pkgRegistry != null) {
  InternalKnowledgePackage p = pkgRegistry.getPackage();
      ProcessDescr processDescr = new ProcessDescr();
      processDescr.setName(process.getPackageName() + "." + process.getName());
      processDescr.setResource( resource );
      processDescr.setProcessId( process.getId() );
      DialectCompiletimeRegistry dialectRegistry = pkgRegistry.getDialectCompiletimeRegistry();
      Dialect dialect = dialectRegistry.getDialect( "java" );
origin: kiegroup/jbpm

final InternalKnowledgePackage pkg = new KnowledgePackageImpl( "pkg1" );
ActionDescr actionDescr = new ActionDescr();
actionDescr.setText( "list.add( \"hello world\" );" );       
JavaDialect javaDialect = ( JavaDialect ) dialectRegistry.getDialect( "java" );
ProcessDescr processDescr = new ProcessDescr();
processDescr.setClassName( "Process1" );
processDescr.setName( "Process1" );
origin: kiegroup/jbpm

@Test
public void testRuleFlow() throws Exception {
  InputStream in = this.getClass().getResourceAsStream( "/org/jbpm/integrationtests/ruleflow.rfm" );
  assertNotNull( in );
  builder.addPackage( new PackageDescr( "com.sample" ) );
  builder.addRuleFlow( new InputStreamReader( in ) );
  InternalKnowledgePackage pkg = builder.getPackage("com.sample");
  assertNotNull( pkg );
  Map<String, Process> flows = pkg.getRuleFlows();
  assertNotNull( flows );
  assertEquals( 1,
         flows.size() );
  assertTrue( flows.containsKey( "0" ) );
  Process p = (Process) flows.get( "0" );
  assertTrue( p instanceof WorkflowProcessImpl );
  //now serialization
  InternalKnowledgePackage pkg2 = (InternalKnowledgePackage) DroolsStreamUtils.streamIn( DroolsStreamUtils.streamOut( pkg ) );
  assertNotNull( pkg2 );
  flows = pkg2.getRuleFlows();
  assertNotNull( flows );
  assertEquals( 1,
         flows.size() );
  assertTrue( flows.containsKey( "0" ) );
  p = (Process) flows.get( "0" );
  assertTrue( p instanceof WorkflowProcessImpl );
}
origin: kiegroup/jbpm

@Test
public void testReturnValueDescrCreation() throws Exception {
  TestJavaProcessDialect javaProcessDialect = new TestJavaProcessDialect();
  ProcessDialectRegistry.setDialect("java", javaProcessDialect);
  String filename = "BPMN2-GatewaySplit-SequenceConditions.bpmn2";
  KieBase kbase = createKnowledgeBase(filename);
  assertFalse( "No " + ActionDescr.class.getSimpleName() + " instances caught for testing!",
      javaProcessDialect.getActionDescrs().isEmpty() );
  for( BaseDescr descr : javaProcessDialect.getActionDescrs() ) {
    assertNotNull( descr.getClass().getSimpleName() +" has a null resource field", descr.getResource() );
  }
  assertFalse( "No " + ReturnValueDescr.class.getSimpleName() + " instances caught for testing!",
      javaProcessDialect.getReturnValueDescrs().isEmpty() );
  for( BaseDescr descr : javaProcessDialect.getReturnValueDescrs() ) {
    assertNotNull( descr.getClass().getSimpleName() +" has a null resource field", descr.getResource() );
  }
}
origin: kiegroup/jbpm

returnValueDescr.setResource(processDescr.getResource());
origin: kiegroup/jbpm

final InternalKnowledgePackage pkg = new KnowledgePackageImpl("pkg1");
ActionDescr actionDescr = new ActionDescr();
actionDescr.setText( "var testString; print('Hello')" );
ProcessDescr processDescr = new ProcessDescr();
processDescr.setClassName("Process1");
processDescr.setName("Process1");
origin: kiegroup/jbpm

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);
}
origin: kiegroup/jbpm

assertNotNull( in );
builder.addPackage( new PackageDescr( "com.sample" ) );
origin: kiegroup/jbpm

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 );
}
origin: kiegroup/jbpm

buffer.append( "public class " + StringUtils.ucFirst( processDescr.getClassName() ) + " {" + lineSeparator );
buffer.append( "    private static final long serialVersionUID = 510l;" + lineSeparator );
origin: kiegroup/jbpm

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() );
        }
      }
    }
  }
}
origin: kiegroup/jbpm

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;
}

origin: kiegroup/jbpm

public void generateTemplates(final String ruleTemplate,
               final String invokerTemplate,
               final ProcessBuildContext context,
               final String className,
               final Map vars,
               final Object invokerLookup,
               final BaseDescr descrLookup) {
  TemplateRegistry registry = getRuleTemplateRegistry();
  context.getMethods().add((String)
      TemplateRuntime.execute(registry.getNamedTemplate(ruleTemplate), null, new MapVariableResolverFactory(vars), registry)
  );
  registry = getInvokerTemplateRegistry();
  final String invokerClassName = context.getPkg().getName() + "." + context.getProcessDescr().getClassName() + StringUtils.ucFirst(className) + "Invoker";
  context.getInvokers().put(invokerClassName,
      (String)TemplateRuntime.execute(registry.getNamedTemplate(invokerTemplate), null, new MapVariableResolverFactory(vars), registry)
  );
  context.addInvokerLookup(invokerClassName, invokerLookup);
  context.addDescrLookups(invokerClassName, descrLookup);
}

origin: kiegroup/jbpm

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));
  }
}
origin: kiegroup/jbpm

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);
}

origin: kiegroup/jbpm

context.getPkg().getName() + "." + processDescr.getClassName(), 
processDescr, 
processClass,
origin: kiegroup/jbpm

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 ) );
  }
}
org.drools.compiler.lang.descr

Most used classes

  • PackageDescr
  • PatternDescr
  • RuleDescr
  • AndDescr
  • AnnotationDescr
  • ExprConstraintDescr,
  • GlobalDescr,
  • AccumulateDescr,
  • CollectDescr,
  • EntryPointDescr,
  • TypeDeclarationDescr,
  • AccumulateDescr$AccumulateFunctionCallDescr,
  • ActionDescr,
  • AtomicExprDescr,
  • BaseDescr,
  • ConditionalElementDescr,
  • ConstraintConnectiveDescr,
  • FromDescr,
  • ImportDescr
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now