use of org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITRuleAnnotation in project kie-wb-common by kiegroup.
the class RuleAnnotationClauseTextPropertyConverter method dmnFromWB.
public static JSITRuleAnnotation dmnFromWB(final RuleAnnotationClauseText wb) {
final JSITRuleAnnotation result = new JSITRuleAnnotation();
result.setText(wb.getText().getValue());
return result;
}
use of org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITRuleAnnotation in project kie-wb-common by kiegroup.
the class DecisionRulePropertyConverter method dmnFromWB.
public static JSITDecisionRule dmnFromWB(final DecisionRule wb) {
final JSITDecisionRule result = new JSITDecisionRule();
result.setId(wb.getId().getValue());
final Optional<String> description = Optional.ofNullable(DescriptionPropertyConverter.dmnFromWB(wb.getDescription()));
description.ifPresent(result::setDescription);
for (final RuleAnnotationClauseText ruleAnnotationClauseText : wb.getAnnotationEntry()) {
final JSITRuleAnnotation ruleAnnotation = RuleAnnotationClauseTextPropertyConverter.dmnFromWB(ruleAnnotationClauseText);
result.addAnnotationEntry(ruleAnnotation);
}
for (UnaryTests ie : wb.getInputEntry()) {
final JSITUnaryTests inputEntryConverted = UnaryTestsPropertyConverter.dmnFromWB(ie);
result.addInputEntry(inputEntryConverted);
}
for (LiteralExpression oe : wb.getOutputEntry()) {
final JSITLiteralExpression outputEntryConverted = LiteralExpressionPropertyConverter.dmnFromWB(oe);
result.addOutputEntry(outputEntryConverted);
}
return result;
}
use of org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITRuleAnnotation in project kie-wb-common by kiegroup.
the class DecisionRulePropertyConverter method wbFromDMN.
public static DecisionRule wbFromDMN(final JSITDecisionRule dmn) {
final Id id = IdPropertyConverter.wbFromDMN(dmn.getId());
final Description description = DescriptionPropertyConverter.wbFromDMN(dmn.getDescription());
final DecisionRule result = new DecisionRule();
result.setId(id);
result.setDescription(description);
final List<JSITRuleAnnotation> jsiAnnotationEntries = dmn.getAnnotationEntry();
for (int i = 0; i < jsiAnnotationEntries.size(); i++) {
final JSITRuleAnnotation jsiRuleAnnotation = Js.uncheckedCast(jsiAnnotationEntries.get(i));
final RuleAnnotationClauseText ruleAnnotationClauseText = RuleAnnotationClauseTextPropertyConverter.wbFromDMN(jsiRuleAnnotation);
if (Objects.nonNull(ruleAnnotationClauseText)) {
ruleAnnotationClauseText.setParent(result);
result.getAnnotationEntry().add(ruleAnnotationClauseText);
}
}
if (result.getAnnotationEntry().isEmpty()) {
final RuleAnnotationClauseText annotationEntryText = new RuleAnnotationClauseText();
annotationEntryText.getText().setValue(description.getValue());
annotationEntryText.setParent(result);
result.getAnnotationEntry().add(annotationEntryText);
}
final List<JSITUnaryTests> jsiInputEntries = dmn.getInputEntry();
for (int i = 0; i < jsiInputEntries.size(); i++) {
final JSITUnaryTests jsiInputEntry = Js.uncheckedCast(jsiInputEntries.get(i));
final UnaryTests inputEntryConverted = UnaryTestsPropertyConverter.wbFromDMN(jsiInputEntry);
if (Objects.nonNull(inputEntryConverted)) {
inputEntryConverted.setParent(result);
result.getInputEntry().add(inputEntryConverted);
}
}
final List<JSITLiteralExpression> jsiOutputEntries = dmn.getOutputEntry();
for (int i = 0; i < jsiOutputEntries.size(); i++) {
final JSITLiteralExpression jsiOutputEntry = Js.uncheckedCast(jsiOutputEntries.get(i));
final LiteralExpression outputEntryConverted = LiteralExpressionPropertyConverter.wbFromDMN(jsiOutputEntry);
if (Objects.nonNull(outputEntryConverted)) {
outputEntryConverted.setParent(result);
result.getOutputEntry().add(outputEntryConverted);
}
}
return result;
}
Aggregations