private XmlSchemaElement generateWrapper(QName el, XmlSchemaSequence wrappingSequence) { XmlSchemaComplexType schemaComplexType = new XmlSchemaComplexType(schema, false); schemaComplexType.setParticle(wrappingSequence); XmlSchemaElement wrappingSchemaElement = new XmlSchemaElement(schema, true); wrappingSchemaElement.setName(el.getLocalPart()); wrappingSchemaElement.setSchemaType(schemaComplexType); return wrappingSchemaElement; }
private void generateComplexTypeforException() { XmlSchemaSequence sequence = new XmlSchemaSequence(); XmlSchema xmlSchema = getXmlSchema(schemaTargetNameSpace); QName elementName = new QName(schemaTargetNameSpace, "Exception", schema_namespace_prefix); XmlSchemaComplexType complexType = new XmlSchemaComplexType(xmlSchema, false); complexType.setName("Exception"); xmlSchema.getItems().add(complexType); xmlSchema.getSchemaTypes().put(elementName, complexType); typeTable.addComplexSchema(Exception.class.getName(), elementName); QName schemaTypeName = new QName(Java2WSDLConstants.URI_2001_SCHEMA_XSD, "string"); addContentToMethodSchemaType(sequence, schemaTypeName, "Message", false); complexType.setParticle(sequence); }
private void generateComplexTypeforException() { XmlSchemaSequence sequence = new XmlSchemaSequence(); XmlSchema xmlSchema = getXmlSchema(schemaTargetNameSpace); QName elementName = new QName(schemaTargetNameSpace, "Exception", schema_namespace_prefix); XmlSchemaComplexType complexType = new XmlSchemaComplexType(xmlSchema, false); complexType.setName("Exception"); xmlSchema.getItems().add(complexType); xmlSchema.getSchemaTypes().put(elementName, complexType); typeTable.addComplexSchema(Exception.class.getName(), elementName); QName schemaTypeName = new QName(Java2WSDLConstants.URI_2001_SCHEMA_XSD, "string"); addContentToMethodSchemaType(sequence, schemaTypeName, "Message", false); complexType.setParticle(sequence); }
private void buildGenericSeq(XmlSchema schema, XmlSchemaComplexType generics, Class<?> genericsClass) { XmlSchemaSequence genericsSeq = new XmlSchemaSequence(); generics.setParticle(genericsSeq); XmlAccessType accessType = Utils.getXmlAccessType(genericsClass);
@Nonnull private XmlSchemaType createAny() { final XmlSchemaComplexType value = new XmlSchemaComplexType(schema, false); final XmlSchemaChoice xmlSchemaSequence = new XmlSchemaChoice(); value.setParticle(xmlSchemaSequence); final List<XmlSchemaChoiceMember> items = xmlSchemaSequence.getItems(); final XmlSchemaAny schemaAny = new XmlSchemaAny(); schemaAny.setMinOccurs(0); schemaAny.setMaxOccurs(UNBOUNDED); schemaAny.setProcessContent(XmlSchemaContentProcessing.SKIP); items.add(schemaAny); return value; } }
@Nonnull private XmlSchemaType createAny() { final XmlSchemaComplexType value = new XmlSchemaComplexType(schema, false); final XmlSchemaChoice xmlSchemaSequence = new XmlSchemaChoice(); value.setParticle(xmlSchemaSequence); final List<XmlSchemaChoiceMember> items = xmlSchemaSequence.getItems(); final XmlSchemaAny schemaAny = new XmlSchemaAny(); schemaAny.setMinOccurs(0); schemaAny.setMaxOccurs(UNBOUNDED); schemaAny.setProcessContent(XmlSchemaContentProcessing.SKIP); items.add(schemaAny); return value; } }
private XmlSchemaComplexType duplicateXmlSchemaComplexType(Scope newScope) { XmlSchemaComplexType oldSchemaType = (XmlSchemaComplexType) getSchemaType(); XmlSchemaComplexType newSchemaType = new XmlSchemaComplexType(schema, true); newSchemaType.setName(newScope.toString()); newSchemaType.setParticle(oldSchemaType.getParticle()); return newSchemaType; }
xmlSchemaComplexType = new XmlSchemaComplexType(xmlSchema, false); XmlSchemaSequence xmlSchemaSequence = new XmlSchemaSequence(); xmlSchemaComplexType.setParticle(xmlSchemaSequence); xmlSchemaComplexType.setName(complexTypeName);
@Override public void writeSchema(XmlSchema root) { XmlSchemaComplexType complex = new XmlSchemaComplexType(root, true); complex.setName(getSchemaType().getLocalPart()); XmlSchemaSequence sequence = new XmlSchemaSequence(); complex.setParticle(sequence); AegisType kType = getKeyType(); AegisType vType = getValueType(); XmlSchemaElement element = new XmlSchemaElement(root, false); sequence.getItems().add(element); element.setName(getEntryName().getLocalPart()); element.setMinOccurs(0); element.setMaxOccurs(Long.MAX_VALUE); XmlSchemaComplexType evType = new XmlSchemaComplexType(root, false); element.setType(evType); XmlSchemaSequence evSequence = new XmlSchemaSequence(); evType.setParticle(evSequence); createElement(root, evSequence, getKeyName(), kType, false); createElement(root, evSequence, getValueName(), vType, true); }
@Override public void writeSchema(XmlSchema root) { XmlSchemaComplexType complex = new XmlSchemaComplexType(root, true); complex.setName(getSchemaType().getLocalPart()); XmlSchemaSequence sequence = new XmlSchemaSequence(); complex.setParticle(sequence); AegisType kType = getKeyType(); AegisType vType = getValueType(); XmlSchemaElement element = new XmlSchemaElement(root, false); sequence.getItems().add(element); element.setName(getEntryName().getLocalPart()); element.setMinOccurs(0); element.setMaxOccurs(Long.MAX_VALUE); XmlSchemaComplexType evType = new XmlSchemaComplexType(root, false); element.setType(evType); XmlSchemaSequence evSequence = new XmlSchemaSequence(); evType.setParticle(evSequence); createElement(root, evSequence, getKeyName(), kType, false); createElement(root, evSequence, getValueName(), vType, true); }
XmlSchemaAny any = new XmlSchemaAny(); entrySequence.getItems().add(any); entryType.setParticle(entrySequence); entryType.setName(entryName.getLocalPart()); xmlSchema.getItems().add(entryType);
/** * Creates the default data services response element, and stores it in the schema. * @param cparams The common parameters used in the schema generator */ private static void createAndStoreDataServiceResponseElement(CommonParams cparams) { XmlSchemaElement element = createElement(cparams, DBConstants.WSO2_DS_NAMESPACE, DBConstants.DATA_SERVICE_RESPONSE_WRAPPER_ELEMENT, true); XmlSchemaComplexType type = createComplexType(cparams, DBConstants.WSO2_DS_NAMESPACE, DBConstants.DATA_SERVICE_RESPONSE_WRAPPER_ELEMENT, false); element.setType(type); XmlSchemaAny anyEl = new XmlSchemaAny(); anyEl.setMinOccurs(0); XmlSchemaSequence seq = new XmlSchemaSequence(); seq.getItems().add(anyEl); type.setParticle(seq); }
} else { sequence = new XmlSchemaSequence(); complexType.setParticle(sequence);
} else { sequence = new XmlSchemaAll(); complexType.setParticle(sequence);
@Override public void writeSchema(XmlSchema root) { if (isFlat()) { return; // there is no extra level of type. } if (hasDefinedArray(root)) { return; } XmlSchemaComplexType complex = new XmlSchemaComplexType(root, true); complex.setName(getSchemaType().getLocalPart()); XmlSchemaSequence seq = new XmlSchemaSequence(); complex.setParticle(seq); AegisType componentType = getComponentType(); XmlSchemaElement element = new XmlSchemaElement(root, false); element.setName(componentType.getSchemaType().getLocalPart()); element.setSchemaTypeName(componentType.getSchemaType()); seq.getItems().add(element); if (componentType.isNillable()) { element.setNillable(true); } element.setMinOccurs(getMinOccurs()); element.setMaxOccurs(getMaxOccurs()); }
@Override public void writeSchema(XmlSchema root) { if (isFlat()) { return; // there is no extra level of type. } if (hasDefinedArray(root)) { return; } XmlSchemaComplexType complex = new XmlSchemaComplexType(root, true); complex.setName(getSchemaType().getLocalPart()); XmlSchemaSequence seq = new XmlSchemaSequence(); complex.setParticle(seq); AegisType componentType = getComponentType(); XmlSchemaElement element = new XmlSchemaElement(root, false); element.setName(componentType.getSchemaType().getLocalPart()); element.setSchemaTypeName(componentType.getSchemaType()); seq.getItems().add(element); if (componentType.isNillable()) { element.setNillable(true); } element.setMinOccurs(getMinOccurs()); element.setMaxOccurs(getMaxOccurs()); }
private XmlSchemaComplexType generateSchemaArray(Scope scopedName, Long size, XmlSchemaType type, Scope fQName) { XmlSchemaComplexType complexType = new XmlSchemaComplexType(schema, true); complexType.setName(mapper.mapToQName(scopedName)); XmlSchemaSequence sequence = new XmlSchemaSequence(); XmlSchemaElement element = new XmlSchemaElement(schema, false); element.setMinOccurs(size); element.setMaxOccurs(size); element.setName(ELEMENT_NAME); if (type != null) { element.setSchemaTypeName(type.getQName()); if (type.getQName().equals(ReferenceConstants.WSADDRESSING_TYPE)) { element.setNillable(true); } } else { ArrayDeferredAction arrayAction = new ArrayDeferredAction(element); wsdlVisitor.getDeferredActions().add(fQName, arrayAction); } sequence.getItems().add(element); complexType.setParticle(sequence); return complexType; }
value.setParticle(xmlSchemaSequence); xmlSchemaSequence.getItems().add(transform); visit = value;
private XmlSchemaType generateSchemaType(XmlSchemaType stype, Scope scopedName, long bound, Scope fullyQualifiedName) { XmlSchemaComplexType ct = new XmlSchemaComplexType(schema, true); ct.setName(mapper.mapToQName(scopedName)); XmlSchemaSequence sequence = new XmlSchemaSequence(); XmlSchemaElement el = new XmlSchemaElement(schema, false); el.setName(ELEMENT_NAME); el.setMinOccurs(0); if (bound != -1) { el.setMaxOccurs(bound); } else { el.setMaxOccurs(Long.MAX_VALUE); } if (stype != null) { el.setSchemaTypeName(stype.getQName()); if (stype.getQName().equals(ReferenceConstants.WSADDRESSING_TYPE)) { el.setNillable(true); } } else { SequenceDeferredAction elementAction = new SequenceDeferredAction(el); wsdlVisitor.getDeferredActions().add(fullyQualifiedName, elementAction); } sequence.getItems().add(el); ct.setParticle(sequence); return ct; }
public void visitDeclaredStruct(AST identifierNode) { Scope structScope = new Scope(getScope(), identifierNode); // xmlschema:struct XmlSchemaComplexType complexType = new XmlSchemaComplexType(schema, true); complexType.setName(mapper.mapToQName(structScope)); XmlSchemaSequence sequence = new XmlSchemaSequence(); complexType.setParticle(sequence); // corba:struct Struct struct = new Struct(); struct.setQName(new QName(typeMap.getTargetNamespace(), structScope.toString())); struct.setType(complexType.getQName()); struct.setRepositoryID(structScope.toIDLRepositoryID()); boolean recursiveAdd = addRecursiveScopedName(identifierNode); // struct members visitStructMembers(identifierNode, struct, sequence, structScope); if (recursiveAdd) { removeRecursiveScopedName(identifierNode); } // add corbaType typeMap.getStructOrExceptionOrUnion().add(struct); // REVISIT: are there assignment needed? setSchemaType(complexType); setCorbaType(struct); // Need to check if the struct was forward declared processForwardStructActions(structScope); // Once we've finished declaring the struct, we should make sure it has been removed from // the list of scopedNames so that we inidicate that is no longer simply forward declared. scopedNames.remove(structScope); }