Package org.apache.axis.wsdl.symbolTable

Examples of org.apache.axis.wsdl.symbolTable.ElementDecl


     */
    protected TypeEntry getElementDecl(String elementName)
    {
        if (elements != null) {
            for (int i = 0; i < elements.size(); i++) {
                ElementDecl elem = (ElementDecl) elements.get(i);
                String variableName;

                if (elem.getAnyElement()) {
                    variableName = Constants.ANYCONTENT;
                } else {
                    variableName = elem.getName();
                }

                if (variableName.equals(elementName))
        return elem.getType();
      }
  }
  return null;
    }
View Full Code Here


            String comments = "";
            if (elements != null)
            {
                if (elements != null && i < (elements.size()*2))
                {
                    ElementDecl elem = (ElementDecl)elements.get(i/2);
                    comments = elem.getDocumentation();
                }
            }
           
            String typeName = (String) names.get(i);
            String variable = (String) names.get(i + 1);
View Full Code Here

            // Process the elements
            Vector elements = te.getContainedElements();

            if (elements != null) {
                for (int j = 0; j < elements.size(); j++) {
                    ElementDecl elem = (ElementDecl) elements.get(j);
                    paramTypes.add(elem.getType().getName());
                    paramNames.add(JavaUtils.getUniqueValue(
                            helper.reservedPropNames, elem.getName()));
                }
            }
        }

        // Set the index where the local params start
View Full Code Here

            String documentation = "";
            if (elements != null)
            {
                if (elements != null && i < (elements.size()*2))
                {
                    ElementDecl elem = (ElementDecl)elements.get(i/2);
                    documentation = elem.getDocumentation();
                }
            }
           
            String get = "get";

            if (typeName.equals("boolean")) {
                get = "is";
            }

            String comment = getJavadocDescriptionPart(documentation, false);
            if (comment.length() > 3) {
                // remove the " *" at the front of the first line
                comment = comment.substring(2);
            }
            if (enableGetters) {
                try {
                    pw.println();
                    pw.println("    /**");
                    pw.println("     * Gets the " + name + " value for this " + getClassName() + ".");
                    pw.println("     * ");
                    pw.println("     * @return " + name + comment);
                    pw.println("     */");
                } catch (DOMException e) {
                    // no comment
                }                   
                pw.println("    public " + typeName + " " + get + capName
                        + "() {");

                if (isUnion()) {
                    writeSimpleTypeGetter(typeName, name, "return");
                } else {
                    pw.println("        return " + name + ";");
                }

                pw.println("    }");
                pw.println();
            }

            if (enableSetters) {
                try
                {
                    String nm = (isUnion()) ? "_value" : name;
                    pw.println();
                    pw.println("    /**");
                    pw.println("     * Sets the " + nm + " value for this " + getClassName() + ".");
                    pw.println("     * ");
                    pw.println("     * @param " + nm + comment);
                    pw.println("     */");
                }
                catch (DOMException e)
                {
                    // no comment
                }                   
                if (isUnion()) {
                    pw.println("    public void set" + capName + "(" + typeName
                            + " _value) {");
                    writeSimpleTypeSetter(typeName);
                } else {
                    pw.println("    public void set" + capName + "(" + typeName
                            + " " + name + ") {");
                    pw.println("        this." + name + " = " + name + ";");
                }

                pw.println("    }");
                pw.println();
            }

            // If this is a special collection type, insert extra
            // java code so that the serializer/deserializer can recognize
            // the class.  This is not JAX-RPC, and will be replaced with
            // compliant code when JAX-RPC determines how to deal with this case.
            // These signatures comply with Bean Indexed Properties which seems
            // like the reasonable approach to take for collection types.
            // (It may be more efficient to handle this with an ArrayList...but
            // for the initial support it was easier to use an actual array.)
            if ((elements != null) && (j < elements.size())) {
                ElementDecl elem = (ElementDecl) elements.get(j);

                if (elem.getType().getQName().getLocalPart().indexOf("[") > 0) {
                    String compName =
                            typeName.substring(0, typeName.lastIndexOf("["));

                    if (enableGetters) {
                        pw.println("    public " + compName + " " + get
View Full Code Here

    protected void writeMetaData(PrintWriter pw) throws IOException {

        // Collect elementMetaData
        if (elements != null) {
            for (int i = 0; i < elements.size(); i++) {
                ElementDecl elem = (ElementDecl) elements.get(i);

                // String elemName = elem.getName().getLocalPart();
                // String javaName = Utils.xmlNameToJava(elemName);
                // Changed the code to write meta data
                // for all of the elements in order to
                // support sequences. Defect 9060
                // Meta data is needed if the default serializer
                // action cannot map the javaName back to the
                // element's qname.  This occurs if:
                // - the javaName and element name local part are different.
                // - the javaName starts with uppercase char (this is a wierd
                // case and we have several problems with the mapping rules.
                // Seems best to gen meta data in this case.)
                // - the element name is qualified (has a namespace uri)
                // its also needed if:
                // - the element has the minoccurs flag set
                // if (!javaName.equals(elemName) ||
                // Character.isUpperCase(javaName.charAt(0)) ||
                // !elem.getName().getNamespaceURI().equals("") ||
                // elem.getMinOccursIs0()) {
                // If we did some mangling, make sure we'll write out the XML
                // the correct way.
                if (elementMetaData == null) {
                    elementMetaData = new Vector();
                }

                elementMetaData.add(elem);

                // }
            }
        }

        pw.println("    // " + Messages.getMessage("typeMeta"));
        pw.println(
                "    private static org.apache.axis.description.TypeDesc typeDesc =");
        pw.println("        new org.apache.axis.description.TypeDesc("
                + Utils.getJavaLocalName(type.getName()) + ".class, "
                + (this.canSearchParents
                ? "true"
                : "false") + ");");
        pw.println();
        pw.println("    static {");
        pw.println("        typeDesc.setXmlType("
                + Utils.getNewQName(type.getQName()) + ");");

        // Add attribute and element field descriptors
        if ((attributes != null) || (elementMetaData != null)) {
            if (attributes != null) {
                boolean wroteAttrDecl = false;

                for (int i = 0; i < attributes.size(); i += 2) {
                    TypeEntry te = (TypeEntry) attributes.get(i);
                    QName attrName = (QName) attributes.get(i + 1);
                    String attrLocalName = Utils.getLastLocalPart(attrName.getLocalPart());
                    String fieldName =
                            Utils.xmlNameToJava(attrLocalName);

                    fieldName = getAsFieldName(fieldName);

                    QName attrXmlType = te.getQName();

                    pw.print("        ");

                    if (!wroteAttrDecl) {
                        pw.print("org.apache.axis.description.AttributeDesc ");

                        wroteAttrDecl = true;
                    }

                    pw.println(
                            "attrField = new org.apache.axis.description.AttributeDesc();");
                    pw.println("        attrField.setFieldName(\"" + fieldName
                            + "\");");
                    pw.println("        attrField.setXmlName("
                            + Utils.getNewQNameWithLastLocalPart(attrName) + ");");

                    if (attrXmlType != null) {
                        pw.println("        attrField.setXmlType("
                                + Utils.getNewQName(attrXmlType) + ");");
                    }

                    pw.println("        typeDesc.addFieldDesc(attrField);");
                }
            }

            if (elementMetaData != null) {
                boolean wroteElemDecl = false;

                for (int i = 0; i < elementMetaData.size(); i++) {
                    ElementDecl elem =
                            (ElementDecl) elementMetaData.elementAt(i);

                    if (elem.getAnyElement()) {
                        continue;
                    }

                    String elemLocalName = Utils.getLastLocalPart(elem.getName().getLocalPart());
                    String fieldName = Utils.xmlNameToJava(elemLocalName);

                    fieldName = getAsFieldName(fieldName);

                    QName xmlName = elem.getName();

                    // Some special handling for arrays.
                    TypeEntry elemType = elem.getType();
                    QName xmlType = null;

                    if ((elemType.getDimensions().length() > 1)
                            && (elemType.getClass() == DefinedType.class)) {

                        // If we have a DefinedType with dimensions, it must
                        // be a SOAP array derived type.  In this case, use
                        // the refType's QName for the metadata.
                        xmlType = elemType.getRefType().getQName();
                    } else {

                        // Otherwise, use the type at the end of the ref
                        // chain.
                        while (elemType.getRefType() != null) {
                            elemType = elemType.getRefType();
                        }

                        xmlType = elemType.getQName();
                    }

                    pw.print("        ");

                    if (!wroteElemDecl) {
                        pw.print("org.apache.axis.description.ElementDesc ");

                        wroteElemDecl = true;
                    }

                    pw.println(
                            "elemField = new org.apache.axis.description.ElementDesc();");
                    pw.println("        elemField.setFieldName(\"" + fieldName
                            + "\");");
                    pw.println("        elemField.setXmlName("
                            + Utils.getNewQNameWithLastLocalPart(xmlName) + ");");

                    if (xmlType != null) {
                        pw.println("        elemField.setXmlType("
                                + Utils.getNewQName(xmlType) + ");");
                    }

                    if (elem.getMinOccursIs0()) {
                        pw.println("        elemField.setMinOccurs(0);");
                    }

                    pw.println("        typeDesc.addFieldDesc(elemField);");
                }
View Full Code Here

    protected void preprocess() {

        // Add element names
        if (elements != null) {
            for (int i = 0; i < elements.size(); i++) {
                ElementDecl elem = (ElementDecl) elements.get(i);
                String typeName = elem.getType().getName();
                String variableName;

                if (elem.getAnyElement()) {
                    typeName = "org.apache.axis.message.MessageElement []";
                    variableName = Constants.ANYCONTENT;
                    isAny = true;
                } else {
                    String elemName = Utils.getLastLocalPart(elem.getName().getLocalPart());
                    variableName = Utils.xmlNameToJava(elemName);
                }

                names.add(typeName);
                names.add(variableName);

                if (type.isSimpleType()
                        && (variableName.endsWith("Value")
                        || variableName.equals("value"))) {
                    simpleValueTypes.add(typeName);
                }

                // bug 19069: need to generate code that access member variables that
                // are enum types through the class interface, not the constructor
                // this util method returns non-null if the type at node is an enum
                if (null != Utils.getEnumerationBaseAndValues(
                        elem.getType().getNode(), emitter.getSymbolTable())) {
                    enumerationTypes.add(typeName);
                }
            }
        }
View Full Code Here

            String comments = "";
            if (elements != null)
            {
                if (elements != null && i < (elements.size()*2))
                {
                    ElementDecl elem = (ElementDecl)elements.get((int)i/2);
                    comments = elem.getDocumentation();
                }
            }
           
            String typeName = (String) names.get(i);
            String variable = (String) names.get(i + 1);
View Full Code Here

                    SchemaUtils.getContainedElementDeclarations(te.getNode(),
                            emitter.getSymbolTable());

            if (elements != null) {
                for (int j = 0; j < elements.size(); j++) {
                    ElementDecl elem = (ElementDecl) elements.get(j);
                    String name = Utils.getLastLocalPart(elem.getName().getLocalPart());
                    paramTypes.add(elem.getType().getName());
                    paramNames.add(
                            mangle
                            + Utils.xmlNameToJava(name));
                }
            }
View Full Code Here

            String documentation = "";
            if (elements != null)
            {
                if (elements != null && i < (elements.size()*2))
                {
                    ElementDecl elem = (ElementDecl)elements.get((int)i/2);
                    documentation = elem.getDocumentation();
                }
            }
           
            String get = "get";

            if (typeName.equals("boolean")) {
                get = "is";
            }

            if (enableGetters) {
                try {
                    String comments = "Gets the " + name + " value for this " + getClassName() + ".";
                    pw.println();
                    pw.println("    /**");
                    pw.println("     * " + comments);
                    pw.println("     * ");
                    pw.println("     * @return " + name + " " + getJavadocDescriptionPart(documentation, true));
                    pw.println("     */");
                } catch (DOMException e) {
                    // no comment
                }                   
                pw.println("    public " + typeName + " " + get + capName
                        + "() {");

                if (isUnion()) {
                    writeSimpleTypeGetter(typeName, name, "return");
                } else {
                    pw.println("        return " + name + ";");
                }

                pw.println("    }");
                pw.println();
            }

            if (enableSetters) {
                try
                {
                    String comments = "Sets the " + name + " value for this " + getClassName() + ".";
                    pw.println();
                    pw.println("    /**");
                    pw.println("     * " + comments);
                    pw.println("     * ");
                    pw.println("     * @param " + name + " " + getJavadocDescriptionPart(documentation, true));
                    pw.println("     */");
                }
                catch (DOMException e)
                {
                    // no comment
                }                   
                if (isUnion()) {
                    pw.println("    public void set" + capName + "(" + typeName
                            + " value) {");
                    writeSimpleTypeSetter(typeName);
                } else {
                    pw.println("    public void set" + capName + "(" + typeName
                            + " " + name + ") {");
                    pw.println("        this." + name + " = " + name + ";");
                }

                pw.println("    }");
                pw.println();
            }

            // If this is a special collection type, insert extra
            // java code so that the serializer/deserializer can recognize
            // the class.  This is not JAX-RPC, and will be replaced with
            // compliant code when JAX-RPC determines how to deal with this case.
            // These signatures comply with Bean Indexed Properties which seems
            // like the reasonable approach to take for collection types.
            // (It may be more efficient to handle this with an ArrayList...but
            // for the initial support it was easier to use an actual array.)
            if ((elements != null) && (j < elements.size())) {
                ElementDecl elem = (ElementDecl) elements.get(j);

                if (elem.getType().getQName().getLocalPart().indexOf("[") > 0) {
                    String compName =
                            typeName.substring(0, typeName.lastIndexOf("["));

                    if (enableGetters) {
                        pw.println("    public " + compName + " " + get
View Full Code Here

            String comments = "";
            if (elements != null)
            {
                if (elements != null && i < (elements.size()*2))
                {
                    ElementDecl elem = (ElementDecl)elements.get(i/2);
                    comments = elem.getDocumentation();
                }
            }
           
            String typeName = (String) names.get(i);
            String variable = (String) names.get(i + 1);
View Full Code Here

TOP

Related Classes of org.apache.axis.wsdl.symbolTable.ElementDecl

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.