Refine search
synchronized (e) { ArrayList<Integer> toremove = new ArrayList(); for (int i = 0; i < e.getSubstitutionGroup().size(); i++) { XSDElementDeclaration se = (XSDElementDeclaration) e.getSubstitutionGroup().get(i); if (se == null || (Utilities.equals(el.getTargetNamespace(), se.getTargetNamespace()) && Utilities.equals(el.getName(), se.getName()))) { toremove.add(i); if (se != null && e.equals(se.getSubstitutionGroupAffiliation())) { XSDElementDeclaration clone = (XSDElementDeclaration) e.cloneConcreteComponent(false, false); clone.setTargetNamespace(GML.NAMESPACE); se.setSubstitutionGroupAffiliation(clone); e = e.getSubstitutionGroupAffiliation();
namespace = element.getTargetNamespace(); type = e.getTypeDefinition(); XSDElementDeclaration attribute = (XSDElementDeclaration) particle.getContent(); if (attribute.isElementDeclarationReference()) { attribute = attribute.getResolvedElementDeclaration(); if (GML.NAMESPACE.equals(attribute.getTargetNamespace())) { continue; if (featureType.getDescriptor(attribute.getName()) == null) { continue; Object attributeValue = feature.getAttribute(attribute.getName()); properties.add(new Object[] {particle, attributeValue});
protected final XSDTypeDefinition findGlobalElementXSDType(XSDElementDeclaration element) { for (Iterator i = schema.getElementDeclarations().iterator(); i.hasNext();) { XSDElementDeclaration e = (XSDElementDeclaration) i.next(); if (element.getName().equals( e.getName() ) && (element.getTargetNamespace() == null || element.getTargetNamespace().equals( e.getTargetNamespace() ) ) ) { return e.getType(); } } return null; }
for (Iterator e = schema.getElementDeclarations().iterator(); e.hasNext(); ) { XSDElementDeclaration element = (XSDElementDeclaration) e.next(); if (ft.getName().equals(element.getName())) { type = element.getTypeDefinition(); break; for (Iterator t = schema.getTypeDefinitions().iterator(); t.hasNext(); ) { XSDTypeDefinition typedef = (XSDTypeDefinition) t.next(); if ((ft.getName() + "_Type").equals(typedef.getName())) { for (Iterator c = children.iterator(); c.hasNext(); ) { XSDElementDeclaration ce = (XSDElementDeclaration) c.next(); if (at.getName().equals(ce.getName())) { found = true; if (ce.getContainer() instanceof XSDParticle) { XSDParticle part = (XSDParticle) ce.getContainer(); at.setMinOccurs(part.getMinOccurs()); at.setMaxOccurs(part.getMaxOccurs());
/** Returns the name of the element represented by the particle as a QName. */ public static QName getParticleName(XSDParticle particle) { XSDElementDeclaration content = (XSDElementDeclaration) particle.getContent(); if (content.isElementDeclarationReference()) { content = content.getResolvedElementDeclaration(); } return new QName(content.getTargetNamespace(), content.getName()); }
XSDFactory factory = XSDFactory.eINSTANCE; XSDComplexTypeDefinition definition = factory.createXSDComplexTypeDefinition(); definition.setName(type.getName().getLocalPart()); definition.setDerivationMethod(XSDDerivationMethod.EXTENSION_LITERAL); XSDModelGroup attributes = factory.createXSDModelGroup(); attributes.setCompositor(XSDCompositor.SEQUENCE_LITERAL); XSDElementDeclaration attribute = factory.createXSDElementDeclaration(); attribute.setName(attributeDescriptor.getLocalName()); attribute.setNillable(attributeDescriptor.isNillable()); if (xsd.resolveTypeDefinition(name.getNamespaceURI(), name.getLocalPart()) == null) { throw new IllegalStateException( "No type for " + attribute.getName() + " (" + binding.getName() xsd.resolveTypeDefinition(name.getNamespaceURI(), name.getLocalPart()); attribute.setTypeDefinition(attributeDefinition); xsd.getContents().add(definition);
protected void createAttributeElementDeclaration(EAttribute attribute, XSDComplexTypeDefinition xsdComplexTypeDefinition) { XSDModelGroup modelGroup = getModelGroup(xsdComplexTypeDefinition); XSDElementDeclaration xsdElementDeclaration = XSDFactory.eINSTANCE.createXSDElementDeclaration(); xsdElementDeclaration.setName(getName(attribute)); // If the attribute can have a null value (primitives and enums can't), and // if the attribute can hold many nulls or // it can hold only a single value that is allowed to be null // and it can be considered set when it has the null value... // if (attribute.getEType().getDefaultValue() == null && (attribute.isMany() || (!attribute.isRequired() && (attribute.getDefaultValueLiteral() != null || attribute.isUnsettable())))) { xsdElementDeclaration.setNillable(true); } if (xsdElementDeclaration.isNillable() || attribute.isMany() || !minimizedXMI) { XSDSimpleTypeDefinition attrType = getType(attribute.getEAttributeType()); if (attrType != null) { xsdElementDeclaration.setTypeDefinition(attrType); } XSDParticle particle = XSDFactory.eINSTANCE.createXSDParticle(); particle.setContent(xsdElementDeclaration); setAttributeElementMultiplicity(attribute, particle); modelGroup.getContents().add(particle); map(particle, attribute); } }
protected void makeReferenceElement(EReference reference, XSDComplexTypeDefinition xsdComplexTypeDefinition) { XSDModelGroup modelGroup = getModelGroup(xsdComplexTypeDefinition); XSDElementDeclaration xsdElementDeclaration = XSDFactory.eINSTANCE.createXSDElementDeclaration(); xsdElementDeclaration.setName(getName(reference)); if (reference.isUnsettable() && !reference.isMany()) { xsdElementDeclaration.setNillable(true); } setReferenceElementType(reference, xsdElementDeclaration); XSDParticle particle = XSDFactory.eINSTANCE.createXSDParticle(); particle.setContent(xsdElementDeclaration); setReferenceElementMultiplicity(reference, particle); modelGroup.getContents().add(particle); map(particle, reference); }
protected XSDElementDeclaration buildGlobalElement(XSDSchema xsdSchema, EClass eClass) { XSDElementDeclaration xsdElementDeclaration = XSDFactory.eINSTANCE.createXSDElementDeclaration(); xsdElementDeclaration.setName(extendedMetaData.getName(eClass)); XSDTypeDefinition xsdTypeDefinition = xsdSchema.resolveTypeDefinitionURI(getURI(eClass)); handleImport(xsdSchema, xsdTypeDefinition); xsdElementDeclaration.setTypeDefinition(xsdTypeDefinition); xsdSchema.getContents().add(xsdElementDeclaration); map(xsdElementDeclaration, eClass); createEcoreAnnotation(xsdElementDeclaration, "ignore", "true"); return xsdElementDeclaration; }
@SuppressWarnings("unchecked") protected XSDSchema xsd(SimpleFeatureType simpleFeatureType) throws IOException { XSDFactory factory = XSDFactory.eINSTANCE; XSDSchema xsd = factory.createXSDSchema(); xsd.setSchemaForSchemaQNamePrefix("xsd"); xsd.getQNamePrefixToNamespaceMap().put("xsd", XSDConstants.SCHEMA_FOR_SCHEMA_URI_2001); xsd.setElementFormDefault(XSDForm.get(XSDForm.QUALIFIED)); XSDImport gml = factory.createXSDImport(); gml.setNamespace(gmlNamespace); gml.setSchemaLocation(baseURL.toString() + "/" + gmlLocation); gml.setResolvedSchema(gmlConfiguration.getXSD().getSchema()); xsd.getContents().add(gml); xsd.getQNamePrefixToNamespaceMap().put("gml", gmlNamespace); xsd.getQNamePrefixToNamespaceMap().put("gml", "http://www.opengis.net/gml"); XSDElementDeclaration element = factory.createXSDElementDeclaration(); element.setName(simpleFeatureType.getTypeName()); XSDElementDeclaration _FEATURE = xsd.resolveElementDeclaration(gmlNamespace, "_Feature"); element.setSubstitutionGroupAffiliation(_FEATURE); element.setTypeDefinition(featureType); xsd.getContents().add(element); xsd.updateElement(); return xsd;
XSDElementDeclaration element = f.createXSDElementDeclaration(); element.setName(attribute.getLocalName()); element.setNillable(attribute.isNillable()); Class binding = attribute.getType().getBinding(); if (Point.class.isAssignableFrom(binding)) { element.setTypeDefinition( schemaIndex.getTypeDefinition(gml.qName("PointPropertyType"))); } else if (LineString.class.isAssignableFrom(binding)) { element.setTypeDefinition( searchType(schemaIndex, "LineStringPropertyType", "CurvePropertyType")); } else if (Polygon.class.isAssignableFrom(binding)) { element.setTypeDefinition( searchType(schemaIndex, "PolygonPropertyType", "SurfacePropertyType")); } else if (MultiPoint.class.isAssignableFrom(binding)) { element.setTypeDefinition( schemaIndex.getTypeDefinition(gml.qName("MultiPointPropertyType"))); } else if (MultiLineString.class.isAssignableFrom(binding)) { element.setTypeDefinition( searchType( schemaIndex, element.setTypeDefinition( searchType( schemaIndex,
private void buildSchemaContent( FeatureTypeInfo featureTypeMeta, XSDSchema schema, XSDFactory factory, String baseUrl) throws IOException { if (!findTypeInSchema(featureTypeMeta, schema, factory)) { // build the type manually FeatureType featureType = featureTypeMeta.getFeatureType(); if (featureTypeMeta.isCircularArcPresent() && this.getClass().equals(GML3.class)) { featureType = new CurveTypeWrapper(featureType); } XSDComplexTypeDefinition xsdComplexType = buildComplexSchemaContent(featureType, schema, factory); XSDElementDeclaration element = factory.createXSDElementDeclaration(); element.setName(featureTypeMeta.getName()); element.setTargetNamespace(featureTypeMeta.getNamespace().getURI()); synchronized (Schemas.class) { // this call changes the global schemas too, need to be synchronized element.setSubstitutionGroupAffiliation(getFeatureElement()); } element.setTypeDefinition(xsdComplexType); schema.getContents().add(element); schema.updateElement(); } }
protected XSDElementDeclaration buildGlobalElement(XSDSchema xsdSchema, EStructuralFeature eStructuralFeature) { XSDElementDeclaration xsdElementDeclaration = XSDFactory.eINSTANCE.createXSDElementDeclaration(); xsdElementDeclaration.setName(extendedMetaData.getName(eStructuralFeature)); EClassifier eType = eStructuralFeature.getEType(); XSDTypeDefinition xsdTypeDefinition = xsdSchema.resolveTypeDefinitionURI(getURI(eType)); handleImport(xsdSchema, xsdTypeDefinition); xsdElementDeclaration.setTypeDefinition(xsdTypeDefinition); if (isWrapperType(eType)) { xsdElementDeclaration.setNillable(true); } String defaultValue = eStructuralFeature.getDefaultValueLiteral(); if (defaultValue != null) { xsdElementDeclaration.setConstraint(XSDConstraint.DEFAULT_LITERAL); xsdElementDeclaration.setLexicalValue(defaultValue); } xsdSchema.getContents().add(xsdElementDeclaration); map(xsdElementDeclaration, eStructuralFeature); if (eStructuralFeature.eIsSet(EcorePackage.Literals.ETYPED_ELEMENT__EGENERIC_TYPE)) { createEcoreAnnotation(xsdElementDeclaration, "type", getGenericType(xsdSchema, eStructuralFeature.getEGenericType())); } buildAnnotations(xsdElementDeclaration, eStructuralFeature); return xsdElementDeclaration; }
root = XSDFactory.eINSTANCE.createXSDElementDeclaration(); root.setName(name.getLocalPart()); root.setTargetNamespace(name.getNamespaceURI()); root.setTypeDefinition(type); if (entry.element.isAbstract()) { List sub = safeCopy(entry.element.getSubstitutionGroup()); if (e.getName() == null) { continue; new QName(e.getTargetNamespace(), e.getName()), context); XSDTypeDefinition type = e.getType(); new StringBuffer( "Found multiple non-abstract bindings for "); msg.append(entry.element.getName()).append(": "); if (entry.element.isAbstract()) { logger.fine(entry.element.getName() + " is abstract"); entry.object, entry.element, entry.parent.element.getType()) : (Element) encode(entry.object, entry.element);
if (!xsdType.getTargetNamespace().equals(schema.getTargetNamespace())) { return findType(xsdType); for (Iterator itr = children.iterator(); itr.hasNext();) { XSDParticle particle = (XSDParticle) itr.next(); XSDElementDeclaration element = (XSDElementDeclaration) particle.getContent(); if (element.isElementDeclarationReference()) { element = element.getResolvedElementDeclaration(); XSDTypeDefinition childType = element.getTypeDefinition(); if (childType == null) { childType = findGlobalElementXSDType(element); int minOccurs = particle.getMinOccurs(); int maxOccurs = particle.getMaxOccurs(); if (maxOccurs == -1) { maxOccurs = Integer.MAX_VALUE; boolean isNillable = element.isNillable(); if (type == null) { for (Iterator a = schema.getAttributeDeclarations().iterator(); a.hasNext();) { XSDAttributeDeclaration ad = (XSDAttributeDeclaration) a.next(); if (Utilities.equals(ad.getTargetNamespace(), attribute.getTargetNamespace())
descriptor.getUserData().put("substitutionGroup", substitutionGroup); int minOccurs = Schemas.getMinOccurs(container, elemDecl); int maxOccurs = Schemas.getMaxOccurs(container, elemDecl); boolean nillable = elemDecl.isNillable(); Iterator substitutions = elemDecl.getSubstitutionGroup().iterator(); XSDElementDeclaration sub; while (substitutions.hasNext()) { sub = (XSDElementDeclaration) substitutions.next(); if (!(sub.getName().equals(elemDecl.getName())) || !(sub.getTargetNamespace().equals(elemDecl.getTargetNamespace()))) { Name elemName = Types.typeName(sub.getTargetNamespace(), sub.getName()); AttributeType type = getTypeOf(sub, crs); if (type != null) { XSDTypeDefinition typeDef = elemDecl.getType(); Collection<PropertyDescriptor> children = complexType.getDescriptors(); if (element.isElementDeclarationReference()) { element = element.getResolvedElementDeclaration(); if (desc.getName().getLocalPart().equals(element.getName()) && desc.getName().getNamespaceURI() .equals(element.getTargetNamespace())) { childDesc = desc; break;
boolean nillable = elemDecl.isNillable(); Iterator substitutions = elemDecl.getSubstitutionGroup().iterator(); XSDElementDeclaration sub; while (substitutions.hasNext()) { sub = (XSDElementDeclaration) substitutions.next(); if (!(sub.getName().equals(elemDecl.getName())) || !(sub.getTargetNamespace().equals(elemDecl.getTargetNamespace()))) { Name elemName = Types.typeName(sub.getTargetNamespace(), sub.getName()); AttributeType type = getTypeOf(sub, crs); if (type != null) { XSDTypeDefinition typeDef = elemDecl.getType(); (XSDElementDeclaration) particle.getContent(); if (element.isElementDeclarationReference()) { element = element.getResolvedElementDeclaration(); if (desc.getName().getLocalPart().equals(element.getName()) && desc.getName() .getNamespaceURI() .equals(element.getTargetNamespace())) { childDesc = desc; break;
public FeatureTypeContext(SimpleFeature f, GMLDelegate gml) { this.featureType = f.getFeatureType(); QName featureName = new QName( featureType.getName().getNamespaceURI(), featureType.getName().getLocalPart()); // look up the element in the schema XSDElementDeclaration element = encoder.getSchemaIndex().getElementDeclaration(featureName); if (element == null) { // create one element = XSDFactory.eINSTANCE.createXSDElementDeclaration(); element.setName(featureType.getName().getLocalPart()); element.setTargetNamespace(featureType.getName().getNamespaceURI()); element.setTypeDefinition( encoder.getSchemaIndex().getTypeDefinition(GML.AbstractFeatureType)); } // look up all the bindings for each property BindingLoader bindingLoader = encoder.getBindingLoader(); // get all the properties List properties = gml.getFeatureProperties(f, element, encoder); attributes = setupAttributeContexts(properties, featureType, bindingLoader); featureQualifiedName = getFeatureQualifiedName(featureName); }
if (child.isElementDeclarationReference()) { child = child.getResolvedElementDeclaration(); XSDFactory.eINSTANCE.createXSDElementDeclaration(); elementDecl.setTargetNamespace(Encoder.COMMENT.getNamespaceURI()); elementDecl.setName(Encoder.COMMENT.getLocalPart()); elementDecl.setElement(comment); element.getType(), name.getLocalPart(), true); if (particle != null) { particles.put(name, particle); Schemas.getChildElementParticles(element.getType(), true) .iterator(); p.hasNext(); ) { XSDParticle particle = (XSDParticle) p.next(); XSDElementDeclaration el = (XSDElementDeclaration) particle.getContent(); if (el.isElementDeclarationReference()) { el = el.getResolvedElementDeclaration(); XSDParticle particle = XSDFactory.eINSTANCE.createXSDParticle(); XSDElementDeclaration wrapper = XSDFactory.eINSTANCE.createXSDElementDeclaration(); wrapper.setResolvedElementDeclaration(elementDecl); if (child.getResolvedElementDeclaration() != null) { child = child.getResolvedElementDeclaration(); if (partContent.getResolvedElementDeclaration() != null) { partContent = partContent.getResolvedElementDeclaration();
for (SimpleLiteral sl : record.getDCElement()) { XSDSchema dctSchema = DCT.getInstance().getSchema(); XSDElementDeclaration declaration = dctSchema.resolveElementDeclaration(sl.getName()); if (declaration.getTypeDefinition() == null) { XSDSchema dcSchema = DC.getInstance().getSchema(); declaration = dcSchema.resolveElementDeclaration(sl.getName()); if (record.getBoundingBox() != null && record.getBoundingBox().size() > 0) { for (Object box : record.getBoundingBox()) { XSDElementDeclaration bboxElement; OWS.getInstance() .getSchema() .resolveElementDeclaration("WGS84BoundingBox"); } else { bboxElement =