Class CMSModelCloningContext
- java.lang.Object
-
- de.hybris.platform.cms2.cloning.service.impl.CMSModelCloningContext
-
- All Implemented Interfaces:
ModelCloningContext
public class CMSModelCloningContext extends java.lang.Object implements ModelCloningContext
Defines theModelCloningContextto use for deep cloning components that are supported by SmartEdit. The cloning context specifies if a given attribute should be treated aspartOf, should be skipped or should use a preset value.
-
-
Constructor Summary
Constructors Constructor Description CMSModelCloningContext()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddPresetValuePredicate(java.util.function.BiPredicate<ItemModel,java.lang.String> predicate)java.lang.ObjectgetPresetValue(java.lang.Object component, java.lang.String qualifier)Only valid ifModelCloningContext.usePresetValue(Object, String)returnstruefor the specified attribute.protected java.util.List<java.util.function.BiPredicate<ItemModel,java.lang.String>>getPresetValuePredicates()protected java.util.List<java.util.function.BiPredicate<ItemModel,java.lang.String>>getTreatAsPartOfPredicates()voidsetPresetValuePredicates(java.util.List<java.util.function.BiPredicate<ItemModel,java.lang.String>> presetValuePredicates)voidsetTreatAsPartOfPredicates(java.util.List<java.util.function.BiPredicate<ItemModel,java.lang.String>> treatAsPartOfPredicates)booleanskipAttribute(java.lang.Object component, java.lang.String qualifier)Iftruethat particular attribute will not be included in the cloning process.booleantreatAsPartOf(java.lang.Object component, java.lang.String qualifier)Iftruethat particular attribute is treated as partOf which results in deep-cloning each attribute value too before assigning them as value to the cloned model.booleanusePresetValue(java.lang.Object component, java.lang.String qualifier)Iftruefor the given attribute the cloning process will not use the original model attribute values but the one returned byModelCloningContext.getPresetValue(Object, String).
-
-
-
Method Detail
-
treatAsPartOf
public boolean treatAsPartOf(java.lang.Object component, java.lang.String qualifier)Description copied from interface:ModelCloningContextIftruethat particular attribute is treated as partOf which results in deep-cloning each attribute value too before assigning them as value to the cloned model.This applies to model reference attributes only!
- Specified by:
treatAsPartOfin interfaceModelCloningContext
-
skipAttribute
public boolean skipAttribute(java.lang.Object component, java.lang.String qualifier)Description copied from interface:ModelCloningContextIftruethat particular attribute will not be included in the cloning process. As a result the cloned model will not have any value for that attribute.- Specified by:
skipAttributein interfaceModelCloningContext
-
usePresetValue
public boolean usePresetValue(java.lang.Object component, java.lang.String qualifier)Description copied from interface:ModelCloningContextIftruefor the given attribute the cloning process will not use the original model attribute values but the one returned byModelCloningContext.getPresetValue(Object, String).- Specified by:
usePresetValuein interfaceModelCloningContext- See Also:
ModelCloningContext.getPresetValue(Object, String)
-
getPresetValue
public java.lang.Object getPresetValue(java.lang.Object component, java.lang.String qualifier)Description copied from interface:ModelCloningContextOnly valid ifModelCloningContext.usePresetValue(Object, String)returnstruefor the specified attribute.Returns the value to be used as attribute value of the new cloned model.
- Specified by:
getPresetValuein interfaceModelCloningContext
-
addPresetValuePredicate
public void addPresetValuePredicate(java.util.function.BiPredicate<ItemModel,java.lang.String> predicate)
-
getTreatAsPartOfPredicates
protected java.util.List<java.util.function.BiPredicate<ItemModel,java.lang.String>> getTreatAsPartOfPredicates()
-
setTreatAsPartOfPredicates
public void setTreatAsPartOfPredicates(java.util.List<java.util.function.BiPredicate<ItemModel,java.lang.String>> treatAsPartOfPredicates)
-
getPresetValuePredicates
protected java.util.List<java.util.function.BiPredicate<ItemModel,java.lang.String>> getPresetValuePredicates()
-
setPresetValuePredicates
public void setPresetValuePredicates(java.util.List<java.util.function.BiPredicate<ItemModel,java.lang.String>> presetValuePredicates)
-
-