Java Code Examples for org.drools.core.util.StringUtils#capitalize()

The following examples show how to use org.drools.core.util.StringUtils#capitalize() . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
public MessageProducerGenerator(
        WorkflowProcess process,
        String modelfqcn,
        String processfqcn,
        String messageDataEventClassName,
        TriggerMetaData trigger) {
    this.process = process;
    this.trigger = trigger;
    this.packageName = process.getPackageName();
    this.processId = process.getId();
    this.processName = processId.substring(processId.lastIndexOf('.') + 1);
    String classPrefix = StringUtils.capitalize(processName);
    this.resourceClazzName = classPrefix + "MessageProducer_" + trigger.getOwnerId();
    this.relativePath = packageName.replace(".", "/") + "/" + resourceClazzName + ".java";
    this.messageDataEventClassName = messageDataEventClassName;
}
 
Example 2
public MessageConsumerGenerator(
        WorkflowProcess process,
        String modelfqcn,
        String processfqcn,
        String appCanonicalName,
        String messageDataEventClassName,
        TriggerMetaData trigger) {
    this.process = process;
    this.trigger = trigger;
    this.packageName = process.getPackageName();
    this.processId = process.getId();
    this.processName = processId.substring(processId.lastIndexOf('.') + 1);
    String classPrefix = StringUtils.capitalize(processName);
    this.resourceClazzName = classPrefix + "MessageConsumer_" + trigger.getOwnerId();
    this.relativePath = packageName.replace(".", "/") + "/" + resourceClazzName + ".java";
    this.modelfqcn = modelfqcn;
    this.dataClazzName = modelfqcn.substring(modelfqcn.lastIndexOf('.') + 1);
    this.processClazzName = processfqcn;
    this.appCanonicalName = appCanonicalName;
    this.messageDataEventClassName = messageDataEventClassName;
}
 
Example 3
public AbstractResourceGenerator(
        GeneratorContext context,
        WorkflowProcess process,
        String modelfqcn,
        String processfqcn,
        String appCanonicalName) {
    this.context = context;
    this.process = process;
    this.packageName = process.getPackageName();
    this.processId = process.getId();
    this.processName = processId.substring(processId.lastIndexOf('.') + 1);
    this.appCanonicalName = appCanonicalName;
    String classPrefix = StringUtils.capitalize(processName);
    this.resourceClazzName = classPrefix + "Resource";
    this.relativePath = packageName.replace(".", "/") + "/" + resourceClazzName + ".java";
    this.modelfqcn = modelfqcn;
    this.dataClazzName = modelfqcn.substring(modelfqcn.lastIndexOf('.') + 1);
    this.processClazzName = processfqcn;
}
 
Example 4
public ModelClassGenerator(GeneratorContext context, WorkflowProcess workFlowProcess) {
    String pid = workFlowProcess.getId();
    String name = ProcessToExecModelGenerator.extractProcessId(pid);
    this.modelClassName = workFlowProcess.getPackageName() + "." +
            StringUtils.capitalize(name) + "Model";

    this.context = context;
    this.workFlowProcess = workFlowProcess;
}
 
Example 5
public InputModelClassGenerator(GeneratorContext context, WorkflowProcess workFlowProcess) {
    String pid = workFlowProcess.getId();
    className = StringUtils.capitalize(ProcessToExecModelGenerator.extractProcessId(pid) + "ModelInput");
    this.modelClassName = workFlowProcess.getPackageName() + "." + className;

    this.context = context;
    this.workFlowProcess = workFlowProcess;
}
 
Example 6
public MessageDataEventGenerator(
        WorkflowProcess process,
        TriggerMetaData trigger) {
    this.process = process;
    this.trigger = trigger;
    this.packageName = process.getPackageName();
    this.processId = process.getId();
    this.processName = processId.substring(processId.lastIndexOf('.') + 1);
    String classPrefix = StringUtils.capitalize(processName);
    this.resourceClazzName = classPrefix + "MessageDataEvent_" + trigger.getOwnerId();
    this.relativePath = packageName.replace(".", "/") + "/" + resourceClazzName + ".java";
}
 
