Examples of XSModelGroup


Examples of org.apache.xerces.xs.XSModelGroup

    protected void printComplexValidationDataStructMembers(PrintStream stream, XSComplexTypeDefinition complexType,
            Set<String> printedMembers) {
        if (complexType.getParticle() != null) {
            XSTerm term = complexType.getParticle().getTerm();
            if (term instanceof XSModelGroup) {
                XSModelGroup modelGroup = (XSModelGroup) term;
                printComplexValidationDataStructMembers(stream, modelGroup, printedMembers);
            }
        }
        if (complexType.getBaseType() instanceof XSComplexTypeDefinition) {
            XSComplexTypeDefinition baseType = (XSComplexTypeDefinition) complexType.getBaseType();
View Full Code Here

Examples of org.apache.xerces.xs.XSModelGroup

     *            XSParticle to build state machine for.
     * @return State machine or null.
     */
    protected StateMachineRootNode build(XSParticle particle) {
        if (particle.getTerm() instanceof XSModelGroup) {
            XSModelGroup modelGroup = (XSModelGroup) particle.getTerm();
            boolean foundNestedModelGroup = false;
            for (int i = 0; i < modelGroup.getParticles().getLength(); i++) {
                XSParticle subParticle = (XSParticle) modelGroup.getParticles().item(i);
                if (subParticle.getTerm() instanceof XSModelGroup) {
                    foundNestedModelGroup = true;
                    break;
                }
            }
View Full Code Here

Examples of org.apache.xerces.xs.XSModelGroup

     */
    public static String fillInComplexValidationTemplate(String tmpl, String cppElementName,
            String cppValidationDataStructType, XSComplexTypeDefinition complexType, XSElementDeclaration element,
            StateMachineRootNode sm, IGenerationDataProvider dataProvider) {

        XSModelGroup modelGroup = null;
        boolean complexTypeMaxOccursUnbounded = false;
        int complexTypeMinOccurs = -1;
        int complexTypeMaxOccurs = -1;
        if (complexType != null) {
          XSParticle complexTypeParticle = complexType.getParticle();
            if (complexTypeParticle != null) {
              complexTypeMaxOccursUnbounded = complexTypeParticle.getMaxOccursUnbounded();
              complexTypeMinOccurs = complexTypeParticle.getMinOccurs();
              complexTypeMaxOccurs = complexTypeParticle.getMaxOccurs();
                if (complexTypeParticle.getTerm() instanceof XSModelGroup) {
                 
                    modelGroup = (XSModelGroup) complexType.getParticle().getTerm();
                }
            }
        }
        XSParticle particle = null;
        if (modelGroup != null && modelGroup.getParticles() != null) {
            for (int i = 0; i < modelGroup.getParticles().getLength(); i++) {
                XSObject particleObject = modelGroup.getParticles().item(i);
                if (particleObject instanceof XSParticle) {
                    XSParticle currentParticle = (XSParticle) particleObject;
                    if (currentParticle.getTerm() instanceof XSElementDeclaration) {
                        XSElementDeclaration particleElement = (XSElementDeclaration) currentParticle.getTerm();
                        if (particleElement.getName().equals(element.getName())) {
                            particle = currentParticle;
                            break;
                        }
                    }
                }
            }
        }
       
        Config config = dataProvider.getConfig();
        int iterationCounter = 0;
        while (tmpl.contains(Constants.TEMPLATE_DELIMITER_COMPLEX_VALIDATION)) {
            iterationCounter++;
            if (iterationCounter > config.getMaxTemplateResolvingIterations()) {
                System.err.println("********************************************");
                System.err.println("Could not resolve template:");
                System.err.println(fillInTemplate(tmpl, cppElementName, null, null, null, null, null, dataProvider));
                System.err.println("********************************************");
                break;
            }

            if (tmpl.contains(Constants.TMPL_COMPLEX_VALI_STRUCT_TYPE)) {
                tmpl = tmpl.replace(Constants.TMPL_COMPLEX_VALI_STRUCT_TYPE, cppValidationDataStructType);
            }
            if (tmpl.contains(Constants.TMPL_COMPLEX_VALI_STRUCT_NAME)) {
                tmpl = tmpl.replace(Constants.TMPL_COMPLEX_VALI_STRUCT_NAME, config
                        .getComplexValidationDataStructVariableName());
            }
            if (tmpl.contains(Constants.TMPL_COMPLEX_VALI_PARENT_STRUCT_NAME)) {
                tmpl = tmpl.replace(Constants.TMPL_COMPLEX_VALI_PARENT_STRUCT_NAME, config
                        .getComplexValidationDataParentStructVariableName());
            }
            if (tmpl.contains(Constants.TMPL_COMPLEX_VALI_STRUCT_MEMBER)) {
                tmpl = tmpl.replace(Constants.TMPL_COMPLEX_VALI_STRUCT_MEMBER, Util
                        .createComplexValidationDataStructMemberName(element, config));
            }
            if (tmpl.contains(Constants.TMPL_COMPLEX_VALI_CHECK_MAX_OCCURENCE)) {
                String maxOccCheck = config.getTemplateComplexValidationCheckMaxOccurence();
                if (particle == null || (particle != null && particle.getMaxOccursUnbounded()) || complexTypeMaxOccursUnbounded ) {
                    maxOccCheck = "";
                }
                tmpl = tmpl.replace(Constants.TMPL_COMPLEX_VALI_CHECK_MAX_OCCURENCE, maxOccCheck);
            }
            if (tmpl.contains(Constants.TMPL_COMPLEX_VALI_GET_VALIDATION_DATA)) {
                tmpl = tmpl.replace(Constants.TMPL_COMPLEX_VALI_GET_VALIDATION_DATA, config
                        .getTemplateComplexValidationGetTopValidationData());
            }
            if (tmpl.contains(Constants.TMPL_COMPLEX_VALI_DELETE_VALIDATION_DATA)) {
                tmpl = tmpl.replace(Constants.TMPL_COMPLEX_VALI_DELETE_VALIDATION_DATA, config
                        .getTemplateComplexValidationDeleteValidationData());
            }
            if (tmpl.contains(Constants.TMPL_COMPLEX_VALI_GET_PARENT_VALIDATION_DATA)) {
                tmpl = tmpl.replace(Constants.TMPL_COMPLEX_VALI_GET_PARENT_VALIDATION_DATA, config
                        .getTemplateComplexValidationGetTopParentValidationData());
            }
            if (tmpl.contains(Constants.TMPL_COMPLEX_VALI_INCREMENT_OCCURENCE)) {
                tmpl = tmpl.replace(Constants.TMPL_COMPLEX_VALI_INCREMENT_OCCURENCE, config
                        .getTemplateComplexValidationIncrementOccurence());
            }
            if (tmpl.contains(Constants.TMPL_COMPLEX_VALI_MAX_OCCURENCE)) {
                int maxOccurence = 0;
                if (particle != null) {
                    maxOccurence = particle.getMaxOccurs();
                }
                tmpl = tmpl.replace(Constants.TMPL_COMPLEX_VALI_MAX_OCCURENCE, String.valueOf(maxOccurence));
            }
            if (tmpl.contains(Constants.TMPL_COMPLEX_VALI_CHECK_MIN_OCCURENCE_OF_CHILDREN)) {
                String childrenCheck = "";
                if (modelGroup != null && modelGroup.getParticles() != null) {
                    switch (modelGroup.getCompositor()) {
                    case XSModelGroup.COMPOSITOR_ALL:
                    case XSModelGroup.COMPOSITOR_SEQUENCE:
                        for (int i = 0; i < modelGroup.getParticles().getLength(); i++) {
                            XSObject item = modelGroup.getParticles().item(i);
                            if (item instanceof XSParticle) {
                                XSParticle child = (XSParticle) item;
                                if (child.getMinOccurs() == 0) {
                                    continue;
                                }
                                String particleTmpl = config.getTemplateComplexValidationCheckMinOccurencOfChildren();
                                childrenCheck += fillInComplexValidationParticleTemplate(particleTmpl, child, config);
                            }
                        }
                        break;
                    case XSModelGroup.COMPOSITOR_CHOICE:
                        boolean allChildrenHaveMinOccurs = true;
                        for (int i = 0; i < modelGroup.getParticles().getLength(); i++) {
                            XSObject item = modelGroup.getParticles().item(i);
                            if (item instanceof XSParticle) {
                                XSParticle child = (XSParticle) item;
                                if (child.getMinOccurs() == 0) {
                                    allChildrenHaveMinOccurs = false;
                                    continue;
                                }
                                String particleTmpl = config
                                        .getTemplateComplexValidationChoiceCheckMinOccurencOfChildren();
                                childrenCheck += fillInComplexValidationParticleTemplate(particleTmpl, child, config);
                            }
                        }
                        if (allChildrenHaveMinOccurs) {
                            childrenCheck += config.getTemplateComplexValidationChoiceCheckOneChildPresent();
                            if (childrenCheck.contains(Constants.TMPL_COMPLEX_VALI_CHOICE_ONE_CHILD_PER_CHILD)) {
                                for (int i = 0; i < modelGroup.getParticles().getLength(); i++) {
                                    XSObject item = modelGroup.getParticles().item(i);
                                    if (item instanceof XSParticle) {
                                        XSParticle child = (XSParticle) item;
                                        String perChild = config
                                                .getTemplateComplexValidationChoiceCheckOneChildPresentPerChild();
                                        if (i != modelGroup.getParticles().getLength() - 1) {
                                            perChild += " && " + Constants.TMPL_CONTINUE_LOOP;
                                        }
                                        childrenCheck = childrenCheck.replace(
                                                Constants.TMPL_COMPLEX_VALI_CHOICE_ONE_CHILD_PER_CHILD, perChild);
                                        childrenCheck = fillInComplexValidationParticleTemplate(childrenCheck, child,
                                                config);

                                        if (childrenCheck.contains(Constants.TMPL_CONTINUE_LOOP)) {
                                            childrenCheck = childrenCheck.replace(Constants.TMPL_CONTINUE_LOOP,
                                                    Constants.TMPL_COMPLEX_VALI_CHOICE_ONE_CHILD_PER_CHILD);
                                        }
                                    }
                                }
                            }
                        }
                        break;
                    }
                }
                tmpl = tmpl.replace(Constants.TMPL_COMPLEX_VALI_CHECK_MIN_OCCURENCE_OF_CHILDREN, childrenCheck);
            }
            if (tmpl.contains(Constants.TMPL_COMPLEX_VALI_CHECK_SIBLINGS)) {
                String siblingsCheck = "";
                if (modelGroup != null && modelGroup.getParticles() != null) {
                    switch (modelGroup.getCompositor()) {
                    case XSModelGroup.COMPOSITOR_SEQUENCE:
                        List<XSParticle> previousSiblings = new ArrayList<XSParticle>();
                        List<XSParticle> followingSiblings = new ArrayList<XSParticle>();
                        Util.splitParticlesForSequence(modelGroup, particle, previousSiblings, followingSiblings);
                        for (int i = previousSiblings.size() - 1; i >= 0; i--) {
View Full Code Here

Examples of org.apache.xerces.xs.XSModelGroup

            for (int i = 0; i < particles.getLength(); i++) {
                XSObject item = particles.item(i);
                if (item instanceof XSParticle) {
                    XSParticle particle = (XSParticle) item;
                    if (particle.getTerm() instanceof XSModelGroup) {
                        XSModelGroup nestedModelGroup = (XSModelGroup) particle.getTerm();
                        String indent = "  ";
                        if (nestedHierarchy != 0) {
                            for (int j = 0; j < nestedHierarchy; j++) {
                                indent += indent;
                            }
                        }
                        if (nestedHierarchy == 0)
                            outFile.println("nested model group: ");
                        else {
                            outFile.println(indent + "nested nested model group: ");
                        }
                        outFile.println(indent + "element: " + getElementStack().peek().getName());
                        outFile.println(indent + "outer compositor: " + getCompositorString(modelGroup));
                        outFile.println(indent + "inner compositor: " + getCompositorString(nestedModelGroup));
                        outFile.println(indent + "inner min/max Occ: " + particle.getMinOccurs() + ", "
                                + particle.getMaxOccurs());
                        if (nestedModelGroup.getParticles() != null) {
                            for (int j = 0; j < nestedModelGroup.getParticles().getLength(); j++) {
                                XSParticle nestedChildParticle = (XSParticle) nestedModelGroup.getParticles().item(j);
                                if (nestedChildParticle.getMinOccurs() != 1 && nestedChildParticle.getMaxOccurs() != 1)
                                    outFile.println(indent + "inner child " + j + " min/max Occ: "
                                            + nestedChildParticle.getMinOccurs() + ", "
                                            + nestedChildParticle.getMaxOccurs());
                            }
View Full Code Here

Examples of org.apache.xerces.xs.XSModelGroup

        if (element.getTypeDefinition() instanceof XSComplexTypeDefinition) {
            XSComplexTypeDefinition complexType = (XSComplexTypeDefinition) element.getTypeDefinition();
            if (complexType.getParticle() != null) {
                if (complexType.getParticle().getTerm() instanceof XSModelGroup) {
                    XSModelGroup modelGroup = (XSModelGroup) complexType.getParticle().getTerm();
                    checkModelGroup(modelGroup, 0);
                }
            }
        }
View Full Code Here

Examples of org.apache.xerces.xs.XSModelGroup

      XSTerm xsterm = xsp.getTerm();
      if (xsterm instanceof XSModelGroup == false)
         return null;

      XSModelGroup xm = (XSModelGroup)xsterm;
      XSObjectList xo = xm.getParticles();
      if (xo.getLength() != 1)
         return null;

      XSParticle xp = (XSParticle)xo.item(0);
      XSTerm term = xp.getTerm();
View Full Code Here

Examples of org.apache.xerces.xs.XSModelGroup

         if (term == null)
            return;
         switch (term.getType())
         {
            case XSConstants.MODEL_GROUP:
               XSModelGroup group = (XSModelGroup)term;
               XSObjectList list = group.getParticles();
               for (int i = 0; i < list.getLength(); i++)
                  analyzeParticle((XSParticle)list.item(i), parentName, namespace);
               break;
            case XSConstants.ELEMENT_DECLARATION:
               XSElementDeclaration decl = (XSElementDeclaration)term;
View Full Code Here

Examples of org.apache.xerces.xs.XSModelGroup

            return true;
        }

        XSTerm term = particle.getTerm();
        if (term instanceof XSModelGroup) {
            XSModelGroup modelGroup = (XSModelGroup) term;

            if (!handleModelGroup(modelGroup)) {
                return false;
            }

            XSObjectList particles = modelGroup.getParticles();
            for (int i = 0; i < particles.getLength(); i++) {
                if (particles.item(i) instanceof XSParticle) {
                    if (!handleParticle((XSParticle) particles.item(i))) {
                        return false;
                    }
View Full Code Here

Examples of org.apache.xerces.xs.XSModelGroup

         buf.append(this.write(xsel, xsp));
         buf.append("</sequence>");
      }
      else if (xsterm instanceof XSModelGroup)
      {
         XSModelGroup jmg = (XSModelGroup)xsterm;
         XSObjectList objlist = jmg.getParticles();
         String end = null;

         switch (jmg.getCompositor())
         {
            case XSModelGroup.COMPOSITOR_ALL:
               buf.append("<all>");
               end = "</all>";
               break;
View Full Code Here

Examples of org.apache.xerces.xs.XSModelGroup

         XSTerm term = particle.getTerm();

         if (term instanceof XSModelGroup == false)
            throw new WSException("[JAX-RPC 2.3.1.2] Expected model group, could not unwrap");

         XSModelGroup group = (XSModelGroup)term;

         unwrapped = unwrapModelGroup(group);
      }

      return unwrapped;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.