@@ -20,7 +20,12 @@ export function load(contentElement, cdata, objectType, fieldPath, isMultiSelect
2020 const fieldConfiguration = getFieldConfiguration ( objectType , fieldPath ) ;
2121 if ( ! fieldConfiguration ) return console . error ( 'No configuration found for field path "' + fieldPath + '"' ) ;
2222
23- const settings = { isMultiSelect, fieldConfiguration } ;
23+ const settings = {
24+ isMultiSelect,
25+ fieldConfiguration,
26+ geometryIdFieldName : getGeometryIdFieldName ( )
27+ } ;
28+
2429 loadWFSData ( settings , cdata . geometry_ids ) . then (
2530 wfsData => renderContent ( contentElement , cdata , settings , mode , wfsData ) ,
2631 error => console . error ( error )
@@ -161,7 +166,10 @@ function createLinkExistingGeometryButton(contentElement, cdata, settings) {
161166}
162167
163168function editGeometry ( contentElement , cdata , settings , wfsData , uuid ) {
164- const extent = wfsData ?. features . find ( feature => feature . properties . ouuid === uuid ) ?. bbox ;
169+ const extent = wfsData ?. features . find ( feature => {
170+ return feature . properties [ settings . geometryIdFieldName ] === uuid ;
171+ } ) ?. bbox ;
172+
165173 if ( ! extent ) return ;
166174
167175 window . open ( getEditGeometryUrl ( settings , wfsData , extent ) , '_blank' ) ;
@@ -500,7 +508,7 @@ function configureGeometrySelection(map, contentElement, cdata, settings, wfsDat
500508 map . addInteraction ( select ) ;
501509 select . on ( 'select' , event => {
502510 const selectedGeometryId = event . selected . length > 0
503- ? event . selected [ 0 ] . get ( 'ouuid' )
511+ ? event . selected [ 0 ] . get ( settings . geometryIdFieldName )
504512 : undefined ;
505513 rerenderEditorButtons ( contentElement , cdata , settings , wfsData , extent , selectedGeometryId ) ;
506514 } ) ;
@@ -562,7 +570,6 @@ function getMasterportalVectorLayerIds(fieldConfiguration, wfsData) {
562570}
563571
564572function getDefaultMasterportalVectorLayerId ( fieldConfiguration ) {
565-
566573 return fieldConfiguration . masterportal_default_vector_layer_id
567574 ?. find ( entry => entry . group_id === null || getUserGroupIds ( ) . includes ( entry . group_id ) )
568575 ?. layer_id ;
@@ -579,7 +586,6 @@ function getMasterportalUrl() {
579586}
580587
581588function getConfigurationFileName ( ) {
582-
583589 const configurationId = getUserConfiguration ( ) . masterportal_configuration ;
584590 if ( ! configurationId ?. length ) return undefined ;
585591
@@ -597,7 +603,9 @@ function getWfsUrl(settings, geometryIds) {
597603 return baseUrl
598604 + '?service=WFS&version=1.1.0&request=GetFeature&typename='
599605 + featureType
600- + '&outputFormat=application/json&srsname=EPSG:25832&cql_filter=ouuid in ('
606+ + '&outputFormat=application/json&srsname=EPSG:25832&cql_filter='
607+ + settings . geometryIdFieldName
608+ + ' in ('
601609 + geometryIds . map ( id => '\'' + id + '\'' ) . join ( ',' )
602610 + ')' ;
603611}
@@ -609,6 +617,14 @@ function getAuthorizationString() {
609617 return 'Basic ' + window . btoa ( username + ':' + password ) ;
610618}
611619
620+ function getGeometryIdFieldName ( ) {
621+ const fieldName = getBaseConfiguration ( ) . wfs_geometry_id_field_name ;
622+
623+ return fieldName ?. length
624+ ? fieldName
625+ : 'ouuid' ;
626+ }
627+
612628function getBaseConfiguration ( ) {
613629 return ez5 . session . getBaseConfig ( 'plugin' , 'custom-data-type-nfis-geometry' ) [ 'nfisGeoservices' ] ;
614630}
0 commit comments