Package org.geotools.data.complex
Class FeatureTypeMapping
- Object
-
- FeatureTypeMapping
-
- Direct Known Subclasses:
XmlFeatureTypeMapping
public class FeatureTypeMapping extends Object
- Since:
- 2.4
- Author:
- Gabriel Roldan (Axios Engineering), Rini Angreani (CSIRO Earth Science and Resource Engineering)
-
-
Constructor Summary
Constructors Constructor Description FeatureTypeMapping()
No parameters constructor for use by the digester configuration engine as a JavaBeanFeatureTypeMapping(FeatureSource<? extends FeatureType,? extends Feature> source, FeatureSource<SimpleFeatureType,SimpleFeature> indexSource, AttributeDescriptor target, String defaultGeometryXPath, List<AttributeMapping> mappings, NamespaceSupport namespaces, boolean isDenormalised)
FeatureTypeMapping(FeatureSource<? extends FeatureType,? extends Feature> source, AttributeDescriptor target, String defaultGeometryXPath, List<AttributeMapping> mappings, NamespaceSupport namespaces, boolean isDenormalised)
FeatureTypeMapping(FeatureSource<? extends FeatureType,? extends Feature> source, AttributeDescriptor target, List<AttributeMapping> mappings, NamespaceSupport namespaces)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object o)
List<Expression>
findMappingsFor(XPathUtil.StepList propertyName, boolean includeNestedMappings)
Looks up for attribute mappings matching the xpath expressionpropertyName
.AttributeMapping
getAttributeMapping(String xpathExpression)
Finds the attribute mapping for the target expressionexactPath
.AttributeMapping
getAttributeMapping(XPathUtil.StepList exactPath)
Finds the attribute mapping for the target expressionexactPath
List<AttributeMapping>
getAttributeMappings()
List<AttributeMapping>
getAttributeMappingsByExpression(Expression sourceExpression)
Finds the attribute mappings for the given source expression.List<AttributeMapping>
getAttributeMappingsIgnoreIndex(XPathUtil.StepList targetPath)
Finds the attribute mappings for the given target location path.String
getDefaultGeometryXPath()
Returns the default geometry XPath expression that was specified in the mapping configuration, ornull
if none was set.Expression
getFeatureIdExpression()
String
getIndexAttributeName(String xpath)
Returns index attribute name linked to unrolled propertyName or null if is absentFeatureSource<SimpleFeatureType,SimpleFeature>
getIndexSource()
List<AttributeMapping>
getIsListMappings()
Return list of attribute mappings that are configured as list (isList = true).Name
getMappingName()
NamespaceSupport
getNamespaces()
List<NestedAttributeMapping>
getNestedMappings()
FeatureSource<? extends FeatureType,? extends Feature>
getSource()
Optional<String>
getSourceDatastoreId()
Returns the source datastore id from mappings configurations.AttributeDescriptor
getTargetFeature()
FeatureTypeMapping
getUnderlyingComplexMapping()
int
hashCode()
boolean
isDenormalised()
boolean
isInclude()
void
setDefaultGeometryXPath(String defaultGeometryXPath)
Specifies which property should be used as default geometry for the target feature type.void
setDenormalised(boolean isDenormalised)
void
setInclude(boolean isInclude)
void
setIndexSource(FeatureSource<SimpleFeatureType,SimpleFeature> indexSource)
void
setName(Name name)
void
setSource(FeatureSource<? extends FeatureType,? extends Feature> source)
void
setSourceDatastoreId(String sourceDatastoreId)
Sets the source datastore id from mappings configurations.void
setTargetFeature(AttributeDescriptor feature)
Has to be called after#setTargetType(FeatureType)
-
-
-
Constructor Detail
-
FeatureTypeMapping
public FeatureTypeMapping()
No parameters constructor for use by the digester configuration engine as a JavaBean
-
FeatureTypeMapping
public FeatureTypeMapping(FeatureSource<? extends FeatureType,? extends Feature> source, AttributeDescriptor target, List<AttributeMapping> mappings, NamespaceSupport namespaces)
-
FeatureTypeMapping
public FeatureTypeMapping(FeatureSource<? extends FeatureType,? extends Feature> source, AttributeDescriptor target, String defaultGeometryXPath, List<AttributeMapping> mappings, NamespaceSupport namespaces, boolean isDenormalised)
-
FeatureTypeMapping
public FeatureTypeMapping(FeatureSource<? extends FeatureType,? extends Feature> source, FeatureSource<SimpleFeatureType,SimpleFeature> indexSource, AttributeDescriptor target, String defaultGeometryXPath, List<AttributeMapping> mappings, NamespaceSupport namespaces, boolean isDenormalised)
-
-
Method Detail
-
getAttributeMappings
public List<AttributeMapping> getAttributeMappings()
-
getNestedMappings
public List<NestedAttributeMapping> getNestedMappings()
-
getFeatureIdExpression
public Expression getFeatureIdExpression()
-
getAttributeMappingsIgnoreIndex
public List<AttributeMapping> getAttributeMappingsIgnoreIndex(XPathUtil.StepList targetPath)
Finds the attribute mappings for the given target location path. If the exactPath is not indexed, it will get all the matching mappings ignoring index. If it is indexed, it will get the one with matching index only.
-
getAttributeMappingsByExpression
public List<AttributeMapping> getAttributeMappingsByExpression(Expression sourceExpression)
Finds the attribute mappings for the given source expression.- Returns:
- list of matching attribute mappings
-
getAttributeMapping
public AttributeMapping getAttributeMapping(XPathUtil.StepList exactPath)
Finds the attribute mapping for the target expressionexactPath
- Parameters:
exactPath
- the xpath expression on the target schema to find the mapping for- Returns:
- the attribute mapping that match 1:1 with
exactPath
ornull
if
-
getAttributeMapping
public AttributeMapping getAttributeMapping(String xpathExpression)
Finds the attribute mapping for the target expressionexactPath
.- Parameters:
xpathExpression
- the xpath expression on the target schema to find the mapping for- Returns:
- the attribute mapping that match 1:1 with
exactPath
ornull
-
getNamespaces
public NamespaceSupport getNamespaces()
-
setTargetFeature
public void setTargetFeature(AttributeDescriptor feature)
Has to be called after#setTargetType(FeatureType)
-
getTargetFeature
public AttributeDescriptor getTargetFeature()
-
getSource
public FeatureSource<? extends FeatureType,? extends Feature> getSource()
-
getUnderlyingComplexMapping
public FeatureTypeMapping getUnderlyingComplexMapping()
-
setName
public void setName(Name name)
-
getMappingName
public Name getMappingName()
-
getIsListMappings
public List<AttributeMapping> getIsListMappings()
Return list of attribute mappings that are configured as list (isList = true).- Returns:
- attribute mappings with isList enabled.
-
findMappingsFor
public List<Expression> findMappingsFor(XPathUtil.StepList propertyName, boolean includeNestedMappings)
Looks up for attribute mappings matching the xpath expressionpropertyName
.If any step in
propertyName
has index greater than 1, any mapping for the same property applies, regardless of the mapping. For example, if there are mappings forgml:name[1]
,gml:name[2]
andgml:name[3]
, but propertyName is justgml:name
, all three mappings apply.
-
isDenormalised
public boolean isDenormalised()
-
setDenormalised
public void setDenormalised(boolean isDenormalised)
-
isInclude
public boolean isInclude()
-
setInclude
public void setInclude(boolean isInclude)
-
getDefaultGeometryXPath
public String getDefaultGeometryXPath()
Returns the default geometry XPath expression that was specified in the mapping configuration, ornull
if none was set.- Returns:
- XPath expression identifying the default geometry property
- See Also:
setDefaultGeometryXPath(String)
-
setDefaultGeometryXPath
public void setDefaultGeometryXPath(String defaultGeometryXPath)
Specifies which property should be used as default geometry for the target feature type.This is especially useful when automatic detection of the default geometry is difficult or impossible to do, e.g. when the geometry property is nested inside another property, or multiple geometry properties are present.
The specified geometry property may be a direct child of the target feature type, or may be nested inside another property. If the evaluation of the provided expression yields multiple values, an exception will be thrown at runtime.
- Parameters:
defaultGeometryXPath
- XPath expression identifying the default geometry property
-
setSource
public void setSource(FeatureSource<? extends FeatureType,? extends Feature> source)
-
getIndexSource
public FeatureSource<SimpleFeatureType,SimpleFeature> getIndexSource()
-
setIndexSource
public void setIndexSource(FeatureSource<SimpleFeatureType,SimpleFeature> indexSource)
-
getIndexAttributeName
public String getIndexAttributeName(String xpath)
Returns index attribute name linked to unrolled propertyName or null if is absent- Returns:
- Index attribute name
-
getSourceDatastoreId
public Optional<String> getSourceDatastoreId()
Returns the source datastore id from mappings configurations.
-
setSourceDatastoreId
public void setSourceDatastoreId(String sourceDatastoreId)
Sets the source datastore id from mappings configurations.
-
-