templates.dmn2java.tree.decision.ftl Maven / Gradle / Ivy
<#include "drgElementCommon.ftl">
<#if javaPackageName?has_content>
package ${javaPackageName};
#if>
import java.util.*;
import java.util.stream.Collectors;
<@importRequiredBKMs drgElement />
@javax.annotation.Generated(value = {"decision.ftl", "${modelRepository.name(drgElement)}"})
@${transformer.drgElementAnnotationClassName()}(
namespace = "${javaPackageName}",
name = "${modelRepository.name(drgElement)}",
label = "${modelRepository.label(drgElement)}",
elementKind = ${transformer.elementKindAnnotationClassName()}.${transformer.elementKind(drgElement)},
expressionKind = ${transformer.expressionKindAnnotationClassName()}.${transformer.expressionKind(drgElement)},
hitPolicy = ${transformer.hitPolicyAnnotationClassName()}.${transformer.hitPolicy(drgElement)},
rulesCount = ${modelRepository.rulesCount(drgElement)}
)
public class ${javaClassName} extends ${decisionBaseClass} {
public static final ${transformer.drgElementMetadataClassName()} ${transformer.drgElementMetadataFieldName()} = new ${transformer.drgElementMetadataClassName()}(
"${javaPackageName}",
"${modelRepository.name(drgElement)}",
"${modelRepository.label(drgElement)}",
${transformer.elementKindAnnotationClassName()}.${transformer.elementKind(drgElement)},
${transformer.expressionKindAnnotationClassName()}.${transformer.expressionKind(drgElement)},
${transformer.hitPolicyAnnotationClassName()}.${transformer.hitPolicy(drgElement)},
${modelRepository.rulesCount(drgElement)}
);
<@addSubDecisionFields drgElement/>
public ${javaClassName}() {
<#if transformer.hasDirectSubDecisions(drgElement)>
this(${transformer.decisionConstructorNewArgumentList(drgElement)});
#if>
}
<#if transformer.hasDirectSubDecisions(drgElement)>
public ${javaClassName}(${transformer.decisionConstructorSignature(drgElement)}) {
<@setSubDecisionFields drgElement/>
}
#if>
<#if transformer.shouldGenerateApplyWithConversionFromString(drgElement)>
public ${transformer.drgElementOutputType(drgElement)} apply(${transformer.drgElementSignatureWithConversionFromString(drgElement)}) {
try {
return apply(${transformer.drgElementDefaultArgumentsExtraCache(transformer.drgElementDefaultArgumentsExtra(transformer.drgElementArgumentListWithConversionFromString(drgElement)))});
} catch (Exception e) {
logError("Cannot apply decision '${javaClassName}'", e);
return null;
}
}
public ${transformer.drgElementOutputType(drgElement)} apply(${transformer.drgElementSignatureExtraCache(transformer.drgElementSignatureExtra(transformer.drgElementSignatureWithConversionFromString(drgElement)))}) {
try {
return apply(${transformer.drgElementArgumentsExtraCache(transformer.drgElementArgumentsExtra(transformer.drgElementArgumentListWithConversionFromString(drgElement)))});
} catch (Exception e) {
logError("Cannot apply decision '${javaClassName}'", e);
return null;
}
}
#if>
public ${transformer.drgElementOutputType(drgElement)} apply(${transformer.drgElementSignature(drgElement)}) {
return apply(${transformer.drgElementDefaultArgumentsExtraCache(transformer.drgElementDefaultArgumentsExtra(transformer.drgElementArgumentList(drgElement)))});
}
public ${transformer.drgElementOutputType(drgElement)} apply(${transformer.drgElementSignatureExtraCache(transformer.drgElementSignatureExtra(transformer.drgElementSignature(drgElement)))}) {
<@applyMethodBody drgElement />
}
<@evaluateExpressionMethod drgElement />
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy