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

The following examples show how to use org.drools.core.util.StringUtils#capitalize() . 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
Source File: MessageProducerGenerator.java    From kogito-runtimes with Apache License 2.0 6 votes vote down vote up
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
Source File: MessageConsumerGenerator.java    From kogito-runtimes with Apache License 2.0 6 votes vote down vote up
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
Source File: AbstractResourceGenerator.java    From kogito-runtimes with Apache License 2.0 6 votes vote down vote up
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
Source File: ModelClassGenerator.java    From kogito-runtimes with Apache License 2.0 5 votes vote down vote up
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
Source File: InputModelClassGenerator.java    From kogito-runtimes with Apache License 2.0 5 votes vote down vote up
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
Source File: MessageDataEventGenerator.java    From kogito-runtimes with Apache License 2.0 5 votes vote down vote up
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
Source File: OutputModelClassGenerator.java    From kogito-runtimes with Apache License 2.0 5 votes vote down vote up
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
Source File: DMNRestResourceGenerator.java    From kogito-runtimes with Apache License 2.0 5 votes vote down vote up
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
Source File: AbstractNodeVisitor.java    From kogito-runtimes with Apache License 2.0 5 votes vote down vote up
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 File: ModelMetaData.java    From kogito-runtimes with 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
Source File: UserTaskModelMetaData.java    From kogito-runtimes with Apache License 2.0 5 votes vote down vote up
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
Source File: ProcessToExecModelGenerator.java    From kogito-runtimes with Apache License 2.0 4 votes vote down vote up
public static String extractModelClassName(String processId) {
    return StringUtils.capitalize(extractProcessId(processId) + MODEL_CLASS_SUFFIX);
}
 
Example 13
Source File: ModelMetaData.java    From kogito-runtimes with 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);
}