JAnnotation actionAnnotation = new JAnnotation(Action.class);
if (inputMessage.getExtensionAttributes() != null) {
QName inputAction = (QName)inputMessage.getExtensionAttribute(WSAW_ACTION_QNAME);
if (inputAction != null) {
actionAnnotation.addElement(new JAnnotationElement("input",
inputAction.getLocalPart()));
required = true;
}
}
if (outputMessage != null && outputMessage.getExtensionAttributes() != null) {
QName outputAction = (QName)outputMessage.getExtensionAttribute(WSAW_ACTION_QNAME);
if (outputAction != null) {
actionAnnotation.addElement(new JAnnotationElement("output",
outputAction.getLocalPart()));
required = true;
}
}
if (operation.hasFaults()) {
List<JAnnotation> faultAnnotations = new ArrayList<JAnnotation>();
for (FaultInfo faultInfo : operation.getFaults()) {
if (faultInfo.getExtensionAttributes() != null) {
QName faultAction = (QName)faultInfo.getExtensionAttribute(WSAW_ACTION_QNAME);
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.getLocalPart()));
faultAnnotations.add(faultAnnotation);
required = true;
}
}
actionAnnotation.addElement(new JAnnotationElement("fault", faultAnnotations));
}
if (required) {
method.addAnnotation("Action", actionAnnotation);
}