use of com.enonic.xp.node.NodeState in project xp by enonic.
the class CompareStatusResolver method resolve.
public CompareStatus resolve() {
if (source == null && target == null) {
throw new IllegalArgumentException("Both source and target versions null");
}
if (source == null) {
return CompareStatus.NEW_TARGET;
} else if (target == null) {
return CompareStatus.NEW;
}
if (source.equals(target)) {
return CompareStatus.EQUAL;
}
final NodeState sourceState = source.getNodeState();
final NodeState targetState = target.getNodeState();
if (sourceState.equals(NodeState.PENDING_DELETE) && !targetState.equals(NodeState.PENDING_DELETE)) {
return CompareStatus.PENDING_DELETE;
} else if (!sourceState.equals(NodeState.PENDING_DELETE) && targetState.equals(NodeState.PENDING_DELETE)) {
return CompareStatus.PENDING_DELETE_TARGET;
}
if (!source.getNodePath().equals(target.getNodePath())) {
return CompareStatus.MOVED;
}
return resolveFromVersion();
}
Aggregations