/** * Contribute array-related properties. * <p/> * If this is a array depending on, there must me a corresponding ODO Object * that we enrich with the array dimensions as the numeric range. * * @param xsdElement the xsd element marked as an array * @param cobolAnnotations the xsd element COBOL annotations * @param props the corresponding set of properties */ @SuppressWarnings("unchecked") private void addArrayProps(XmlSchemaElement xsdElement, CobolAnnotations cobolAnnotations, Map < String, Object > props) { props.put(MIN_OCCURS_PROP_NAME, xsdElement.getMinOccurs()); props.put(MAX_OCCURS_PROP_NAME, xsdElement.getMaxOccurs()); String dependingOn = cobolAnnotations.getDependingOn(); if (dependingOn != null) { Map < String, Object > depProps = (Map < String, Object >) odoObjects .get(dependingOn); depProps.put(MIN_INCLUSIVE_PROP_NAME, Long.toString(xsdElement.getMinOccurs())); depProps.put(MAX_INCLUSIVE_PROP_NAME, Long.toString(xsdElement.getMaxOccurs())); props.put(DEPENDING_ON_PROP_NAME, odoObjectNames.get(dependingOn)); } }
private static XmlElementInfo createXmlElementInfo(final QName qname, final QName xmlType, final XmlSchemaElement element) { final XmlElementInfo elementInfo = new XmlElementInfo(); elementInfo.qname = qname; elementInfo.xmlType = xmlType; elementInfo.minOccurs = element.getMinOccurs(); elementInfo.maxOccurs = element.getMaxOccurs(); elementInfo.nillable = element.isNillable(); return elementInfo; }
public boolean isLiteralArray(XmlSchemaComplexType type) { boolean array = false; if ((type.getAttributes().isEmpty()) && (type.getParticle() instanceof XmlSchemaSequence)) { XmlSchemaSequence stype = (XmlSchemaSequence)type.getParticle(); if ((stype.getItems().size() == 1) && (stype.getItems().get(0) instanceof XmlSchemaElement)) { XmlSchemaElement el = (XmlSchemaElement)stype.getItems().get(0); if (!(el.getMaxOccurs() == 1)) { // it's a literal array array = true; } if (el.getMaxOccurs() == 1 && el.getMinOccurs() == 1 && type.getName() != null && WSDLTypes.isAnonymous(type.getName())) { array = true; } } } return array; }
private void processSchemaList() throws AxisFault { // get the operation schema and process. XmlSchema operationSchema = getXmlSchema(elementQname); XmlSchemaElement messageElement = operationSchema.getElementByName(elementQname.getLocalPart()); mainXmlNode = new XmlNode(elementQname.getLocalPart(), elementQname.getNamespaceURI() , false, (messageElement.getMaxOccurs() == 1 ? false : true) , ""); QName messageSchemaTypeName = messageElement.getSchemaTypeName(); XmlSchemaType schemaType = null; XmlSchema schemaOfType = null; if (messageSchemaTypeName != null) { schemaType = operationSchema.getTypeByName(messageSchemaTypeName); if (schemaType == null) { schemaOfType = getXmlSchema(messageSchemaTypeName); schemaType = schemaOfType.getTypeByName(messageSchemaTypeName.getLocalPart()); } else { schemaOfType = operationSchema; } } else { schemaType = messageElement.getSchemaType(); schemaOfType = operationSchema; } if (schemaType != null) { processSchemaType(schemaType, mainXmlNode, schemaOfType); } else { // nothing to do } }
/** * Create an elementInfo that stores information about a global, named, * element. * * @param element the element * @param currentSchema the schema it came from. * @param schemaCollection the collection of all schemas. * @param prefixAccumulator the accumulator that assigns prefixes. * @return */ public static ParticleInfo forGlobalElement(XmlSchemaElement element, XmlSchema currentSchema, SchemaCollection schemaCollection, NamespacePrefixAccumulator prefixAccumulator) { ParticleInfo elementInfo = new ParticleInfo(); elementInfo.particle = element; elementInfo.minOccurs = element.getMinOccurs(); elementInfo.maxOccurs = element.getMaxOccurs(); elementInfo.nillable = element.isNillable(); elementInfo.global = true; factoryCommon(element, currentSchema, schemaCollection, prefixAccumulator, elementInfo); return elementInfo; }
private void processSchemaList() throws AxisFault { // get the operation schema and process. XmlSchema operationSchema = getXmlSchema(elementQname); XmlSchemaElement messageElement = operationSchema.getElementByName(elementQname.getLocalPart()); mainXmlNode = new XmlNode(elementQname.getLocalPart(), elementQname.getNamespaceURI() , false, (messageElement.getMaxOccurs() == 1 ? false : true) , ""); QName messageSchemaTypeName = messageElement.getSchemaTypeName(); XmlSchemaType schemaType = null; XmlSchema schemaOfType = null; if (messageSchemaTypeName != null) { schemaType = operationSchema.getTypeByName(messageSchemaTypeName); if (schemaType == null) { schemaOfType = getXmlSchema(messageSchemaTypeName); schemaType = schemaOfType.getTypeByName(messageSchemaTypeName.getLocalPart()); } else { schemaOfType = operationSchema; } } else { schemaType = messageElement.getSchemaType(); schemaOfType = operationSchema; } if (schemaType != null) { processSchemaType(schemaType, mainXmlNode, schemaOfType); } else { // nothing to do } }
} else if (part.getMessageInfo().getOperation().isUnwrapped() && el.getMaxOccurs() != 1) {
} else { elementInfo.minOccurs = element.getMinOccurs(); elementInfo.maxOccurs = element.getMaxOccurs(); elementInfo.nillable = element.isNillable(); factorySetupType(element, schemaCollection, elementInfo);
XmlSchemaType schemaType = element.getSchemaType(); if (schemaTypeName != null) { xmlNode = new XmlNode(element.getName(), targetNamespace, false, (element.getMaxOccurs() == 1 ? false : true), schemaTypeName.getLocalPart()); parentNode.addChildToList(xmlNode); if (("http://www.w3.org/2001/XMLSchema").equals(schemaTypeName.getNamespaceURI())) { xmlNode = new XmlNode(element.getName(), targetNamespace, false, (element.getMaxOccurs() == 1 ? false : true), schemaType.getQName().getLocalPart()); parentNode.addChildToList(xmlNode); processSchemaType(schemaType, xmlNode, schema); xmlNode = new XmlNode(targetQname.getLocalPart(), targetNamespace, false, (element.getMaxOccurs() != 1), targetQname.getLocalPart()); parentNode.addChildToList(xmlNode); if (("http://www.w3.org/2001/XMLSchema").equals(targetQname.getNamespaceURI())) {
XmlSchemaType schemaType = element.getSchemaType(); if (schemaTypeName != null) { xmlNode = new XmlNode(element.getName(), targetNamespace, false, (element.getMaxOccurs() == 1 ? false : true), schemaTypeName.getLocalPart()); parentNode.addChildToList(xmlNode); if (("http://www.w3.org/2001/XMLSchema").equals(schemaTypeName.getNamespaceURI())) { xmlNode = new XmlNode(element.getName(), targetNamespace, false, (element.getMaxOccurs() == 1 ? false : true), schemaType.getQName().getLocalPart()); parentNode.addChildToList(xmlNode); processSchemaType(schemaType, xmlNode, schema); xmlNode = new XmlNode(targetQname.getLocalPart(), targetNamespace, false, (element.getMaxOccurs() != 1), targetQname.getLocalPart()); parentNode.addChildToList(xmlNode); if (("http://www.w3.org/2001/XMLSchema").equals(targetQname.getNamespaceURI())) {
private Map < String, Object > getProps(int fieldIndex, XmlSchemaElement xsdElement, RootCompositeType compositeTypes) { Map < String, Object > props; CobolAnnotations cobolAnnotations = new CobolAnnotations(xsdElement); if (xsdElement.getSchemaType() instanceof XmlSchemaComplexType) { props = getProps((XmlSchemaComplexType) xsdElement.getSchemaType(), compositeTypes); } else if (xsdElement.getSchemaType() instanceof XmlSchemaSimpleType) { props = getProps((XmlSchemaSimpleType) xsdElement.getSchemaType(), cobolAnnotations); if (props.get(ODO_OBJECT_PROP_NAME) != null) { odoObjectNames.put(cobolAnnotations.getCobolName(), getFieldName(xsdElement)); } } else { throw new Xsd2ConverterException("Unsupported xsd element of type " + xsdElement.getSchemaType().getQName() + " at line " + xsdElement.getLineNumber()); } if (xsdElement.getMaxOccurs() > 1) { addArrayProps(xsdElement, cobolAnnotations, props); } if (xsdElement.getMinOccurs() == 0 && xsdElement.getMaxOccurs() == 1) { addOptionalProps(xsdElement, cobolAnnotations, props); } props.put(COBOL_NAME_PROP_NAME, cobolAnnotations.getCobolName()); props.put(FIELD_INDEX_PROP_NAME, fieldIndex); return props; }
private static ElementInfo getElementInfo(XmlSchemaElement element) { if (element == null) { return null; } ElementInfo elementInfo = new ElementInfo(element.getQName(), getTypeInfo(element.getSchemaType())); elementInfo.setMany(element.getMaxOccurs() > 1); elementInfo.setNillable(element.isNillable()); elementInfo.setOmissible(element.getMinOccurs()==0); return elementInfo; }
} else if (part.getMessageInfo().getOperation().isUnwrapped() && (mObj.getClass().isArray() || mObj instanceof List) && el.getMaxOccurs() != 1) { writeArrayObject(marshaller, source,
private static ElementInfo getElementInfo(XmlSchemaElement element) { if (element == null) { return null; } ElementInfo elementInfo = new ElementInfo(element.getQName(), getTypeInfo(element.getSchemaType())); elementInfo.setMany(element.getMaxOccurs() > 1); elementInfo.setNillable(element.isNillable()); elementInfo.setOmissible(element.getMinOccurs()==0); return elementInfo; }
ContainerNode avroRecordType = buildAvroCompositeType( getAvroTypeName(xsdType), avroChildrenFields, xsdElement.getMaxOccurs() > 1, xsdElement.getMinOccurs() == 0 && xsdElement.getMaxOccurs() == 1); ObjectNode avroRecordElement = MAPPER.createObjectNode(); avroRecordElement.put("type", avroRecordType); visit((XmlSchemaSimpleType) xsdElement.getSchemaType(), level, getAvroFieldName(xsdElement), xsdElement.getMinOccurs(), xsdElement.getMaxOccurs(), avroFields);
if (childElement.getMaxOccurs() > 1) {
public WSDLPart(Part part, Class javaType) throws InvalidWSDLException { this.part = part; QName elementName = part.getElementName(); if (elementName != null) { element = WSDLOperationIntrospectorImpl.this.getElement(elementName); if (element == null) { throw new InvalidWSDLException("Element cannot be resolved: " + elementName.toString()); } } else { // Create an faked XSD element to host the metadata element = new XmlSchemaElement(); element.setName(part.getName()); element.setQName(new QName(null, part.getName())); QName typeName = part.getTypeName(); if (typeName != null) { XmlSchemaType type = WSDLOperationIntrospectorImpl.this.getType(typeName); if (type == null) { throw new InvalidWSDLException("Type cannot be resolved: " + typeName.toString()); } element.setSchemaType(type); element.setSchemaTypeName(type.getQName()); } } XMLType xmlType = new XMLType(getElementInfo(element)); xmlType.setNillable(element.isNillable()); xmlType.setMany(element.getMaxOccurs() > 1); dataType = new DataTypeImpl<XMLType>(dataBinding, javaType, xmlType); }
public WSDLPart(Part part, Class javaType) throws InvalidWSDLException { this.part = part; QName elementName = part.getElementName(); if (elementName != null) { element = WSDLOperationIntrospectorImpl.this.getElement(elementName); if (element == null) { throw new InvalidWSDLException("Element cannot be resolved: " + elementName.toString()); } } else { // Create an faked XSD element to host the metadata element = new XmlSchemaElement(); element.setName(part.getName()); element.setQName(new QName(null, part.getName())); QName typeName = part.getTypeName(); if (typeName != null) { XmlSchemaType type = WSDLOperationIntrospectorImpl.this.getType(typeName); if (type == null) { throw new InvalidWSDLException("Type cannot be resolved: " + typeName.toString()); } element.setSchemaType(type); element.setSchemaTypeName(type.getQName()); } } XMLType xmlType = new XMLType(getElementInfo(element)); xmlType.setNillable(element.isNillable()); xmlType.setMany(element.getMaxOccurs() > 1); dataType = new DataTypeImpl<XMLType>(dataBinding, javaType, xmlType); }
boolean isArray = xmlSchemaElement.getMaxOccurs() > 1;
boolean isArray = xmlSchemaElement.getMaxOccurs() > 1;