Exemple #1
0
 private void checkCompatibility(final UpdateOp op1, final UpdateOp op2) throws QueryException {
   switch (op1.getType()) {
     case RENAME:
       if (op1.getTarget().equals(op2.getTarget())) {
         throw new QueryException(
             ErrorCode.ERR_UPDATE_DUPLICATE_RENAME_TARGET,
             "Node %s is target of more than one replace operation.",
             op2.getTarget());
       }
       break;
     case REPLACE_NODE:
       if (op1.getTarget().equals(op2.getTarget())) {
         throw new QueryException(
             ErrorCode.ERR_UPDATE_DUPLICATE_REPLACE_NODE_TARGET,
             "Node %s is target of more than one replace node operation.",
             op2.getTarget());
       }
       break;
     case REPLACE_VALUE:
       if (op1.getTarget().equals(op2.getTarget())) {
         throw new QueryException(
             ErrorCode.ERR_UPDATE_DUPLICATE_REPLACE_VALUE_TARGET,
             "Node %s is target of more than one replace value operation.",
             op2.getTarget());
       }
       break;
     case REPLACE_ELEMENT_CONTENT:
       if (op1.getTarget().equals(op2.getTarget())) {
         throw new QueryException(
             ErrorCode.ERR_UPDATE_DUPLICATE_REPLACE_VALUE_TARGET,
             "Node %s is target of more than one replace element content operation.",
             op2.getTarget());
       }
       break;
     default:
       // Do nothing.
   }
 }