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 {
lock.lock();
try {
if (elementMapper == null) {
elementMapper = TypeMapper.<JAXBElement<?>>create()
.with(Validation.class, this::createValidation)
elementMapper = TypeMapper.<JAXBElement<?>>create().with(Validation.class, this::createValidation)
.with(ValidationResult.class, this::createValidationResult);
}
} finally {
......@@ -107,8 +106,7 @@ public class QualityAdeMarshaller implements ADEMarshaller {
lock.lock();
try {
if (typeMapper == null) {
typeMapper = TypeMapper.create()
.with(Validation.class, this::marshalValidation)
typeMapper = TypeMapper.create().with(Validation.class, this::marshalValidation)
.with(ValidationResult.class, this::marshalValidationResult)
.with(ConsecutivePointsSame.class, this::marshalConsecutivePointsSame)
.with(TooFewPoints.class, this::marshalTooFewPoints)
......@@ -170,6 +168,10 @@ public class QualityAdeMarshaller implements ADEMarshaller {
if (src.hasErrors()) {
for (ValidationError err : src.getErrors()) {
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;
......@@ -324,7 +326,7 @@ public class QualityAdeMarshaller implements ADEMarshaller {
}
private PolygonWrongOrientationType marshalPolygonWrongOrientation(PolygonWrongOrientation src) {
PolygonWrongOrientationType dest = new PolygonWrongOrientationType();
PolygonWrongOrientationType dest = new PolygonWrongOrientationType();
dest.setGeometryId(src.getGeometryId());
if (src.isSetEdges()) {
List<EdgeType> edges = dest.getEdges();
......@@ -385,7 +387,7 @@ public class QualityAdeMarshaller implements ADEMarshaller {
private MultipleConnectedComponentsType marshalMultipleConnectedComponents(MultipleConnectedComponents src) {
MultipleConnectedComponentsType dest = new MultipleConnectedComponentsType();
dest.setGeometryId(src.getGeometryId());
if (src.isSetComponents() ) {
if (src.isSetComponents()) {
dest.getComponents().addAll(src.getComponents());
}
return dest;
......
......@@ -19,10 +19,22 @@ import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlSeeAlso;
import javax.xml.bind.annotation.XmlTransient;
@XmlSeeAlso({ RingErrorType.class, PolygonErrorType.class, SolidErrorType.class, SemanticErrorType.class })
@XmlAccessorType(XmlAccessType.FIELD)
@XmlRootElement(name = "ValidationError")
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 @@
features
</documentation>
</annotation>
<sequence>
<element name="GE_R_TOO_FEW_POINTS"
type="qual:GE_R_TOO_FEW_POINTS" minOccurs="0" maxOccurs="unbounded" />
<element name="GE_R_SELF_INTERSECTION"
type="qual:GE_R_SELF_INTERSECTION" 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"
<element name="GE_P_HOLE_OUTSIDE"
type="qual:GE_P_HOLE_OUTSIDE" minOccurs="0" maxOccurs="unbounded" />
<element name="GE_P_INNER_RINGS_NESTED"
type="qual:GE_P_INNER_RINGS_NESTED" minOccurs="0"
maxOccurs="unbounded" />
<element name="GE_P_INTERIOR_DISCONNECTED"
type="qual:GE_P_INTERIOR_DISCONNECTED" minOccurs="0"
maxOccurs="unbounded" />
......@@ -349,11 +345,6 @@
<element name="GE_P_NON_PLANAR_POLYGON_DISTANCE_PLANE"
type="qual:GE_P_NON_PLANAR_POLYGON_DISTANCE_PLANE" minOccurs="0"
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"
type="qual:GE_P_NON_PLANAR_POLYGON_NORMALS_DEVIATION" minOccurs="0"
maxOccurs="unbounded" />
......@@ -361,35 +352,46 @@
type="qual:GE_P_ORIENTATION_RINGS_SAME" minOccurs="0"
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"
type="qual:GE_S_ALL_POLYGONS_WRONG_ORIENTATION" minOccurs="0"
maxOccurs="unbounded" />
<element name="GE_S_POLYGON_WRONG_ORIENTATION"
type="qual:GE_S_POLYGON_WRONG_ORIENTATION" minOccurs="0"
<element name="GE_S_MULTIPLE_CONNECTED_COMPONENTS"
type="qual:GE_S_MULTIPLE_CONNECTED_COMPONENTS" minOccurs="0"
maxOccurs="unbounded" />
<element name="GE_S_SELF_INTERSECTION"
type="qual:GE_S_SELF_INTERSECTION" minOccurs="0"
<element name="GE_S_NON_MANIFOLD_EDGE"
type="qual:GE_S_NON_MANIFOLD_EDGE" minOccurs="0"
maxOccurs="unbounded" />
<element name="GE_S_NON_MANIFOLD_VERTEX"
type="qual:GE_S_NON_MANIFOLD_VERTEX" minOccurs="0"
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"
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"
type="qual:GE_S_TOO_FEW_POLYGONS" minOccurs="0"
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"
type="qual:SE_ATTRIBUTE_WRONG_VALUE" minOccurs="0"
maxOccurs="unbounded" />
<element name="SE_ATTRIBUTE_MISSING"
type="qual:SE_ATTRIBUTE_MISSING" minOccurs="0" maxOccurs="unbounded" />
</sequence>
<attribute name="result" type="qual:result" />
</complexType>
......@@ -531,8 +533,10 @@
<enumeration value="GE_R_NOT_CLOSED" />
<enumeration value="GE_R_CONSECUTIVE_POINTS_SAME" />
<enumeration value="GE_R_SELF_INTERSECTION" />
<enumeration value="GE_R_NOT_CLOSED" />
<enumeration value="GE_P_NON_PLANAR" />
<enumeration
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_INTERSECTING_RINGS" />
<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