use of org.kie.workbench.common.dmn.api.definition.model.TextAnnotation in project kie-wb-common by kiegroup.
the class DefaultValueUtilitiesTest method testUpdateNewNodeName_Decision.
@Test
public void testUpdateNewNodeName_Decision() {
// Add some existing nodes to ensure naming is not affected by existing content
graph.addNode(makeMockNode(new BusinessKnowledgeModel()));
graph.addNode(makeMockNode(new InputData()));
graph.addNode(makeMockNode(new KnowledgeSource()));
graph.addNode(makeMockNode(new TextAnnotation()));
final Decision decision1 = new Decision();
final Decision decision2 = new Decision();
final Decision decision3 = new Decision();
final Decision decision4 = new Decision();
assertUpdateNewNodeName(decision1, decision2, (decision) -> decision.getName().getValue(), () -> Decision.class.getSimpleName() + "-1", () -> Decision.class.getSimpleName() + "-2");
// Update existing names manually and add two more
decision1.getName().setValue("decision");
decision2.getName().setValue(Decision.class.getSimpleName() + "-5");
assertUpdateNewNodeName(decision3, decision4, (decision) -> decision.getName().getValue(), () -> Decision.class.getSimpleName() + "-6", () -> Decision.class.getSimpleName() + "-7");
}
use of org.kie.workbench.common.dmn.api.definition.model.TextAnnotation in project kie-wb-common by kiegroup.
the class DefaultValueUtilitiesTest method testUpdateNewNodeName_BusinessKnowledgeModel.
@Test
public void testUpdateNewNodeName_BusinessKnowledgeModel() {
// Add some existing nodes to ensure naming is not affected by existing content
graph.addNode(makeMockNode(new Decision()));
graph.addNode(makeMockNode(new InputData()));
graph.addNode(makeMockNode(new KnowledgeSource()));
graph.addNode(makeMockNode(new TextAnnotation()));
final BusinessKnowledgeModel bkm1 = new BusinessKnowledgeModel();
final BusinessKnowledgeModel bkm2 = new BusinessKnowledgeModel();
final BusinessKnowledgeModel bkm3 = new BusinessKnowledgeModel();
final BusinessKnowledgeModel bkm4 = new BusinessKnowledgeModel();
assertUpdateNewNodeName(bkm1, bkm2, (bkm) -> bkm.getName().getValue(), () -> BusinessKnowledgeModel.class.getSimpleName() + "-1", () -> BusinessKnowledgeModel.class.getSimpleName() + "-2");
// Update existing names manually and add two more
bkm1.getName().setValue("bkm");
bkm2.getName().setValue(BusinessKnowledgeModel.class.getSimpleName() + "-5");
assertUpdateNewNodeName(bkm3, bkm4, (bkm) -> bkm.getName().getValue(), () -> BusinessKnowledgeModel.class.getSimpleName() + "-6", () -> BusinessKnowledgeModel.class.getSimpleName() + "-7");
}
use of org.kie.workbench.common.dmn.api.definition.model.TextAnnotation in project kie-wb-common by kiegroup.
the class DMNDeepCloneProcessTest method testCloneWhenSourceIsTextAnnotation.
@Test
public void testCloneWhenSourceIsTextAnnotation() {
final TextAnnotation source = buildTextAnnotation();
final TextAnnotation cloned = dmnDeepCloneProcess.clone(source, new TextAnnotation());
assertThat(cloned).isNotNull();
assertThat(cloned.getId().getValue()).isNotEqualTo(SOURCE_ID);
assertThat(cloned.getText().getValue()).isEqualTo(TEXT_DATA + FIRST_INDEX_IN_SUFFIX);
}
use of org.kie.workbench.common.dmn.api.definition.model.TextAnnotation in project kie-wb-common by kiegroup.
the class DMNDiagramTextPropertyProviderImplTest method checkSupportsDMNDiagram.
@Test
@SuppressWarnings("unchecked")
public void checkSupportsDMNDiagram() {
assertTrue(provider.supports(element));
final Element other = mock(Element.class);
final Definition otherContent = mock(Definition.class);
final TextAnnotation otherDefinition = mock(TextAnnotation.class);
when(other.getContent()).thenReturn(otherContent);
when(otherContent.getDefinition()).thenReturn(otherDefinition);
assertFalse(provider.supports(other));
}
use of org.kie.workbench.common.dmn.api.definition.model.TextAnnotation in project kie-wb-common by kiegroup.
the class StunnerConverter method ddExtAugmentStunner.
private void ddExtAugmentStunner(final Node currentNode, final JSIDMNShape shape) {
final View content = (View) currentNode.getContent();
final Bound ulBound = upperLeftBound(content);
final Bound lrBound = lowerRightBound(content);
final Object definition = content.getDefinition();
if (definition instanceof Decision) {
final Decision decision = (Decision) definition;
internalAugment(shape, ulBound, decision.getDimensionsSet(), lrBound, decision.getStylingSet(), (line) -> {
/*NOP*/
});
} else if (definition instanceof InputData) {
final InputData inputData = (InputData) definition;
internalAugment(shape, ulBound, inputData.getDimensionsSet(), lrBound, inputData.getStylingSet(), (line) -> {
/*NOP*/
});
} else if (definition instanceof BusinessKnowledgeModel) {
final BusinessKnowledgeModel businessKnowledgeModel = (BusinessKnowledgeModel) definition;
internalAugment(shape, ulBound, businessKnowledgeModel.getDimensionsSet(), lrBound, businessKnowledgeModel.getStylingSet(), (line) -> {
/*NOP*/
});
} else if (definition instanceof KnowledgeSource) {
final KnowledgeSource knowledgeSource = (KnowledgeSource) definition;
internalAugment(shape, ulBound, knowledgeSource.getDimensionsSet(), lrBound, knowledgeSource.getStylingSet(), (line) -> {
/*NOP*/
});
} else if (definition instanceof TextAnnotation) {
final TextAnnotation textAnnotation = (TextAnnotation) definition;
internalAugment(shape, ulBound, textAnnotation.getDimensionsSet(), lrBound, textAnnotation.getStylingSet(), (line) -> {
/*NOP*/
});
} else if (definition instanceof DecisionService) {
final DecisionService decisionService = (DecisionService) definition;
internalAugment(shape, ulBound, decisionService.getDimensionsSet(), lrBound, decisionService.getStylingSet(), (dividerLineY) -> decisionService.setDividerLineY(new DecisionServiceDividerLineY(dividerLineY - ulBound.getY())));
}
}
Aggregations