Class ConflictResolutionRule

    • Constructor Detail

      • ConflictResolutionRule

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

      • parseTarget

        protected void parseTarget​(java.lang.String target)
      • canResolveAttributeConflict

        public boolean canResolveAttributeConflict​(java.lang.String id,
                                                   java.lang.String className,
                                                   java.lang.String attName,
                                                   java.lang.String value1,
                                                   java.lang.String value2)
        Returns true if the conflict on the given attribute can be resolved by a rule.
        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.
        Since:
        jcms-8.0.0
      • 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)
        Returns the resolved value for the conflict on the given attribute or null if the conflict must be ignored.
        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.
        Since:
        jcms-8.0.0
      • canResolveCreateCreateConflict

        public boolean canResolveCreateCreateConflict​(java.lang.String id,
                                                      java.lang.String className)
        Returns true if the Create/Create conflict on the given data can be resolved.
        Parameters:
        id - the data id
        className - the data class
        Returns:
        true if the Create/Create conflict on the given data can be resolved.
        Since:
        jcms-8.0.0
      • canResolveUpdateDeleteConflict

        public boolean canResolveUpdateDeleteConflict​(java.lang.String id,
                                                      java.lang.String className)
        Returns true if the Update/Delete conflict on the given data can be resolved.
        Parameters:
        id - the data id
        className - the data class
        Returns:
        true if the Update/Delete conflict on the given data can be resolved.
        Since:
        jcms-8.0.0
      • resolveUpdateDeleteConflict

        public java.util.List<StorableLogEntry> resolveUpdateDeleteConflict​(java.util.List<StorableLogEntry> store1OpList,
                                                                            java.util.List<StorableLogEntry> store2OpList)
        Returns either store1OpList or store2OpList according the resolution behavior.
        Parameters:
        store1OpList - the list of operations on the data from store 1
        store2OpList - the list of operations on the data from store 1
        Returns:
        either store1OpList or store2OpList according the resolution behavior.
        Since:
        jcms-8.0.0
      • resolveCreateCreateConflict

        public java.util.List<StorableLogEntry> resolveCreateCreateConflict​(java.util.List<StorableLogEntry> store1OpList,
                                                                            java.util.List<StorableLogEntry> store2OpList)
        Returns either store1OpList or store2OpList according the resolution behavior.
        Parameters:
        store1OpList - the list of operations on the data from store 1
        store2OpList - the list of operations on the data from store 1
        Returns:
        either store1OpList or store2OpList according the resolution behavior.
        Since:
        jcms-8.0.1
      • selectorMatches

        protected boolean selectorMatches​(java.lang.String id,
                                          java.lang.String className,
                                          java.lang.String attName)
      • isArray

        protected boolean isArray​(java.lang.String value)
        Returns true if this value is an array.
        Parameters:
        value - the encoded value.
        Returns:
        true if this value is an array.
        Since:
        jcms-8.0.0
      • isCollection

        protected boolean isCollection​(java.lang.String value)
        Returns true if this value is a collection.
        Parameters:
        value - the encoded value.
        Returns:
        true if this value is a collection.
        Since:
        jcms-8.0.0
      • isMap

        protected boolean isMap​(java.lang.String value)
        Returns true if this value is a map.
        Parameters:
        value - the encoded value.
        Returns:
        true if this value is a map.
        Since:
        jcms-8.0.0
      • isArrayOrCollectionAttribute

        protected boolean isArrayOrCollectionAttribute​(java.lang.String value1,
                                                       java.lang.String value2)
        Returns true if one of the 2 values is an array or a collection.
        Parameters:
        value1 - the first value
        value2 - the second value.
        Returns:
        true if one of the 2 values is an array or a collection.
        Since:
        jcms-8.0.0
      • isMapAttribute

        protected boolean isMapAttribute​(java.lang.String value1,
                                         java.lang.String value2)
        Returns true if one of the 2 values is a map.
        Parameters:
        value1 - the first value
        value2 - the second value.
        Returns:
        true if one of the 2 values is a map.
        Since:
        jcms-8.0.0
      • decodeArray

        protected java.lang.String[] decodeArray​(java.lang.String value)
        Returns an String[] from the encoded value.
        Parameters:
        value - the encoded value
        Returns:
        an String[] from the encoded value.
        Since:
        jcms-8.0.0
      • decodeCollectionOrMapItemSet

        protected java.util.Set<java.lang.String> decodeCollectionOrMapItemSet​(java.lang.String value)
        Returns a Set from the encoded value.
        Parameters:
        value - the encoded value
        Returns:
        a Set from the encoded value.
        Since:
        jcms-8.0.0
      • decodeList

        protected java.util.List<java.lang.String> decodeList​(java.lang.String value)
        Returns a List from the encoded value.
        Parameters:
        value - the encoded value
        Returns:
        a List from the encoded value.
        Since:
        jcms-8.0.0
      • getAction

        public java.lang.String getAction()
        Returns the name of the action.
        Returns:
        the name of the action.
        Since:
        jcms-8.0.0
      • buildRule

        public static ConflictResolutionRule buildRule​(java.lang.String action,
                                                       java.lang.String target)
        Returns a new rule according an action and a target.
        Parameters:
        action - the action
        target - the target.
        Returns:
        a new rule according an action and a target.
        Since:
        jcms-8.0.0
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object