Example #1
0
  @Override
  public void accept(final Visitor visitor) {
    if (hasNodeStatesMap() && !nodeStatesMap().isEmpty()) {
      for (NodeState node : nodeStates()) {
        DiffSets<Long> labelDiff = node.labelDiffSets();
        visitor.visitNodeLabelChanges(node.getId(), labelDiff.getAdded(), labelDiff.getRemoved());
      }
    }

    if (hasIndexChangesDiffSets() && !indexChanges().isEmpty()) {
      indexChanges().accept(indexVisitor(visitor, false));
    }

    if (hasConstraintIndexChangesDiffSets() && !constraintIndexChanges().isEmpty()) {
      constraintIndexChanges().accept(indexVisitor(visitor, true));
    }

    if (hasConstraintsChangesDiffSets() && !constraintsChanges().isEmpty()) {
      constraintsChanges()
          .accept(
              new DiffSets.Visitor<UniquenessConstraint>() {
                @Override
                public void visitAdded(UniquenessConstraint element) {
                  visitor.visitAddedConstraint(
                      element, createdConstraintIndexesByConstraint().get(element));
                }

                @Override
                public void visitRemoved(UniquenessConstraint element) {
                  visitor.visitRemovedConstraint(element);
                }
              });
    }
  }
Example #2
0
 @Override
 public void graphDoReplaceProperty(Property replacedProperty, SafeProperty newProperty) {
   if (!newProperty.isNoProperty()) {
     DiffSets<SafeProperty> diffSets = graphPropertyDiffSets();
     if (!replacedProperty.isNoProperty()) {
       diffSets.remove((SafeProperty) replacedProperty);
     }
     diffSets.add(newProperty);
     legacyState.graphSetProperty(newProperty.asPropertyDataJustForIntegration());
     hasChanges = true;
   }
 }
Example #3
0
 @Override
 public void nodeDoReplaceProperty(
     long nodeId, Property replacedProperty, SafeProperty newProperty) {
   if (!newProperty.isNoProperty()) {
     DiffSets<SafeProperty> diffSets = nodePropertyDiffSets(nodeId);
     if (!replacedProperty.isNoProperty()) {
       diffSets.remove((SafeProperty) replacedProperty);
     }
     diffSets.add(newProperty);
     legacyState.nodeSetProperty(nodeId, newProperty.asPropertyDataJustForIntegration());
     hasChanges = true;
   }
 }
Example #4
0
 @Override
 public UpdateTriState labelState(long nodeId, long labelId) {
   NodeState nodeState = getState(nodeStatesMap(), nodeId, null);
   if (nodeState != null) {
     DiffSets<Long> labelDiff = nodeState.labelDiffSets();
     if (labelDiff.isAdded(labelId)) {
       return UpdateTriState.ADDED;
     }
     if (labelDiff.isRemoved(labelId)) {
       return UpdateTriState.REMOVED;
     }
   }
   return UpdateTriState.UNTOUCHED;
 }
Example #5
0
 @Override
 public boolean constraintDoUnRemove(UniquenessConstraint constraint) {
   // hasChanges should already be set correctly when this is called
   if (constraintsChanges().unRemove(constraint)) {
     constraintIndexChanges.unRemove(
         new IndexDescriptor(constraint.label(), constraint.propertyKeyId()));
     return true;
   }
   return false;
 }
Example #6
0
 @Override
 public DiffSets<IndexDescriptor> constraintIndexDiffSetsByLabel(long labelId) {
   if (hasLabelStatesMap()) {
     LabelState labelState = getState(labelStatesMap(), labelId, null);
     if (labelState != null) {
       return labelState.constraintIndexChanges();
     }
   }
   return DiffSets.emptyDiffSets();
 }
Example #7
0
 @Override
 public DiffSets<IndexDescriptor> indexDiffSetsByLabel(long labelId) {
   if (hasLabelStatesMap()) {
     LabelState labelState = getState(labelStatesMap, labelId, null);
     if (null != labelState) {
       return labelState.indexChanges();
     }
   }
   return DiffSets.emptyDiffSets();
 }
Example #8
0
 @Override
 public DiffSets<Long> nodesWithLabelChanged(long labelId) {
   if (hasLabelStatesMap()) {
     LabelState state = getState(labelStatesMap, labelId, null);
     if (null != state) {
       return state.getNodeDiffSets();
     }
   }
   return DiffSets.emptyDiffSets();
 }