Search in sources :

Example 1 with Parameter

use of com.sun.tools.ws.processor.model.Parameter in project metro-jax-ws by eclipse-ee4j.

the class ModelerUtils method createRpcLitParameters.

public static List<Parameter> createRpcLitParameters(Message message, Block block, S2JJAXBModel jaxbModel, ErrorReceiverFilter errReceiver) {
    RpcLitStructure rpcStruct = (RpcLitStructure) block.getType();
    List<Parameter> parameters = new ArrayList<>();
    for (MessagePart part : message.getParts()) {
        if (!ModelerUtils.isBoundToSOAPBody(part))
            continue;
        QName name = part.getDescriptor();
        TypeAndAnnotation typeAndAnn = jaxbModel.getJavaType(name);
        if (typeAndAnn == null) {
            String msgQName = "{" + message.getDefining().getTargetNamespaceURI() + "}" + message.getName();
            errReceiver.error(part.getLocator(), ModelerMessages.WSDLMODELER_RPCLIT_UNKOWNSCHEMATYPE(name.toString(), part.getName(), msgQName));
            throw new AbortException();
        }
        String type = typeAndAnn.getTypeClass().fullName();
        type = ClassNameInfo.getGenericClass(type);
        RpcLitMember param = new RpcLitMember(new QName("", part.getName()), type);
        JavaType javaType = new JavaSimpleType(new JAXBTypeAndAnnotation(typeAndAnn));
        param.setJavaType(javaType);
        rpcStruct.addRpcLitMember(param);
        Parameter parameter = ModelerUtils.createParameter(part.getName(), param, block);
        parameter.setEmbedded(true);
        parameters.add(parameter);
    }
    return parameters;
}
Also used : QName(javax.xml.namespace.QName) MessagePart(com.sun.tools.ws.wsdl.document.MessagePart) JavaSimpleType(com.sun.tools.ws.processor.model.java.JavaSimpleType) ArrayList(java.util.ArrayList) JavaType(com.sun.tools.ws.processor.model.java.JavaType) TypeAndAnnotation(com.sun.tools.xjc.api.TypeAndAnnotation) Parameter(com.sun.tools.ws.processor.model.Parameter) AbortException(com.sun.tools.ws.wscompile.AbortException)

Example 2 with Parameter

use of com.sun.tools.ws.processor.model.Parameter in project metro-jax-ws by eclipse-ee4j.

the class ModelerUtils method createUnwrappedParameter.

/**
 * @return unwrapped parameter
 */
private static Parameter createUnwrappedParameter(JAXBProperty prop, JAXBType jaxbType, Block block, JAXBStructuredType type, JavaStructureType jst) {
    QName elementName = prop.getElementName();
    JavaType javaType = new JavaSimpleType(prop.getType());
    JAXBElementMember eType = new JAXBElementMember(elementName, jaxbType);
    JavaStructureMember jsm = new JavaStructureMember(elementName.getLocalPart(), javaType, eType);
    eType.setJavaStructureMember(jsm);
    jst.add(jsm);
    eType.setProperty(prop);
    type.add(eType);
    JAXBType t = new JAXBType(elementName, javaType, jaxbType.getJaxbMapping(), jaxbType.getJaxbModel());
    t.setUnwrapped(true);
    Parameter parameter = createParameter(elementName.getLocalPart(), t, block);
    parameter.setEmbedded(true);
    return parameter;
}
Also used : JavaType(com.sun.tools.ws.processor.model.java.JavaType) QName(javax.xml.namespace.QName) JavaSimpleType(com.sun.tools.ws.processor.model.java.JavaSimpleType) Parameter(com.sun.tools.ws.processor.model.Parameter) JavaStructureMember(com.sun.tools.ws.processor.model.java.JavaStructureMember)

Example 3 with Parameter

use of com.sun.tools.ws.processor.model.Parameter in project metro-jax-ws by eclipse-ee4j.

the class ModelerUtils method createUnwrappedParameters.

/**
 * This method uses JAXBStructured type (wrapper style operations) and
 * unwraps it to create list of parameters.
 *
 * @param jaxbType instance of JAXBType, could be JAXBStructured type.
 * @param block The Block (body/Header/Attachment) to which the created Parameter belong.
 * @return list of Parameters
 */
