private Map<CDOID, CDOIDAndVersion> cacheRevisions() { Map<CDOID, CDOIDAndVersion> cache = new HashMap<CDOID, CDOIDAndVersion>(); for (CDOIDAndVersion key : changeSetData.getNewObjects()) { if (revisionCallback == null && !(key instanceof CDORevision)) { throw new IllegalStateException("No callback installed to lazily obtain revision " + key); } cache.put(key.getID(), key); } for (CDORevisionKey key : changeSetData.getChangedObjects()) { if (revisionDeltaCallback == null && !(key instanceof CDORevisionDelta)) { throw new IllegalStateException( "No callback installed to lazily obtain revision delta " + key); } cache.put(key.getID(), key); } for (CDOIDAndVersion key : changeSetData.getDetachedObjects()) { cache.put(key.getID(), DETACHED); } return cache; }
private Map<CDOID, Object> createMap(CDOChangeSetData changeSetData) { Map<CDOID, Object> map = CDOIDUtil.createMap(); for (CDOIDAndVersion data : changeSetData.getNewObjects()) { map.put(data.getID(), data); } for (CDORevisionKey data : changeSetData.getChangedObjects()) { map.put(data.getID(), data); } for (CDOIDAndVersion data : changeSetData.getDetachedObjects()) { map.put(data.getID(), data.getID()); } return map; }
private boolean takeNoPair(Object data) { if (data instanceof CDORevision) { result.getNewObjects().add((CDORevision) data); } else if (data instanceof CDORevisionDelta) { result.getChangedObjects().add((CDORevisionDelta) data); } else if (data instanceof CDOID) { result .getDetachedObjects() .add(CDOIDUtil.createIDAndVersion((CDOID) data, CDOBranchVersion.UNSPECIFIED_VERSION)); } else if (data instanceof Conflict) { Conflict conflict = (Conflict) data; conflicts.put(conflict.getID(), conflict); } else if (data != null) { throw new IllegalArgumentException( "Must be a CDORevision, a CDORevisionDelta, a CDOID, a Conflict or null: " + data); } else { return false; } return true; }