@@ -62,7 +62,7 @@ func MapWFSToCapabilitiesGeneratorInput(wfs *pdoknlv3.WFS, ownerInfo *smoothoper
6262
6363 if wfs .Spec .Service .Inspire != nil {
6464 config .Global .AdditionalSchemaLocations = inspireSchemaLocations
65- metadataURL , _ := replaceMustachTemplate (ownerInfo .Spec .MetadataUrls .CSW .HrefTemplate , wfs .Spec .Service .Inspire .ServiceMetadataURL .CSW .MetadataIdentifier )
65+ metadataURL , _ := replaceMustacheTemplate (ownerInfo .Spec .MetadataUrls .CSW .HrefTemplate , wfs .Spec .Service .Inspire .ServiceMetadataURL .CSW .MetadataIdentifier )
6666
6767 config .Services .WFS200Config .Wfs200 .Capabilities .OperationsMetadata = & wfs200.OperationsMetadata {
6868 ExtendedCapabilities : & wfs200.ExtendedCapabilities {
@@ -106,7 +106,7 @@ func getFeatureTypeList(wfs *pdoknlv3.WFS, ownerInfo *smoothoperatorv1.OwnerInfo
106106 otherCRS = append (otherCRS , CRS )
107107 }
108108
109- metadataURL , err := replaceMustachTemplate (ownerInfo .Spec .MetadataUrls .CSW .HrefTemplate , fType .DatasetMetadataURL .CSW .MetadataIdentifier )
109+ metadataURL , err := replaceMustacheTemplate (ownerInfo .Spec .MetadataUrls .CSW .HrefTemplate , fType .DatasetMetadataURL .CSW .MetadataIdentifier )
110110 if err != nil {
111111 return nil , err
112112 }
@@ -148,7 +148,7 @@ func createCRSFromEpsgString(epsgString string) (*wfs200.CRS, error) {
148148 }, nil
149149}
150150
151- func replaceMustachTemplate (hrefTemplate string , identifier string ) (string , error ) {
151+ func replaceMustacheTemplate (hrefTemplate string , identifier string ) (string , error ) {
152152 templateVariable := map [string ]string {"identifier" : identifier }
153153 return mustache .Render (hrefTemplate , templateVariable )
154154}
@@ -165,48 +165,51 @@ func mapServiceProvider(provider *smoothoperatorv1.ServiceProvider) (serviceProv
165165 }
166166 }
167167
168- // TODO fix linting (nestif)
169- //nolint:nestif
170168 if provider .ServiceContact != nil {
171169 serviceProvider .ServiceContact = & wfs200.ServiceContact {
172170 IndividualName : provider .ServiceContact .IndividualName ,
173171 PositionName : provider .ServiceContact .PositionName ,
174172 Role : provider .ServiceContact .Role ,
175173 }
176174 if provider .ServiceContact .ContactInfo != nil {
177- serviceProvider .ServiceContact .ContactInfo = & wfs200.ContactInfo {
178- Text : provider .ServiceContact .ContactInfo .Text ,
179- HoursOfService : provider .ServiceContact .ContactInfo .HoursOfService ,
180- ContactInstructions : provider .ServiceContact .ContactInfo .ContactInstructions ,
181- }
182- if provider .ServiceContact .ContactInfo .Phone != nil {
183- serviceProvider .ServiceContact .ContactInfo .Phone = & wfs200.Phone {
184- Voice : provider .ServiceContact .ContactInfo .Phone .Voice ,
185- Facsimile : provider .ServiceContact .ContactInfo .Phone .Facsimile ,
186- }
187- }
188- if provider .ServiceContact .ContactInfo .Address != nil {
189- serviceProvider .ServiceContact .ContactInfo .Address = & wfs200.Address {
190- DeliveryPoint : provider .ServiceContact .ContactInfo .Address .DeliveryPoint ,
191- City : provider .ServiceContact .ContactInfo .Address .City ,
192- AdministrativeArea : provider .ServiceContact .ContactInfo .Address .AdministrativeArea ,
193- PostalCode : provider .ServiceContact .ContactInfo .Address .PostalCode ,
194- Country : provider .ServiceContact .ContactInfo .Address .Country ,
195- ElectronicMailAddress : provider .ServiceContact .ContactInfo .Address .ElectronicMailAddress ,
196- }
197- }
198- if provider .ServiceContact .ContactInfo .OnlineResource != nil {
199- serviceProvider .ServiceContact .ContactInfo .OnlineResource = & wfs200.OnlineResource {
200- Type : provider .ServiceContact .ContactInfo .OnlineResource .Type ,
201- Href : provider .ServiceContact .ContactInfo .OnlineResource .Href ,
202- }
203- }
175+ serviceProvider .ServiceContact .ContactInfo = mapContactInfo (* provider .ServiceContact .ContactInfo )
204176 }
205177 }
206178
207179 return serviceProvider
208180}
209181
182+ func mapContactInfo (contactInfo smoothoperatorv1.ContactInfo ) (serviceContactInfo * wfs200.ContactInfo ) {
183+ serviceContactInfo = & wfs200.ContactInfo {
184+ Text : contactInfo .Text ,
185+ HoursOfService : contactInfo .HoursOfService ,
186+ ContactInstructions : contactInfo .ContactInstructions ,
187+ }
188+ if contactInfo .Phone != nil {
189+ serviceContactInfo .Phone = & wfs200.Phone {
190+ Voice : contactInfo .Phone .Voice ,
191+ Facsimile : contactInfo .Phone .Facsimile ,
192+ }
193+ }
194+ if contactInfo .Address != nil {
195+ serviceContactInfo .Address = & wfs200.Address {
196+ DeliveryPoint : contactInfo .Address .DeliveryPoint ,
197+ City : contactInfo .Address .City ,
198+ AdministrativeArea : contactInfo .Address .AdministrativeArea ,
199+ PostalCode : contactInfo .Address .PostalCode ,
200+ Country : contactInfo .Address .Country ,
201+ ElectronicMailAddress : contactInfo .Address .ElectronicMailAddress ,
202+ }
203+ }
204+ if contactInfo .OnlineResource != nil {
205+ serviceContactInfo .OnlineResource = & wfs200.OnlineResource {
206+ Type : contactInfo .OnlineResource .Type ,
207+ Href : contactInfo .OnlineResource .Href ,
208+ }
209+ }
210+ return
211+ }
212+
210213func MapWMSToCapabilitiesGeneratorInput (wms * pdoknlv3.WMS , ownerInfo * smoothoperatorv1.OwnerInfo ) (* capabilitiesgenerator.Config , error ) {
211214 hostBaseURL := "https://service.pdok.nl"
212215 canonicalServiceURL := hostBaseURL + "/" + pdoknlv3 .GetBaseURLPath (wms )
@@ -271,7 +274,7 @@ func MapWMSToCapabilitiesGeneratorInput(wms *pdoknlv3.WMS, ownerInfo *smoothoper
271274
272275 if wms .Spec .Service .Inspire != nil {
273276 config .Global .AdditionalSchemaLocations = inspireSchemaLocations
274- metadataURL , _ := replaceMustachTemplate (ownerInfo .Spec .MetadataUrls .CSW .HrefTemplate , wms .Spec .Service .Inspire .ServiceMetadataURL .CSW .MetadataIdentifier )
277+ metadataURL , _ := replaceMustacheTemplate (ownerInfo .Spec .MetadataUrls .CSW .HrefTemplate , wms .Spec .Service .Inspire .ServiceMetadataURL .CSW .MetadataIdentifier )
275278
276279 defaultLanguage := wms130.Language {Language : wms .Spec .Service .Inspire .Language }
277280
0 commit comments