public abstract class ConflictResolutionRule extends java.lang.Object implements StoreConstants
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
ACTION_DELETE |
static java.lang.String |
ACTION_IGNORE |
static java.lang.String |
ACTION_IGNORE_EMPTY_ITEM |
static java.lang.String |
ACTION_IGNORE_ORDER |
static java.lang.String |
ACTION_MERGE |
static java.lang.String |
ACTION_PREFER_NOT_EMPTY |
static java.lang.String |
ACTION_STORE1 |
static java.lang.String |
ACTION_STORE2 |
static java.lang.String |
ACTION_UPDATE |
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, MAP_ASSIGN, MAP_CHARS_TO_ESCAPE, MAP_CLASS_SEPARATOR, MAP_FLAG, NAMESPACE, REVISION, SH_SUFFIX, STORING_STATE, UPDATE_OP
Constructor and Description |
---|
ConflictResolutionRule(java.lang.String target) |
Modifier and Type | Method and Description |
---|---|
static ConflictResolutionRule |
buildRule(java.lang.String action,
java.lang.String target)
Returns a new rule according an action and a target.
|
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.
|
boolean |
canResolveCreateCreateConflict(java.lang.String id,
java.lang.String className)
Returns true if the Create/Create conflict on the given data can be resolved.
|
boolean |
canResolveUpdateDeleteConflict(java.lang.String id,
java.lang.String className)
Returns true if the Update/Delete conflict on the given data can be resolved.
|
protected java.lang.String[] |
decodeArray(java.lang.String value)
Returns an String[] from the encoded value.
|
protected java.util.Set<java.lang.String> |
decodeCollectionOrMapItemSet(java.lang.String value)
Returns a Set from the encoded value.
|
protected java.util.List<java.lang.String> |
decodeList(java.lang.String value)
Returns a List from the encoded value.
|
java.lang.String |
getAction()
Returns the name of the action.
|
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.
|
protected boolean |
isArray(java.lang.String value)
Returns true if this value is an array.
|
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.
|
protected boolean |
isCollection(java.lang.String value)
Returns true if this value is a collection.
|
protected boolean |
isMap(java.lang.String value)
Returns true if this value is a map.
|
protected boolean |
isMapAttribute(java.lang.String value1,
java.lang.String value2)
Returns true if one of the 2 values is a map.
|
protected void |
parseTarget(java.lang.String target) |
java.util.List<StorableLogEntry> |
resolveCreateCreateConflict(java.util.List<StorableLogEntry> store1OpList,
java.util.List<StorableLogEntry> store2OpList)
Returns either store1OpList or store2OpList according the resolution behavior.
|
java.util.List<StorableLogEntry> |
resolveUpdateDeleteConflict(java.util.List<StorableLogEntry> store1OpList,
java.util.List<StorableLogEntry> store2OpList)
Returns either store1OpList or store2OpList according the resolution behavior.
|
protected boolean |
selectorMatches(java.lang.String id,
java.lang.String className,
java.lang.String attName) |
java.lang.String |
toString() |
public static final java.lang.String ACTION_IGNORE
public static final java.lang.String ACTION_IGNORE_ORDER
public static final java.lang.String ACTION_IGNORE_EMPTY_ITEM
public static final java.lang.String ACTION_PREFER_NOT_EMPTY
public static final java.lang.String ACTION_MERGE
public static final java.lang.String ACTION_STORE1
public static final java.lang.String ACTION_STORE2
public static final java.lang.String ACTION_UPDATE
public static final java.lang.String ACTION_DELETE
protected void parseTarget(java.lang.String target)
public boolean canResolveAttributeConflict(java.lang.String id, java.lang.String className, java.lang.String attName, java.lang.String value1, java.lang.String value2)
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 store1public java.lang.String getResolvedAttributeValue(java.lang.String id, java.lang.String className, java.lang.String attName, java.lang.String value1, java.lang.String value2)
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 store1public boolean canResolveCreateCreateConflict(java.lang.String id, java.lang.String className)
id
- the data idclassName
- the data classpublic boolean canResolveUpdateDeleteConflict(java.lang.String id, java.lang.String className)
id
- the data idclassName
- the data classpublic java.util.List<StorableLogEntry> resolveUpdateDeleteConflict(java.util.List<StorableLogEntry> store1OpList, java.util.List<StorableLogEntry> store2OpList)
store1OpList
- the list of operations on the data from store 1store2OpList
- the list of operations on the data from store 1public java.util.List<StorableLogEntry> resolveCreateCreateConflict(java.util.List<StorableLogEntry> store1OpList, java.util.List<StorableLogEntry> store2OpList)
store1OpList
- the list of operations on the data from store 1store2OpList
- the list of operations on the data from store 1protected boolean selectorMatches(java.lang.String id, java.lang.String className, java.lang.String attName)
protected boolean isArray(java.lang.String value)
value
- the encoded value.protected boolean isCollection(java.lang.String value)
value
- the encoded value.protected boolean isMap(java.lang.String value)
value
- the encoded value.protected boolean isArrayOrCollectionAttribute(java.lang.String value1, java.lang.String value2)
value1
- the first valuevalue2
- the second value.protected boolean isMapAttribute(java.lang.String value1, java.lang.String value2)
value1
- the first valuevalue2
- the second value.protected java.lang.String[] decodeArray(java.lang.String value)
value
- the encoded valueprotected java.util.Set<java.lang.String> decodeCollectionOrMapItemSet(java.lang.String value)
value
- the encoded valueprotected java.util.List<java.lang.String> decodeList(java.lang.String value)
value
- the encoded valuepublic java.lang.String getAction()
public static ConflictResolutionRule buildRule(java.lang.String action, java.lang.String target)
action
- the actiontarget
- the target.public java.lang.String toString()
toString
in class java.lang.Object
Copyright © 2001-2010 Jalios SA. All Rights Reserved.