コード例 #1
0
 private CDORevision applyDelta(CDORevisionDelta revisionDelta) {
   CDOID id = revisionDelta.getID();
   CDORevision changedObject = delegate.getRevision(id).copy();
   revisionDelta.apply(changedObject);
   cachedRevisions.put(id, changedObject);
   return changedObject;
 }
コード例 #2
0
    protected boolean hasFeatureConflicts(
        CDORevisionDelta localDelta, List<CDORevisionDelta> remoteDeltas) {
      Set<EStructuralFeature> features = new HashSet<EStructuralFeature>();
      for (CDOFeatureDelta localFeatureDelta : localDelta.getFeatureDeltas()) {
        features.add(localFeatureDelta.getFeature());
      }

      for (CDORevisionDelta remoteDelta : remoteDeltas) {
        for (CDOFeatureDelta remoteFeatureDelta : remoteDelta.getFeatureDeltas()) {
          EStructuralFeature feature = remoteFeatureDelta.getFeature();
          if (features.contains(feature)) {
            return true;
          }
        }
      }

      return false;
    }
コード例 #3
0
    @Override
    protected void resolveConflict(
        CDOObject conflict, CDORevisionDelta localDelta, List<CDORevisionDelta> remoteDeltas) {
      if (hasFeatureConflicts(localDelta, remoteDeltas)) {
        // TODO localDelta may be corrupt already and the transaction will not be able to restore
        // it!!!
        throw new CDOException(
            Messages.getString("AbstractObjectConflictResolver.0")); // $NON-NLS-1$
      }

      rollbackObject(conflict);

      // Add remote deltas to local delta
      for (CDORevisionDelta remoteDelta : remoteDeltas) {
        for (CDOFeatureDelta remoteFeatureDelta : remoteDelta.getFeatureDeltas()) {
          // TODO Add public API for this:
          ((InternalCDORevisionDelta) localDelta).addFeatureDelta(remoteFeatureDelta);
        }
      }

      changeObject(conflict, localDelta);
    }
コード例 #4
0
ファイル: DefaultCDOMerger.java プロジェクト: sthibaudeau/cdo
  protected Object changedInTargetAndDetachedInSource(CDORevisionDelta targetDelta) {
    switch (resolutionPreference) {
      case SOURCE_OVER_TARGET:
        return targetDelta.getID();

      case TARGET_OVER_SOURCE:
        return targetDelta; // TODO Do we need to "recreate" the target revision as NEW?

      case NONE:
        return new ChangedInTargetAndDetachedInSourceConflict(targetDelta);

      default:
        throw new IllegalStateException("Illegal resolution preference: " + resolutionPreference);
    }
  }
コード例 #5
0
ファイル: DefaultCDOMerger.java プロジェクト: sthibaudeau/cdo
 @Override
 public CDOID getID() {
   return targetDelta.getID();
 }
コード例 #6
0
ファイル: DefaultCDOMerger.java プロジェクト: sthibaudeau/cdo
 @Override
 public CDOID getID() {
   return sourceDelta.getID();
 }