Skip to content

Commit

Permalink
add support for ERXKeys for hasKeyChangedFromCommittedSnapshot…
Browse files Browse the repository at this point in the history
  • Loading branch information
darkv committed May 5, 2017
1 parent 21273df commit a0cce2e
Showing 1 changed file with 47 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -864,6 +864,16 @@ public boolean hasKeyChangedFromCommittedSnapshot(String key) {
return d.containsKey(key);
}

/**
* Returns whether or not the given key has changed when compared to the committed snapshot.
*
* @param key The key that you wish to check has changed from the committed snapshot
* @return true if it has changed
*/
public <T> boolean hasKeyChangedFromCommittedSnapshot(ERXKey<T> key) {
return hasKeyChangedFromCommittedSnapshot(key.key());
}

/**
* Returns whether or not the given key has changed from the given committed value.
Expand All @@ -877,6 +887,18 @@ public boolean hasKeyChangedFromCommittedSnapshotFromValue(String key, Object ol
return d.containsKey(key) && Objects.equals(oldValue, committedSnapshotValueForKey(key));
}

/**
* Returns whether or not the given key has changed from the given committed value.
* @param key The key that you wish to check has changed from the committed snapshot
* @param oldValue The value you wish to see if the key has changed from EG. Has 'status' changed from
* STATUS.PENDING_STATUS
* @return true if the specified key value has changed from the specified value
*/
public <T> boolean hasKeyChangedFromCommittedSnapshotFromValue(ERXKey<T> key, T oldValue) {
return hasKeyChangedFromCommittedSnapshotFromValue(key.key(), oldValue);
}

/**
* Returns whether or not the given key has changed from the given previous value to the new value since the committed value.
*
Expand All @@ -891,6 +913,19 @@ public boolean hasKeyChangedFromCommittedSnapshotFromValueToNewValue(String key,
return d.containsKey(key) && Objects.equals(newValue, d.objectForKey(key)) && Objects.equals(oldValue, committedSnapshotValueForKey(key));
}

/**
* Returns whether or not the given key has changed from the given previous value to the new value since the committed value.
*
* @param key The key that you wish to check has changed from the committed snapshot
* @param oldValue The value you wish to see if the key has changed from
* @param newValue The value you wish to see if the key has changed to EG. Has 'status' changed from
* STATUS.PENDING_STATUS to STATUS.CONFIRMED_STATUS
* @return true if the specified key value has changed from the specified value
*/
public <T> boolean hasKeyChangedFromCommittedSnapshotFromValueToNewValue(ERXKey<T> key, T oldValue, T newValue) {
return hasKeyChangedFromCommittedSnapshotFromValueToNewValue(key.key(), oldValue, newValue);
}

/**
* Returns whether or not the given key has changed to the new value since the committed value.
*
Expand All @@ -904,6 +939,18 @@ public boolean hasKeyChangedFromCommittedSnapshotToValue(String key, Object newV
return d.containsKey(key) && Objects.equals(newValue, d.objectForKey(key));
}

/**
* Returns whether or not the given key has changed to the new value since the committed value.
*
* @param key The key that you wish to check has changed from the committed snapshot
* @param newValue The value you wish to see if the key has changed to EG. Has 'status' changed to
* STATUS.CANCELLED_STATUS
* @return true if the specified key value has changed to the specified value
*/
public <T> boolean hasKeyChangedFromCommittedSnapshotToValue(ERXKey<T> key, T newValue) {
return hasKeyChangedFromCommittedSnapshotToValue(key.key(), newValue);
}

public boolean parentObjectStoreIsObjectStoreCoordinator() {
return editingContext().parentObjectStore() instanceof EOObjectStoreCoordinator;
}
Expand Down

0 comments on commit a0cce2e

Please sign in to comment.