code: private void validate(QPath path) throws RepositoryException, AccessDeniedException, ReferentialIntegrityException
     {
  
        List<ItemState> changes = changesLog.getAllStates();
        for (ItemState itemState : changes)
        {
  
           if (itemState.isInternallyCreated())
           {
              // skip internally created
              if (itemState.isMixinChanged())
              {
                 // ...except of check of ACL correct size for internally created
                 // items.
                 // If no permissions in the list throw exception.
                 if (itemState.isDescendantOf(path))
                 {
                    if (((NodeData)itemState.getData()).getACL().getPermissionsSize() < 1)
                    {
                       throw new RepositoryException("Node " + itemState.getData().getQPath().getAsString()
                          + " has wrong formed ACL.");
                    }
                 }
                 validateMandatoryItem(itemState);
              }
           }
           else
           {
              if (itemState.isDescendantOf(path))
              {
                 validateAccessPermissions(itemState);
                 validateMandatoryItem(itemState);
              }
  
              if (path.isDescendantOf(itemState.getAncestorToSave()))
              {
                 throw new ConstraintViolationException(path.getAsString()
                    + " is the same or descendant of either Session.move()'s destination or source node only "
                    + path.getAsString());
              }
           }
        }
     }
docs: Validate all user created changes saves like access permeations, mandatory items, value
  constraint.
  
  @param path
  @throws RepositoryException
  @throws AccessDeniedException
  @throws ReferentialIntegrityException