JAnnotation actionAnnotation = new JAnnotation(Action.class);
if (inputMessage.getExtensionAttributes() != null) {
String inputAction = getAction(inputMessage);
if (inputAction != null) {
actionAnnotation.addElement(new JAnnotationElement("input",
inputAction));
required = true;
}
}
if (outputMessage != null && outputMessage.getExtensionAttributes() != null) {
String outputAction = getAction(outputMessage);
if (outputAction != null) {
actionAnnotation.addElement(new JAnnotationElement("output",
outputAction));
required = true;
}
}
if (operation.hasFaults()) {
List<JAnnotation> faultAnnotations = new ArrayList<JAnnotation>();
for (FaultInfo faultInfo : operation.getFaults()) {
if (faultInfo.getExtensionAttributes() != null) {
String faultAction = getAction(faultInfo);
if (faultAction == null) {
continue;
}
JavaException exceptionClass = getExceptionClass(method, faultInfo);
if (!StringUtils.isEmpty(exceptionClass.getPackageName())
&& !exceptionClass.getPackageName().equals(intf.getPackageName())) {
intf.addImport(exceptionClass.getClassName());
}
JAnnotation faultAnnotation = new JAnnotation(FaultAction.class);
faultAnnotation.addElement(new JAnnotationElement("className", exceptionClass));
faultAnnotation.addElement(new JAnnotationElement("value",
faultAction));
faultAnnotations.add(faultAnnotation);
required = true;
}
}
actionAnnotation.addElement(new JAnnotationElement("fault", faultAnnotations));
}
if (required) {
method.addAnnotation("Action", actionAnnotation);
}