public static List<Parameter> createUnwrappedParameters(JAXBType jaxbType, Block block) {
    List<Parameter> paramList = new ArrayList<>();
    JAXBStructuredType type = null;
    if (!(jaxbType instanceof JAXBStructuredType))
        type = createJAXBStructureType(jaxbType);
    else
        type = (JAXBStructuredType) jaxbType;
    JavaStructureType jst = new JavaStructureType(jaxbType.getJavaType().getRealName(), true, type);
    type.setJavaType(jst);
    block.setType(type);
    List memberList = jaxbType.getWrapperChildren();
    Iterator props = memberList.iterator();
    while (props.hasNext()) {
        JAXBProperty prop = (JAXBProperty) props.next();
        paramList.add(createUnwrappedParameter(prop, jaxbType, block, type, jst));
    }
    return paramList;
}
Also used : ArrayList(java.util.ArrayList) Iterator(java.util.Iterator) Parameter(com.sun.tools.ws.processor.model.Parameter) ArrayList(java.util.ArrayList) List(java.util.List) JavaStructureType(com.sun.tools.ws.processor.model.java.JavaStructureType)

Example 4 with Parameter

use of com.sun.tools.ws.processor.model.Parameter in project metro-jax-ws by eclipse-ee4j.

the class ModelerUtils method createParameter.

/**
 * Called for non-wrapper style operations. It returns a Parameter constructed
 * using the JAXBType and the Block.
 *
 * @param partName typically wsdl:part or any name to be given to the parameter
 * @param jaxbType type of Parameter
 * @param block Block to which the parameter belongs to
 * @return Parameter created.
 */
public static Parameter createParameter(String partName, AbstractType jaxbType, Block block) {
    Parameter parameter = new Parameter(partName, block.getEntity());
    parameter.setProperty(ModelProperties.PROPERTY_PARAM_MESSAGE_PART_NAME, partName);
    parameter.setEmbedded(false);
    parameter.setType(jaxbType);
    parameter.setTypeName(jaxbType.getJavaType().getType().getName());
    parameter.setBlock(block);
    return parameter;
}
Also used : Parameter(com.sun.tools.ws.processor.model.Parameter)

Example 5 with Parameter

use of com.sun.tools.ws.processor.model.Parameter in project metro-jax-ws by eclipse-ee4j.

the class JavaMethod method addParameter.

public void addParameter(JavaParameter param) {
    // verify that this member does not already exist
    if (hasParameter(param.getName())) {
        if (options.isExtensionMode()) {
            param.setName(getUniqueName(param.getName()));
        } else {
            Parameter duplicParam = getParameter(param.getName());
            if (param.getParameter().isEmbedded()) {
                errorReceiver.error(param.getParameter().getLocator(), ModelMessages.MODEL_PARAMETER_NOTUNIQUE_WRAPPER(param.getName(), param.getParameter().getEntityName()));
                errorReceiver.error(duplicParam.getLocator(), ModelMessages.MODEL_PARAMETER_NOTUNIQUE_WRAPPER(param.getName(), duplicParam.getEntityName()));
            } else {
                errorReceiver.error(param.getParameter().getLocator(), ModelMessages.MODEL_PARAMETER_NOTUNIQUE(param.getName(), param.getParameter().getEntityName()));
                errorReceiver.error(duplicParam.getLocator(), ModelMessages.MODEL_PARAMETER_NOTUNIQUE(param.getName(), duplicParam.getEntityName()));
            }
            return;
        }
    }
    parameters.add(param);
}
Also used : Parameter(com.sun.tools.ws.processor.model.Parameter)

Aggregations

Parameter (com.sun.tools.ws.processor.model.Parameter)5 JavaSimpleType (com.sun.tools.ws.processor.model.java.JavaSimpleType)2 JavaType (com.sun.tools.ws.processor.model.java.JavaType)2 ArrayList (java.util.ArrayList)2 QName (javax.xml.namespace.QName)2 JavaStructureMember (com.sun.tools.ws.processor.model.java.JavaStructureMember)1 JavaStructureType (com.sun.tools.ws.processor.model.java.JavaStructureType)1 AbortException (com.sun.tools.ws.wscompile.AbortException)1 MessagePart (com.sun.tools.ws.wsdl.document.MessagePart)1 TypeAndAnnotation (com.sun.tools.xjc.api.TypeAndAnnotation)1 Iterator (java.util.Iterator)1 List (java.util.List)1