public static AttributeDescriptor[] getFeatureDescriptors(RecordDescriptor[] rds) { AttributeDescriptor[] attds = new AttributeDescriptor[rds.length]; for (int i = 0; i < rds.length; i++) { attds[i] = rds[i].getFeatureDescriptor(); } return attds; }
public static AttributeDescriptor[] getFeatureDescriptors(RecordDescriptor[] rds) { AttributeDescriptor[] attds = new AttributeDescriptor[rds.length]; for (int i=0; i<rds.length; i++) { attds[i] = rds[i].getFeatureDescriptor(); } return attds; }
private Set<Name> getSupportedTypes() throws IOException { Set<Name> result = new HashSet<Name>(); for (RecordDescriptor rd : store.getRecordDescriptors()) { result.add(rd.getFeatureDescriptor().getName()); } return result; }
private Set<Name> getSupportedTypes() throws IOException { Set<Name> result = new HashSet<Name>(); for (RecordDescriptor rd : store.getRecordDescriptors()) { result.add(rd.getFeatureDescriptor().getName()); } return result; }
protected void support(RecordDescriptor descriptor) { descriptorByType.put(descriptor.getFeatureDescriptor().getName(), descriptor); descriptorByOutputSchema.put(descriptor.getOutputSchema(), descriptor); }
/** * Create a submapping from a list of property names * Required properties will also be included. * * @param properties list of property names to be included in submapping * @param rd Record Descriptor * @return */ public CatalogStoreMapping subMapping(List<PropertyName> properties, RecordDescriptor rd) { Set<String> paths = new HashSet<String>(); for (PropertyName prop : properties) { paths.add(toDotPath(XPathUtil.steps( rd.getFeatureDescriptor() , prop.toString(), rd.getNamespaceSupport()))); } CatalogStoreMapping mapping = new CatalogStoreMapping(); for ( Entry<String, CatalogStoreMappingElement> element : mappingElements.entrySet()) { if (element.getValue().isRequired() || paths.contains(element.getKey())) { mapping.mappingElements.put(element.getKey(), element.getValue()); } } mapping.identifier = identifier; mapping.includeEnvelope = includeEnvelope && paths.contains( rd.getBoundingBoxPropertyName() ); return mapping; }
/** * Create a submapping from a list of property names Required properties will also be included. * * @param properties list of property names to be included in submapping * @param rd Record Descriptor */ public CatalogStoreMapping subMapping(List<PropertyName> properties, RecordDescriptor rd) { Set<String> paths = new HashSet<String>(); for (PropertyName prop : properties) { paths.add( toDotPath( XPathUtil.steps( rd.getFeatureDescriptor(), prop.toString(), rd.getNamespaceSupport()))); } CatalogStoreMapping mapping = new CatalogStoreMapping(); for (Entry<String, CatalogStoreMappingElement> element : mappingElements.entrySet()) { if (element.getValue().isRequired() || paths.contains(element.getKey())) { mapping.mappingElements.put(element.getKey(), element.getValue()); } } mapping.identifier = identifier; mapping.includeEnvelope = includeEnvelope && paths.contains(rd.getBoundingBoxPropertyName()); return mapping; }
/** * Search for the record descriptor maching the typename, throws a service exception in case none * is found * * @param request * @return */ private RecordDescriptor getRecordDescriptor(Name typeName) { if (typeName == null) { return CSWRecordDescriptor.getInstance(); } for (RecordDescriptor rd : recordDescriptors) { if (typeName.equals(rd.getFeatureDescriptor().getName())) { return rd; } } throw new ServiceException("Unknown type: " + typeName, ServiceException.INVALID_PARAMETER_VALUE, "typeNames"); }
/** * Start Generic Record Builder based on the Record Descriptor * * @param recordDescriptor The Record Descriptor */ public GenericRecordBuilder(RecordDescriptor recordDescriptor) { this.recordDescriptor = recordDescriptor; fb = new ComplexFeatureBuilder(recordDescriptor.getFeatureDescriptor()); for (PropertyDescriptor descriptor : recordDescriptor.getFeatureType().getDescriptors()) { @SuppressWarnings("unchecked") List<AttributeDescriptor> substitutionGroup = (List<AttributeDescriptor>) descriptor.getUserData().get("substitutionGroup"); if (substitutionGroup != null) { for (Iterator<AttributeDescriptor> it = substitutionGroup.iterator(); it.hasNext(); ) { substitutionMap.put(it.next().getName(), descriptor.getName()); } } substitutionMap.put(descriptor.getName(), descriptor.getName()); } }
public GetDomain(CSWInfo csw, CatalogStore store) { this.csw = csw; this.store = store; try { for (RecordDescriptor rd : store.getRecordDescriptors()) { for (Name prop : store.getCapabilities().getDomainQueriables(rd.getFeatureDescriptor().getName())) { attributeTypeMap.put(prop, rd.getFeatureDescriptor().getName()); Enumeration declaredPrefixes = rd.getNamespaceSupport().getDeclaredPrefixes(); while (declaredPrefixes.hasMoreElements()) { String prefix = (String) declaredPrefixes.nextElement(); String uri = rd.getNamespaceSupport().getURI(prefix); ns.declarePrefix(prefix, uri); } } } } catch (IOException e) { throw new ServiceException(e, "Failed to retrieve the domain values", ServiceException.NO_APPLICABLE_CODE); } }
public GetDomain(CSWInfo csw, CatalogStore store) { this.csw = csw; this.store = store; try { for (RecordDescriptor rd : store.getRecordDescriptors()) { for (Name prop : store.getCapabilities() .getDomainQueriables(rd.getFeatureDescriptor().getName())) { attributeTypeMap.put(prop, rd.getFeatureDescriptor().getName()); Enumeration declaredPrefixes = rd.getNamespaceSupport().getDeclaredPrefixes(); while (declaredPrefixes.hasMoreElements()) { String prefix = (String) declaredPrefixes.nextElement(); String uri = rd.getNamespaceSupport().getURI(prefix); ns.declarePrefix(prefix, uri); } } } } catch (IOException e) { throw new ServiceException( e, "Failed to retrieve the domain values", ServiceException.NO_APPLICABLE_CODE); } }
/** * Search for the record descriptor maching the typename, throws a service exception in case * none is found * * @param request */ private RecordDescriptor getRecordDescriptor(Name typeName) { if (typeName == null) { return CSWRecordDescriptor.getInstance(); } for (RecordDescriptor rd : recordDescriptors) { if (typeName.equals(rd.getFeatureDescriptor().getName())) { return rd; } } throw new ServiceException( "Unknown type: " + typeName, ServiceException.INVALID_PARAMETER_VALUE, "typeNames"); }
Name typeName = rd.getFeatureDescriptor().getName(); Query q = new Query(typeName.getLocalPart()); q.setFilter(filter);
private List<Query> toGtQueries(RecordDescriptor rd, EList<URI> ids, GetRecordByIdType request) throws IOException { // prepare to build the queries Set<FeatureId> fids = new HashSet<FeatureId>(); for (URI id : ids) { fids.add(FF.featureId(id.toString())); } Filter filter = FF.id(fids); // build one query Name typeName = rd.getFeatureDescriptor().getName(); Query q = new Query(typeName.getLocalPart()); q.setFilter(filter); // perform some necessary query adjustments Query adapted = rd.adaptQuery(q); // the specification demands that we throw an error if a spatial operator // is used against a non spatial property if (q.getFilter() != null) { rd.verifySpatialFilters(q.getFilter()); } // smuggle base url adapted.getHints().put(GetRecords.KEY_BASEURL, request.getBaseUrl()); List<Query> result = new ArrayList<Query>(); result.add(adapted); return result; }
@Test public void testFeatureTypes() throws IOException { RecordDescriptor[] fts = store.getRecordDescriptors(); assertEquals(1, fts.length); assertEquals(CSWRecordDescriptor.RECORD_DESCRIPTOR, fts[0].getFeatureDescriptor()); }
for (RecordDescriptor rd : store.getRecordDescriptors()) { List<Name> queriables = store.getCapabilities().getQueriables(rd.getFeatureDescriptor().getName()); if (queriables != null && queriables.size() > 0) { DomainType dt = owsf.createDomainType();
@Override public Object visit(PropertyName expression, Object extraData) { XPathUtil.StepList steps = XPathUtil.steps( rd.getFeatureDescriptor() , expression.getPropertyName(), rd.getNamespaceSupport()); if (steps.size()==1 && steps.get(0).getName().getLocalPart().equalsIgnoreCase("AnyText")) { Expression result = ff.literal(" "); for (CatalogStoreMappingElement element : mapping.elements()) { Expression fieldIgnoreNull = ff.function( "if_then_else", ff.function("isNull", element.getContent()), ff.literal(""), element.getContent()); result = ff.function("strConcat", result, ff.function("strConcat", ff.literal(" "), fieldIgnoreNull ) ); } return result; } String path = CatalogStoreMapping.toDotPath(steps); if (path.equalsIgnoreCase(rd.getBoundingBoxPropertyName())) { return ff.property("boundingBox"); } CatalogStoreMappingElement element = mapping.getElement(path); if (element == null) { throw new IllegalArgumentException("Unknown field in mapping: " + expression); } return element.getContent(); }
rd.getFeatureDescriptor(), expression.getPropertyName(), rd.getNamespaceSupport());
CatalogStoreMapping outputMapping = getMapping(rdOutput.getFeatureDescriptor().getName().getLocalPart());
getMapping(rdOutput.getFeatureDescriptor().getName().getLocalPart());