use of org.kie.workbench.common.dmn.api.definition.model.InformationItemPrimary in project kie-wb-common by kiegroup.
the class DMNElementsSynchronizerTest method testSynchronizeBusinessKnowledgeModelNode.
@Test
public void testSynchronizeBusinessKnowledgeModelNode() {
final BusinessKnowledgeModel from = mock(BusinessKnowledgeModel.class);
final BusinessKnowledgeModel to = mock(BusinessKnowledgeModel.class);
final InformationItemPrimary variable = mock(InformationItemPrimary.class);
when(from.getVariable()).thenReturn(variable);
synchronizer.synchronizeBusinessKnowledgeModelNode(from, to);
verify(to).setVariable(variable);
}
use of org.kie.workbench.common.dmn.api.definition.model.InformationItemPrimary in project kie-wb-common by kiegroup.
the class DMNDeepCloneProcess method cloneTypeRefInfo.
private void cloneTypeRefInfo(final IsInformationItem srcInformationItem, final IsInformationItem targetInformationItem) {
if (srcInformationItem instanceof InformationItemPrimary) {
final InformationItemPrimary srcInformationItemPrimary = (InformationItemPrimary) srcInformationItem;
final InformationItemPrimary targetInformationItemPrimary = (InformationItemPrimary) targetInformationItem;
targetInformationItemPrimary.setTypeRefHolder(srcInformationItemPrimary.getTypeRefHolder().copy());
targetInformationItemPrimary.setTypeRef(srcInformationItemPrimary.getTypeRefHolder().getValue().copy());
}
}
use of org.kie.workbench.common.dmn.api.definition.model.InformationItemPrimary in project kie-wb-common by kiegroup.
the class DecisionConverter method nodeFromDMN.
@Override
public Node<View<Decision>, ?> nodeFromDMN(final NodeEntry nodeEntry) {
final JSITDecision dmn = Js.uncheckedCast(nodeEntry.getDmnElement());
@SuppressWarnings("unchecked") final Node<View<Decision>, ?> node = (Node<View<Decision>, ?>) factoryManager.newElement(nodeEntry.getId(), getDefinitionId(Decision.class)).asNode();
final Id id = IdPropertyConverter.wbFromDMN(dmn.getId());
final Description description = DescriptionPropertyConverter.wbFromDMN(dmn.getDescription());
final Name name = new Name(dmn.getName());
final InformationItemPrimary informationItem = InformationItemPrimaryPropertyConverter.wbFromDMN(dmn.getVariable(), dmn);
Expression expression = null;
final JSITExpression jsiWrapped = dmn.getExpression();
if (Objects.nonNull(jsiWrapped)) {
final JSITExpression jsiExpression = Js.uncheckedCast(JsUtils.getUnwrappedElement(jsiWrapped));
expression = ExpressionPropertyConverter.wbFromDMN(jsiExpression, Js.uncheckedCast(dmn), nodeEntry.getComponentWidthsConsumer());
}
final Decision decision = new Decision(id, description, name, new Question(), new AllowedAnswers(), informationItem, expression, new StylingSet(), new GeneralRectangleDimensionsSet());
decision.setDiagramId(nodeEntry.getDiagramId());
decision.setQuestion(QuestionPropertyConverter.wbFromDMN(dmn.getQuestion()));
decision.setAllowedAnswers(AllowedAnswersPropertyConverter.wbFromDMN(dmn.getAllowedAnswers()));
node.getContent().setDefinition(decision);
if (Objects.nonNull(informationItem)) {
informationItem.setParent(decision);
}
if (Objects.nonNull(expression)) {
expression.setParent(decision);
}
DMNExternalLinksToExtensionElements.loadExternalLinksFromExtensionElements(dmn, decision);
return node;
}
use of org.kie.workbench.common.dmn.api.definition.model.InformationItemPrimary in project kie-wb-common by kiegroup.
the class DecisionServiceConverter method nodeFromDMN.
@Override
public Node<View<DecisionService>, ?> nodeFromDMN(final NodeEntry nodeEntry) {
final JSITDecisionService dmn = Js.uncheckedCast(nodeEntry.getDmnElement());
@SuppressWarnings("unchecked") final Node<View<DecisionService>, ?> node = (Node<View<DecisionService>, ?>) factoryManager.newElement(nodeEntry.getId(), getDefinitionId(DecisionService.class)).asNode();
final Id id = IdPropertyConverter.wbFromDMN(dmn.getId());
final Description description = DescriptionPropertyConverter.wbFromDMN(dmn.getDescription());
final Name name = new Name(dmn.getName());
final InformationItemPrimary informationItem = InformationItemPrimaryPropertyConverter.wbFromDMN(dmn.getVariable(), dmn);
final List<DMNElementReference> outputDecision = new ArrayList<>();
final List<DMNElementReference> encapsulatedDecision = new ArrayList<>();
final List<DMNElementReference> inputDecision = new ArrayList<>();
final List<DMNElementReference> inputData = new ArrayList<>();
final List<JSITDMNElementReference> jsiOutputDecisions = dmn.getOutputDecision();
if (Objects.nonNull(jsiOutputDecisions)) {
for (int i = 0; i < jsiOutputDecisions.size(); i++) {
final JSITDMNElementReference jsiOutputDecision = Js.uncheckedCast(jsiOutputDecisions.get(i));
outputDecision.add(DMNElementReferenceConverter.wbFromDMN(jsiOutputDecision));
}
}
final List<JSITDMNElementReference> jsiEncapsulatedDecisions = dmn.getEncapsulatedDecision();
if (Objects.nonNull(jsiEncapsulatedDecisions)) {
for (int i = 0; i < jsiEncapsulatedDecisions.size(); i++) {
final JSITDMNElementReference jsiEncapsulatedDecision = Js.uncheckedCast(jsiEncapsulatedDecisions.get(i));
encapsulatedDecision.add(DMNElementReferenceConverter.wbFromDMN(jsiEncapsulatedDecision));
}
}
final List<JSITDMNElementReference> jsiInputDecisions = dmn.getInputDecision();
if (Objects.nonNull(jsiInputDecisions)) {
for (int i = 0; i < jsiInputDecisions.size(); i++) {
final JSITDMNElementReference jsiInputDecision = Js.uncheckedCast(jsiInputDecisions.get(i));
inputDecision.add(DMNElementReferenceConverter.wbFromDMN(jsiInputDecision));
}
}
final List<JSITDMNElementReference> jsiInputDatas = dmn.getInputData();
if (Objects.nonNull(jsiInputDatas)) {
for (int i = 0; i < jsiInputDatas.size(); i++) {
final JSITDMNElementReference jsiInputData = Js.uncheckedCast(jsiInputDatas.get(i));
inputData.add(DMNElementReferenceConverter.wbFromDMN(jsiInputData));
}
}
final DecisionService decisionService = new DecisionService(id, description, name, informationItem, outputDecision, encapsulatedDecision, inputDecision, inputData, new StylingSet(), new DecisionServiceRectangleDimensionsSet(), new DecisionServiceDividerLineY());
decisionService.setDiagramId(nodeEntry.getDiagramId());
node.getContent().setDefinition(decisionService);
if (Objects.nonNull(informationItem)) {
informationItem.setParent(decisionService);
}
DMNExternalLinksToExtensionElements.loadExternalLinksFromExtensionElements(dmn, decisionService);
return node;
}
use of org.kie.workbench.common.dmn.api.definition.model.InformationItemPrimary in project kie-wb-common by kiegroup.
the class DMNIncludedModelHandlerTest method setType.
private void setType(final HasVariable<InformationItemPrimary> hasVariable, final String type) {
final InformationItemPrimary variable = new InformationItemPrimary();
hasVariable.setVariable(variable);
variable.setTypeRef(type == null ? null : new QName(NULL_NS_URI, type, DEFAULT_NS_PREFIX));
}
Aggregations