diff --git a/citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/marshaller/QualityAdeMarshaller.java b/citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/marshaller/QualityAdeMarshaller.java index 37acd130dd7e62e150b6199bc7302db68bce2d97..cd0528a760628127453cad9dc063bf21519bfec4 100644 --- a/citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/marshaller/QualityAdeMarshaller.java +++ b/citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/marshaller/QualityAdeMarshaller.java @@ -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; diff --git a/citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/model/jaxb/ValidationErrorType.java b/citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/model/jaxb/ValidationErrorType.java index 42aee33d30480eb925d7f58004cc21b0c46152b4..24ca126a93506e3bbc36709a072197cfddc80e10 100644 --- a/citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/model/jaxb/ValidationErrorType.java +++ b/citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/model/jaxb/ValidationErrorType.java @@ -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; + } } diff --git a/citygml4j-quality-ade/src/main/resources/qualityAde.xsd b/citygml4j-quality-ade/src/main/resources/qualityAde.xsd index 0cb8f4fcc3c8b4c199aa1221fbf026a4f4e9d4a6..2ed1ec60d92f08b45d86f0470e23b600441acd86 100644 --- a/citygml4j-quality-ade/src/main/resources/qualityAde.xsd +++ b/citygml4j-quality-ade/src/main/resources/qualityAde.xsd @@ -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" />