Package org.geotools.data.complex
Class DataAccessMappingFeatureIterator
Object
AbstractMappingFeatureIterator
DataAccessMappingFeatureIterator
- All Implemented Interfaces:
Closeable,AutoCloseable,Iterator<Feature>,IMappingFeatureIterator,FeatureIterator<Feature>
- Direct Known Subclasses:
MappingAttributeIterator,XmlMappingFeatureIterator
A Feature iterator that operates over the FeatureSource of a
FeatureTypeMapping and produces Features of the output schema by applying the
mapping rules to the Features of the source schema.
This iterator acts like a one-to-one mapping, producing a Feature of the target type for each feature of the source type.
- Since:
- 2.4
- Author:
- Gabriel Roldan (Axios Engineering), Ben Caradoc-Davies (CSIRO Earth Science and Resource Engineering), Rini Angreani (CSIRO Earth Science and Resource Engineering), Russell Petty (GeoScience Victoria)
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected FeatureThis is the feature that will be processed in next()protected List<Expression>protected FeatureSource<? extends FeatureType,? extends Feature> protected CoordinateReferenceSystemReprojected CRS from the source simple features, or nullprotected FeatureCollection<? extends FeatureType,? extends Feature> protected AttributeDescriptorFields inherited from class AbstractMappingFeatureIterator
attf, dataMaxFeatures, featureCounter, filterFac, ftf, GEOMETRY_FACTORY, includeMandatory, LOGGER, mapping, MULTI_VALUE_TYPE, namespaceAwareFilterFactory, namespaces, query, requestMaxFeatures, RESOLVE_TIMEOUT_POLL_INTERVAL, resolveDepth, resolveTimeOut, selectedMapping, selectedProperties, store, transaction, UNBOUNDED_MULTI_VALUE, XLINK_HREF_NAME, xpathAttributeBuilder -
Constructor Summary
ConstructorsConstructorDescriptionDataAccessMappingFeatureIterator(AppSchemaDataAccess store, FeatureTypeMapping mapping, Query query) DataAccessMappingFeatureIterator(AppSchemaDataAccess store, FeatureTypeMapping mapping, Query query, boolean isFiltered, boolean removeQueryLimitIfDenormalised) DataAccessMappingFeatureIterator(AppSchemaDataAccess store, FeatureTypeMapping mapping, Query query, boolean isFiltered, boolean removeQueryLimitIfDenormalised, boolean hasPostFilter) DataAccessMappingFeatureIterator(AppSchemaDataAccess store, FeatureTypeMapping mapping, Query query, boolean isFiltered, boolean removeQueryLimitIfDenormalised, boolean hasPostFilter, Transaction transaction) DataAccessMappingFeatureIterator(AppSchemaDataAccess store, FeatureTypeMapping mapping, Query query, Query unrolledQuery, boolean removeQueryLimitIfDenormalised) DataAccessMappingFeatureIterator(AppSchemaDataAccess store, FeatureTypeMapping mapping, Query query, Query unrolledQuery, boolean removeQueryLimitIfDenormalised, Transaction transaction) -
Method Summary
Modifier and TypeMethodDescriptionbooleancheckForeignIdValues(List<Object> foreignIdValues) Only used for Joining, to make sure that rows with different foreign id's aren't interpreted as one feature and merged.protected booleancheckForeignIdValues(List<Object> foreignIdValues, Feature next) Only used for Joining, to make sure that rows with different foreign id's aren't interpreted as one feature and merged.protected voidcleanEmptyElements(Feature target) protected voidprotected Featureprotected StringextractIdForAttribute(Expression idExpression, Object sourceInstance) Based on the set of xpath expression/id extracting expression, finds the ID for the attributeidExpressionfrom the source complex attribute.protected StringextractIdForFeature(Feature feature) getForeignIdValues(Object source) Only used for Joining, to make sure that rows with different foreign id's aren't interpreted as one feature and merged.getIdValues(Object source) Only used for Joining, to make sure that rows with different foreign id's aren't interpreted as one feature and merged.FeatureSource<? extends FeatureType,? extends Feature> For testing purposes.protected Stringprotected FeatureIterator<? extends Feature>getSources(String id) Get all source features of the provided id.protected ObjectgetValue(Expression expression, Object sourceFeature) protected ObjectgetValues(boolean isMultiValued, Expression expression, Object sourceFeatureInput) booleanhasNext()Does another Feature exist in this Iteration.protected voidinitialiseSourceFeatures(FeatureTypeMapping mapping, Query query, CoordinateReferenceSystem targetCRS) protected booleanisByReference(Map<Name, Expression> clientPropsMappings, boolean isNested) Checks if client property has xlink:ref in it, if the attribute is for chained features.protected booleanbooleanisReprojectionCrsEqual(CoordinateReferenceSystem source, CoordinateReferenceSystem target) protected booleanbooleanpeekNextValue(Expression prop) protected ObjectpeekValue(Object source, Expression prop) protected Featureprotected AttributesetAttributeValue(Attribute target, String id, Object source, AttributeMapping attMapping, Object values, XPathUtil.StepList inputXpath, List<PropertyName> selectedProperties) Sets the values of grouping attributes.voidsetForeignIds(List<Expression> ids) Only used for Joining, to make sure that rows with different foreign id's aren't interpreted as one feature and merged.voidsetListFilter(Filter filter) setNextFeature(String fId, List<Object> foreignIdValues) protected voidsetXlinkReference(Attribute target, Map<Name, Expression> clientPropsMappings, Object value, XPathUtil.StepList xpath, AttributeType targetNodeType) Set xlink:href client property for multi-valued chained features.skip()voidskipNestedMapping(AttributeMapping attMapping, List<Feature> sources) protected booleanskipTopElement(Name topElement, AttributeMapping attMapping, AttributeType type) protected booleanprotected booleanMethods inherited from class AbstractMappingFeatureIterator
close, getClientProperties, getTransaction, getUnrolledQuery, isHasNextCalled, next, referenceToIdentifier, remove, setAttributeContent, setClientProperties, setGeometryUserData, setHasNextCalledMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Iterator
forEachRemaining
-
Field Details
-
reprojection
Reprojected CRS from the source simple features, or null -
curSrcFeature
This is the feature that will be processed in next() -
mappedSource
-
sourceFeatures
-
foreignIds
-
targetFeature
-
-
Constructor Details
-
DataAccessMappingFeatureIterator
public DataAccessMappingFeatureIterator(AppSchemaDataAccess store, FeatureTypeMapping mapping, Query query, boolean isFiltered, boolean removeQueryLimitIfDenormalised) throws IOException - Throws:
IOException
-
DataAccessMappingFeatureIterator
public DataAccessMappingFeatureIterator(AppSchemaDataAccess store, FeatureTypeMapping mapping, Query query, boolean isFiltered, boolean removeQueryLimitIfDenormalised, boolean hasPostFilter) throws IOException - Throws:
IOException
-
DataAccessMappingFeatureIterator
public DataAccessMappingFeatureIterator(AppSchemaDataAccess store, FeatureTypeMapping mapping, Query query, boolean isFiltered, boolean removeQueryLimitIfDenormalised, boolean hasPostFilter, Transaction transaction) throws IOException - Throws:
IOException
-
DataAccessMappingFeatureIterator
public DataAccessMappingFeatureIterator(AppSchemaDataAccess store, FeatureTypeMapping mapping, Query query) throws IOException - Throws:
IOException
-
DataAccessMappingFeatureIterator
public DataAccessMappingFeatureIterator(AppSchemaDataAccess store, FeatureTypeMapping mapping, Query query, Query unrolledQuery, boolean removeQueryLimitIfDenormalised) throws IOException - Parameters:
mapping- place holder for the target type, the surrogate FeatureSource and the mappings between them.query- the query over the target feature type, that is to be unpacked to its equivalent over the surrogate feature type.- Throws:
IOException
-
DataAccessMappingFeatureIterator
public DataAccessMappingFeatureIterator(AppSchemaDataAccess store, FeatureTypeMapping mapping, Query query, Query unrolledQuery, boolean removeQueryLimitIfDenormalised, Transaction transaction) throws IOException - Throws:
IOException
-
-
Method Details
-
isTransactionOwner
public boolean isTransactionOwner() -
hasNext
public boolean hasNext()Description copied from interface:FeatureIteratorDoes another Feature exist in this Iteration.Iterator defin: Returns true if the iteration has more elements. (In other words, returns true if next would return an element rather than throwing an exception.)
- Specified by:
hasNextin interfaceFeatureIterator<Feature>- Specified by:
hasNextin interfaceIterator<Feature>- Specified by:
hasNextin classAbstractMappingFeatureIterator- Returns:
- true if more Features exist, false otherwise.
-
getSourceFeatureIterator
- Specified by:
getSourceFeatureIteratorin classAbstractMappingFeatureIterator
-
isSourceFeatureIteratorNull
protected boolean isSourceFeatureIteratorNull()- Specified by:
isSourceFeatureIteratorNullin classAbstractMappingFeatureIterator
-
peekValue
-
peekNextValue
-
setForeignIds
Only used for Joining, to make sure that rows with different foreign id's aren't interpreted as one feature and merged. -
getForeignIdValues
Only used for Joining, to make sure that rows with different foreign id's aren't interpreted as one feature and merged. -
checkForeignIdValues
Only used for Joining, to make sure that rows with different foreign id's aren't interpreted as one feature and merged. -
getIdValues
Only used for Joining, to make sure that rows with different foreign id's aren't interpreted as one feature and merged. -
checkForeignIdValues
Only used for Joining, to make sure that rows with different foreign id's aren't interpreted as one feature and merged. -
initialiseSourceFeatures
protected void initialiseSourceFeatures(FeatureTypeMapping mapping, Query query, CoordinateReferenceSystem targetCRS) throws IOException - Specified by:
initialiseSourceFeaturesin classAbstractMappingFeatureIterator- Throws:
IOException
-
unprocessedFeatureExists
protected boolean unprocessedFeatureExists()- Specified by:
unprocessedFeatureExistsin classAbstractMappingFeatureIterator
-
extractIdForFeature
-
extractIdForAttribute
Description copied from class:AbstractMappingFeatureIteratorBased on the set of xpath expression/id extracting expression, finds the ID for the attributeidExpressionfrom the source complex attribute.- Specified by:
extractIdForAttributein classAbstractMappingFeatureIterator- Parameters:
idExpression- the location path of the attribute to be created, for which to obtain the id by evaluating the correspondingorg.geotools.filter.ExpressionfromsourceInstance.sourceInstance- a complex attribute which is the source of the mapping.- Returns:
- the ID to be applied to a new attribute instance addressed by
attributeXPath, ornullif there is no an id mapping for that attribute.
-
isNextSourceFeatureNull
protected boolean isNextSourceFeatureNull()- Specified by:
isNextSourceFeatureNullin classAbstractMappingFeatureIterator
-
sourceFeatureIteratorHasNext
protected boolean sourceFeatureIteratorHasNext()- Specified by:
sourceFeatureIteratorHasNextin classAbstractMappingFeatureIterator
-
getValues
-
setAttributeValue
protected Attribute setAttributeValue(Attribute target, String id, Object source, AttributeMapping attMapping, Object values, XPathUtil.StepList inputXpath, List<PropertyName> selectedProperties) throws IOException Sets the values of grouping attributes.- Returns:
- Feature. Target feature sets with simple attributes
- Throws:
IOException
-
setXlinkReference
protected void setXlinkReference(Attribute target, Map<Name, Expression> clientPropsMappings, Object value, XPathUtil.StepList xpath, AttributeType targetNodeType) Set xlink:href client property for multi-valued chained features. This has to be specially handled because we don't want to encode the nested features attributes, since it's already an xLink. Also we need to eliminate duplicates.- Parameters:
target- The target attributeclientPropsMappings- Client properties mappingsvalue- Nested featuresxpath- Attribute xPath where the client properties are to be settargetNodeType- Target node type
-
setNextFeature
- Throws:
IOException
-
skipNestedMapping
public void skipNestedMapping(AttributeMapping attMapping, List<Feature> sources) throws IOException - Throws:
IOException
-
skip
- Throws:
IOException
-
computeNext
- Specified by:
computeNextin classAbstractMappingFeatureIterator- Throws:
IOException
-
getSources
Get all source features of the provided id. This assumes the source features are grouped by id.- Parameters:
id- The feature id- Returns:
- list of source features
- Throws:
IOException
-
getNextFeatureId
-
cleanEmptyElements
- Throws:
DataSourceException
-
skipTopElement
-
populateFeatureData
- Specified by:
populateFeatureDatain classAbstractMappingFeatureIterator- Throws:
IOException
-
closeSourceFeatures
protected void closeSourceFeatures()- Specified by:
closeSourceFeaturesin classAbstractMappingFeatureIterator
-
getValue
- Specified by:
getValuein classAbstractMappingFeatureIterator
-
isByReference
Checks if client property has xlink:ref in it, if the attribute is for chained features.- Parameters:
clientPropsMappings- the client properties mappingsisNested- true if we're dealing with chained/nested features
-
isReprojectionCrsEqual
public boolean isReprojectionCrsEqual(CoordinateReferenceSystem source, CoordinateReferenceSystem target) -
setListFilter
-
getMappedSource
For testing purposes.- Returns:
- the feature source providing input features to be mapped to target features
-