@@ -35,13 +35,16 @@ import (
3535 pdoknlv3 "github.com/pdok/mapserver-operator/api/v3"
3636)
3737
38+ const SERVICE_METADATA_IDENTIFIER_ANNOTATION = "pdok.nl/wms-service-metadata-uuid"
39+
3840// ConvertTo converts this WMS (v2beta1) to the Hub version (v3).
3941func (src * WMS ) ConvertTo (dstRaw conversion.Hub ) error {
4042 dst := dstRaw .(* pdoknlv3.WMS )
4143 log .Printf ("ConvertTo: Converting WMS from Spoke version v2beta1 to Hub version v3;" +
4244 "source: %s/%s, target: %s/%s" , src .Namespace , src .Name , dst .Namespace , dst .Name )
4345
4446 dst .ObjectMeta = src .ObjectMeta
47+ dst .Annotations [SERVICE_METADATA_IDENTIFIER_ANNOTATION ] = src .Spec .Service .MetadataIdentifier
4548
4649 // Set LifeCycle if defined
4750 if src .Spec .Kubernetes .Lifecycle != nil && src .Spec .Kubernetes .Lifecycle .TTLInDays != nil {
@@ -74,8 +77,7 @@ func (src *WMS) ConvertTo(dstRaw conversion.Hub) error {
7477 DefResolution : nil ,
7578 Inspire : nil ,
7679 DataEPSG : src .Spec .Service .DataEPSG ,
77- //StylingAssets: src.Spec.Service.StylingAssets,
78- Layer : src .Spec .Service .MapLayersToV3 (),
80+ Layer : src .Spec .Service .MapLayersToV3 (),
7981 }
8082
8183 if src .Spec .Service .Maxsize != nil {
@@ -96,7 +98,6 @@ func (src *WMS) ConvertTo(dstRaw conversion.Hub) error {
9698 }
9799 }
98100
99- // TODO - where to place the MetadataIdentifier and FeatureTypes[0].SourceMetadataIdentifier if the service is not inspire?
100101 if src .Spec .Service .Inspire {
101102 service .Inspire = & pdoknlv3.Inspire {
102103 ServiceMetadataURL : pdoknlv3.MetadataURL {
@@ -147,13 +148,14 @@ func (dst *WMS) ConvertFrom(srcRaw conversion.Hub) error {
147148 }
148149
149150 service := WMSService {
150- Title : src .Spec .Service .Title ,
151- Abstract : src .Spec .Service .Abstract ,
152- Keywords : src .Spec .Service .Keywords ,
153- AccessConstraints : src .Spec .Service .AccessConstraints ,
154- Extent : nil ,
155- DataEPSG : src .Spec .Service .DataEPSG ,
156- Layers : []WMSLayer {},
151+ Title : src .Spec .Service .Title ,
152+ Abstract : src .Spec .Service .Abstract ,
153+ Keywords : src .Spec .Service .Keywords ,
154+ AccessConstraints : src .Spec .Service .AccessConstraints ,
155+ Extent : nil ,
156+ DataEPSG : src .Spec .Service .DataEPSG ,
157+ Layers : []WMSLayer {},
158+ MetadataIdentifier : "00000000-0000-0000-0000-000000000000" ,
157159 }
158160
159161 if src .Spec .Service .Mapfile != nil {
@@ -170,6 +172,11 @@ func (dst *WMS) ConvertFrom(srcRaw conversion.Hub) error {
170172 // TODO unable to fill in MetadataIdentifier here untill we know how to handle non inspire services
171173 }
172174
175+ uuid , ok := src .Annotations [SERVICE_METADATA_IDENTIFIER_ANNOTATION ]
176+ if service .MetadataIdentifier == "00000000-0000-0000-0000-000000000000" && ok {
177+ service .MetadataIdentifier = uuid
178+ }
179+
173180 if src .Spec .Service .DefResolution != nil {
174181 service .DefResolution = Pointer (int (* src .Spec .Service .DefResolution ))
175182 }
0 commit comments