Map<String, Response> responses = new HashMap<String, Response>();
if (!isWADL11) {
responses.put(null, methodConfig.addNewResponse());
}
for (RestRepresentation representation : restMethod.getRepresentations()) {
Response response;
if (isWADL11) {
List<Comparable> status = new ArrayList<Comparable>((List<Comparable>) representation.getStatus());
Collections.sort(status);
StringBuilder statusStrBuilder = new StringBuilder();
for (Object o : status) {
statusStrBuilder.append(o).append(" ");
}
String statusStr = statusStrBuilder.toString();
if (!responses.containsKey(statusStr)) {
response = methodConfig.addNewResponse();
response.setStatus(status);
responses.put(statusStr, response);
} else {
response = responses.get(statusStr);
}
} else {
response = responses.get(null);
}
Representation representationConfig = response.addNewRepresentation();
generateRepresentation(representationConfig, representation);
if (!isWADL11 && representation.getType() == RestRepresentation.Type.FAULT) {
Element resp = (Element) response.getDomNode();
Element rep = (Element) representationConfig.getDomNode();
Element fault = resp.getOwnerDocument().createElementNS(Constants.WADL11_NS, "fault");
NamedNodeMap attributes = rep.getAttributes();
for (int i = 0; i < attributes.getLength(); i++) {