コード例 #1
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;
    }
コード例 #2
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);
    }