Class ConflictResolutionRule
java.lang.Object
com.jalios.jcms.tools.storemerge.rule.ConflictResolutionRule
- All Implemented Interfaces:
StoreConstants
- Direct Known Subclasses:
DeleteRule,IgnoreEmptyItemRule,IgnoreOrderRule,IgnoreRule,MergeRule,NewValueRule,PreferNotEmptyRule,Store1Rule,Store2Rule,UpdateRule
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final StringFields inherited from interface com.jalios.jstore.StoreConstants
ARRAY_FLAG, CLEANING_STATE, COLLECTION_FLAG, CREATE_OP, DELETE_OP, IDLE_STATE, INNER_LOGS, INNER_MILESTONE, INNER_PREFIX, INNER_SYNC, ITEM_ESCAPE_CHAR, ITEM_SEPARATOR, LOADING_STATE, LOG_DIR_LOG_PREFIX, LOG_DIR_LOG_WORK, MAP_ASSIGN, MAP_CHARS_TO_ESCAPE, MAP_CLASS_SEPARATOR, MAP_FLAG, NAMESPACE, SH_SUFFIX, STORING_STATE, UPDATE_OP -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic ConflictResolutionRuleReturns a new rule according an action and a target.booleancanResolveAttributeConflict(String id, String className, String attName, String value1, String value2) Returns true if the conflict on the given attribute can be resolved by a rule.booleancanResolveCreateCreateConflict(String id, String className) Returns true if the Create/Create conflict on the given data can be resolved.booleancanResolveUpdateDeleteConflict(String id, String className) Returns true if the Update/Delete conflict on the given data can be resolved.protected String[]decodeArray(String value) Returns an String[] from the encoded value.Returns a Set from the encoded value.decodeList(String value) Returns a List from the encoded value.Returns the name of the action.getResolvedAttributeValue(String id, String className, String attName, String value1, String value2) Returns the resolved value for the conflict on the given attribute or null if the conflict must be ignored.protected booleanReturns true if this value is an array.protected booleanisArrayOrCollectionAttribute(String value1, String value2) Returns true if one of the 2 values is an array or a collection.protected booleanisCollection(String value) Returns true if this value is a collection.protected booleanReturns true if this value is a map.protected booleanisMapAttribute(String value1, String value2) Returns true if one of the 2 values is a map.protected voidparseTarget(String target) resolveCreateCreateConflict(List<StorableLogEntry> store1OpList, List<StorableLogEntry> store2OpList) Returns either store1OpList or store2OpList according the resolution behavior.resolveUpdateDeleteConflict(List<StorableLogEntry> store1OpList, List<StorableLogEntry> store2OpList) Returns either store1OpList or store2OpList according the resolution behavior.protected booleanselectorMatches(String id, String className, String attName) toString()
-
Field Details
-
ACTION_IGNORE
- See Also:
-
ACTION_IGNORE_ORDER
- See Also:
-
ACTION_IGNORE_EMPTY_ITEM
- See Also:
-
ACTION_PREFER_NOT_EMPTY
- See Also:
-
ACTION_MERGE
- See Also:
-
ACTION_STORE1
- See Also:
-
ACTION_STORE2
- See Also:
-
ACTION_UPDATE
- See Also:
-
ACTION_DELETE
- See Also:
-
-
Constructor Details
-
ConflictResolutionRule
-
-
Method Details
-
parseTarget
-
canResolveAttributeConflict
public boolean canResolveAttributeConflict(String id, String className, String attName, String value1, String value2) Returns true if the conflict on the given attribute can be resolved by a rule.- Parameters:
id- the data idclassName- the data classattName- the name of the attributevalue1- the value of the attribute in store1value2- 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 String getResolvedAttributeValue(String id, String className, String attName, String value1, 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 idclassName- the data classattName- the name of the attributevalue1- the value of the attribute in store1value2- 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
Returns true if the Create/Create conflict on the given data can be resolved.- Parameters:
id- the data idclassName- the data class- Returns:
- true if the Create/Create conflict on the given data can be resolved.
- Since:
- jcms-8.0.0
-
canResolveUpdateDeleteConflict
Returns true if the Update/Delete conflict on the given data can be resolved.- Parameters:
id- the data idclassName- the data class- Returns:
- true if the Update/Delete conflict on the given data can be resolved.
- Since:
- jcms-8.0.0
-
resolveUpdateDeleteConflict
public List<StorableLogEntry> resolveUpdateDeleteConflict(List<StorableLogEntry> store1OpList, List<StorableLogEntry> store2OpList) Returns either store1OpList or store2OpList according the resolution behavior.- Parameters:
store1OpList- the list of operations on the data from store 1store2OpList- 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 List<StorableLogEntry> resolveCreateCreateConflict(List<StorableLogEntry> store1OpList, List<StorableLogEntry> store2OpList) Returns either store1OpList or store2OpList according the resolution behavior.- Parameters:
store1OpList- the list of operations on the data from store 1store2OpList- 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
-
isArray
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
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
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
Returns true if one of the 2 values is an array or a collection.- Parameters:
value1- the first valuevalue2- the second value.- Returns:
- true if one of the 2 values is an array or a collection.
- Since:
- jcms-8.0.0
-
isMapAttribute
Returns true if one of the 2 values is a map.- Parameters:
value1- the first valuevalue2- the second value.- Returns:
- true if one of the 2 values is a map.
- Since:
- jcms-8.0.0
-
decodeArray
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
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
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
Returns the name of the action.- Returns:
- the name of the action.
- Since:
- jcms-8.0.0
-
buildRule
Returns a new rule according an action and a target.- Parameters:
action- the actiontarget- the target.- Returns:
- a new rule according an action and a target.
- Since:
- jcms-8.0.0
-
toString
-