if (seq.isEmpty()) { return null; List existingElements = seq.getOrderedElements(); if (existingElements != null) { Iterator elementIt = existingElements.iterator();
public void setNestedParticles(java.util.List nestedParticles) { for (int i = 0; i < nestedParticles.size(); i++) { NestedParticle next = (NestedParticle)nestedParticles.get(i); if (next instanceof Choice) { addChoice((Choice)next); } else if (next instanceof Sequence) { addSequence((Sequence)next); } } }
public void addElement(Element elem) { orderedElements.add(elem); getElements().add(elem); }
Sequence entrySequence = new Sequence(); entrySequence.addElement(keyElement); entrySequence.addElement(valueElement); entryComplexType.setSequence(entrySequence); } else { ComplexType complexType = new ComplexType(); Sequence sequence = new Sequence(); complexType.setSequence(sequence); entryElement.setMinOccurs(Occurs.ZERO); entryElement.setMaxOccurs(Occurs.UNBOUNDED); sequence.addElement(entryElement); entryElement.setComplexType(entryComplexType); element.setComplexType(complexType);
} else { elem.setSimpleType(st); seq.addElement(elem);
public void setSequence(Sequence sequence) { this.sequence = sequence; if (sequence != null) { sequence.setOwner(this); this.typeDefParticle = sequence; } }
/** * Convenience method for processing a choice property. Required * schema components will be generated and set accordingly. * * @param property the choice property to be processed * @param typeInfo the TypeInfo that the given property belongs to * @param type the ComplexType which compositor(s) should be added to * @param compositor the sequence/choice/all to modify * @param schema the schema being built */ private void addChoiceToSchema(Property property, TypeInfo typeInfo, ComplexType type, TypeDefParticle compositor, Schema schema) { Choice choice = new Choice(); if (property.getGenericType() != null) { choice.setMaxOccurs(Occurs.UNBOUNDED); } ArrayList<Property> choiceProperties = (ArrayList<Property>) property.getChoiceProperties(); addToSchemaType(typeInfo, choiceProperties, choice, type, schema); if (compositor instanceof Sequence) { ((Sequence) compositor).addChoice(choice); } else if (compositor instanceof Choice) { ((Choice) compositor).addChoice(choice); } }
private boolean shouldBeSequenced(TypeDefParticle typeDefParticle) { java.util.List elements = typeDefParticle.getElements(); if ((elements != null) && (elements.size() > 1)) { return true; } if (typeDefParticle instanceof Sequence) { java.util.List allItems = ((Sequence) typeDefParticle).getOrderedElements(); for (int i = 0; i < allItems.size(); i++) { Object nextItem = allItems.get(i); if (nextItem instanceof TypeDefParticle) { boolean sequenced = shouldBeSequenced((TypeDefParticle) nextItem); if (sequenced) { return true; } } } } else if (typeDefParticle instanceof Choice) { java.util.List allItems = ((Choice) typeDefParticle).getOrderedElements(); for (int i = 0; i < allItems.size(); i++) { Object nextItem = allItems.get(i); if (nextItem instanceof TypeDefParticle) { boolean sequenced = shouldBeSequenced((TypeDefParticle) nextItem); if (sequenced) { return true; } } } } return false; }
private void processSequence(String targetNamespace, String defaultNamespace, SDOType owningType, Sequence sequence, boolean isMany) { if (sequence != null) { processTypeDef(targetNamespace, defaultNamespace, owningType, sequence); java.util.List orderedItems = sequence.getOrderedElements(); for (int i = 0; i < orderedItems.size(); i++) { Object next = orderedItems.get(i); if (!isMany && maxOccursGreaterThanOne(sequence.getMaxOccurs())) { isMany = true; } if (next instanceof Choice) { processChoice(targetNamespace, defaultNamespace, owningType, (Choice) next, isMany); } else if (next instanceof Sequence) { processSequence(targetNamespace, defaultNamespace, owningType, (Sequence) next, isMany); } else if (next instanceof Any) { processAny(targetNamespace, defaultNamespace, (Any) next, owningType, sequence);//isMany? } else if (next instanceof Element) { processElement(targetNamespace, defaultNamespace, owningType, sequence, (Element) next, false, isMany); } else if (next instanceof Group) { processGroup(targetNamespace, defaultNamespace, owningType, sequence, (Group) next, isMany); } } } }
/** * Adds an Any to a given sequence. If isCollection is true, maxOccurs will * be set to unbounded. * * @param seq * @param isCollection * @see Any * @see Occurs.UNBOUNDED */ protected void processAnyMapping(Sequence seq, boolean isCollection) { Any any = new Any(); any.setProcessContents(Any.LAX); any.setMinOccurs(Occurs.ZERO); if (isCollection) { any.setMaxOccurs(Occurs.UNBOUNDED); } seq.addAny(any); }
Sequence entrySequence = new Sequence(); entrySequence.addElement(keyElement); entrySequence.addElement(valueElement); entryComplexType.setSequence(entrySequence); } else { ComplexType complexType = new ComplexType(); Sequence sequence = new Sequence(); complexType.setSequence(sequence); entryElement.setMinOccurs(Occurs.ZERO); entryElement.setMaxOccurs(Occurs.UNBOUNDED); sequence.addElement(entryElement); entryElement.setComplexType(entryComplexType); element.setComplexType(complexType);
} else { elem.setSimpleType(st); seq.addElement(elem);
public void setSequence(Sequence sequence) { this.sequence = sequence; if (sequence != null) { sequence.setOwner(this); this.typeDefParticle = sequence; } }
/** * Convenience method for processing a choice property. Required * schema components will be generated and set accordingly. * * @param property the choice property to be processed * @param typeInfo the TypeInfo that the given property belongs to * @param type the ComplexType which compositor(s) should be added to * @param compositor the sequence/choice/all to modify * @param schema the schema being built */ private void addChoiceToSchema(Property property, TypeInfo typeInfo, ComplexType type, TypeDefParticle compositor, Schema schema) { Choice choice = new Choice(); if (property.getGenericType() != null) { choice.setMaxOccurs(Occurs.UNBOUNDED); } ArrayList<Property> choiceProperties = (ArrayList<Property>) property.getChoiceProperties(); addToSchemaType(typeInfo, choiceProperties, choice, type, schema); if (compositor instanceof Sequence) { ((Sequence) compositor).addChoice(choice); } else if (compositor instanceof Choice) { ((Choice) compositor).addChoice(choice); } }
private boolean shouldBeSequenced(TypeDefParticle typeDefParticle) { java.util.List elements = typeDefParticle.getElements(); if ((elements != null) && (elements.size() > 1)) { return true; } if (typeDefParticle instanceof Sequence) { java.util.List allItems = ((Sequence) typeDefParticle).getOrderedElements(); for (int i = 0; i < allItems.size(); i++) { Object nextItem = allItems.get(i); if (nextItem instanceof TypeDefParticle) { boolean sequenced = shouldBeSequenced((TypeDefParticle) nextItem); if (sequenced) { return true; } } } } else if (typeDefParticle instanceof Choice) { java.util.List allItems = ((Choice) typeDefParticle).getOrderedElements(); for (int i = 0; i < allItems.size(); i++) { Object nextItem = allItems.get(i); if (nextItem instanceof TypeDefParticle) { boolean sequenced = shouldBeSequenced((TypeDefParticle) nextItem); if (sequenced) { return true; } } } } return false; }
private void processSequence(String targetNamespace, String defaultNamespace, SDOType owningType, Sequence sequence, boolean isMany) { if (sequence != null) { processTypeDef(targetNamespace, defaultNamespace, owningType, sequence); java.util.List orderedItems = sequence.getOrderedElements(); for (int i = 0; i < orderedItems.size(); i++) { Object next = orderedItems.get(i); if (!isMany && maxOccursGreaterThanOne(sequence.getMaxOccurs())) { isMany = true; } if (next instanceof Choice) { processChoice(targetNamespace, defaultNamespace, owningType, (Choice) next, isMany); } else if (next instanceof Sequence) { processSequence(targetNamespace, defaultNamespace, owningType, (Sequence) next, isMany); } else if (next instanceof Any) { processAny(targetNamespace, defaultNamespace, (Any) next, owningType, sequence);//isMany? } else if (next instanceof Element) { processElement(targetNamespace, defaultNamespace, owningType, sequence, (Element) next, false, isMany); } else if (next instanceof Group) { processGroup(targetNamespace, defaultNamespace, owningType, sequence, (Group) next, isMany); } } } }
/** * Adds an Any to a given sequence. If isCollection is true, maxOccurs will * be set to unbounded. * * @param seq * @param isCollection * @see Any * @see Occurs.UNBOUNDED */ protected void processAnyMapping(Sequence seq, boolean isCollection) { Any any = new Any(); any.setProcessContents(Any.LAX); any.setMinOccurs(Occurs.ZERO); if (isCollection) { any.setMaxOccurs(Occurs.UNBOUNDED); } seq.addAny(any); }
Sequence sequence = new Sequence(); cType.setSequence(sequence); currentElement.setComplexType(cType); globalElement.setName(frag.getLocalName()); ComplexType gCType = new ComplexType(); Sequence gSequence = new Sequence(); gCType.setSequence(gSequence); globalElement.setComplexType(gCType); currentSequence.addElement(currentElement); currentElementExists = true; currentSequence.addElement(currentElement); if (frag.getNextFragment() != null && !frag.getNextFragment().nameIsText()) { Element childElt = buildElement(frag, null, Occurs.ZERO, null); currentSequence.addElement(childElt);