@Test public void testCloneWhenSourceIsDecision() { final Decision source = buildDecision(); setLinks(source, FIRST_URL, SECOND_URL); final Decision cloned = dmnDeepCloneProcess.clone(source, new Decision()); assertThat(cloned).isNotNull(); assertThat(cloned.getId().getValue()).isNotEqualTo(SOURCE_ID); assertThat(cloned.getName().getValue()).isEqualTo(DECISION_SOURCE_NAME + FIRST_INDEX_IN_SUFFIX); assertThat(cloned.getLinksHolder().getValue().getLinks()) .hasSize(2) .extracting(DMNExternalLink::getUrl).contains(FIRST_URL, SECOND_URL); assertThat(cloned.getVariable().getTypeRef()).isEqualTo(BuiltInType.BOOLEAN.asQName()); assertThat(cloned.getQuestion().getValue()).isEqualTo(QUESTION); assertThat(cloned.getAllowedAnswers().getValue()).isEqualTo(ANSWER); assertThat(cloned.getExpression()).isNotNull(); assertThat(cloned.getExpression()).isInstanceOf(FunctionDefinition.class); assertThat(cloned.getExpression().getId().getValue()).isNotEqualTo(FUNCTION_ID); assertThat(cloned.getExpression().getTypeRef()).isEqualTo(BuiltInType.BOOLEAN.asQName()); assertThat(((FunctionDefinition) cloned.getExpression()).getExpression()).isInstanceOf(Context.class); assertThat(((FunctionDefinition) cloned.getExpression()).getExpression().getId()).isNotEqualTo(CONTEXT_ID); assertThat(((FunctionDefinition) cloned.getExpression()).getExpression().getTypeRef()).isEqualTo(BuiltInType.NUMBER.asQName()); }
@Override public <S, T> T clone(final S source, final T target) { super.clone(source, target); if (source instanceof DRGElement) { cloneDRGElementBasicInfo((DRGElement) source, (DRGElement) target); } if (source instanceof HasText) { cloneTextElementBasicInfo((HasText) source, (HasText) target); } if (source instanceof HasVariable) { final IsInformationItem sourceVariable = ((HasVariable) source).getVariable(); final IsInformationItem targetVariable = ((HasVariable) target).getVariable(); cloneTypeRefInfo(sourceVariable, targetVariable); } if (source instanceof Decision) { cloneDecision((Decision) source, (Decision) target); } if (source instanceof BusinessKnowledgeModel) { cloneBusinessKnowledgeModel((BusinessKnowledgeModel) source, (BusinessKnowledgeModel) target); } return target; }
DMNDeepCloneProcess extends DeepCloneProcess implements IDeepCloneProcess { @Override public <S, T> T clone(final S source, final T target) { super.clone(source, target); if (source instanceof DRGElement) { cloneDRGElementBasicInfo((DRGElement) source, (DRGElement) target); } if (source instanceof HasText) { cloneTextElementBasicInfo((HasText) source, (HasText) target); } if (source instanceof HasVariable) { final IsInformationItem sourceVariable = ((HasVariable) source).getVariable(); final IsInformationItem targetVariable = ((HasVariable) target).getVariable(); cloneTypeRefInfo(sourceVariable, targetVariable); } if (source instanceof Decision) { cloneDecision((Decision) source, (Decision) target); } if (source instanceof BusinessKnowledgeModel) { cloneBusinessKnowledgeModel((BusinessKnowledgeModel) source, (BusinessKnowledgeModel) target); } return target; } }
DMNDeepCloneProcess extends DeepCloneProcess implements IDeepCloneProcess { @Override public <S, T> T clone(final S source, final T target) { super.clone(source, target); if (source instanceof DRGElement) { cloneDRGElementBasicInfo((DRGElement) source, (DRGElement) target); } if (source instanceof HasText) { cloneTextElementBasicInfo((HasText) source, (HasText) target); } if (source instanceof HasVariable) { final IsInformationItem sourceVariable = ((HasVariable) source).getVariable(); final IsInformationItem targetVariable = ((HasVariable) target).getVariable(); cloneTypeRefInfo(sourceVariable, targetVariable); } if (source instanceof Decision) { cloneDecision((Decision) source, (Decision) target); } if (source instanceof BusinessKnowledgeModel) { cloneBusinessKnowledgeModel((BusinessKnowledgeModel) source, (BusinessKnowledgeModel) target); } return target; } protected  DMNDeepCloneProcess(); @Inject  DMNDeepCloneProcess(final FactoryManager factoryManager,
                               final AdapterManager adapterManager,
                               final ClassUtils classUtils,
                               final SessionManager sessionManager); }
DMNDeepCloneProcess extends DeepCloneProcess implements IDeepCloneProcess { @Override public <S, T> T clone(final S source, final T target) { super.clone(source, target); if (source instanceof DRGElement) { cloneDRGElementBasicInfo((DRGElement) source, (DRGElement) target); } if (source instanceof HasText) { cloneTextElementBasicInfo((HasText) source, (HasText) target); } if (source instanceof HasVariable) { final IsInformationItem sourceVariable = ((HasVariable) source).getVariable(); final IsInformationItem targetVariable = ((HasVariable) target).getVariable(); cloneTypeRefInfo(sourceVariable, targetVariable); } if (source instanceof Decision) { cloneDecision((Decision) source, (Decision) target); } if (source instanceof BusinessKnowledgeModel) { cloneBusinessKnowledgeModel((BusinessKnowledgeModel) source, (BusinessKnowledgeModel) target); } return target; } protected  DMNDeepCloneProcess(); @Inject  DMNDeepCloneProcess(final FactoryManager factoryManager,
                               final AdapterManager adapterManager,
                               final ClassUtils classUtils,
                               final SessionManager sessionManager); @Override T clone(final S source,
                          final T target); }
DMNDeepCloneProcess extends DeepCloneProcess implements IDeepCloneProcess { @Override public <S, T> T clone(final S source, final T target) { super.clone(source, target); if (source instanceof DRGElement) { cloneDRGElementBasicInfo((DRGElement) source, (DRGElement) target); } if (source instanceof HasText) { cloneTextElementBasicInfo((HasText) source, (HasText) target); } if (source instanceof HasVariable) { final IsInformationItem sourceVariable = ((HasVariable) source).getVariable(); final IsInformationItem targetVariable = ((HasVariable) target).getVariable(); cloneTypeRefInfo(sourceVariable, targetVariable); } if (source instanceof Decision) { cloneDecision((Decision) source, (Decision) target); } if (source instanceof BusinessKnowledgeModel) { cloneBusinessKnowledgeModel((BusinessKnowledgeModel) source, (BusinessKnowledgeModel) target); } return target; } protected  DMNDeepCloneProcess(); @Inject  DMNDeepCloneProcess(final FactoryManager factoryManager,
                               final AdapterManager adapterManager,
                               final ClassUtils classUtils,
                               final SessionManager sessionManager); @Override T clone(final S source,
                          final T target);  }