Example 7
public OutputModelClassGenerator(GeneratorContext context, WorkflowProcess workFlowProcess) {
    String pid = workFlowProcess.getId();
    className = StringUtils.capitalize(ProcessToExecModelGenerator.extractProcessId(pid) + "ModelOutput");
    this.modelClassName = workFlowProcess.getPackageName() + "." + className;

    this.context = context;
    this.workFlowProcess = workFlowProcess;
}
 
Example 8
public DMNRestResourceGenerator(DMNModel model, String appCanonicalName) {
    this.dmnModel = model;
    this.packageName = CodegenStringUtil.escapeIdentifier(model.getNamespace());
    this.decisionId = model.getDefinitions().getId();
    this.decisionName = CodegenStringUtil.escapeIdentifier(model.getName());
    this.nameURL = URLEncoder.encode(model.getName()).replaceAll("\\+", "%20");
    this.appCanonicalName = appCanonicalName;
    String classPrefix = StringUtils.capitalize(decisionName);
    this.resourceClazzName = classPrefix + "Resource";
    this.relativePath = packageName.replace(".", "/") + "/" + resourceClazzName + ".java";
}
 
Example 9
protected Statement makeAssignmentFromModel(Variable v, String name) {
    ClassOrInterfaceType type = parseClassOrInterfaceType(v.getType().getStringType());
    // `type` `name` = (`type`) `model.get<Name>
    AssignExpr assignExpr = new AssignExpr(
            new VariableDeclarationExpr(type, name),
            new CastExpr(
                    type,
                    new MethodCallExpr(
                            new NameExpr("model"),
                            "get" + StringUtils.capitalize(name))),
            AssignExpr.Operator.ASSIGN);

    return new ExpressionStmt(assignExpr);
}
 
Example 10
Source Project: kogito-runtimes   File: ModelMetaData.java    License: Apache License 2.0 5 votes vote down vote up
public MethodCallExpr callSetter(String targetVar, String destField, Expression value) {
    String name = variableScope.getTypes().get(destField).getSanitizedName();
    String type = variableScope.getType(destField);
    String setter = "set" + StringUtils.capitalize(name); // todo cache FieldDeclarations in compilationUnit()
    return new MethodCallExpr(new NameExpr(targetVar), setter).addArgument(
            new CastExpr(
                    new ClassOrInterfaceType(null, type),
                    new EnclosedExpr(value)));
}
 
Example 11
public UserTaskModelMetaData(String packageName, VariableScope processVariableScope, VariableScope variableScope, HumanTaskNode humanTaskNode, String processId) {
    this.packageName = packageName;
    this.processVariableScope = processVariableScope;
    this.variableScope = variableScope;
    this.humanTaskNode = humanTaskNode;
    this.processId = processId;

    this.inputModelClassSimpleName = StringUtils.capitalize(ProcessToExecModelGenerator.extractProcessId(processId) + "_" + humanTaskNode.getId() + "_" + TASK_INTPUT_CLASS_SUFFIX);
    this.inputModelClassName = packageName + '.' + inputModelClassSimpleName;

    this.outputModelClassSimpleName = StringUtils.capitalize(ProcessToExecModelGenerator.extractProcessId(processId) + "_" + humanTaskNode.getId() + "_" + TASK_OUTTPUT_CLASS_SUFFIX);
    this.outputModelClassName = packageName + '.' + outputModelClassSimpleName;

}
 
Example 12
public static String extractModelClassName(String processId) {
    return StringUtils.capitalize(extractProcessId(processId) + MODEL_CLASS_SUFFIX);
}
 
Example 13
Source Project: kogito-runtimes   File: ModelMetaData.java    License: Apache License 2.0 4 votes vote down vote up
public MethodCallExpr callGetter(String targetVar, String field) {
    String getter = "get" + StringUtils.capitalize(field); // todo cache FieldDeclarations in compilationUnit()
    return new MethodCallExpr(new NameExpr(targetVar), getter);
}