org.geotools.data.complex
Class DataAccessMappingFeatureIterator

java.lang.Object
  extended by org.geotools.data.complex.AbstractMappingFeatureIterator
      extended by org.geotools.data.complex.DataAccessMappingFeatureIterator
All Implemented Interfaces:
java.util.Iterator<org.opengis.feature.Feature>, IMappingFeatureIterator, FeatureIterator<org.opengis.feature.Feature>
Direct Known Subclasses:
FilteringMappingFeatureIterator

public class DataAccessMappingFeatureIterator
extends AbstractMappingFeatureIterator

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
Version:
$Id: DataAccessMappingFeatureIterator.java 35975 2010-08-02 07:09:35Z ang05a $
Author:
Gabriel Roldan, Axios Engineering, Ben Caradoc-Davies, CSIRO Exploration and Mining, Rini Angreani, Curtin University of Technology, Russell Petty, GSV

Field Summary
protected  org.opengis.feature.Feature curSrcFeature
          This is the feature that will be processed in next()
protected  FeatureSource<org.opengis.feature.type.FeatureType,org.opengis.feature.Feature> mappedSource
           
protected  org.opengis.referencing.crs.CoordinateReferenceSystem reprojection
          Reprojected CRS from the source simple features, or null
protected  FeatureCollection<org.opengis.feature.type.FeatureType,org.opengis.feature.Feature> sourceFeatures
           
 
Fields inherited from class org.geotools.data.complex.AbstractMappingFeatureIterator
attf, featureCounter, featureFidMapping, LOGGER, mapping, maxFeatures, namespaceAwareFilterFactory, namespaces, store, XLINK_HREF_NAME, xpathAttributeBuilder
 
Constructor Summary
DataAccessMappingFeatureIterator(AppSchemaDataAccess store, FeatureTypeMapping mapping, Query query, boolean isFiltered, boolean isDenormalised)
           
DataAccessMappingFeatureIterator(AppSchemaDataAccess store, FeatureTypeMapping mapping, Query query, boolean isFiltered, boolean isDenormalised, boolean isQueryUnrolled)
           
 
Method Summary
protected  void closeSourceFeatures()
           
protected  org.opengis.feature.Feature computeNext()
           
protected  java.lang.String extractIdForAttribute(org.opengis.filter.expression.Expression idExpression, java.lang.Object sourceInstance)
          Based on the set of xpath expression/id extracting expression, finds the ID for the attribute idExpression from the source complex attribute.
protected  java.lang.String extractIdForFeature()
           
protected  java.lang.String extractIdForFeature(org.opengis.feature.Feature feature)
           
 void flagNextFeature(boolean isSet)
           
protected  java.util.Iterator<org.opengis.feature.Feature> getSourceFeatureIterator()
           
protected  java.lang.Object getValue(org.opengis.filter.expression.Expression expression, java.lang.Object sourceFeature)
           
protected  java.lang.Object getValues(boolean isMultiValued, org.opengis.filter.expression.Expression expression, java.lang.Object sourceFeatureInput)
           
 boolean hasNext()
          Return true if there are more features.
protected  void initialiseSourceFeatures(FeatureTypeMapping mapping, Query query)
           
protected  boolean isByReference(java.util.Map<org.opengis.feature.type.Name,org.opengis.filter.expression.Expression> clientPropsMappings, boolean isNested)
          Checks if client property has xlink:ref in it, if the attribute is for chained features.
 boolean isNextFeatureSet()
           
protected  boolean isNextSourceFeatureNull()
           
protected  boolean isSourceFeatureIteratorNull()
           
protected  org.opengis.feature.Feature populateFeatureData(java.lang.String id)
           
protected  void setAttributeValue(org.opengis.feature.Attribute target, org.opengis.feature.Feature source, AttributeMapping attMapping)
          Sets the values of grouping attributes.
protected  void setClientProperties(org.opengis.feature.Attribute target, java.lang.Object source, java.util.Map<org.opengis.feature.type.Name,org.opengis.filter.expression.Expression> clientProperties)
           
protected  void setNextFeature(java.lang.String fId, java.util.ArrayList<org.opengis.feature.Feature> features)
           
protected  void setXlinkReference(org.opengis.feature.Attribute target, java.util.Map<org.opengis.feature.type.Name,org.opengis.filter.expression.Expression> clientPropsMappings, java.lang.Object value, XPath.StepList xpath, org.opengis.feature.type.AttributeType targetNodeType)
          Set xlink:href client property for multi-valued chained features.
protected  boolean sourceFeatureIteratorHasNext()
           
protected  boolean unprocessedFeatureExists()
           
 
Methods inherited from class org.geotools.data.complex.AbstractMappingFeatureIterator
close, getUnrolledQuery, isHasNextCalled, next, remove, setGeometry, setHasNextCalled
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

reprojection

protected org.opengis.referencing.crs.CoordinateReferenceSystem reprojection
Reprojected CRS from the source simple features, or null


curSrcFeature

protected org.opengis.feature.Feature curSrcFeature
This is the feature that will be processed in next()


mappedSource

protected FeatureSource<org.opengis.feature.type.FeatureType,org.opengis.feature.Feature> mappedSource

sourceFeatures

protected FeatureCollection<org.opengis.feature.type.FeatureType,org.opengis.feature.Feature> sourceFeatures
Constructor Detail

DataAccessMappingFeatureIterator

public DataAccessMappingFeatureIterator(AppSchemaDataAccess store,
                                        FeatureTypeMapping mapping,
                                        Query query,
                                        boolean isFiltered,
                                        boolean isDenormalised)
                                 throws java.io.IOException
Throws:
java.io.IOException

DataAccessMappingFeatureIterator

