示例#1
0
 /**
  * Returns operation modifiers as string, separated with comma.
  *
  * @return a string containing the modifiers
  */
 private static String getModifiersAsString(Operation operation) {
   StringBuffer buffer = new StringBuffer();
   boolean needsComma = false;
   // Return parameter modifiers
   Parameter returnParameter = OperationUtil.getReturnParameter(operation);
   if (returnParameter != null) {
     // non unique parameter
     if (!returnParameter.isUnique()) {
       buffer.append("nonunique");
       needsComma = true;
     }
     // return parameter has ordered values
     if (returnParameter.isOrdered()) {
       if (needsComma) {
         buffer.append(", ");
       }
       buffer.append("ordered");
       needsComma = true;
     }
   }
   // is the operation a query ?
   if (operation.isQuery()) {
     if (needsComma) {
       buffer.append(", ");
     }
     buffer.append("query");
     needsComma = true;
   }
   // is the operation redefining another operation ?
   Iterator<Operation> it = operation.getRedefinedOperations().iterator();
   while (it.hasNext()) {
     Operation currentOperation = it.next();
     if (needsComma) {
       buffer.append(", ");
     }
     buffer.append("redefines ");
     buffer.append(currentOperation.getName());
     needsComma = true;
   }
   // has the operation a constraint ?
   Iterator<Constraint> it2 = operation.getOwnedRules().iterator();
   while (it2.hasNext()) {
     Constraint constraint = it2.next();
     if (needsComma) {
       buffer.append(", ");
     }
     if (constraint.getSpecification() != null) {
       buffer.append(constraint.getSpecification().stringValue());
     }
     needsComma = true;
   }
   return buffer.toString();
 }