/** * 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; }
(Object) new ArrayList<ReferencedEnvelope>(boxes)); addElement( recordDescriptor.getBoundingBoxPropertyName(), Collections.singletonList((Object) geom), userData,
@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(); }
if (path.equalsIgnoreCase(rd.getBoundingBoxPropertyName())) { return ff.property("boundingBox");