public DataAccessMappingFeatureIterator(AppSchemaDataAccess store,
                                        FeatureTypeMapping mapping,
                                        Query query,
                                        boolean isFiltered,
                                        boolean isDenormalised,
                                        boolean isQueryUnrolled)
                                 throws java.io.IOException
Parameters:
store -
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:
java.io.IOException
Method Detail

hasNext

public boolean hasNext()
Description copied from class: AbstractMappingFeatureIterator
Return true if there are more features.

Specified by:
hasNext in interface java.util.Iterator<org.opengis.feature.Feature>
Specified by:
hasNext in interface FeatureIterator<org.opengis.feature.Feature>
Overrides:
hasNext in class AbstractMappingFeatureIterator
Returns:
true if more Features exist, false otherwise.
See Also:
Iterator.hasNext()

getSourceFeatureIterator

protected java.util.Iterator<org.opengis.feature.Feature> getSourceFeatureIterator()
Specified by:
getSourceFeatureIterator in class AbstractMappingFeatureIterator

isSourceFeatureIteratorNull

protected boolean isSourceFeatureIteratorNull()
Specified by:
isSourceFeatureIteratorNull in class AbstractMappingFeatureIterator

initialiseSourceFeatures

protected void initialiseSourceFeatures(FeatureTypeMapping mapping,
                                        Query query)
                                 throws java.io.IOException
Specified by:
initialiseSourceFeatures in class AbstractMappingFeatureIterator
Throws:
java.io.IOException

unprocessedFeatureExists

protected boolean unprocessedFeatureExists()
Specified by:
unprocessedFeatureExists in class AbstractMappingFeatureIterator

extractIdForFeature

protected java.lang.String extractIdForFeature()
Specified by:
extractIdForFeature in class AbstractMappingFeatureIterator

extractIdForFeature

protected java.lang.String extractIdForFeature(org.opengis.feature.Feature feature)

extractIdForAttribute

protected java.lang.String extractIdForAttribute(org.opengis.filter.expression.Expression idExpression,
                                                 java.lang.Object sourceInstance)
Description copied from class: AbstractMappingFeatureIterator
Based on the set of xpath expression/id extracting expression, finds the ID for the attribute idExpression from the source complex attribute.

Specified by:
extractIdForAttribute in class AbstractMappingFeatureIterator
Parameters:
idExpression - the location path of the attribute to be created, for which to obtain the id by evaluating the corresponding org.geotools.filter.Expression from sourceInstance.
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, or null if there is no an id mapping for that attribute.

isNextSourceFeatureNull

protected boolean isNextSourceFeatureNull()
Specified by:
isNextSourceFeatureNull in class AbstractMappingFeatureIterator

sourceFeatureIteratorHasNext

protected boolean sourceFeatureIteratorHasNext()
Specified by:
sourceFeatureIteratorHasNext in class AbstractMappingFeatureIterator

getValues

protected java.lang.Object getValues(boolean isMultiValued,
                                     org.opengis.filter.expression.Expression expression,
                                     java.lang.Object sourceFeatureInput)

setAttributeValue

protected void setAttributeValue(org.opengis.feature.Attribute target,
                                 org.opengis.feature.Feature source,
                                 AttributeMapping attMapping)
                          throws java.io.IOException
Sets the values of grouping attributes.

Parameters:
sourceFeature -
groupingMappings -
targetFeature -
Throws:
java.io.IOException

setXlinkReference

protected void setXlinkReference(org.opengis.feature.Attribute target,
                                 java.util.Map<org.opengis.feature.type.Name,org.opengis.filter.expression.Expression> clientPropsMappings,
                                 java.lang.Object value,
                                 XPath.StepList xpath,
                                 org.opengis.feature.type.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 attribute
clientPropsMappings - Client properties mappings
value - Nested features
xpath - Attribute xPath where the client properties are to be set
targetNodeType - Target node type

setClientProperties

protected void setClientProperties(org.opengis.feature.Attribute target,
                                   java.lang.Object source,
                                   java.util.Map<org.opengis.feature.type.Name,org.opengis.filter.expression.Expression> clientProperties)
Specified by:
setClientProperties in class AbstractMappingFeatureIterator

setNextFeature

protected void setNextFeature(java.lang.String fId,
                              java.util.ArrayList<org.opengis.feature.Feature> features)
                       throws java.io.IOException
Throws:
java.io.IOException

computeNext

protected org.opengis.feature.Feature computeNext()
                                           throws java.io.IOException
Overrides:
computeNext in class AbstractMappingFeatureIterator
Throws:
java.io.IOException

populateFeatureData

protected org.opengis.feature.Feature populateFeatureData(java.lang.String id)
                                                   throws java.io.IOException
Specified by:
populateFeatureData in class AbstractMappingFeatureIterator
Throws:
java.io.IOException

closeSourceFeatures

protected void closeSourceFeatures()
Specified by:
closeSourceFeatures in class AbstractMappingFeatureIterator

getValue

protected java.lang.Object getValue(org.opengis.filter.expression.Expression expression,
                                    java.lang.Object sourceFeature)
Specified by:
getValue in class AbstractMappingFeatureIterator

isByReference

protected boolean isByReference(java.util.Map<org.opengis.feature.type.Name,org.opengis.filter.expression.Expression> clientPropsMappings,
                                boolean isNested)
Checks if client property has xlink:ref in it, if the attribute is for chained features.

Parameters:
clientPropsMappings - the client properties mappings
isNested - true if we're dealing with chained/nested features
Returns:

flagNextFeature

public void flagNextFeature(boolean isSet)

isNextFeatureSet

public boolean isNextFeatureSet()


Copyright © 1996-2010 Geotools. All Rights Reserved.