@Test public void testCloneWhenSourceIsKnowledgeSource() { final KnowledgeSource source = buildKnowledgeSource(); setLinks(source, FIRST_URL, SECOND_URL); final KnowledgeSource cloned = dmnDeepCloneProcess.clone(source, new KnowledgeSource()); assertThat(cloned).isNotNull(); assertThat(cloned.getId().getValue()).isNotEqualTo(SOURCE_ID); assertThat(cloned.getName().getValue()).isEqualTo(KNOWLEDGE_SOURCE_NAME + FIRST_INDEX_IN_SUFFIX); assertThat(cloned.getLinksHolder().getValue().getLinks()) .hasSize(2) .extracting(DMNExternalLink::getUrl).contains(FIRST_URL, SECOND_URL); }
@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);  }