public List<AttributeTypeInfo> loadAttributes(FeatureTypeInfo info) throws IOException { List<AttributeTypeInfo> attributes = new ArrayList(); FeatureType ft = getFeatureType(info); for (PropertyDescriptor pd : ft.getDescriptors()) { AttributeTypeInfo att = catalog.getFactory().createAttribute(); att.setFeatureType(info); att.setName(pd.getName().getLocalPart()); att.setMinOccurs(pd.getMinOccurs()); att.setMaxOccurs(pd.getMaxOccurs()); att.setNillable(pd.isNillable()); att.setBinding(pd.getType().getBinding()); int length = FeatureTypes.getFieldLength(pd); if (length > 0) { att.setLength(length); } attributes.add(att); } return attributes; }
/** * Extracts the AttributeTypeInfo by copying them from the specified feature type. * * @param ft The schema to be harvested * @param info The optional feature type info from which all the attributes belong to */ public List<AttributeTypeInfo> getAttributes(FeatureType ft, FeatureTypeInfo info) { List<AttributeTypeInfo> attributes = new ArrayList<AttributeTypeInfo>(); for (PropertyDescriptor pd : ft.getDescriptors()) { AttributeTypeInfo att = catalog.getFactory().createAttribute(); att.setFeatureType(info); att.setName(pd.getName().getLocalPart()); att.setMinOccurs(pd.getMinOccurs()); att.setMaxOccurs(pd.getMaxOccurs()); att.setNillable(pd.isNillable()); att.setBinding(pd.getType().getBinding()); int length = FeatureTypes.getFieldLength(pd); if (length > 0) { att.setLength(length); } attributes.add(att); } return attributes; }
/** * Returns a list of properties of a simple feature type, including all properties from a given * list, and all mandatory (minoccurs > 0) added. * * @param type feature type * @param propNames given list of properties * @return list of properties including all mandatory properties * @throws IOException */ public static List<PropertyName> addMandatoryProperties( SimpleFeatureType type, List<PropertyName> oldProps) { Iterator<PropertyDescriptor> ii = type.getDescriptors().iterator(); List<PropertyName> properties = new ArrayList<PropertyName>(); while (ii.hasNext()) { PropertyDescriptor descr = ii.next(); PropertyName propName = ff.property(descr.getName()); if (oldProps != null && oldProps.contains(propName)) { properties.add(propName); } else if (((descr.getMinOccurs() > 0) && (descr.getMaxOccurs() != 0))) { // mandatory, add it properties.add(propName); } } return properties; }
int maxOccurs = propertyDescriptor.getMaxOccurs(); if (valueList.size() == maxOccurs) { throw new IndexOutOfBoundsException(
int maxOccurs = descriptor.getMaxOccurs(); Name name = descriptor.getName(); if (GML.NAMESPACE.equals(name.getNamespaceURI())
int maxOccurs = descriptor.getMaxOccurs(); Name name = descriptor.getName(); if (Object.class.equals(binding)) {
public void init(PropertyDescriptor descriptor) { init(); namespace = descriptor.getName().getNamespaceURI(); name = descriptor.getName().getLocalPart(); minOccurs = descriptor.getMinOccurs(); maxOccurs = descriptor.getMaxOccurs(); if (descriptor instanceof AttributeDescriptor) { AttributeDescriptor attribute = (AttributeDescriptor) descriptor; isNillable = attribute.isNillable(); propertyType = attribute.getType(); } if (descriptor instanceof AssociationDescriptor) { AssociationDescriptor association = (AssociationDescriptor) descriptor; propertyType = association.getType(); } }
XSDParticle substitutedChildParticle = XSDFactory.eINSTANCE.createXSDParticle(); substitutedChildParticle.setMaxOccurs(descriptor.getMaxOccurs()); substitutedChildParticle.setMinOccurs(descriptor.getMinOccurs()); XSDElementDeclaration wrapper = XSDParticle substitutedChildParticle = XSDFactory.eINSTANCE.createXSDParticle(); substitutedChildParticle.setMaxOccurs(descriptor.getMaxOccurs()); substitutedChildParticle.setMinOccurs(descriptor.getMinOccurs()); XSDElementDeclaration wrapper = XSDParticle substitutedChildParticle = XSDFactory.eINSTANCE.createXSDParticle(); substitutedChildParticle.setMaxOccurs(descriptor.getMaxOccurs()); substitutedChildParticle.setMinOccurs(descriptor.getMinOccurs()); XSDElementDeclaration wrapper =
/** * Returns a list of properties of a simple feature type, including all properties from a given * list, and all mandatory (minoccurs > 0) added. * * @param type * feature type * @param propNames * given list of properties * @return list of properties including all mandatory properties * @throws IOException */ public static List<PropertyName> addMandatoryProperties(SimpleFeatureType type, List<PropertyName> oldProps) { Iterator<PropertyDescriptor> ii = type.getDescriptors().iterator(); List<PropertyName> properties = new ArrayList<PropertyName>(); while (ii.hasNext()) { PropertyDescriptor descr = ii.next(); PropertyName propName = ff.property(descr.getName()); if (oldProps != null && oldProps.contains(propName)) { properties.add(propName); } else if (((descr.getMinOccurs() > 0) && (descr.getMaxOccurs() != 0))) { // mandatory, add it properties.add(propName); } } return properties; }
private void writeProperty(PropertyDescriptor attr, DataOutput data) throws IOException { writeName(attr.getName(), data); data.writeBoolean(attr.isNillable()); data.writeInt(attr.getMinOccurs()); data.writeInt(attr.getMaxOccurs()); writePropertyType(attr.getType(), data); } }
private void writeProperty(PropertyDescriptor attr, DataOutput data) throws IOException { writeName(attr.getName(), data); data.writeBoolean(attr.isNillable()); data.writeInt(attr.getMinOccurs()); data.writeInt(attr.getMaxOccurs()); writePropertyType(attr.getType(), data); } }
private void writeProperty(PropertyDescriptor attr, DataOutput data) throws IOException { writeName(attr.getName(), data); data.writeBoolean(attr.isNillable()); data.writeInt(attr.getMinOccurs()); data.writeInt(attr.getMaxOccurs()); writePropertyType(attr.getType(), data); } }
private static void writeProperty(PropertyDescriptor attr, DataOutput data) throws IOException { writeName(attr.getName(), data); data.writeBoolean(attr.isNillable()); data.writeInt(attr.getMinOccurs()); data.writeInt(attr.getMaxOccurs()); writePropertyType(attr.getType(), data); }
private static void writeProperty(PropertyDescriptor attr, DataOutput data) throws IOException { writeName(attr.getName(), data); data.writeBoolean(attr.isNillable()); data.writeInt(attr.getMinOccurs()); data.writeInt(attr.getMaxOccurs()); writePropertyType(attr.getType(), data); }
public void init(PropertyDescriptor descriptor) { init(); namespace = descriptor.getName().getNamespaceURI(); name = descriptor.getName().getLocalPart(); minOccurs = descriptor.getMinOccurs(); maxOccurs = descriptor.getMaxOccurs(); if (descriptor instanceof AttributeDescriptor) { AttributeDescriptor attribute = (AttributeDescriptor) descriptor; isNillable = attribute.isNillable(); propertyType = attribute.getType(); } if (descriptor instanceof AssociationDescriptor) { AssociationDescriptor association = (AssociationDescriptor) descriptor; propertyType = association.getType(); } }
private void printAttributeDescriptor(Writer w, PropertyDescriptor attrib) throws IOException { print(w, attrib.getName().toString()); print(w, "\t"); print(w, FieldType.forBinding(attrib.getType().getBinding()).name()); print(w, "\t"); print(w, Integer.toString(attrib.getMinOccurs())); print(w, "\t"); print(w, Integer.toString(attrib.getMaxOccurs())); print(w, "\t"); print(w, Boolean.toString(attrib.isNillable())); PropertyType attrType = attrib.getType(); if (attrType instanceof GeometryType) { GeometryType gt = (GeometryType) attrType; CoordinateReferenceSystem crs = gt.getCoordinateReferenceSystem(); String crsText = CrsTextSerializer.serialize(crs); print(w, "\t"); println(w, crsText); } else { println(w, ""); } }
private void printAttributeDescriptor(Writer w, PropertyDescriptor attrib) throws IOException { print(w, attrib.getName().toString()); print(w, "\t"); print(w, FieldType.forBinding(attrib.getType().getBinding()).name()); print(w, "\t"); print(w, Integer.toString(attrib.getMinOccurs())); print(w, "\t"); print(w, Integer.toString(attrib.getMaxOccurs())); print(w, "\t"); print(w, Boolean.toString(attrib.isNillable())); PropertyType attrType = attrib.getType(); if (attrType instanceof GeometryType) { GeometryType gt = (GeometryType) attrType; CoordinateReferenceSystem crs = gt.getCoordinateReferenceSystem(); String crsText = CrsTextSerializer.serialize(crs); print(w, "\t"); println(w, crsText); } else { println(w, ""); } }
@Override public void funnel(PropertyDescriptor descriptor, PrimitiveSink into) { NameFunnel.funnel(descriptor.getName(), into); PropertyType attrType = descriptor.getType(); NameFunnel.funnel(attrType.getName(), into); FieldType type = FieldType.forBinding(attrType.getBinding()); into.putInt(type.getTag()); into.putBoolean(descriptor.isNillable()); into.putInt(descriptor.getMaxOccurs()); into.putInt(descriptor.getMinOccurs()); if (descriptor instanceof GeometryDescriptor) { CoordinateReferenceSystem crs; crs = ((GeometryDescriptor) descriptor).getCoordinateReferenceSystem(); String srsName; if (crs == null) { srsName = RevObjects.NULL_CRS_IDENTIFIER; } else { srsName = CRS.toSRS(crs); } NullableStringFunnel.funnel(srsName, into); } } };
@Override public void funnel(PropertyDescriptor descriptor, PrimitiveSink into) { NameFunnel.funnel(descriptor.getName(), into); PropertyType attrType = descriptor.getType(); NameFunnel.funnel(attrType.getName(), into); GtEntityType type = GtEntityType.fromBinding(attrType.getBinding()); into.putInt(type.getValue()); into.putBoolean(descriptor.isNillable()); into.putInt(descriptor.getMaxOccurs()); into.putInt(descriptor.getMinOccurs()); if (descriptor instanceof GeometryDescriptor) { CoordinateReferenceSystem crs; crs = ((GeometryDescriptor) descriptor).getCoordinateReferenceSystem(); String srsName; if (crs == null) { srsName = "urn:ogc:def:crs:EPSG::0"; } else { srsName = CRS.toSRS(crs); } NullableStringFunnel.funnel(srsName, into); } } };
@Override public void funnel(PropertyDescriptor descriptor, PrimitiveSink into) { NameFunnel.funnel(descriptor.getName(), into); PropertyType attrType = descriptor.getType(); NameFunnel.funnel(attrType.getName(), into); FieldType type = FieldType.forBinding(attrType.getBinding()); into.putInt(type.getTag()); into.putBoolean(descriptor.isNillable()); into.putInt(descriptor.getMaxOccurs()); into.putInt(descriptor.getMinOccurs()); if (descriptor instanceof GeometryDescriptor) { CoordinateReferenceSystem crs; crs = ((GeometryDescriptor) descriptor).getCoordinateReferenceSystem(); String srsName; if (crs == null) { srsName = RevObjects.NULL_CRS_IDENTIFIER; } else { srsName = CRS.toSRS(crs); } NullableStringFunnel.funnel(srsName, into); } } };