Skip to content

Commit 9fd61d8

Browse files
author
Jelle Dijkstra
committed
Requested changes
1 parent 93fea7c commit 9fd61d8

File tree

2 files changed

+20
-24
lines changed

2 files changed

+20
-24
lines changed

internal/controller/capabilitiesgenerator/capabilities_generator_test.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -652,8 +652,8 @@ func TestInputForWMS(t *testing.T) {
652652
pdoknlv3.SetHost("http://localhost")
653653

654654
contactPersonPrimary := smoothoperatorv1.ContactPersonPrimary{
655-
ContactPerson: asPtr("KlantContactCenter PDOK"),
656-
ContactOrganization: asPtr("PDOK"),
655+
ContactPerson: smoothoperatorutils.Pointer("KlantContactCenter PDOK"),
656+
ContactOrganization: smoothoperatorutils.Pointer("PDOK"),
657657
}
658658

659659
ownerInfo := smoothoperatorv1.OwnerInfo{
@@ -667,18 +667,18 @@ func TestInputForWMS(t *testing.T) {
667667
WMS: &smoothoperatorv1.WMS{
668668
ContactInformation: smoothoperatorv1.ContactInformation{
669669
ContactPersonPrimary: &contactPersonPrimary,
670-
ContactPosition: asPtr("pointOfContact"),
670+
ContactPosition: smoothoperatorutils.Pointer("pointOfContact"),
671671
ContactAddress: &smoothoperatorv1.ContactAddress{
672-
AddressType: asPtr("Work"),
672+
AddressType: smoothoperatorutils.Pointer("Work"),
673673
Address: nil,
674-
City: asPtr("Apeldoorn"),
674+
City: smoothoperatorutils.Pointer("Apeldoorn"),
675675
StateOrProvince: nil,
676676
PostCode: nil,
677-
Country: asPtr("The Netherlands"),
677+
Country: smoothoperatorutils.Pointer("The Netherlands"),
678678
},
679679
ContactVoiceTelephone: nil,
680680
ContactFacsimileTelephone: nil,
681-
ContactElectronicMailAddress: asPtr("[email protected]"),
681+
ContactElectronicMailAddress: smoothoperatorutils.Pointer("[email protected]"),
682682
},
683683
},
684684
},

internal/controller/capabilitiesgenerator/mapper.go

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ func MapWMSToCapabilitiesGeneratorInput(wms *pdoknlv3.WMS, ownerInfo *smoothoper
232232
KeywordList: &wms130.Keywords{Keyword: wms.Spec.Service.Keywords},
233233
OnlineResource: wms130.OnlineResource{Href: &hostBaseURL},
234234
ContactInformation: getContactInformation(ownerInfo),
235-
Fees: asPtr("NONE"),
235+
Fees: smoothoperatorutils.Pointer("NONE"),
236236
AccessConstraints: &wms.Spec.Service.AccessConstraints,
237237
LayerLimit: nil,
238238
MaxWidth: &maxWidth,
@@ -338,7 +338,7 @@ func getDcpType(url string, fillPost bool) *wms130.DCPType {
338338
OnlineResource: wms130.OnlineResource{
339339
Xlink: nil,
340340
Type: nil,
341-
Href: asPtr(url),
341+
Href: smoothoperatorutils.Pointer(url),
342342
},
343343
}
344344

@@ -364,9 +364,9 @@ func getLayers(wms *pdoknlv3.WMS, canonicalURL string) []wms130.Layer {
364364
referenceLayer := wms.Spec.Service.Layer
365365
title := referenceLayer.Title
366366
if title != nil {
367-
title = asPtr(mapperutils.EscapeQuotes(*referenceLayer.Title))
367+
title = smoothoperatorutils.Pointer(mapperutils.EscapeQuotes(*referenceLayer.Title))
368368
} else {
369-
title = asPtr("")
369+
title = smoothoperatorutils.Pointer("")
370370
}
371371

372372
defaultCrs := []wms130.CRS{{
@@ -508,11 +508,11 @@ func getLayers(wms *pdoknlv3.WMS, canonicalURL string) []wms130.Layer {
508508
}
509509

510510
topLayer := wms130.Layer{
511-
Queryable: asPtr(1),
511+
Queryable: smoothoperatorutils.Pointer(1),
512512
Opaque: nil,
513513
Name: nil,
514514
Title: *title,
515-
Abstract: asPtr(mapperutils.EscapeQuotes(wms.Spec.Service.Abstract)),
515+
Abstract: smoothoperatorutils.Pointer(mapperutils.EscapeQuotes(wms.Spec.Service.Abstract)),
516516
KeywordList: &wms130.Keywords{Keyword: referenceLayer.Keywords},
517517
CRS: defaultCrs,
518518
EXGeographicBoundingBox: &defaultBoundingBox,
@@ -552,12 +552,12 @@ func getLayers(wms *pdoknlv3.WMS, canonicalURL string) []wms130.Layer {
552552

553553
if layer.DatasetMetadataURL != nil {
554554
metadataUrls = append(metadataUrls, &wms130.MetadataURL{
555-
Type: asPtr("TC211"),
556-
Format: asPtr("text/plain"),
555+
Type: smoothoperatorutils.Pointer("TC211"),
556+
Format: smoothoperatorutils.Pointer("text/plain"),
557557
OnlineResource: wms130.OnlineResource{
558558
Xlink: nil,
559-
Type: asPtr("simple"),
560-
Href: asPtr("https://www.nationaalgeoregister.nl/geonetwork/srv/dut/csw?service=CSW&version=2.0.2&request=GetRecordById&outputschema=http://www.isotc211.org/2005/gmd&elementsetname=full&id=" + layer.DatasetMetadataURL.CSW.MetadataIdentifier),
559+
Type: smoothoperatorutils.Pointer("simple"),
560+
Href: smoothoperatorutils.Pointer("https://www.nationaalgeoregister.nl/geonetwork/srv/dut/csw?service=CSW&version=2.0.2&request=GetRecordById&outputschema=http://www.isotc211.org/2005/gmd&elementsetname=full&id=" + layer.DatasetMetadataURL.CSW.MetadataIdentifier),
561561
},
562562
})
563563
}
@@ -570,7 +570,7 @@ func getLayers(wms *pdoknlv3.WMS, canonicalURL string) []wms130.Layer {
570570
}
571571

572572
nestedLayer := wms130.Layer{
573-
Queryable: asPtr(1),
573+
Queryable: smoothoperatorutils.Pointer(1),
574574
Opaque: nil,
575575
Name: layer.Name,
576576
Title: smoothoperatorutils.PointerVal(layer.Title, ""),
@@ -604,8 +604,8 @@ func getLayers(wms *pdoknlv3.WMS, canonicalURL string) []wms130.Layer {
604604
Format: "image/png",
605605
OnlineResource: wms130.OnlineResource{
606606
Xlink: nil,
607-
Type: asPtr("simple"),
608-
Href: asPtr(canonicalURL + "/legend/" + *layer.Name + "/" + style.Name + ".png"),
607+
Type: smoothoperatorutils.Pointer("simple"),
608+
Href: smoothoperatorutils.Pointer(canonicalURL + "/legend/" + *layer.Name + "/" + style.Name + ".png"),
609609
},
610610
},
611611
StyleSheetURL: nil,
@@ -619,7 +619,3 @@ func getLayers(wms *pdoknlv3.WMS, canonicalURL string) []wms130.Layer {
619619
result = append(result, topLayer)
620620
return result
621621
}
622-
623-
func asPtr[T any](value T) *T {
624-
return &value
625-
}

0 commit comments

Comments
 (0)