Search in sources :

Example 1 with TWSDLOperation

use of com.sun.tools.ws.api.wsdl.TWSDLOperation in project metro-jax-ws by eclipse-ee4j.

the class W3CAddressingJavaGeneratorExtension method writeMethodAnnotations.

@Override
public void writeMethodAnnotations(TWSDLOperation two, JMethod jMethod) {
    JAnnotationUse actionAnn = null;
    if (!(two instanceof Operation))
        return;
    Operation o = ((Operation) two);
    // explicit input action
    if (o.getInput().getAction() != null && !o.getInput().getAction().equals("")) {
        // explicitly specified
        actionAnn = jMethod.annotate(Action.class);
        actionAnn.param("input", o.getInput().getAction());
    }
    // explicit output action
    if (o.getOutput() != null && o.getOutput().getAction() != null && !o.getOutput().getAction().equals("")) {
        // explicitly specified
        if (actionAnn == null)
            actionAnn = jMethod.annotate(Action.class);
        actionAnn.param("output", o.getOutput().getAction());
    }
    // explicit fault action
    if (o.getFaults() != null && o.getFaults().size() > 0) {
        Map<String, JClass> map = o.getFaults();
        JAnnotationArrayMember jam = null;
        for (Fault f : o.faults()) {
            if (f.getAction() == null)
                continue;
            if (f.getAction().equals(""))
                continue;
            if (actionAnn == null) {
                actionAnn = jMethod.annotate(Action.class);
            }
            if (jam == null) {
                jam = actionAnn.paramArray("fault");
            }
            final JAnnotationUse faAnn = jam.annotate(FaultAction.class);
            faAnn.param("className", map.get(f.getName()));
            faAnn.param("value", f.getAction());
        }
    }
}
Also used : Action(jakarta.xml.ws.Action) FaultAction(jakarta.xml.ws.FaultAction) JClass(com.sun.codemodel.JClass) JAnnotationUse(com.sun.codemodel.JAnnotationUse) JAnnotationArrayMember(com.sun.codemodel.JAnnotationArrayMember) Fault(com.sun.tools.ws.wsdl.document.Fault) TWSDLOperation(com.sun.tools.ws.api.wsdl.TWSDLOperation) Operation(com.sun.tools.ws.wsdl.document.Operation)

Aggregations

JAnnotationArrayMember (com.sun.codemodel.JAnnotationArrayMember)1 JAnnotationUse (com.sun.codemodel.JAnnotationUse)1 JClass (com.sun.codemodel.JClass)1 TWSDLOperation (com.sun.tools.ws.api.wsdl.TWSDLOperation)1 Fault (com.sun.tools.ws.wsdl.document.Fault)1 Operation (com.sun.tools.ws.wsdl.document.Operation)1 Action (jakarta.xml.ws.Action)1 FaultAction (jakarta.xml.ws.FaultAction)1