public void addTopLevelComplexTypes(ComplexType complexType) { topLevelComplexTypes.put(complexType.getName(), complexType); }
return null; boolean addedNR = addNextNamespaceResolver(complexType.getAttributesMap()); SDOType newType = startComplexType(targetNamespace, defaultNamespace, name, complexType); if (newType != null) { if (complexType.getComplexContent() != null) { processComplexContent(targetNamespace, defaultNamespace, complexType.getComplexContent(), newType); finishComplexType(newType); } else if (complexType.getSimpleContent() != null) { processSimpleContent(targetNamespace, defaultNamespace, complexType.getSimpleContent(), newType); finishComplexType(newType); } else { if (complexType.getChoice() != null) { processChoice(targetNamespace, defaultNamespace, newType, complexType.getChoice(), false); } else if (complexType.getSequence() != null) { processSequence(targetNamespace, defaultNamespace, newType, complexType.getSequence(), false); } else if (complexType.getAll() != null) { processAll(targetNamespace, defaultNamespace, newType, complexType.getAll(), false); processOrderedAttributes(targetNamespace, defaultNamespace, newType, complexType.getOrderedAttributes()); finishComplexType(newType);
public String getOwnerName() { if (owner != null) { return owner.getNameOrOwnerName(); } return null; }
public void setTypeDefParticle(TypeDefParticle typeDefParticle) { this.typeDefParticle = typeDefParticle; if (typeDefParticle instanceof Choice) { setChoice((Choice)typeDefParticle); } else if (typeDefParticle instanceof Sequence) { setSequence((Sequence)typeDefParticle); } else { setAll((All)typeDefParticle); } }
private SDOType startComplexType(String targetNamespace, String defaultNamespace, String name, ComplexType complexType) { String nameValue = (String) complexType.getAttributesMap().get(SDOConstants.SDOXML_NAME_QNAME); String originalName = name; if (nameValue != null) { itemNameToSDOName.put(name, nameValue); originalName = name; name = nameValue; } //check if already processed, if yes return false because a new type was not started else start new type and return true boolean alreadyExists = false; if(null != complexType.getName()) { alreadyExists = typesExists(targetNamespace, name); } if (!alreadyExists) { return startNewComplexType(targetNamespace, name, originalName, complexType); } return null; }
private ComplexType generateComplexType(Type type) { SDOType sdoType = (SDOType) type; ComplexType complexType = new ComplexType(); String xsdLocalName = sdoType.getXsdLocalName(); if (xsdLocalName != null) { complexType.setName(xsdLocalName); } else { complexType.setName(sdoType.getName()); String sdoXmlPrefix = getPrefixForURI(SDOConstants.SDOXML_URL); QName qname = new QName(SDOConstants.SDOXML_URL, SDOConstants.SDOXML_NAME, sdoXmlPrefix); complexType.getAttributesMap().put(qname, sdoType.getName()); complexType.setAbstractValue(sdoType.isAbstract()); if ((sdoType.getAppInfoElements() != null) && (sdoType.getAppInfoElements().size() > 0)) { Annotation annotation = new Annotation(); annotation.setAppInfo(sdoType.getAppInfoElements()); complexType.setAnnotation(annotation); complexType.getAttributesMap().put(qname, aliasNamesString); complexType.setMixed(sdoType.isSequenced()); Type baseType = null; if (sdoType.isSubType()) { ComplexContent complexContent = new ComplexContent(); complexContent.setExtension(extension); complexType.setComplexContent(complexContent); return complexType;
ComplexType type = new ComplexType(); JavaClass superClass = CompilerHelper.getNextMappedSuperClass(myClass, this.typeInfo, this.helper); type.setAbstractValue(true); SimpleContent content = new SimpleContent(); content.setExtension(extension); type.setSimpleContent(content); return type; }else{ ComplexContent content = new ComplexContent(); content.setExtension(extension); type.setComplexContent(content); extension.setSequence((Sequence) compositor); } else { type.setSequence((Sequence) compositor); } else { compositor = new All(); type.setAll((All) compositor); extension.setSequence((Sequence) compositor); } else { type.setSequence((Sequence) compositor);
ComplexType type = new ComplexType(); SimpleContent content = new SimpleContent(); if (EMPTY_STRING.equals(typeName)) { type.setName(typeName); schema.addTopLevelComplexTypes(type); if (rootElement != null) { rootElement.setType(pfx + type.getName()); extension.setBaseType(extensionTypeName); content.setExtension(extension); type.setSimpleContent(content); info.setComplexType(type); } else { ComplexType type = createComplexTypeForClass(myClass, info); TypeDefParticle compositor = null; if(type.getComplexContent() != null && type.getComplexContent().getExtension() != null) { compositor = type.getComplexContent().getExtension().getTypeDefParticle(); } else { compositor = type.getTypeDefParticle(); info.setCompositor(compositor); } else { type.setName(typeName); if (rootElement != null) { rootElement.setType(pfx + type.getName());
ComplexType ct = new ComplexType(); if (!anonymous) { ct.setName(desc.getSchemaReference().getSchemaContextAsQName(workingSchema.getNamespaceResolver()).getLocalPart()); ComplexContent complexContent = new ComplexContent(); complexContent.setExtension(extension); ct.setComplexContent(complexContent); extension.setSequence(seq); } else { ct.setSequence(seq);
currentElement = new Element(); ComplexType cType = new ComplexType(); Sequence sequence = new Sequence(); cType.setSequence(sequence); currentElement.setComplexType(cType); globalElement = new Element(); globalElement.setName(frag.getLocalName()); ComplexType gCType = new ComplexType(); Sequence gSequence = new Sequence(); gCType.setSequence(gSequence); globalElement.setComplexType(gCType); s.addTopLevelElement(globalElement); currentSequence = currentElement.getComplexType().getSequence();
ComplexType cType = new ComplexType(); TypeDefParticle particle = null; if (isChoice) { cType.setTypeDefParticle(particle); currentElement.setComplexType(cType); } else { ComplexType cType = new ComplexType(); cType.setSimpleContent(new SimpleContent()); Extension extension = new Extension(); extension.setBaseType(type.getRestriction().getBaseType()); cType.getSimpleContent().setExtension(extension); currentElement.setSimpleType(null); currentElement.setComplexType(cType); } else { String eType = currentElement.getType(); ComplexType cType = new ComplexType(); SimpleContent sContent = new SimpleContent(); Extension extension = new Extension(); extension.setBaseType(eType); sContent.setExtension(extension); cType.setSimpleContent(sContent); currentElement.setType(null); currentElement.setComplexType(cType); xpr.particle = globalElement.getComplexType().getTypeDefParticle(); return xpr;
private SDOType startNewComplexType(String targetNamespace, String sdoTypeName, String xsdLocalName, ComplexType complexType) { SDOType currentType; if(null == complexType.getName()) { currentType = createSDOTypeForName(targetNamespace, sdoTypeName, xsdLocalName); } else { currentType = getGeneratedTypesByXsdQName().get(new QName(targetNamespace, complexType.getName())); if (complexType.isMixed()) { currentType.setMixed(true); currentType.setSequenced(true); if (complexType.getAnyAttribute() != null) { currentType.setOpen(true); currentType.setAbstract(complexType.isAbstractValue()); currentType.setDataType(false); String value = (String) complexType.getAttributesMap().get(SDOConstants.SDOXML_ALIASNAME_QNAME); if (value != null) { XMLConversionManager xmlConversionManager = ((SDOXMLHelper) aHelperContext.getXMLHelper()).getXmlConversionManager(); String sequencedValue = (String) complexType.getAttributesMap().get(SDOConstants.SDOXML_SEQUENCE_QNAME); if (sequencedValue != null) { currentType.setSequenced(Boolean.valueOf(sequencedValue)); Annotation annotation = complexType.getAnnotation(); if (annotation != null) { java.util.List documentation = annotation.getDocumentation(); if (complexType.getAnnotation() != null) {
public void addToSchemaType(TypeInfo ownerTypeInfo, java.util.List<Property> properties, TypeDefParticle compositor, ComplexType type, Schema workingSchema) { type.setAll(null); type.setSequence(null); type.setChoice(null); ownerTypeInfo.setCompositor(null); return; parentType.setMixed(true);
Attribute attr = buildAttribute(nextProperty); if (owner instanceof ComplexType) { ((ComplexType)owner).getOrderedAttributes().add(attr); } else if (owner instanceof Extension) { ((Extension)owner).getOrderedAttributes().add(attr); anyAttribute.setProcessContents(AnyAttribute.LAX); if (owner instanceof ComplexType) { ((ComplexType)owner).setAnyAttribute(anyAttribute); ((ComplexType)owner).setTypeDefParticle((TypeDefParticle)nestedParticle);
ComplexType entryComplexType = new ComplexType(); Sequence entrySequence = new Sequence(); entryComplexType.setSequence(entrySequence); element.setMaxOccurs(Occurs.UNBOUNDED); } else { ComplexType complexType = new ComplexType(); Sequence sequence = new Sequence(); complexType.setSequence(sequence);
/** * Create and return a ComplexType containing simple content for a given XMLDescriptor. Assumes * that the descriptor has a schema context set. * * @param desc * @param schemaForNamespace * @param workingSchema * @param properties * @param descriptors * @return */ private ComplexType buildComplexTypeWithSimpleContent(XMLDescriptor desc, HashMap<String, Schema> schemaForNamespace, Schema workingSchema, SchemaModelGeneratorProperties properties, List<XMLDescriptor> descriptors) { ComplexType ct = new ComplexType(); SimpleContent sc = new SimpleContent(); Extension extension = new Extension(); sc.setExtension(extension); ct.setSimpleContent(sc); for (DatabaseMapping mapping : desc.getMappings()) { XMLField xFld = (XMLField) mapping.getField(); if (xFld.getXPath().equals(TEXT)) { extension.setBaseType(getSchemaTypeForDirectMapping((XMLDirectMapping) mapping, workingSchema)); } else if (xFld.getXPathFragment().isAttribute()) { String schemaTypeString = getSchemaTypeForDirectMapping((XMLDirectMapping) mapping, workingSchema); Attribute attr = buildAttribute((XMLDirectMapping) mapping, schemaTypeString); extension.getOrderedAttributes().add(attr); } } return ct; }
reference.setRef(prefix + COLON + attribute.getName()); if (type.getSimpleContent() != null) { type.getSimpleContent().getExtension().getOrderedAttributes().add(reference); } else { type.getOrderedAttributes().add(reference); if (type.getSimpleContent() != null) { type.getSimpleContent().getExtension().getOrderedAttributes().add(attribute); } else if (type.getComplexContent() != null) { type.getComplexContent().getExtension().getOrderedAttributes().add(attribute); } else { type.getOrderedAttributes().add(attribute);
String typeName = null; if (type.isComplexType()) { typeName = type.getComplexType().getName(); } else { typeName = type.getSimpleType().getName(); ComplexType cType = createComplexTypeForClass(javaClass, type); TypeDefParticle particle = null; if(cType.getComplexContent() != null && cType.getComplexContent().getExtension() != null) { particle = cType.getComplexContent().getExtension().getTypeDefParticle(); } else { particle = cType.getTypeDefParticle();
ct.getOrderedAttributes().add(attr); } else { elem.setSimpleType(st);