Class MergeRule

  • All Implemented Interfaces:
    StoreConstants

    public class MergeRule
    extends ConflictResolutionRule
    This rule resolves Update/Update conflict on array attribute by merging the values.
    Since:
    jcms-8.0.0
    • Constructor Detail

      • MergeRule

        public MergeRule​(java.lang.String target)
    • Method Detail

      • canResolveAttributeConflict

        public boolean canResolveAttributeConflict​(java.lang.String id,
                                                   java.lang.String className,
                                                   java.lang.String attName,
                                                   java.lang.String value1,
                                                   java.lang.String value2)
        Description copied from class: ConflictResolutionRule
        Returns true if the conflict on the given attribute can be resolved by a rule.
        Overrides:
        canResolveAttributeConflict in class ConflictResolutionRule
        Parameters:
        id - the data id
        className - the data class
        attName - the name of the attribute
        value1 - the value of the attribute in store1
        value2 - the value of the attribute in store1
        Returns:
        true if the conflict on the given attribute can be resolved by a rule.
      • getResolvedAttributeValue

        public java.lang.String getResolvedAttributeValue​(java.lang.String id,
                                                          java.lang.String className,
                                                          java.lang.String attName,
                                                          java.lang.String value1,
                                                          java.lang.String value2)
        Description copied from class: ConflictResolutionRule
        Returns the resolved value for the conflict on the given attribute or null if the conflict must be ignored.
        Overrides:
        getResolvedAttributeValue in class ConflictResolutionRule
        Parameters:
        id - the data id
        className - the data class
        attName - the name of the attribute
        value1 - the value of the attribute in store1
        value2 - the value of the attribute in store1
        Returns:
        the resolved value for the conflict on the given attribute or null if the conflict must be ignored.
      • mergeArray

        protected java.lang.String mergeArray​(java.lang.String value1,
                                              java.lang.String value2)
      • mergeSet

        protected java.lang.String mergeSet​(java.lang.String value1,
                                            java.lang.String value2)
      • mergeMap

        protected java.lang.String mergeMap​(java.lang.String value1,
                                            java.lang.String value2)