Commit 2b82ad81 authored by Matthias Betz's avatar Matthias Betz
Browse files

errors are listed in lexicographic order, automatically sorted when marshalling

parent 017aeb12
Pipeline #4365 passed with stage
in 12 seconds
...@@ -90,8 +90,7 @@ public class QualityAdeMarshaller implements ADEMarshaller { ...@@ -90,8 +90,7 @@ public class QualityAdeMarshaller implements ADEMarshaller {
lock.lock(); lock.lock();
try { try {
if (elementMapper == null) { if (elementMapper == null) {
elementMapper = TypeMapper.<JAXBElement<?>>create() elementMapper = TypeMapper.<JAXBElement<?>>create().with(Validation.class, this::createValidation)
.with(Validation.class, this::createValidation)
.with(ValidationResult.class, this::createValidationResult); .with(ValidationResult.class, this::createValidationResult);
} }
} finally { } finally {
...@@ -107,8 +106,7 @@ public class QualityAdeMarshaller implements ADEMarshaller { ...@@ -107,8 +106,7 @@ public class QualityAdeMarshaller implements ADEMarshaller {
lock.lock(); lock.lock();
try { try {
if (typeMapper == null) { if (typeMapper == null) {
typeMapper = TypeMapper.create() typeMapper = TypeMapper.create().with(Validation.class, this::marshalValidation)
.with(Validation.class, this::marshalValidation)
.with(ValidationResult.class, this::marshalValidationResult) .with(ValidationResult.class, this::marshalValidationResult)
.with(ConsecutivePointsSame.class, this::marshalConsecutivePointsSame) .with(ConsecutivePointsSame.class, this::marshalConsecutivePointsSame)
.with(TooFewPoints.class, this::marshalTooFewPoints) .with(TooFewPoints.class, this::marshalTooFewPoints)
...@@ -170,6 +168,10 @@ public class QualityAdeMarshaller implements ADEMarshaller { ...@@ -170,6 +168,10 @@ public class QualityAdeMarshaller implements ADEMarshaller {
if (src.hasErrors()) { if (src.hasErrors()) {
for (ValidationError err : src.getErrors()) { for (ValidationError err : src.getErrors()) {
dest.getErrors().add(marshalValidationError(err)); dest.getErrors().add(marshalValidationError(err));
// sort lexicographic, order does not actually matter but xml is restrictive
// that way
// could be solved with xsd v1.1 but jaxb can only process v1.0
dest.getErrors().sort((e1, e2) -> e1.getName().compareTo(e2.getName()));
} }
} }
return dest; return dest;
...@@ -324,7 +326,7 @@ public class QualityAdeMarshaller implements ADEMarshaller { ...@@ -324,7 +326,7 @@ public class QualityAdeMarshaller implements ADEMarshaller {
} }
private PolygonWrongOrientationType marshalPolygonWrongOrientation(PolygonWrongOrientation src) { private PolygonWrongOrientationType marshalPolygonWrongOrientation(PolygonWrongOrientation src) {
PolygonWrongOrientationType dest = new PolygonWrongOrientationType(); PolygonWrongOrientationType dest = new PolygonWrongOrientationType();
dest.setGeometryId(src.getGeometryId()); dest.setGeometryId(src.getGeometryId());
if (src.isSetEdges()) { if (src.isSetEdges()) {
List<EdgeType> edges = dest.getEdges(); List<EdgeType> edges = dest.getEdges();
...@@ -385,7 +387,7 @@ public class QualityAdeMarshaller implements ADEMarshaller { ...@@ -385,7 +387,7 @@ public class QualityAdeMarshaller implements ADEMarshaller {
private MultipleConnectedComponentsType marshalMultipleConnectedComponents(MultipleConnectedComponents src) { private MultipleConnectedComponentsType marshalMultipleConnectedComponents(MultipleConnectedComponents src) {
MultipleConnectedComponentsType dest = new MultipleConnectedComponentsType(); MultipleConnectedComponentsType dest = new MultipleConnectedComponentsType();
dest.setGeometryId(src.getGeometryId()); dest.setGeometryId(src.getGeometryId());
if (src.isSetComponents() ) { if (src.isSetComponents()) {
dest.getComponents().addAll(src.getComponents()); dest.getComponents().addAll(src.getComponents());
} }
return dest; return dest;
......
...@@ -19,10 +19,22 @@ import javax.xml.bind.annotation.XmlAccessType; ...@@ -19,10 +19,22 @@ import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlSeeAlso; import javax.xml.bind.annotation.XmlSeeAlso;
import javax.xml.bind.annotation.XmlTransient;
@XmlSeeAlso({ RingErrorType.class, PolygonErrorType.class, SolidErrorType.class, SemanticErrorType.class }) @XmlSeeAlso({ RingErrorType.class, PolygonErrorType.class, SolidErrorType.class, SemanticErrorType.class })
@XmlAccessorType(XmlAccessType.FIELD) @XmlAccessorType(XmlAccessType.FIELD)
@XmlRootElement(name = "ValidationError") @XmlRootElement(name = "ValidationError")
public abstract class ValidationErrorType { public abstract class ValidationErrorType {
@XmlTransient
private String name;
protected ValidationErrorType() {
name = getClass().getAnnotation(XmlRootElement.class).name();
}
public String getName() {
return name;
}
} }
...@@ -328,18 +328,14 @@ ...@@ -328,18 +328,14 @@
features features
</documentation> </documentation>
</annotation> </annotation>
<sequence> <sequence>
<element name="GE_R_TOO_FEW_POINTS" <element name="GE_P_HOLE_OUTSIDE"
type="qual:GE_R_TOO_FEW_POINTS" minOccurs="0" maxOccurs="unbounded" /> type="qual:GE_P_HOLE_OUTSIDE" minOccurs="0" maxOccurs="unbounded" />
<element name="GE_R_SELF_INTERSECTION" <element name="GE_P_INNER_RINGS_NESTED"
type="qual:GE_R_SELF_INTERSECTION" minOccurs="0" type="qual:GE_P_INNER_RINGS_NESTED" minOccurs="0"
maxOccurs="unbounded" />
<element name="GE_R_NOT_CLOSED" type="qual:GE_R_NOT_CLOSED"
minOccurs="0" maxOccurs="unbounded" />
<element name="GE_R_CONSECUTIVE_POINTS_SAME"
type="qual:GE_R_CONSECUTIVE_POINTS_SAME" minOccurs="0"
maxOccurs="unbounded" /> maxOccurs="unbounded" />
<element name="GE_P_INTERIOR_DISCONNECTED" <element name="GE_P_INTERIOR_DISCONNECTED"
type="qual:GE_P_INTERIOR_DISCONNECTED" minOccurs="0" type="qual:GE_P_INTERIOR_DISCONNECTED" minOccurs="0"
maxOccurs="unbounded" /> maxOccurs="unbounded" />
...@@ -349,11 +345,6 @@ ...@@ -349,11 +345,6 @@
<element name="GE_P_NON_PLANAR_POLYGON_DISTANCE_PLANE" <element name="GE_P_NON_PLANAR_POLYGON_DISTANCE_PLANE"
type="qual:GE_P_NON_PLANAR_POLYGON_DISTANCE_PLANE" minOccurs="0" type="qual:GE_P_NON_PLANAR_POLYGON_DISTANCE_PLANE" minOccurs="0"
maxOccurs="unbounded" /> maxOccurs="unbounded" />
<element name="GE_P_INNER_RINGS_NESTED"
type="qual:GE_P_INNER_RINGS_NESTED" minOccurs="0"
maxOccurs="unbounded" />
<element name="GE_P_HOLE_OUTSIDE"
type="qual:GE_P_HOLE_OUTSIDE" minOccurs="0" maxOccurs="unbounded" />
<element name="GE_P_NON_PLANAR_POLYGON_NORMALS_DEVIATION" <element name="GE_P_NON_PLANAR_POLYGON_NORMALS_DEVIATION"
type="qual:GE_P_NON_PLANAR_POLYGON_NORMALS_DEVIATION" minOccurs="0" type="qual:GE_P_NON_PLANAR_POLYGON_NORMALS_DEVIATION" minOccurs="0"
maxOccurs="unbounded" /> maxOccurs="unbounded" />
...@@ -361,35 +352,46 @@ ...@@ -361,35 +352,46 @@
type="qual:GE_P_ORIENTATION_RINGS_SAME" minOccurs="0" type="qual:GE_P_ORIENTATION_RINGS_SAME" minOccurs="0"
maxOccurs="unbounded" /> maxOccurs="unbounded" />
<element name="GE_R_CONSECUTIVE_POINTS_SAME"
type="qual:GE_R_CONSECUTIVE_POINTS_SAME" minOccurs="0"
maxOccurs="unbounded" />
<element name="GE_R_NOT_CLOSED" type="qual:GE_R_NOT_CLOSED"
minOccurs="0" maxOccurs="unbounded" />
<element name="GE_R_SELF_INTERSECTION"
type="qual:GE_R_SELF_INTERSECTION" minOccurs="0"
maxOccurs="unbounded" />
<element name="GE_R_TOO_FEW_POINTS"
type="qual:GE_R_TOO_FEW_POINTS" minOccurs="0" maxOccurs="unbounded" />
<element name="GE_S_ALL_POLYGONS_WRONG_ORIENTATION" <element name="GE_S_ALL_POLYGONS_WRONG_ORIENTATION"
type="qual:GE_S_ALL_POLYGONS_WRONG_ORIENTATION" minOccurs="0" type="qual:GE_S_ALL_POLYGONS_WRONG_ORIENTATION" minOccurs="0"
maxOccurs="unbounded" /> maxOccurs="unbounded" />
<element name="GE_S_POLYGON_WRONG_ORIENTATION" <element name="GE_S_MULTIPLE_CONNECTED_COMPONENTS"
type="qual:GE_S_POLYGON_WRONG_ORIENTATION" minOccurs="0" type="qual:GE_S_MULTIPLE_CONNECTED_COMPONENTS" minOccurs="0"
maxOccurs="unbounded" /> maxOccurs="unbounded" />
<element name="GE_S_SELF_INTERSECTION" <element name="GE_S_NON_MANIFOLD_EDGE"
type="qual:GE_S_SELF_INTERSECTION" minOccurs="0" type="qual:GE_S_NON_MANIFOLD_EDGE" minOccurs="0"
maxOccurs="unbounded" /> maxOccurs="unbounded" />
<element name="GE_S_NON_MANIFOLD_VERTEX" <element name="GE_S_NON_MANIFOLD_VERTEX"
type="qual:GE_S_NON_MANIFOLD_VERTEX" minOccurs="0" type="qual:GE_S_NON_MANIFOLD_VERTEX" minOccurs="0"
maxOccurs="unbounded" /> maxOccurs="unbounded" />
<element name="GE_S_NON_MANIFOLD_EDGE"
type="qual:GE_S_NON_MANIFOLD_EDGE" minOccurs="0"
maxOccurs="unbounded" />
<element name="GE_S_NOT_CLOSED" type="qual:GE_S_NOT_CLOSED" <element name="GE_S_NOT_CLOSED" type="qual:GE_S_NOT_CLOSED"
minOccurs="0" maxOccurs="unbounded" /> minOccurs="0" maxOccurs="unbounded" />
<element name="GE_S_POLYGON_WRONG_ORIENTATION"
type="qual:GE_S_POLYGON_WRONG_ORIENTATION" minOccurs="0"
maxOccurs="unbounded" />
<element name="GE_S_SELF_INTERSECTION"
type="qual:GE_S_SELF_INTERSECTION" minOccurs="0"
maxOccurs="unbounded" />
<element name="GE_S_TOO_FEW_POLYGONS" <element name="GE_S_TOO_FEW_POLYGONS"
type="qual:GE_S_TOO_FEW_POLYGONS" minOccurs="0" type="qual:GE_S_TOO_FEW_POLYGONS" minOccurs="0"
maxOccurs="unbounded" /> maxOccurs="unbounded" />
<element name="GE_S_MULTIPLE_CONNECTED_COMPONENTS"
type="qual:GE_S_MULTIPLE_CONNECTED_COMPONENTS" minOccurs="0"
maxOccurs="unbounded" />
<element name="SE_ATTRIBUTE_MISSING"
type="qual:SE_ATTRIBUTE_MISSING" minOccurs="0" maxOccurs="unbounded" />
<element name="SE_ATTRIBUTE_WRONG_VALUE" <element name="SE_ATTRIBUTE_WRONG_VALUE"
type="qual:SE_ATTRIBUTE_WRONG_VALUE" minOccurs="0" type="qual:SE_ATTRIBUTE_WRONG_VALUE" minOccurs="0"
maxOccurs="unbounded" /> maxOccurs="unbounded" />
<element name="SE_ATTRIBUTE_MISSING"
type="qual:SE_ATTRIBUTE_MISSING" minOccurs="0" maxOccurs="unbounded" />
</sequence> </sequence>
<attribute name="result" type="qual:result" /> <attribute name="result" type="qual:result" />
</complexType> </complexType>
...@@ -531,8 +533,10 @@ ...@@ -531,8 +533,10 @@
<enumeration value="GE_R_NOT_CLOSED" /> <enumeration value="GE_R_NOT_CLOSED" />
<enumeration value="GE_R_CONSECUTIVE_POINTS_SAME" /> <enumeration value="GE_R_CONSECUTIVE_POINTS_SAME" />
<enumeration value="GE_R_SELF_INTERSECTION" /> <enumeration value="GE_R_SELF_INTERSECTION" />
<enumeration value="GE_R_NOT_CLOSED" /> <enumeration
<enumeration value="GE_P_NON_PLANAR" /> value="GE_P_NON_PLANAR_POLYGON_NORMALS_DEVIATION" />
<enumeration
value="GE_P_NON_PLANAR_POLYGON_DISTANCE_PLANE" />
<enumeration value="GE_P_INTERIOR_DISCONNECTED" /> <enumeration value="GE_P_INTERIOR_DISCONNECTED" />
<enumeration value="GE_P_INTERSECTING_RINGS" /> <enumeration value="GE_P_INTERSECTING_RINGS" />
<enumeration value="GE_P_HOLE_OUTSIDE" /> <enumeration value="GE_P_HOLE_OUTSIDE" />
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment