Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
CityDoctor
QualityADE
Commits
af713a75
Commit
af713a75
authored
Apr 14, 2022
by
Matthias Betz
Browse files
removing one list depth of multiple component error
parent
21048170
Changes
8
Hide whitespace changes
Inline
Side-by-side
citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/adapter/properties/ComponentListPropertyAdapter.java
deleted
100644 → 0
View file @
21048170
/*-
* 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
();
}
}
citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/adapter/types/ComponentListAdapter.java
deleted
100644 → 0
View file @
21048170
package
de.hft.stuttgart.quality.adapter.types
;
import
javax.xml.namespace.QName
;
import
org.xmlobjects.annotation.XMLElement
;
import
org.xmlobjects.builder.ObjectBuildException
;
import
org.xmlobjects.builder.ObjectBuilder
;
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.adapter.properties.PolygonIdListPropertyAdapter
;
import
de.hft.stuttgart.quality.model.properties.PolygonIdListProperty
;
import
de.hft.stuttgart.quality.model.types.ComponentList
;
@XMLElement
(
name
=
"ComponentList"
,
namespaceURI
=
QualityADEModule
.
NAMESPACE_URI
)
public
class
ComponentListAdapter
implements
ObjectBuilder
<
ComponentList
>,
ObjectSerializer
<
ComponentList
>
{
@Override
public
ComponentList
createObject
(
QName
name
,
Object
parent
)
throws
ObjectBuildException
{
return
new
ComponentList
();
}
@Override
public
void
buildChildObject
(
ComponentList
object
,
QName
name
,
Attributes
attributes
,
XMLReader
reader
)
throws
ObjectBuildException
,
XMLReadException
{
if
(!
QualityADEModule
.
NAMESPACE_URI
.
equals
(
name
.
getNamespaceURI
()))
{
return
;
}
switch
(
name
.
getLocalPart
())
{
case
"component"
->
object
.
getComponents
()
.
add
(
reader
.
getObjectUsingBuilder
(
PolygonIdListPropertyAdapter
.
class
));
default
->
throw
new
IllegalStateException
(
"Cannot handle name "
+
name
+
" when building ComponentList element"
);
}
}
@Override
public
Element
createElement
(
ComponentList
object
,
Namespaces
namespaces
)
throws
ObjectSerializeException
{
return
Element
.
of
(
QualityADEModule
.
NAMESPACE_URI
,
"ComponentList"
);
}
@Override
public
void
writeChildElements
(
ComponentList
object
,
Namespaces
namespaces
,
XMLWriter
writer
)
throws
ObjectSerializeException
,
XMLWriteException
{
for
(
PolygonIdListProperty
listProperty
:
object
.
getComponents
())
{
writer
.
writeElementUsingSerializer
(
Element
.
of
(
QualityADEModule
.
NAMESPACE_URI
,
"component"
),
listProperty
,
PolygonIdListPropertyAdapter
.
class
,
namespaces
);
}
}
}
citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/adapter/types/MultipleComponentsErrorAdapter.java
View file @
af713a75
...
...
@@ -14,8 +14,8 @@ import org.xmlobjects.xml.Element;
import
org.xmlobjects.xml.Namespaces
;
import
de.hft.stuttgart.quality.QualityADEModule
;
import
de.hft.stuttgart.quality.adapter.properties.
Component
ListPropertyAdapter
;
import
de.hft.stuttgart.quality.model.properties.
Component
ListProperty
;
import
de.hft.stuttgart.quality.adapter.properties.
PolygonId
ListPropertyAdapter
;
import
de.hft.stuttgart.quality.model.properties.
PolygonId
ListProperty
;
import
de.hft.stuttgart.quality.model.types.MultipleComponentsError
;
@XMLElement
(
name
=
"GE_S_MULTIPLE_CONNECTED_COMPONENTS"
,
namespaceURI
=
QualityADEModule
.
NAMESPACE_URI
)
...
...
@@ -33,11 +33,11 @@ public class MultipleComponentsErrorAdapter extends AbstractSolidErrorAdapter<Mu
return
;
}
switch
(
name
.
getLocalPart
())
{
case
"component
s
"
->
object
.
getComponents
().
add
(
reader
.
getObjectUsingBuilder
(
Component
ListPropertyAdapter
.
class
));
case
"component"
->
object
.
getComponents
().
add
(
reader
.
getObjectUsingBuilder
(
PolygonId
ListPropertyAdapter
.
class
));
default
->
super
.
buildChildObject
(
object
,
name
,
attributes
,
reader
);
}
}
@Override
public
Element
createElement
(
MultipleComponentsError
object
,
Namespaces
namespaces
)
throws
ObjectSerializeException
{
...
...
@@ -48,9 +48,9 @@ public class MultipleComponentsErrorAdapter extends AbstractSolidErrorAdapter<Mu
public
void
writeChildElements
(
MultipleComponentsError
object
,
Namespaces
namespaces
,
XMLWriter
writer
)
throws
ObjectSerializeException
,
XMLWriteException
{
super
.
writeChildElements
(
object
,
namespaces
,
writer
);
for
(
Component
ListProperty
clp
:
object
.
getComponents
())
{
writer
.
writeElementUsingSerializer
(
Element
.
of
(
QualityADEModule
.
NAMESPACE_URI
,
"component
s
"
),
clp
,
Component
ListPropertyAdapter
.
class
,
namespaces
);
for
(
PolygonId
ListProperty
clp
:
object
.
getComponents
())
{
writer
.
writeElementUsingSerializer
(
Element
.
of
(
QualityADEModule
.
NAMESPACE_URI
,
"component"
),
clp
,
PolygonId
ListPropertyAdapter
.
class
,
namespaces
);
}
}
}
citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/model/properties/ComponentListProperty.java
deleted
100644 → 0
View file @
21048170
/*-
* 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.model.properties
;
import
java.io.Serial
;
import
org.citygml4j.core.model.ade.ADEObject
;
import
org.xmlobjects.gml.model.base.AbstractInlineProperty
;
import
de.hft.stuttgart.quality.model.types.ComponentList
;
public
class
ComponentListProperty
extends
AbstractInlineProperty
<
ComponentList
>
implements
ADEObject
{
@Serial
private
static
final
long
serialVersionUID
=
3081945215746143126L
;
public
ComponentListProperty
()
{
super
();
}
public
ComponentListProperty
(
ComponentList
cl
)
{
super
(
cl
);
}
@Override
public
Class
<
ComponentList
>
getTargetType
()
{
return
ComponentList
.
class
;
}
}
citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/model/types/ComponentList.java
deleted
100644 → 0
View file @
21048170
/*-
* 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.model.types
;
import
java.io.Serial
;
import
java.util.List
;
import
org.citygml4j.core.model.ade.ADEObject
;
import
org.xmlobjects.gml.model.GMLObject
;
import
org.xmlobjects.model.ChildList
;
import
de.hft.stuttgart.quality.model.properties.PolygonIdListProperty
;
public
class
ComponentList
extends
GMLObject
implements
ADEObject
{
@Serial
private
static
final
long
serialVersionUID
=
7846916128728837265L
;
private
List
<
PolygonIdListProperty
>
components
;
public
List
<
PolygonIdListProperty
>
getComponents
()
{
if
(
components
==
null
)
{
components
=
new
ChildList
<>(
this
);
}
return
components
;
}
public
void
setComponents
(
List
<
PolygonIdListProperty
>
components
)
{
this
.
components
=
asChild
(
components
);
}
}
citygml4j-quality-ade/src/main/java/de/hft/stuttgart/quality/model/types/MultipleComponentsError.java
View file @
af713a75
...
...
@@ -20,23 +20,23 @@ import java.util.List;
import
org.xmlobjects.model.ChildList
;
import
de.hft.stuttgart.quality.model.properties.
Component
ListProperty
;
import
de.hft.stuttgart.quality.model.properties.
PolygonId
ListProperty
;
public
class
MultipleComponentsError
extends
AbstractSolidError
{
@Serial
private
static
final
long
serialVersionUID
=
4322219502819024437L
;
private
List
<
Component
ListProperty
>
components
;
private
List
<
PolygonId
ListProperty
>
components
;
public
List
<
Component
ListProperty
>
getComponents
()
{
public
List
<
PolygonId
ListProperty
>
getComponents
()
{
if
(
components
==
null
)
{
components
=
new
ChildList
<>(
this
);
}
return
components
;
}
public
void
setComponents
(
List
<
Component
ListProperty
>
edges
)
{
public
void
setComponents
(
List
<
PolygonId
ListProperty
>
edges
)
{
this
.
components
=
asChild
(
edges
);
}
...
...
citygml4j-quality-ade/src/main/resources/qualityAde.xsd
View file @
af713a75
...
...
@@ -94,17 +94,6 @@
<element
ref=
"qual:Checking"
/>
</sequence>
</complexType>
<element
name=
"ComponentList"
substitutionGroup=
"gml:_Object"
type=
"qual:ComponentListType"
/>
<complexType
name=
"ComponentListType"
>
<sequence>
<element
maxOccurs=
"unbounded"
name=
"component"
type=
"qual:PolygonIdListPropertyType"
/>
</sequence>
</complexType>
<complexType
name=
"ComponentListPropertyType"
>
<sequence>
<element
ref=
"qual:ComponentList"
/>
</sequence>
</complexType>
<element
name=
"Edge"
substitutionGroup=
"gml:_Object"
type=
"qual:EdgeType"
/>
<complexType
name=
"EdgeType"
>
<sequence>
...
...
@@ -383,7 +372,7 @@
<complexContent>
<extension
base=
"qual:AbstractSolidErrorType"
>
<sequence>
<element
maxOccurs=
"unbounded"
name=
"component
s
"
type=
"qual:
Component
ListPropertyType"
/>
<element
maxOccurs=
"unbounded"
name=
"component"
type=
"qual:
PolygonId
ListPropertyType"
/>
</sequence>
</extension>
</complexContent>
...
...
citygml4j-quality-ade/src/test/java/de/hft/stuttgart/quality/QualityAdeTests.java
View file @
af713a75
...
...
@@ -63,7 +63,6 @@ import de.hft.stuttgart.quality.model.enums.RingSelfIntType;
import
de.hft.stuttgart.quality.model.enums.TopLevelFeatureType
;
import
de.hft.stuttgart.quality.model.properties.AbstractErrorProperty
;
import
de.hft.stuttgart.quality.model.properties.CheckingProperty
;
import
de.hft.stuttgart.quality.model.properties.ComponentListProperty
;
import
de.hft.stuttgart.quality.model.properties.EdgeListProperty
;
import
de.hft.stuttgart.quality.model.properties.EdgeProperty
;
import
de.hft.stuttgart.quality.model.properties.FeatureStatisticsProperty
;
...
...
@@ -78,7 +77,6 @@ import de.hft.stuttgart.quality.model.properties.ValidationResultProperty;
import
de.hft.stuttgart.quality.model.types.AllPolygonsOrientedWrongError
;
import
de.hft.stuttgart.quality.model.types.Checking
;
import
de.hft.stuttgart.quality.model.types.CityObjectProperties
;
import
de.hft.stuttgart.quality.model.types.ComponentList
;
import
de.hft.stuttgart.quality.model.types.ConsecutivePointsSameError
;
import
de.hft.stuttgart.quality.model.types.Edge
;
import
de.hft.stuttgart.quality.model.types.EdgeList
;
...
...
@@ -213,14 +211,10 @@ class QualityAdeTests {
MultipleComponentsError
err
=
new
MultipleComponentsError
();
err
.
setGeometryId
(
"geomId"
);
ComponentList
comp
=
new
ComponentList
();
PolygonIdList
polygons
=
new
PolygonIdList
();
polygons
.
getPolygonIds
().
add
(
"test1"
);
polygons
.
getPolygonIds
().
add
(
"test2"
);
comp
.
getComponents
().
add
(
new
PolygonIdListProperty
(
polygons
));
err
.
getComponents
().
add
(
new
ComponentListProperty
(
comp
));
err
.
getComponents
().
add
(
new
PolygonIdListProperty
(
polygons
));
res
.
getErrors
().
add
(
new
AbstractErrorProperty
(
err
));
byte
[]
buf
=
writeModel
(
model
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment