Author: jsorel
Date: Wed Apr 6 09:56:11 2016
New Revision: 1737957
URL: http://svn.apache.org/viewvc?rev=1737957&view=rev
Log:
Fix missing serialId on Aggregate and Bounds operations, fix AbstractFeature
returned default values for association roles not compliant with javadoc
Modified:
sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/AbstractFeature.java
sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/AggregateOperation.java
sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/BoundsOperation.java
sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/internal/feature/FeatureTypeBuilder.java
Modified:
sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/AbstractFeature.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/AbstractFeature.java?rev=1737957&r1=1737956&r2=1737957&view=diff
==============================================================================
---
sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/AbstractFeature.java
[UTF-8] (original)
+++
sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/AbstractFeature.java
[UTF-8] Wed Apr 6 09:56:11 2016
@@ -270,7 +270,8 @@ public abstract class AbstractFeature im
if (pt instanceof AttributeType<?>) {
return getDefaultValue((AttributeType<?>) pt);
} else if (pt instanceof FeatureAssociationRole) {
- return null; // No default value for associations.
+ final int maxOcc = ((FeatureAssociationRole)pt).getMaximumOccurs();
+ return maxOcc>1 ? Collections.EMPTY_LIST : null;
// No default value for associations.
} else {
throw unsupportedPropertyType(pt.getName());
}
Modified:
sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/AggregateOperation.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/AggregateOperation.java?rev=1737957&r1=1737956&r2=1737957&view=diff
==============================================================================
---
sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/AggregateOperation.java
(original)
+++
sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/AggregateOperation.java
Wed Apr 6 09:56:11 2016
@@ -44,7 +44,11 @@ import org.opengis.util.GenericName;
* @module
*/
final class AggregateOperation extends AbstractOperation {
-
+ /**
+ * For cross-version compatibility.
+ */
+ private static final long serialVersionUID = 2303047827010821381L;
+
private static final AttributeType<String> TYPE = new
DefaultAttributeType<>(
Collections.singletonMap(NAME_KEY,
"String"),String.class,1,1,null);
Modified:
sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/BoundsOperation.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/BoundsOperation.java?rev=1737957&r1=1737956&r2=1737957&view=diff
==============================================================================
---
sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/BoundsOperation.java
(original)
+++
sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/feature/BoundsOperation.java
Wed Apr 6 09:56:11 2016
@@ -59,6 +59,10 @@ import org.opengis.referencing.operation
* @module
*/
final class BoundsOperation extends AbstractOperation {
+ /**
+ * For cross-version compatibility.
+ */
+ private static final long serialVersionUID = 6250548001562807671L;
private static final AttributeType<Envelope> TYPE = new
DefaultAttributeType<>(
Collections.singletonMap(NAME_KEY,
"Envelope"),Envelope.class,1,1,null);
@@ -144,13 +148,15 @@ final class BoundsOperation extends Abst
}
- static GeneralEnvelope calculate(Feature feature,
CoordinateReferenceSystem crs) throws TransformException {
+ GeneralEnvelope calculate(Feature feature, CoordinateReferenceSystem crs)
throws TransformException {
GeneralEnvelope bounds = null;
final FeatureType type = feature.getType();
for(PropertyType pt : type.getProperties(true)){
- if(!AttributeConvention.isGeometryAttribute(pt)) continue;
+
if(!pt.getName().equals(AttributeConvention.ATTRIBUTE_DEFAULT_GEOMETRY)){
+ if(!AttributeConvention.isGeometryAttribute(pt)) continue;
+ }
final Object val =
feature.getPropertyValue(pt.getName().toString());
Modified:
sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/internal/feature/FeatureTypeBuilder.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/internal/feature/FeatureTypeBuilder.java?rev=1737957&r1=1737956&r2=1737957&view=diff
==============================================================================
---
sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/internal/feature/FeatureTypeBuilder.java
(original)
+++
sis/branches/JDK8/core/sis-feature/src/main/java/org/apache/sis/internal/feature/FeatureTypeBuilder.java
Wed Apr 6 09:56:11 2016
@@ -668,7 +668,7 @@ public class FeatureTypeBuilder {
if(!properties.containsKey(defGeomAttribute)){
throw new IllegalArgumentException("Property
"+defGeomAttribute+" used in default geometry does not exist");
}
- final AttributeType geomAtt =
(AttributeType)properties.get(defGeomAttribute);
+ final PropertyType geomAtt = properties.get(defGeomAttribute);
final CoordinateReferenceSystem crs =
AttributeConvention.getCRSCharacteristic(geomAtt);
final Operation att =
FeatureOperations.link(ATTRIBUTE_DEFAULT_GEOMETRY, geomAtt);
properties.put(ATTRIBUTE_DEFAULT_GEOMETRY, att);