Commit f95ca9ff authored by Matthias Betz's avatar Matthias Betz
Browse files

fixed error adapter

fixed tests
added service meta inf
fixed various other issues
parent af713a75
......@@ -33,7 +33,7 @@ public class CityObjectPropertiesAdapter implements ObjectBuilder<CityObjectProp
return;
}
switch (name.getLocalPart()) {
case "validationResult" -> object.setValidationResult(reader.getObjectUsingBuilder(ValidationResultPropertyAdapter.class));
case "ValidationResult" -> object.setValidationResult(reader.getObjectUsingBuilder(ValidationResultPropertyAdapter.class));
default -> throw new IllegalStateException("Cannot handle name " + name + " when building CityObjectProperties element");
}
}
......
package de.hft.stuttgart.quality.adapter.types;
import de.hft.stuttgart.quality.model.enums.ErrorId;
import de.hft.stuttgart.quality.model.types.Error;
import javax.xml.namespace.QName;
import de.hft.stuttgart.quality.QualityADEModule;
import org.xmlobjects.annotation.XMLElement;
import org.xmlobjects.builder.ObjectBuildException;
import org.xmlobjects.builder.ObjectBuilder;
import org.xmlobjects.serializer.ObjectSerializeException;
......@@ -16,8 +15,11 @@ import org.xmlobjects.xml.Attributes;
import org.xmlobjects.xml.Element;
import org.xmlobjects.xml.Namespaces;
import javax.xml.namespace.QName;
import de.hft.stuttgart.quality.QualityADEModule;
import de.hft.stuttgart.quality.model.enums.ErrorId;
import de.hft.stuttgart.quality.model.types.Error;
@XMLElement(name = "Error", namespaceURI = QualityADEModule.NAMESPACE_URI)
public class ErrorAdapter implements ObjectBuilder<Error>, ObjectSerializer<Error> {
@Override
......@@ -37,6 +39,11 @@ public class ErrorAdapter implements ObjectBuilder<Error>, ObjectSerializer<Erro
default -> throw new IllegalStateException("Cannot handle name " + name + " when building Error element");
}
}
@Override
public Element createElement(Error object, Namespaces namespaces) throws ObjectSerializeException {
return Element.of(QualityADEModule.NAMESPACE_URI, "Error");
}
@Override
public void writeChildElements(Error object, Namespaces namespaces, XMLWriter writer)
......
......@@ -16,7 +16,9 @@ import org.xmlobjects.xml.Element;
import org.xmlobjects.xml.Namespaces;
import de.hft.stuttgart.quality.QualityADEModule;
import de.hft.stuttgart.quality.adapter.properties.ErrorPropertyAdapter;
import de.hft.stuttgart.quality.adapter.properties.FeatureStatisticsPropertyAdapter;
import de.hft.stuttgart.quality.model.properties.ErrorProperty;
import de.hft.stuttgart.quality.model.types.Statistics;
@XMLElement(name = "Statistics", namespaceURI = QualityADEModule.NAMESPACE_URI)
......@@ -46,10 +48,11 @@ public class StatisticsAdapter implements ObjectBuilder<Statistics>, ObjectSeria
.setNumErrorWaterObjects(reader.getObjectUsingBuilder(FeatureStatisticsPropertyAdapter.class));
case "numErrorTransportation" -> object
.setNumErrorTransportation(reader.getObjectUsingBuilder(FeatureStatisticsPropertyAdapter.class));
case "error" -> object.getErrors().add(reader.getObjectUsingBuilder(ErrorPropertyAdapter.class));
default -> throw new IllegalStateException("Cannot handle name " + name + " when building Statistics element");
}
}
@Override
public Element createElement(Statistics object, Namespaces namespaces) throws ObjectSerializeException {
return Element.of(QualityADEModule.NAMESPACE_URI, "Statistics");
......@@ -82,5 +85,9 @@ public class StatisticsAdapter implements ObjectBuilder<Statistics>, ObjectSeria
writer.writeElementUsingSerializer(Element.of(QualityADEModule.NAMESPACE_URI, "numErrorTransportation"),
object.getNumErrorTransportation(), FeatureStatisticsPropertyAdapter.class, namespaces);
}
for (ErrorProperty errorProp : object.getErrors()) {
writer.writeElementUsingSerializer(Element.of(QualityADEModule.NAMESPACE_URI, "error"), errorProp,
ErrorPropertyAdapter.class, namespaces);
}
}
}
......@@ -27,6 +27,15 @@ public class FeatureStatistics extends GMLObject implements ADEObject {
private int numChecked;
private int numErrors;
public FeatureStatistics() {
// constructor for serialization
}
public FeatureStatistics(int numChecked, int numErrors) {
this.numChecked = numChecked;
this.numErrors = numErrors;
}
public int getNumChecked() {
return numChecked;
......
de.hft.stuttgart.quality.QualityADEContext
\ No newline at end of file
Supports Markdown
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