Search in sources :

Example 1 with UseParentIfNotEmptyMergeCue

use of org.craftercms.core.xml.mergers.impl.cues.impl.UseParentIfNotEmptyMergeCue in project core by craftercms.

the class DescriptorMergerImplTest method setUpTestMerger.

private void setUpTestMerger() {
    MergeCueResolverImpl mergeCueResolver = new MergeCueResolverImpl();
    ElementMergeMatcherImpl elementMergeMatcher = new ElementMergeMatcherImpl();
    elementMergeMatcher.setIdAttributeName(new QName(MergeParentAndChildMergeCueTest.ID_ATTR_NAME));
    UseChildMergeCue overrideParentMergeCue = new UseChildMergeCue();
    overrideParentMergeCue.setPriority(OVERRIDE_PARENT_MERGE_CUE_PRIORITY);
    UseParentMergeCue disallowOverrideMergeCue = new UseParentMergeCue();
    disallowOverrideMergeCue.setPriority(DISALLOW_OVERRIDE_MERGE_CUE_PRIORITY);
    UseParentMergeCue useParentIfAvailableMergeCue = new UseParentMergeCue();
    useParentIfAvailableMergeCue.setPriority(USE_PARENT_MERGE_CUE_PRIORITY);
    MergeParentAndChildMergeCue mergeWithParentMergeCue = new MergeParentAndChildMergeCue();
    mergeWithParentMergeCue.setPriority(MERGE_WITH_PARENT_MERGE_CUE_PRIORITY);
    mergeWithParentMergeCue.setElementMergeMatcher(elementMergeMatcher);
    mergeWithParentMergeCue.setMergeCueResolver(mergeCueResolver);
    mergeWithParentMergeCue.setMergeOrderParamName(MergeParentAndChildMergeCueTest.MERGE_ORDER_PARAM_NAME);
    mergeWithParentMergeCue.setDefaultMergeOrder(MergeParentAndChildMergeCueTest.DEFAULT_MERGE_ORDER);
    MergeParentAndChildMergeCue mergeWithChildMergeCue = new MergeParentAndChildMergeCue();
    mergeWithChildMergeCue.setPriority(MERGE_WITH_CHILD_MERGE_CUE_PRIORITY);
    mergeWithChildMergeCue.setElementMergeMatcher(elementMergeMatcher);
    mergeWithChildMergeCue.setMergeCueResolver(mergeCueResolver);
    mergeWithChildMergeCue.setMergeOrderParamName(MergeParentAndChildMergeCueTest.MERGE_ORDER_PARAM_NAME);
    mergeWithChildMergeCue.setDefaultMergeOrder(MergeParentAndChildMergeCueTest.DEFAULT_MERGE_ORDER);
    UseParentIfNotEmptyMergeCue defaultParentMergeCue = new UseParentIfNotEmptyMergeCue();
    defaultParentMergeCue.setPriority(DEFAULT_PARENT_MERGE_CUE_PRIORITY);
    UseChildIfNotEmptyMergeCue defaultChildMergeCue = new UseChildIfNotEmptyMergeCue();
    defaultParentMergeCue.setPriority(DEFAULT_CHILD_MERGE_CUE_PRIORITY);
    Map<QName, MergeCue> parentMergeCues = new HashMap<QName, MergeCue>(2);
    parentMergeCues.put(new QName(DISALLOW_OVERRIDE_MERGE_CUE_ATTR_NAME), disallowOverrideMergeCue);
    parentMergeCues.put(new QName(MERGE_WITH_CHILD_MERGE_CUE_ATTR_NAME), mergeWithChildMergeCue);
    Map<QName, MergeCue> childMergeCues = new HashMap<QName, MergeCue>(3);
    childMergeCues.put(new QName(OVERRIDE_PARENT_MERGE_CUE_ATTR_NAME), overrideParentMergeCue);
    childMergeCues.put(new QName(USE_PARENT_MERGE_CUE_ATTR_NAME), useParentIfAvailableMergeCue);
    childMergeCues.put(new QName(MERGE_WITH_PARENT_MERGE_CUE_ATTR_NAME), mergeWithParentMergeCue);
    mergeCueResolver.setParentMergeCues(parentMergeCues);
    mergeCueResolver.setChildMergeCues(childMergeCues);
    mergeCueResolver.setDefaultParentMergeCue(defaultParentMergeCue);
    mergeCueResolver.setDefaultChildMergeCue(defaultChildMergeCue);
    merger = new DescriptorMergerImpl();
    merger.setInitialMergeCue(mergeWithChildMergeCue);
}
Also used : UseParentMergeCue(org.craftercms.core.xml.mergers.impl.cues.impl.UseParentMergeCue) UseParentIfNotEmptyMergeCue(org.craftercms.core.xml.mergers.impl.cues.impl.UseParentIfNotEmptyMergeCue) HashMap(java.util.HashMap) QName(org.dom4j.QName) MergeParentAndChildMergeCue(org.craftercms.core.xml.mergers.impl.cues.impl.MergeParentAndChildMergeCue) MergeCueResolverImpl(org.craftercms.core.xml.mergers.impl.cues.impl.MergeCueResolverImpl) UseChildIfNotEmptyMergeCue(org.craftercms.core.xml.mergers.impl.cues.impl.UseChildIfNotEmptyMergeCue) MergeParentAndChildMergeCue(org.craftercms.core.xml.mergers.impl.cues.impl.MergeParentAndChildMergeCue) UseParentMergeCue(org.craftercms.core.xml.mergers.impl.cues.impl.UseParentMergeCue) MergeCue(org.craftercms.core.xml.mergers.impl.cues.MergeCue) UseParentIfNotEmptyMergeCue(org.craftercms.core.xml.mergers.impl.cues.impl.UseParentIfNotEmptyMergeCue) UseChildMergeCue(org.craftercms.core.xml.mergers.impl.cues.impl.UseChildMergeCue) UseChildMergeCue(org.craftercms.core.xml.mergers.impl.cues.impl.UseChildMergeCue) ElementMergeMatcherImpl(org.craftercms.core.xml.mergers.impl.cues.impl.ElementMergeMatcherImpl) UseChildIfNotEmptyMergeCue(org.craftercms.core.xml.mergers.impl.cues.impl.UseChildIfNotEmptyMergeCue)

Aggregations

HashMap (java.util.HashMap)1 MergeCue (org.craftercms.core.xml.mergers.impl.cues.MergeCue)1 ElementMergeMatcherImpl (org.craftercms.core.xml.mergers.impl.cues.impl.ElementMergeMatcherImpl)1 MergeCueResolverImpl (org.craftercms.core.xml.mergers.impl.cues.impl.MergeCueResolverImpl)1 MergeParentAndChildMergeCue (org.craftercms.core.xml.mergers.impl.cues.impl.MergeParentAndChildMergeCue)1 UseChildIfNotEmptyMergeCue (org.craftercms.core.xml.mergers.impl.cues.impl.UseChildIfNotEmptyMergeCue)1 UseChildMergeCue (org.craftercms.core.xml.mergers.impl.cues.impl.UseChildMergeCue)1 UseParentIfNotEmptyMergeCue (org.craftercms.core.xml.mergers.impl.cues.impl.UseParentIfNotEmptyMergeCue)1 UseParentMergeCue (org.craftercms.core.xml.mergers.impl.cues.impl.UseParentMergeCue)1 QName (org.dom4j.QName)1