Commit 5fe70e14 authored by Matthias Betz's avatar Matthias Betz
Browse files

add property adapters

parent c35f2cd6
/*-
* Copyright 2022 Hochschule für Technik Stuttgart
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package de.hft.stuttgart.quality.adapter;
import javax.xml.namespace.QName;
import org.xmlobjects.builder.ObjectBuildException;
import org.xmlobjects.builder.ObjectBuilder;
import org.xmlobjects.gml.adapter.geometry.DirectPositionAdapter;
import org.xmlobjects.serializer.ObjectSerializeException;
import org.xmlobjects.serializer.ObjectSerializer;
import org.xmlobjects.stream.XMLReadException;
import org.xmlobjects.stream.XMLReader;
import org.xmlobjects.stream.XMLWriteException;
import org.xmlobjects.stream.XMLWriter;
import org.xmlobjects.xml.Attributes;
import org.xmlobjects.xml.Element;
import org.xmlobjects.xml.Namespaces;
import de.hft.stuttgart.quality.QualityADEModule;
import de.hft.stuttgart.quality.model.types.Edge;
public class EdgeAdapter implements ObjectBuilder<Edge>, ObjectSerializer<Edge> {
@Override
public Edge createObject(QName name, Object parent) throws ObjectBuildException {
return new Edge();
}
@Override
public void buildChildObject(Edge object, QName name, Attributes attributes, XMLReader reader)
throws ObjectBuildException, XMLReadException {
if (!QualityADEModule.NAMESPACE_URI.equals(name.getNamespaceURI())) {
return;
}
switch (name.getLocalPart()) {
case "from" -> object.setFrom(reader.getObjectUsingBuilder(DirectPositionAdapter.class));
case "to" -> object.setTo(reader.getObjectUsingBuilder(DirectPositionAdapter.class));
default -> throw new IllegalStateException("Cannot handle name " + name + " when building edge element");
}
}
@Override
public void writeChildElements(Edge object, Namespaces namespaces, XMLWriter writer)
throws ObjectSerializeException, XMLWriteException {
if (object.getFrom() != null) {
writer.writeElementUsingSerializer(Element.of(QualityADEModule.NAMESPACE_URI, "from"), object.getFrom(),
DirectPositionAdapter.class, namespaces);
}
if (object.getTo() != null) {
writer.writeElementUsingSerializer(Element.of(QualityADEModule.NAMESPACE_URI, "to"), object.getTo(),
DirectPositionAdapter.class, namespaces);
}
}
}
/*-
* Copyright 2022 Hochschule für Technik Stuttgart
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package de.hft.stuttgart.quality.adapter.properties;
import de.hft.stuttgart.quality.model.properties.AbstractErrorProperty;
import org.xmlobjects.builder.ObjectBuildException;
import org.xmlobjects.gml.adapter.base.AbstractInlinePropertyAdapter;
import javax.xml.namespace.QName;
public class AbstractErrorPropertyAdapter extends AbstractInlinePropertyAdapter<AbstractErrorProperty> {
@Override
public AbstractErrorProperty createObject(QName name, Object parent) throws ObjectBuildException {
return new AbstractErrorProperty();
}
}
/*-
* Copyright 2022 Hochschule für Technik Stuttgart
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package de.hft.stuttgart.quality.adapter.properties;
import de.hft.stuttgart.quality.model.properties.AbstractGeometryErrorProperty;
import org.xmlobjects.builder.ObjectBuildException;
import org.xmlobjects.gml.adapter.base.AbstractInlinePropertyAdapter;
import javax.xml.namespace.QName;
public class AbstractGeometryErrorPropertyAdapter extends AbstractInlinePropertyAdapter<AbstractGeometryErrorProperty> {
@Override
public AbstractGeometryErrorProperty createObject(QName name, Object parent) throws ObjectBuildException {
return new AbstractGeometryErrorProperty();
}
}
/*-
* Copyright 2022 Hochschule für Technik Stuttgart
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package de.hft.stuttgart.quality.adapter.properties;
import de.hft.stuttgart.quality.model.properties.AbstractPolygonErrorProperty;
import org.xmlobjects.builder.ObjectBuildException;
import org.xmlobjects.gml.adapter.base.AbstractInlinePropertyAdapter;
import javax.xml.namespace.QName;
public class AbstractPolygonErrorPropertyAdapter extends AbstractInlinePropertyAdapter<AbstractPolygonErrorProperty> {
@Override
public AbstractPolygonErrorProperty createObject(QName name, Object parent) throws ObjectBuildException {
return new AbstractPolygonErrorProperty();
}
}
/*-
* Copyright 2022 Hochschule für Technik Stuttgart
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package de.hft.stuttgart.quality.adapter.properties;
import de.hft.stuttgart.quality.model.properties.AbstractRingErrorProperty;
import org.xmlobjects.builder.ObjectBuildException;
import org.xmlobjects.gml.adapter.base.AbstractInlinePropertyAdapter;
import javax.xml.namespace.QName;
public class AbstractRingErrorPropertyAdapter extends AbstractInlinePropertyAdapter<AbstractRingErrorProperty> {
@Override
public AbstractRingErrorProperty createObject(QName name, Object parent) throws ObjectBuildException {
return new AbstractRingErrorProperty();
}
}
/*-
* Copyright 2022 Hochschule für Technik Stuttgart
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package de.hft.stuttgart.quality.adapter.properties;
import de.hft.stuttgart.quality.model.properties.AbstractSemanticErrorProperty;
import org.xmlobjects.builder.ObjectBuildException;
import org.xmlobjects.gml.adapter.base.AbstractInlinePropertyAdapter;
import javax.xml.namespace.QName;
public class AbstractSemanticErrorPropertyAdapter extends AbstractInlinePropertyAdapter<AbstractSemanticErrorProperty> {
@Override
public AbstractSemanticErrorProperty createObject(QName name, Object parent) throws ObjectBuildException {
return new AbstractSemanticErrorProperty();
}
}
/*-
* Copyright 2022 Hochschule für Technik Stuttgart
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package de.hft.stuttgart.quality.adapter.properties;
import de.hft.stuttgart.quality.model.properties.AbstractSolidErrorProperty;
import org.xmlobjects.builder.ObjectBuildException;
import org.xmlobjects.gml.adapter.base.AbstractInlinePropertyAdapter;
import javax.xml.namespace.QName;
public class AbstractSolidErrorPropertyAdapter extends AbstractInlinePropertyAdapter<AbstractSolidErrorProperty> {
@Override
public AbstractSolidErrorProperty createObject(QName name, Object parent) throws ObjectBuildException {
return new AbstractSolidErrorProperty();
}
}
/*-
* Copyright 2022 Hochschule für Technik Stuttgart
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package de.hft.stuttgart.quality.adapter.properties;
import de.hft.stuttgart.quality.model.properties.CheckingProperty;
import org.xmlobjects.builder.ObjectBuildException;
import org.xmlobjects.gml.adapter.base.AbstractInlinePropertyAdapter;
import javax.xml.namespace.QName;
public class CheckingPropertyAdapter extends AbstractInlinePropertyAdapter<CheckingProperty> {
@Override
public CheckingProperty createObject(QName name, Object parent) throws ObjectBuildException {
return new CheckingProperty();
}
}
/*-
* Copyright 2022 Hochschule für Technik Stuttgart
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package de.hft.stuttgart.quality.adapter.properties;
import de.hft.stuttgart.quality.model.properties.ComponentListProperty;
import org.xmlobjects.builder.ObjectBuildException;
import org.xmlobjects.gml.adapter.base.AbstractInlinePropertyAdapter;
import javax.xml.namespace.QName;
public class ComponentListPropertyAdapter extends AbstractInlinePropertyAdapter<ComponentListProperty> {
@Override
public ComponentListProperty createObject(QName name, Object parent) throws ObjectBuildException {
return new ComponentListProperty();
}
}
/*-
* Copyright 2022 Hochschule für Technik Stuttgart
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package de.hft.stuttgart.quality.adapter.properties;
import de.hft.stuttgart.quality.model.properties.EdgeListProperty;
import org.xmlobjects.builder.ObjectBuildException;
import org.xmlobjects.gml.adapter.base.AbstractInlinePropertyAdapter;
import javax.xml.namespace.QName;
public class EdgeListPropertyAdapter extends AbstractInlinePropertyAdapter<EdgeListProperty> {
@Override
public EdgeListProperty createObject(QName name, Object parent) throws ObjectBuildException {
return new EdgeListProperty();
}
}
/*-
* Copyright 2022 Hochschule für Technik Stuttgart
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package de.hft.stuttgart.quality.adapter.properties;
import de.hft.stuttgart.quality.model.properties.EdgeProperty;
import org.xmlobjects.builder.ObjectBuildException;
import org.xmlobjects.gml.adapter.base.AbstractInlinePropertyAdapter;
import javax.xml.namespace.QName;
public class EdgePropertyAdapter extends AbstractInlinePropertyAdapter<EdgeProperty> {
@Override
public EdgeProperty createObject(QName name, Object parent) throws ObjectBuildException {
return new EdgeProperty();
}
}
/*-
* Copyright 2022 Hochschule für Technik Stuttgart
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package de.hft.stuttgart.quality.adapter.properties;
import de.hft.stuttgart.quality.model.properties.ErrorProperty;
import org.xmlobjects.builder.ObjectBuildException;
import org.xmlobjects.gml.adapter.base.AbstractInlinePropertyAdapter;
import javax.xml.namespace.QName;
public class ErrorPropertyAdapter extends AbstractInlinePropertyAdapter<ErrorProperty> {
@Override
public ErrorProperty createObject(QName name, Object parent) throws ObjectBuildException {
return new ErrorProperty();
}
}
/*-
* Copyright 2022 Hochschule für Technik Stuttgart
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package de.hft.stuttgart.quality.adapter.properties;
import de.hft.stuttgart.quality.model.properties.FeatureStatisticsProperty;
import org.xmlobjects.builder.ObjectBuildException;
import org.xmlobjects.gml.adapter.base.AbstractInlinePropertyAdapter;
import javax.xml.namespace.QName;
public class FeatureStatisticsPropertyAdapter extends AbstractInlinePropertyAdapter<FeatureStatisticsProperty> {
@Override
public FeatureStatisticsProperty createObject(QName name, Object parent) throws ObjectBuildException {
return new FeatureStatisticsProperty();
}
}
/*-
* Copyright 2022 Hochschule für Technik Stuttgart
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package de.hft.stuttgart.quality.adapter.properties;
import de.hft.stuttgart.quality.model.properties.FilterProperty;
import org.xmlobjects.builder.ObjectBuildException;
import org.xmlobjects.gml.adapter.base.AbstractInlinePropertyAdapter;
import javax.xml.namespace.QName;
public class FilterPropertyAdapter extends AbstractInlinePropertyAdapter<FilterProperty> {
@Override
public FilterProperty createObject(QName name, Object parent) throws ObjectBuildException {
return new FilterProperty();
}
}
/*-
* Copyright 2022 Hochschule für Technik Stuttgart
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package de.hft.stuttgart.quality.adapter.properties;
import de.hft.stuttgart.quality.model.properties.GlobalParametersProperty;
import org.xmlobjects.builder.ObjectBuildException;
import org.xmlobjects.gml.adapter.base.AbstractInlinePropertyAdapter;
import javax.xml.namespace.QName;
public class GlobalParametersPropertyAdapter extends AbstractInlinePropertyAdapter<GlobalParametersProperty> {
@Override
public GlobalParametersProperty createObject(QName name, Object parent) throws ObjectBuildException {
return new GlobalParametersProperty();
}
}
/*-
* Copyright 2022 Hochschule für Technik Stuttgart
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package de.hft.stuttgart.quality.adapter.properties;
import de.hft.stuttgart.quality.model.properties.ParameterProperty;
import org.xmlobjects.builder.ObjectBuildException;
import org.xmlobjects.gml.adapter.base.AbstractInlinePropertyAdapter;
import javax.xml.namespace.QName;
public class ParameterPropertyAdapter extends AbstractInlinePropertyAdapter<ParameterProperty> {
@Override
public ParameterProperty createObject(QName name, Object parent) throws ObjectBuildException {
return new ParameterProperty();
}
}
/*-
* Copyright 2022 Hochschule für Technik Stuttgart
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software