use of org.kie.workbench.common.dmn.api.property.dmn.Id in project kie-wb-common by kiegroup.
the class BusinessKnowledgeModelTest method testDifferentStylingSet.
@Test
public void testDifferentStylingSet() {
final BusinessKnowledgeModel modelOne = new BusinessKnowledgeModel(new Id("123"), new Description(), new Name(), new InformationItemPrimary(new Id("346"), new Name(), new QName()), new FunctionDefinition(new Id("789"), new Description(), new QName(), null), new StylingSet(), new GeneralRectangleDimensionsSet());
final BusinessKnowledgeModel modelTwo = new BusinessKnowledgeModel(new Id("123"), new Description(), new Name(), new InformationItemPrimary(new Id("346"), new Name(), new QName()), new FunctionDefinition(new Id("789"), new Description(), new QName(), null), new StylingSet(), new GeneralRectangleDimensionsSet());
assertEquals(modelOne, modelTwo);
modelOne.getStylingSet().setFontSize(new FontSize(10.0));
modelTwo.getStylingSet().setFontSize(new FontSize(11.0));
assertNotEquals(modelOne, modelTwo);
}
use of org.kie.workbench.common.dmn.api.property.dmn.Id in project kie-wb-common by kiegroup.
the class BindingTest method testCopy.
@Test
public void testCopy() {
final Binding source = new Binding();
final InformationItem informationItem = new InformationItem(new Id(ITEM_ID), new Description(DESCRIPTION), new Name(INFORMATION_ITEM_NAME), BuiltInType.BOOLEAN.asQName());
source.setParameter(informationItem);
final Binding target = source.copy();
assertNotNull(target);
assertNull(target.getExpression());
assertNotNull(target.getParameter());
assertNotEquals(ITEM_ID, target.getParameter().getId().getValue());
assertEquals(DESCRIPTION, target.getParameter().getDescription().getValue());
assertEquals(INFORMATION_ITEM_NAME, target.getParameter().getName().getValue());
assertEquals(BuiltInType.BOOLEAN.asQName(), target.getParameter().getTypeRef());
}
use of org.kie.workbench.common.dmn.api.property.dmn.Id in project kie-wb-common by kiegroup.
the class DMNMarshallerStandalone method internalAugment.
@SuppressWarnings("unchecked")
private void internalAugment(final Stream<DMNShape> drgShapeStream, final Id id, final Bound ulBound, final RectangleDimensionsSet dimensionsSet, final Bound lrBound, final StylingSet stylingSet, final DoubleConsumer decisionServiceDividerLineYSetter) {
final Optional<DMNShape> drgShapeOpt = drgShapeStream.filter(shape -> shape.getDmnElementRef().getLocalPart().endsWith(id.getValue())).findFirst();
if (!drgShapeOpt.isPresent()) {
return;
}
final DMNShape drgShape = drgShapeOpt.get();
if (ulBound != null) {
ulBound.setX(xOfShape(drgShape));
ulBound.setY(yOfShape(drgShape));
}
dimensionsSet.setWidth(new Width(widthOfShape(drgShape)));
dimensionsSet.setHeight(new Height(heightOfShape(drgShape)));
if (lrBound != null) {
lrBound.setX(xOfShape(drgShape) + widthOfShape(drgShape));
lrBound.setY(yOfShape(drgShape) + heightOfShape(drgShape));
}
final DMNStyle dmnStyleOfDrgShape = drgShape.getStyle() instanceof DMNStyle ? (DMNStyle) drgShape.getStyle() : null;
if (dmnStyleOfDrgShape != null) {
if (null != dmnStyleOfDrgShape.getFillColor()) {
stylingSet.setBgColour(new BgColour(ColorUtils.wbFromDMN(dmnStyleOfDrgShape.getFillColor())));
}
if (null != dmnStyleOfDrgShape.getStrokeColor()) {
stylingSet.setBorderColour(new BorderColour(ColorUtils.wbFromDMN(dmnStyleOfDrgShape.getStrokeColor())));
}
}
final StylingSet fontSet = new StylingSet();
if (dmnStyleOfDrgShape != null) {
mergeFontSet(fontSet, FontSetPropertyConverter.wbFromDMN(dmnStyleOfDrgShape));
}
if (drgShape.getDMNLabel() != null && drgShape.getDMNLabel().getSharedStyle() instanceof DMNStyle) {
mergeFontSet(fontSet, FontSetPropertyConverter.wbFromDMN((DMNStyle) drgShape.getDMNLabel().getSharedStyle()));
}
if (drgShape.getDMNLabel() != null && drgShape.getDMNLabel().getStyle() instanceof DMNStyle) {
mergeFontSet(fontSet, FontSetPropertyConverter.wbFromDMN((DMNStyle) drgShape.getDMNLabel().getStyle()));
}
mergeFontSet(stylingSet, fontSet);
if (drgShape.getDMNDecisionServiceDividerLine() != null) {
decisionServiceDividerLineYSetter.accept(drgShape.getDMNDecisionServiceDividerLine().getWaypoint().get(0).getY());
}
}
use of org.kie.workbench.common.dmn.api.property.dmn.Id in project kie-wb-common by kiegroup.
the class InputClauseLiteralExpressionTest method testCopy.
@Test
public void testCopy() {
final InputClauseLiteralExpression source = new InputClauseLiteralExpression(new Id(CLAUSE_ID), new Description(DESCRIPTION), BuiltInType.BOOLEAN.asQName(), new Text(TEXT), new ImportedValues());
final InputClauseLiteralExpression target = source.copy();
assertNotNull(target);
assertNotEquals(CLAUSE_ID, target.getId());
assertEquals(TEXT, target.getText().getValue());
assertEquals(DESCRIPTION, target.getDescription().getValue());
assertEquals(BuiltInType.BOOLEAN.asQName(), target.getTypeRef());
}
use of org.kie.workbench.common.dmn.api.property.dmn.Id in project kie-wb-common by kiegroup.
the class InvocationTest method testCopy.
@Test
public void testCopy() {
final Invocation source = new Invocation(new Id(INVOCATION_ID), new Description(DESCRIPTION), BuiltInType.BOOLEAN.asQName(), null, new ArrayList<>());
final Invocation target = source.copy();
assertNotNull(target);
assertNotEquals(INVOCATION_ID, target.getId());
assertEquals(DESCRIPTION, target.getDescription().getValue());
assertEquals(BuiltInType.BOOLEAN.asQName(), target.getTypeRef());
assertNull(target.getExpression());
assertTrue(target.getBinding().isEmpty());
}
Aggregations