private Map<String, Object> buildDummyFeatureTypeInfo(ComplexAttribute f) { Map<String, Object> dummy = new HashMap<String, Object>(); dummy.put("name", f.getType().getName().getLocalPart()); dummy.put("namespace", getNamespace(f.getType().getName())); dummy.put("prefix", getPrefix(f.getType().getName())); dummy.put("title", "Layer: " + f.getType().getName().getLocalPart()); dummy.put("abstract", "[No Abstract Provided]"); dummy.put("description", "[No Description Provided]"); dummy.put("keywords", new ArrayList<String>()); dummy.put("metadataLinks", new ArrayList<String>()); dummy.put("SRS", "[SRS]"); if (f instanceof Feature) { final GeometryDescriptor gd = ((Feature) f).getType().getGeometryDescriptor(); if (gd != null) { dummy.put("nativeCRS", gd.getCoordinateReferenceSystem()); } } return dummy; }
private SimpleHash buildType(ComplexType ft) { // create a variable "attributes" which his a list of all the // attributes, but at the same time, is a map keyed by name Map<String, Object> attributeMap = new LinkedHashMap<String, Object>(); Collection<PropertyDescriptor> descriptors = ft.getDescriptors(); for (Iterator<PropertyDescriptor> it = descriptors.iterator(); it.hasNext(); ) { PropertyDescriptor descr = it.next(); Map<String, Object> attribute = new HashMap<String, Object>(); attribute.put("name", descr.getName().getLocalPart()); attribute.put("namespace", getNamespace(descr.getName())); attribute.put("prefix", getPrefix(descr.getName())); attribute.put("type", descr.getType().getBinding().getName()); attribute.put( "isGeometry", Boolean.valueOf(Geometry.class.isAssignableFrom(descr.getType().getBinding()))); attributeMap.put(descr.getName().toString(), attribute); } // build up the result, feature type is represented by its name an // attributes SimpleHash map = new SimpleHash(); map.put("attributes", new SequenceMapModel(attributeMap, this)); map.put("name", ft.getName().getLocalPart()); map.put("namespace", getNamespace(ft.getName())); map.put("prefix", getPrefix(ft.getName())); return map; }
public ComplexAttributeImpl(Collection<Property> properties, ComplexType type, Identifier id) { this(properties, new AttributeDescriptorImpl(type, type.getName(), 1, 1, true, null), id); }
public AttributeNodeIterator(AttributeNodePointer pointer, Name name) { this.pointer = pointer; feature = (ComplexAttribute) pointer.getImmediateAttribute(); AttributeDescriptor descriptor = feature.getDescriptor(); Name attName = descriptor == null ? feature.getType().getName() : descriptor.getName(); if (attName.equals(name)) { children = Collections.<Property>singletonList(feature); } else { children = new ArrayList<Property>(feature.getProperties(name)); } position = children.size() > 0 ? 1 : 0; }
Name typeName = featureWrapperAttribute.getType().getName(); ComplexAttribute nestedComplexAttribute = (ComplexAttribute) featureWrapperAttribute.getProperty(typeName);
private void assertPropertyNamesAndTypeNames( ComplexType parentType, Map expectedPropertiesAndTypes) throws Exception { for (Iterator it = expectedPropertiesAndTypes.entrySet().iterator(); it.hasNext(); ) { Map.Entry entry = (Entry) it.next(); Name dName = (Name) entry.getKey(); Name expectedDescriptorTypeName = (Name) entry.getValue(); AttributeDescriptor d = (AttributeDescriptor) Types.descriptor(parentType, dName); assertNotNull("Descriptor " + dName + " not found for type " + parentType.getName(), d); AttributeType type; try { type = (AttributeType) d.getType(); } catch (Exception e) { LOGGER.log( Level.SEVERE, "type not parsed for " + ((AttributeDescriptor) d).getName(), e); throw e; } assertNotNull(type); Name actualTypeName = type.getName(); assertNotNull(actualTypeName); assertNotNull(type.getBinding()); if (expectedDescriptorTypeName != null) { assertEquals( "type mismatch for property " + dName, expectedDescriptorTypeName, actualTypeName); } } }
definition.setName(type.getName().getLocalPart()); definition.setDerivationMethod(XSDDerivationMethod.EXTENSION_LITERAL);
public ComplexAttributeImpl(Collection<Property> properties, ComplexType type, Identifier id) { this(properties, new AttributeDescriptorImpl( type, type.getName(), 1, 1, true, null), id); }
public AttributeNodeIterator(AttributeNodePointer pointer, Name name) { this.pointer = pointer; feature = (ComplexAttribute) pointer.getImmediateNode(); AttributeDescriptor descriptor = feature.getDescriptor(); Name attName = descriptor == null ? feature.getType().getName() : descriptor.getName(); if (attName.equals(name)) { children = Collections.<Property>singletonList(feature); } else { children = new ArrayList<Property>(feature.getProperties(name)); } position = children.size() > 0 ? 1 : 0; }
public AttributeNodeIterator(AttributeNodePointer pointer, Name name) { this.pointer = pointer; feature = (ComplexAttribute) pointer.getImmediateAttribute(); AttributeDescriptor descriptor = feature.getDescriptor(); Name attName = descriptor == null ? feature.getType().getName() : descriptor.getName(); if (attName.equals(name)) { children = Collections.<Property>singletonList(feature); } else { children = new ArrayList<Property>(feature.getProperties(name)); } position = children.size() > 0 ? 1 : 0; }
Assert.assertEquals(typeName, measurementType.getName()); Assert.assertTrue(measurementType.isIdentified()); Assert.assertFalse(measurementType.isAbstract());
+ entry.getKey() + " in type " + type.getName().toString());
public NonFeatureTypeProxy(final ComplexType type, final FeatureTypeMapping mapping, Collection<PropertyDescriptor> schema) { super(type.getName(), null); subject = type; AttributeDescriptor originalTarget = mapping.getTargetFeature(); int maxOccurs = originalTarget.getMaxOccurs(); int minOccurs = originalTarget.getMinOccurs(); boolean nillable = originalTarget.isNillable(); Object defaultValue = originalTarget.getDefaultValue(); Name name = originalTarget.getName(); // create a new descriptor with the wrapped type and set it to the mapping ComplexFeatureTypeFactoryImpl typeFactory = new ComplexFeatureTypeFactoryImpl(); AttributeDescriptor descriptor = typeFactory.createAttributeDescriptor(this, name, minOccurs, maxOccurs, nillable, defaultValue); descriptor.getUserData().putAll(originalTarget.getUserData()); mapping.setTargetFeature(descriptor); this.descriptors = schema; }
private void assertPropertyNamesAndTypeNames(ComplexType parentType, Map expectedPropertiesAndTypes) throws Exception { for (Iterator it = expectedPropertiesAndTypes.entrySet().iterator(); it.hasNext();) { Map.Entry entry = (Entry) it.next(); Name dName = (Name) entry.getKey(); Name expectedDescriptorTypeName = (Name) entry.getValue(); AttributeDescriptor d = (AttributeDescriptor) Types.descriptor(parentType, dName); assertNotNull("Descriptor " + dName + " not found for type " + parentType.getName(), d); AttributeType type; try { type = (AttributeType) d.getType(); } catch (Exception e) { LOGGER.log(Level.SEVERE, "type not parsed for " + ((AttributeDescriptor) d).getName(), e); throw e; } assertNotNull(type); Name actualTypeName = type.getName(); assertNotNull(actualTypeName); assertNotNull(type.getBinding()); if (expectedDescriptorTypeName != null) { assertEquals("type mismatch for property " + dName, expectedDescriptorTypeName, actualTypeName); } } }
/** * Sole constructor * * @param type * The underlying non feature type */ public NonFeatureTypeProxy(final ComplexType type, final FeatureTypeMapping mapping) { super(type.getName(), null); subject = type; AttributeDescriptor originalTarget = mapping.getTargetFeature(); int maxOccurs = originalTarget.getMaxOccurs(); int minOccurs = originalTarget.getMinOccurs(); boolean nillable = originalTarget.isNillable(); Object defaultValue = originalTarget.getDefaultValue(); Name name = originalTarget.getName(); // create a new descriptor with the wrapped type and set it to the mapping ComplexFeatureTypeFactoryImpl typeFactory = new ComplexFeatureTypeFactoryImpl(); AttributeDescriptor descriptor = typeFactory.createAttributeDescriptor(this, name, minOccurs, maxOccurs, nillable, defaultValue); descriptor.getUserData().putAll(originalTarget.getUserData()); mapping.setTargetFeature(descriptor); // smuggle FEATURE_LINK descriptor descriptors = new ArrayList<PropertyDescriptor>(subject.getDescriptors()) { { add(ComplexFeatureConstants.FEATURE_CHAINING_LINK); } }; }