geonetwork-ui 2.2.0-dev.4db0b597 → 2.2.0-dev.5042be2c
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm2022/libs/api/metadata-converter/src/lib/gn4/atomic-operations.mjs +27 -1
- package/esm2022/libs/api/metadata-converter/src/lib/gn4/gn4.field.mapper.mjs +49 -58
- package/esm2022/libs/api/metadata-converter/src/lib/gn4/gn4.metadata.mapper.mjs +5 -4
- package/esm2022/libs/api/metadata-converter/src/lib/gn4/types/metadata.model.mjs +1 -1
- package/esm2022/libs/api/metadata-converter/src/lib/iso19139/codelists/keyword.mapper.mjs +14 -0
- package/esm2022/libs/api/metadata-converter/src/lib/iso19139/converter.mjs +20 -17
- package/esm2022/libs/api/metadata-converter/src/lib/iso19139/read-parts.mjs +52 -23
- package/esm2022/libs/api/metadata-converter/src/lib/iso19139/write-parts.mjs +52 -32
- package/esm2022/libs/api/repository/src/lib/gn4/organizations/organizations-from-metadata.service.mjs +10 -3
- package/esm2022/libs/api/repository/src/lib/gn4/platform/gn4-platform.mapper.mjs +14 -5
- package/esm2022/libs/api/repository/src/lib/gn4/platform/gn4-platform.service.mjs +33 -8
- package/esm2022/libs/common/domain/src/lib/model/record/metadata.model.mjs +1 -1
- package/esm2022/libs/common/domain/src/lib/model/thesaurus/thesaurus.model.mjs +1 -1
- package/esm2022/libs/common/domain/src/lib/platform.service.interface.mjs +1 -1
- package/esm2022/libs/feature/map/src/lib/map-context/map-context.service.mjs +9 -1
- package/esm2022/libs/feature/search/src/lib/utils/service/fields.mjs +41 -26
- package/esm2022/libs/feature/search/src/lib/utils/service/fields.service.mjs +11 -9
- package/esm2022/libs/ui/elements/src/lib/markdown-parser/markdown-parser.component.mjs +3 -3
- package/esm2022/libs/ui/elements/src/lib/metadata-info/metadata-info.component.mjs +35 -22
- package/esm2022/libs/ui/elements/src/lib/metadata-quality/metadata-quality.component.mjs +3 -4
- package/esm2022/libs/ui/elements/src/lib/record-api-form/record-api-form.component.mjs +8 -5
- package/esm2022/libs/ui/elements/src/lib/ui-elements.module.mjs +4 -4
- package/esm2022/libs/ui/inputs/src/lib/button/button.component.mjs +3 -3
- package/esm2022/libs/ui/inputs/src/lib/text-area/text-area.component.mjs +3 -3
- package/esm2022/libs/ui/inputs/src/lib/ui-inputs.module.mjs +6 -6
- package/esm2022/translations/de.json +3 -2
- package/esm2022/translations/en.json +5 -4
- package/esm2022/translations/es.json +3 -2
- package/esm2022/translations/fr.json +5 -4
- package/esm2022/translations/it.json +5 -4
- package/esm2022/translations/nl.json +3 -2
- package/esm2022/translations/pt.json +3 -2
- package/fesm2022/geonetwork-ui.mjs +402 -235
- package/fesm2022/geonetwork-ui.mjs.map +1 -1
- package/libs/api/metadata-converter/src/lib/gn4/atomic-operations.d.ts +2 -0
- package/libs/api/metadata-converter/src/lib/gn4/atomic-operations.d.ts.map +1 -1
- package/libs/api/metadata-converter/src/lib/gn4/gn4.field.mapper.d.ts +0 -1
- package/libs/api/metadata-converter/src/lib/gn4/gn4.field.mapper.d.ts.map +1 -1
- package/libs/api/metadata-converter/src/lib/gn4/gn4.metadata.mapper.d.ts.map +1 -1
- package/libs/api/metadata-converter/src/lib/gn4/types/metadata.model.d.ts +3 -5
- package/libs/api/metadata-converter/src/lib/gn4/types/metadata.model.d.ts.map +1 -1
- package/libs/api/metadata-converter/src/lib/iso19139/codelists/keyword.mapper.d.ts +3 -0
- package/libs/api/metadata-converter/src/lib/iso19139/codelists/keyword.mapper.d.ts.map +1 -0
- package/libs/api/metadata-converter/src/lib/iso19139/converter.d.ts.map +1 -1
- package/libs/api/metadata-converter/src/lib/iso19139/read-parts.d.ts +6 -6
- package/libs/api/metadata-converter/src/lib/iso19139/read-parts.d.ts.map +1 -1
- package/libs/api/metadata-converter/src/lib/iso19139/write-parts.d.ts +4 -3
- package/libs/api/metadata-converter/src/lib/iso19139/write-parts.d.ts.map +1 -1
- package/libs/api/repository/src/lib/gn4/organizations/organizations-from-metadata.service.d.ts.map +1 -1
- package/libs/api/repository/src/lib/gn4/platform/gn4-platform.mapper.d.ts +1 -1
- package/libs/api/repository/src/lib/gn4/platform/gn4-platform.mapper.d.ts.map +1 -1
- package/libs/api/repository/src/lib/gn4/platform/gn4-platform.service.d.ts +9 -2
- package/libs/api/repository/src/lib/gn4/platform/gn4-platform.service.d.ts.map +1 -1
- package/libs/common/domain/src/lib/model/record/metadata.model.d.ts +18 -12
- package/libs/common/domain/src/lib/model/record/metadata.model.d.ts.map +1 -1
- package/libs/common/domain/src/lib/model/thesaurus/thesaurus.model.d.ts +1 -0
- package/libs/common/domain/src/lib/model/thesaurus/thesaurus.model.d.ts.map +1 -1
- package/libs/common/domain/src/lib/platform.service.interface.d.ts +1 -1
- package/libs/common/domain/src/lib/platform.service.interface.d.ts.map +1 -1
- package/libs/feature/map/src/lib/map-context/map-context.service.d.ts +1 -0
- package/libs/feature/map/src/lib/map-context/map-context.service.d.ts.map +1 -1
- package/libs/feature/search/src/lib/utils/service/fields.d.ts +21 -8
- package/libs/feature/search/src/lib/utils/service/fields.d.ts.map +1 -1
- package/libs/feature/search/src/lib/utils/service/fields.service.d.ts.map +1 -1
- package/libs/ui/elements/src/lib/markdown-parser/markdown-parser.component.d.ts +1 -1
- package/libs/ui/elements/src/lib/markdown-parser/markdown-parser.component.d.ts.map +1 -1
- package/libs/ui/elements/src/lib/metadata-info/metadata-info.component.d.ts +10 -6
- package/libs/ui/elements/src/lib/metadata-info/metadata-info.component.d.ts.map +1 -1
- package/libs/ui/elements/src/lib/metadata-quality/metadata-quality.component.d.ts.map +1 -1
- package/libs/ui/elements/src/lib/record-api-form/record-api-form.component.d.ts +3 -1
- package/libs/ui/elements/src/lib/record-api-form/record-api-form.component.d.ts.map +1 -1
- package/libs/ui/elements/src/lib/ui-elements.module.d.ts +13 -13
- package/libs/ui/inputs/src/lib/button/button.component.d.ts +1 -1
- package/libs/ui/inputs/src/lib/button/button.component.d.ts.map +1 -1
- package/libs/ui/inputs/src/lib/text-area/text-area.component.d.ts +1 -1
- package/libs/ui/inputs/src/lib/text-area/text-area.component.d.ts.map +1 -1
- package/libs/ui/inputs/src/lib/ui-inputs.module.d.ts +40 -40
- package/libs/ui/layout/src/lib/interactive-table/interactive-table-column/interactive-table-column.component.d.ts +1 -1
- package/package.json +1 -1
- package/src/libs/api/metadata-converter/src/lib/fixtures/generic.records.ts +61 -8
- package/src/libs/api/metadata-converter/src/lib/fixtures/geo2france.records.ts +55 -9
- package/src/libs/api/metadata-converter/src/lib/fixtures/geocat-ch.records.ts +225 -24
- package/src/libs/api/metadata-converter/src/lib/gn4/atomic-operations.ts +29 -0
- package/src/libs/api/metadata-converter/src/lib/gn4/gn4.field.mapper.ts +80 -73
- package/src/libs/api/metadata-converter/src/lib/gn4/gn4.metadata.mapper.ts +4 -3
- package/src/libs/api/metadata-converter/src/lib/gn4/types/metadata.model.ts +3 -5
- package/src/libs/api/metadata-converter/src/lib/iso19139/codelists/keyword.mapper.ts +16 -0
- package/src/libs/api/metadata-converter/src/lib/iso19139/converter.ts +24 -21
- package/src/libs/api/metadata-converter/src/lib/iso19139/read-parts.ts +115 -62
- package/src/libs/api/metadata-converter/src/lib/iso19139/write-parts.ts +169 -95
- package/src/libs/api/repository/src/lib/gn4/organizations/organizations-from-metadata.service.ts +22 -2
- package/src/libs/api/repository/src/lib/gn4/platform/gn4-platform.mapper.ts +15 -4
- package/src/libs/api/repository/src/lib/gn4/platform/gn4-platform.service.ts +47 -8
- package/src/libs/common/domain/src/lib/model/record/metadata.model.ts +21 -14
- package/src/libs/common/domain/src/lib/model/thesaurus/thesaurus.model.ts +1 -0
- package/src/libs/common/domain/src/lib/platform.service.interface.ts +1 -4
- package/src/libs/common/fixtures/src/lib/gn4/groups.fixtures.ts +1 -1
- package/src/libs/common/fixtures/src/lib/records.fixtures.ts +50 -10
- package/src/libs/feature/map/src/lib/map-context/map-context.service.ts +10 -0
- package/src/libs/feature/search/src/lib/utils/service/fields.service.ts +21 -16
- package/src/libs/feature/search/src/lib/utils/service/fields.ts +43 -34
- package/src/libs/ui/elements/src/lib/markdown-editor/markdown-editor.component.css +5 -0
- package/src/libs/ui/elements/src/lib/markdown-editor/markdown-editor.component.html +39 -0
- package/src/libs/ui/elements/src/lib/markdown-editor/markdown-editor.component.ts +58 -0
- package/src/libs/ui/elements/src/lib/markdown-parser/markdown-parser.component.css +2 -2
- package/src/libs/ui/elements/src/lib/markdown-parser/markdown-parser.component.ts +1 -0
- package/src/libs/ui/elements/src/lib/metadata-info/metadata-info.component.html +50 -23
- package/src/libs/ui/elements/src/lib/metadata-info/metadata-info.component.ts +37 -15
- package/src/libs/ui/elements/src/lib/metadata-quality/metadata-quality.component.ts +2 -3
- package/src/libs/ui/elements/src/lib/record-api-form/record-api-form.component.html +4 -4
- package/src/libs/ui/elements/src/lib/record-api-form/record-api-form.component.ts +11 -3
- package/src/libs/ui/elements/src/lib/ui-elements.module.ts +1 -1
- package/src/libs/ui/inputs/src/lib/button/button.component.ts +1 -0
- package/src/libs/ui/inputs/src/lib/text-area/text-area.component.ts +1 -0
- package/src/libs/ui/inputs/src/lib/ui-inputs.module.ts +2 -2
- package/translations/de.json +3 -2
- package/translations/en.json +5 -4
- package/translations/es.json +3 -2
- package/translations/fr.json +5 -4
- package/translations/it.json +5 -4
- package/translations/nl.json +3 -2
- package/translations/pt.json +3 -2
- package/translations/sk.json +3 -2
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
|
-
AccessConstraint,
|
|
3
2
|
CatalogRecord,
|
|
3
|
+
Constraint,
|
|
4
4
|
DatasetDistribution,
|
|
5
5
|
DatasetRecord,
|
|
6
6
|
DatasetServiceDistribution,
|
|
7
7
|
Individual,
|
|
8
|
-
|
|
8
|
+
Keyword,
|
|
9
|
+
KeywordThesaurus,
|
|
9
10
|
RecordStatus,
|
|
10
11
|
Role,
|
|
11
12
|
ServiceEndpoint,
|
|
@@ -26,6 +27,7 @@ import {
|
|
|
26
27
|
findNestedElement,
|
|
27
28
|
findNestedElements,
|
|
28
29
|
readAttribute,
|
|
30
|
+
readText,
|
|
29
31
|
removeAllChildren,
|
|
30
32
|
removeChildren,
|
|
31
33
|
removeChildrenByName,
|
|
@@ -327,82 +329,89 @@ function appendCitationDate(date, type: 'revision' | 'creation') {
|
|
|
327
329
|
)
|
|
328
330
|
}
|
|
329
331
|
|
|
330
|
-
function removeKeywords(
|
|
331
|
-
return removeChildren(
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
332
|
+
function removeKeywords() {
|
|
333
|
+
return removeChildren(pipe(findNestedElements('gmd:descriptiveKeywords')))
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
// returns a <gmd:thesaurusName> element
|
|
337
|
+
function createThesaurus(thesaurus: KeywordThesaurus) {
|
|
338
|
+
return pipe(
|
|
339
|
+
createElement('gmd:thesaurusName'),
|
|
340
|
+
createChild('gmd:CI_Citation'),
|
|
341
|
+
appendChildren(
|
|
342
|
+
pipe(
|
|
343
|
+
createElement('gmd:title'),
|
|
344
|
+
writeCharacterString(thesaurus.name || thesaurus.id)
|
|
345
|
+
),
|
|
346
|
+
pipe(
|
|
347
|
+
createElement('gmd:identifier'),
|
|
348
|
+
createChild('gmd:MD_Identifier'),
|
|
349
|
+
appendChildren(
|
|
350
|
+
pipe(
|
|
351
|
+
createElement('gmd:code'),
|
|
352
|
+
thesaurus.url
|
|
353
|
+
? writeAnchor(thesaurus.url, thesaurus.id)
|
|
354
|
+
: writeCharacterString(thesaurus.id)
|
|
355
|
+
)
|
|
344
356
|
)
|
|
345
357
|
)
|
|
346
358
|
)
|
|
347
359
|
)
|
|
348
360
|
}
|
|
349
361
|
|
|
350
|
-
function appendKeywords(keywords:
|
|
362
|
+
function appendKeywords(keywords: Keyword[]) {
|
|
363
|
+
const keywordsByThesaurus: Keyword[][] = keywords.reduce((acc, keyword) => {
|
|
364
|
+
const thesaurusId = keyword.thesaurus?.id
|
|
365
|
+
const type = keyword.type
|
|
366
|
+
let existingGroup = acc.find((group) =>
|
|
367
|
+
group[0].thesaurus
|
|
368
|
+
? group[0].thesaurus.id === thesaurusId
|
|
369
|
+
: group[0].type === type
|
|
370
|
+
)
|
|
371
|
+
if (!existingGroup) {
|
|
372
|
+
existingGroup = []
|
|
373
|
+
acc.push(existingGroup)
|
|
374
|
+
}
|
|
375
|
+
existingGroup.push(keyword)
|
|
376
|
+
return acc
|
|
377
|
+
}, [])
|
|
351
378
|
return appendChildren(
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
379
|
+
...keywordsByThesaurus.map((keywords) =>
|
|
380
|
+
pipe(
|
|
381
|
+
createElement('gmd:descriptiveKeywords'),
|
|
382
|
+
createChild('gmd:MD_Keywords'),
|
|
383
|
+
appendChildren(
|
|
384
|
+
pipe(
|
|
385
|
+
createElement('gmd:type'),
|
|
386
|
+
createChild('gmd:MD_KeywordTypeCode'),
|
|
387
|
+
addAttribute(
|
|
388
|
+
'codeList',
|
|
389
|
+
'http://standards.iso.org/iso/19139/resources/gmxCodelists.xml#MD_KeywordTypeCode'
|
|
390
|
+
),
|
|
391
|
+
addAttribute('codeListValue', keywords[0].type)
|
|
392
|
+
)
|
|
393
|
+
),
|
|
394
|
+
keywords[0].thesaurus
|
|
395
|
+
? appendChildren(createThesaurus(keywords[0].thesaurus))
|
|
396
|
+
: noop,
|
|
397
|
+
appendChildren(
|
|
398
|
+
...keywords.map((keyword) =>
|
|
357
399
|
pipe(
|
|
358
|
-
createElement('gmd:
|
|
359
|
-
|
|
360
|
-
addAttribute(
|
|
361
|
-
'codeList',
|
|
362
|
-
'http://standards.iso.org/iso/19139/resources/gmxCodelists.xml#MD_KeywordTypeCode'
|
|
363
|
-
),
|
|
364
|
-
addAttribute('codeListValue', type)
|
|
400
|
+
createElement('gmd:keyword'),
|
|
401
|
+
writeCharacterString(keyword.label)
|
|
365
402
|
)
|
|
366
403
|
)
|
|
367
|
-
: noop,
|
|
368
|
-
appendChildren(
|
|
369
|
-
...keywords.map((keyword) =>
|
|
370
|
-
pipe(createElement('gmd:keyword'), writeCharacterString(keyword))
|
|
371
404
|
)
|
|
372
405
|
)
|
|
373
406
|
)
|
|
374
407
|
)
|
|
375
408
|
}
|
|
376
409
|
|
|
377
|
-
function
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
)
|
|
382
|
-
|
|
383
|
-
// remove legal constraints that *only* have 'otherRestrictions'
|
|
384
|
-
const otherConstraintsFilter = pipe(
|
|
385
|
-
findNestedElements(
|
|
386
|
-
'gmd:MD_LegalConstraints',
|
|
387
|
-
'gmd:accessConstraints',
|
|
388
|
-
'gmd:MD_RestrictionCode'
|
|
389
|
-
),
|
|
390
|
-
mapArray(readAttribute('codeListValue')),
|
|
391
|
-
(restrictionCodes) =>
|
|
392
|
-
restrictionCodes.every((code) => code === 'otherRestrictions')
|
|
393
|
-
)
|
|
394
|
-
return removeChildren(
|
|
395
|
-
pipe(
|
|
396
|
-
findChildrenElement('gmd:resourceConstraints'),
|
|
397
|
-
filterArray(
|
|
398
|
-
(el) => securityConstraintsFilter(el) || otherConstraintsFilter(el)
|
|
399
|
-
)
|
|
400
|
-
)
|
|
401
|
-
)
|
|
402
|
-
}
|
|
403
|
-
|
|
404
|
-
function createAccessConstraint(constraint: AccessConstraint) {
|
|
405
|
-
if (constraint.type === 'security') {
|
|
410
|
+
function createConstraint(
|
|
411
|
+
constraint: Constraint,
|
|
412
|
+
type: 'legal' | 'security' | 'other'
|
|
413
|
+
) {
|
|
414
|
+
if (type === 'security') {
|
|
406
415
|
return pipe(
|
|
407
416
|
createElement('gmd:resourceConstraints'),
|
|
408
417
|
createChild('gmd:MD_SecurityConstraints'),
|
|
@@ -422,29 +431,41 @@ function createAccessConstraint(constraint: AccessConstraint) {
|
|
|
422
431
|
)
|
|
423
432
|
)
|
|
424
433
|
)
|
|
434
|
+
} else if (type === 'legal') {
|
|
435
|
+
return pipe(
|
|
436
|
+
createElement('gmd:resourceConstraints'),
|
|
437
|
+
createChild('gmd:MD_LegalConstraints'),
|
|
438
|
+
appendChildren(
|
|
439
|
+
pipe(
|
|
440
|
+
createElement('gmd:accessConstraints'),
|
|
441
|
+
createChild('gmd:MD_RestrictionCode'),
|
|
442
|
+
addAttribute(
|
|
443
|
+
'codeList',
|
|
444
|
+
'http://standards.iso.org/iso/19139/resources/gmxCodelists.xml#MD_RestrictionCode'
|
|
445
|
+
),
|
|
446
|
+
addAttribute('codeListValue', 'otherRestrictions')
|
|
447
|
+
),
|
|
448
|
+
pipe(
|
|
449
|
+
createElement('gmd:otherConstraints'),
|
|
450
|
+
writeCharacterString(constraint.text)
|
|
451
|
+
)
|
|
452
|
+
)
|
|
453
|
+
)
|
|
425
454
|
}
|
|
455
|
+
|
|
426
456
|
return pipe(
|
|
427
457
|
createElement('gmd:resourceConstraints'),
|
|
428
|
-
createChild('gmd:
|
|
458
|
+
createChild('gmd:MD_Constraints'),
|
|
429
459
|
appendChildren(
|
|
430
460
|
pipe(
|
|
431
|
-
createElement('gmd:
|
|
432
|
-
createChild('gmd:MD_RestrictionCode'),
|
|
433
|
-
addAttribute(
|
|
434
|
-
'codeList',
|
|
435
|
-
'http://standards.iso.org/iso/19139/resources/gmxCodelists.xml#MD_RestrictionCode'
|
|
436
|
-
),
|
|
437
|
-
addAttribute('codeListValue', 'otherRestrictions')
|
|
438
|
-
),
|
|
439
|
-
pipe(
|
|
440
|
-
createElement('gmd:otherConstraints'),
|
|
461
|
+
createElement('gmd:useLimitation'),
|
|
441
462
|
writeCharacterString(constraint.text)
|
|
442
463
|
)
|
|
443
464
|
)
|
|
444
465
|
)
|
|
445
466
|
}
|
|
446
467
|
|
|
447
|
-
function
|
|
468
|
+
function removeOtherConstraints() {
|
|
448
469
|
return removeChildren(
|
|
449
470
|
pipe(
|
|
450
471
|
findChildrenElement('gmd:resourceConstraints'),
|
|
@@ -458,12 +479,37 @@ function removeUseLimitations() {
|
|
|
458
479
|
)
|
|
459
480
|
}
|
|
460
481
|
|
|
461
|
-
function
|
|
462
|
-
return
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
482
|
+
function removeSecurityConstraints() {
|
|
483
|
+
return removeChildren(
|
|
484
|
+
pipe(
|
|
485
|
+
findChildrenElement('gmd:resourceConstraints'),
|
|
486
|
+
filterArray(
|
|
487
|
+
pipe(
|
|
488
|
+
findNestedElements('gmd:MD_SecurityConstraints', 'gmd:useLimitation'),
|
|
489
|
+
(array) => array.length > 0
|
|
490
|
+
)
|
|
491
|
+
)
|
|
492
|
+
)
|
|
493
|
+
)
|
|
494
|
+
}
|
|
495
|
+
|
|
496
|
+
function removeLegalConstraints() {
|
|
497
|
+
return removeChildren(
|
|
498
|
+
pipe(
|
|
499
|
+
findChildrenElement('gmd:resourceConstraints'),
|
|
500
|
+
filterArray(
|
|
501
|
+
pipe(
|
|
502
|
+
findNestedElements(
|
|
503
|
+
'gmd:MD_LegalConstraints',
|
|
504
|
+
'gmd:accessConstraints',
|
|
505
|
+
'gmd:MD_RestrictionCode'
|
|
506
|
+
),
|
|
507
|
+
mapArray(readAttribute('codeListValue')),
|
|
508
|
+
(restrictionCodes) =>
|
|
509
|
+
restrictionCodes.every((code) => code !== 'license')
|
|
510
|
+
)
|
|
511
|
+
)
|
|
512
|
+
)
|
|
467
513
|
)
|
|
468
514
|
}
|
|
469
515
|
|
|
@@ -487,7 +533,7 @@ function removeLicenses() {
|
|
|
487
533
|
)
|
|
488
534
|
}
|
|
489
535
|
|
|
490
|
-
function createLicense(license:
|
|
536
|
+
function createLicense(license: Constraint) {
|
|
491
537
|
return pipe(
|
|
492
538
|
createElement('gmd:resourceConstraints'),
|
|
493
539
|
createChild('gmd:MD_LegalConstraints'),
|
|
@@ -728,43 +774,71 @@ export function writeContacts(record: CatalogRecord, rootEl: XmlElement) {
|
|
|
728
774
|
export function writeKeywords(record: CatalogRecord, rootEl: XmlElement) {
|
|
729
775
|
pipe(
|
|
730
776
|
findOrCreateIdentification(),
|
|
731
|
-
removeKeywords(
|
|
732
|
-
appendKeywords(record.keywords
|
|
777
|
+
removeKeywords(),
|
|
778
|
+
appendKeywords(record.keywords)
|
|
733
779
|
)(rootEl)
|
|
734
780
|
}
|
|
735
781
|
|
|
736
|
-
export function
|
|
782
|
+
export function writeTopics(record: CatalogRecord, rootEl: XmlElement) {
|
|
737
783
|
pipe(
|
|
738
784
|
findOrCreateIdentification(),
|
|
739
|
-
|
|
740
|
-
|
|
785
|
+
removeChildrenByName('gmd:topicCategory'),
|
|
786
|
+
appendChildren(
|
|
787
|
+
...record.topics.map((topic) =>
|
|
788
|
+
pipe(
|
|
789
|
+
createElement('gmd:topicCategory'),
|
|
790
|
+
createChild('gmd:MD_TopicCategoryCode'),
|
|
791
|
+
setTextContent(topic)
|
|
792
|
+
)
|
|
793
|
+
)
|
|
794
|
+
)
|
|
795
|
+
)(rootEl)
|
|
796
|
+
}
|
|
797
|
+
|
|
798
|
+
export function writeLicenses(record: CatalogRecord, rootEl: XmlElement) {
|
|
799
|
+
pipe(
|
|
800
|
+
findOrCreateIdentification(),
|
|
801
|
+
removeLicenses(),
|
|
802
|
+
appendChildren(...record.licenses.map(createLicense))
|
|
741
803
|
)(rootEl)
|
|
742
804
|
}
|
|
743
805
|
|
|
744
|
-
export function
|
|
806
|
+
export function writeLegalConstraints(
|
|
745
807
|
record: CatalogRecord,
|
|
746
808
|
rootEl: XmlElement
|
|
747
809
|
) {
|
|
748
810
|
pipe(
|
|
749
811
|
findOrCreateIdentification(),
|
|
750
|
-
|
|
751
|
-
appendChildren(
|
|
812
|
+
removeLegalConstraints(),
|
|
813
|
+
appendChildren(
|
|
814
|
+
...record.legalConstraints.map((c) => createConstraint(c, 'legal'))
|
|
815
|
+
)
|
|
752
816
|
)(rootEl)
|
|
753
817
|
}
|
|
754
818
|
|
|
755
|
-
export function
|
|
819
|
+
export function writeSecurityConstraints(
|
|
820
|
+
record: CatalogRecord,
|
|
821
|
+
rootEl: XmlElement
|
|
822
|
+
) {
|
|
756
823
|
pipe(
|
|
757
824
|
findOrCreateIdentification(),
|
|
758
|
-
|
|
759
|
-
appendChildren(
|
|
825
|
+
removeSecurityConstraints(),
|
|
826
|
+
appendChildren(
|
|
827
|
+
...record.securityConstraints.map((c) => createConstraint(c, 'security'))
|
|
828
|
+
)
|
|
760
829
|
)(rootEl)
|
|
761
830
|
}
|
|
762
831
|
|
|
763
|
-
export function
|
|
832
|
+
export function writeOtherConstraints(
|
|
833
|
+
record: CatalogRecord,
|
|
834
|
+
rootEl: XmlElement
|
|
835
|
+
) {
|
|
764
836
|
pipe(
|
|
765
837
|
findOrCreateIdentification(),
|
|
766
|
-
|
|
767
|
-
appendChildren(
|
|
838
|
+
removeOtherConstraints(),
|
|
839
|
+
appendChildren(
|
|
840
|
+
...record.otherConstraints.map((c) => createConstraint(c, 'other'))
|
|
841
|
+
)
|
|
768
842
|
)(rootEl)
|
|
769
843
|
}
|
|
770
844
|
|
package/src/libs/api/repository/src/lib/gn4/organizations/organizations-from-metadata.service.ts
CHANGED
|
@@ -25,7 +25,14 @@ import {
|
|
|
25
25
|
SourceWithUnknownProps,
|
|
26
26
|
} from '../../../../../../../libs/api/metadata-converter/src'
|
|
27
27
|
import { combineLatest, Observable, of, switchMap, takeLast } from 'rxjs'
|
|
28
|
-
import {
|
|
28
|
+
import {
|
|
29
|
+
filter,
|
|
30
|
+
map,
|
|
31
|
+
shareReplay,
|
|
32
|
+
startWith,
|
|
33
|
+
tap,
|
|
34
|
+
withLatestFrom,
|
|
35
|
+
} from 'rxjs/operators'
|
|
29
36
|
import { LangService } from '../../../../../../../libs/util/i18n/src'
|
|
30
37
|
import { PlatformServiceInterface } from '../../../../../../../libs/common/domain/src/lib/platform.service.interface'
|
|
31
38
|
import { coerce, satisfies, valid } from 'semver'
|
|
@@ -296,15 +303,28 @@ export class OrganizationsFromMetadataService
|
|
|
296
303
|
|
|
297
304
|
const ownerOrganization = allContactOrgs[0]
|
|
298
305
|
|
|
306
|
+
// read the owner group as well to have a fallback logo
|
|
307
|
+
const groupId = selectField(source, 'groupOwner')
|
|
308
|
+
const group$ = this.groups$.pipe(
|
|
309
|
+
map((groups) =>
|
|
310
|
+
groups.find((group) => {
|
|
311
|
+
return group.id === Number(groupId)
|
|
312
|
+
})
|
|
313
|
+
)
|
|
314
|
+
)
|
|
315
|
+
|
|
299
316
|
return this.organisations$.pipe(
|
|
300
317
|
takeLast(1),
|
|
301
|
-
|
|
318
|
+
withLatestFrom(group$),
|
|
319
|
+
map(([organisations, group]: [Organization[], GroupApiModel]) => {
|
|
302
320
|
const recordOrganisation = organisations.filter(
|
|
303
321
|
(org) => org.name === ownerOrganization.name
|
|
304
322
|
)[0]
|
|
323
|
+
const logoUrl = group?.logo && getAsUrl(`${IMAGE_URL}${group.logo}`)
|
|
305
324
|
return {
|
|
306
325
|
...record,
|
|
307
326
|
ownerOrganization: {
|
|
327
|
+
logoUrl,
|
|
308
328
|
...ownerOrganization,
|
|
309
329
|
...recordOrganisation,
|
|
310
330
|
},
|
|
@@ -45,12 +45,23 @@ export class Gn4PlatformMapper {
|
|
|
45
45
|
return { ...apiUser, id: id.toString() } as UserModel
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
-
thesaurusFromApi(thesaurus: any[]): ThesaurusModel {
|
|
48
|
+
thesaurusFromApi(thesaurus: any[], lang3?: string): ThesaurusModel {
|
|
49
49
|
return thesaurus.map((keyword) => {
|
|
50
|
-
|
|
50
|
+
let key = keyword.uri
|
|
51
|
+
// sometines GN can prefix an URI with an "all thesaurus" URI; only keep the last one
|
|
52
|
+
if (key.indexOf('@@@') > -1) {
|
|
53
|
+
key = key.split('@@@')[1]
|
|
54
|
+
}
|
|
55
|
+
const label =
|
|
56
|
+
lang3 && lang3 in keyword.values ? keyword.values[lang3] : keyword.value
|
|
57
|
+
const description =
|
|
58
|
+
lang3 && lang3 in keyword.definitions
|
|
59
|
+
? keyword.definitions[lang3]
|
|
60
|
+
: keyword.definition
|
|
51
61
|
return {
|
|
52
|
-
key
|
|
53
|
-
label
|
|
62
|
+
key,
|
|
63
|
+
label,
|
|
64
|
+
description,
|
|
54
65
|
}
|
|
55
66
|
})
|
|
56
67
|
}
|
|
@@ -14,8 +14,10 @@ import { Organization } from '../../../../../../../libs/common/domain/src/lib/mo
|
|
|
14
14
|
import { Gn4PlatformMapper } from './gn4-platform.mapper'
|
|
15
15
|
import { ltr } from 'semver'
|
|
16
16
|
import { ThesaurusModel } from '../../../../../../../libs/common/domain/src/lib/model/thesaurus/thesaurus.model'
|
|
17
|
+
import { LangService } from '../../../../../../../libs/util/i18n/src'
|
|
17
18
|
|
|
18
19
|
const minApiVersion = '4.2.2'
|
|
20
|
+
|
|
19
21
|
@Injectable()
|
|
20
22
|
export class Gn4PlatformService implements PlatformServiceInterface {
|
|
21
23
|
private readonly type = 'GeoNetwork'
|
|
@@ -50,13 +52,20 @@ export class Gn4PlatformService implements PlatformServiceInterface {
|
|
|
50
52
|
shareReplay(1)
|
|
51
53
|
)
|
|
52
54
|
|
|
55
|
+
/**
|
|
56
|
+
* A map of already loaded thesauri (groups of keywords); the key is a URI
|
|
57
|
+
* @private
|
|
58
|
+
*/
|
|
59
|
+
private thesauri: Record<string, Observable<ThesaurusModel>> = {}
|
|
60
|
+
|
|
53
61
|
constructor(
|
|
54
62
|
private siteApiService: SiteApiService,
|
|
55
63
|
private meApi: MeApiService,
|
|
56
64
|
private usersApi: UsersApiService,
|
|
57
65
|
private mapper: Gn4PlatformMapper,
|
|
58
66
|
private toolsApiService: ToolsApiService,
|
|
59
|
-
private registriesApiService: RegistriesApiService
|
|
67
|
+
private registriesApiService: RegistriesApiService,
|
|
68
|
+
private langService: LangService
|
|
60
69
|
) {
|
|
61
70
|
this.me$ = this.meApi.getMe().pipe(
|
|
62
71
|
switchMap((apiUser) => this.mapper.userFromMeApi(apiUser)),
|
|
@@ -98,17 +107,47 @@ export class Gn4PlatformService implements PlatformServiceInterface {
|
|
|
98
107
|
}
|
|
99
108
|
|
|
100
109
|
translateKey(key: string): Observable<string> {
|
|
110
|
+
// if the key is a URI, use the registries API to look for the translation
|
|
111
|
+
if (key.match(/^https?:\/\//)) {
|
|
112
|
+
// the thesaurus URI is inferred by removing a part of the keyword URI
|
|
113
|
+
// this is not exact science but it's OK, we'll still end up loading a bunch of keywords at once anyway
|
|
114
|
+
const thesaurusUri = key.replace(/\/([^/]+)$/, '/')
|
|
115
|
+
return this.getThesaurusByUri(thesaurusUri).pipe(
|
|
116
|
+
map((thesaurus) => {
|
|
117
|
+
for (const item of thesaurus) {
|
|
118
|
+
if (item.key === key) return item.label
|
|
119
|
+
}
|
|
120
|
+
return key
|
|
121
|
+
})
|
|
122
|
+
)
|
|
123
|
+
}
|
|
101
124
|
return this.keyTranslations$.pipe(map((translations) => translations[key]))
|
|
102
125
|
}
|
|
103
126
|
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
.searchKeywords(
|
|
127
|
+
getThesaurusByUri(uri: string): Observable<ThesaurusModel> {
|
|
128
|
+
if (this.thesauri[uri]) {
|
|
129
|
+
return this.thesauri[uri]
|
|
130
|
+
}
|
|
131
|
+
this.thesauri[uri] = this.registriesApiService
|
|
132
|
+
.searchKeywords(
|
|
133
|
+
null,
|
|
134
|
+
this.langService.iso3,
|
|
135
|
+
1000,
|
|
136
|
+
0,
|
|
137
|
+
null,
|
|
138
|
+
null,
|
|
139
|
+
null,
|
|
140
|
+
`${uri}*`
|
|
141
|
+
)
|
|
110
142
|
.pipe(
|
|
111
|
-
map((thesaurus) =>
|
|
143
|
+
map((thesaurus) =>
|
|
144
|
+
this.mapper.thesaurusFromApi(
|
|
145
|
+
thesaurus as any[],
|
|
146
|
+
this.langService.iso3
|
|
147
|
+
)
|
|
148
|
+
),
|
|
149
|
+
shareReplay(1)
|
|
112
150
|
)
|
|
151
|
+
return this.thesauri[uri]
|
|
113
152
|
}
|
|
114
153
|
}
|
|
@@ -48,13 +48,7 @@ export const RecordStatusValues = [
|
|
|
48
48
|
]
|
|
49
49
|
export type RecordStatus = typeof RecordStatusValues[number]
|
|
50
50
|
|
|
51
|
-
export type
|
|
52
|
-
export interface AccessConstraint {
|
|
53
|
-
text: string
|
|
54
|
-
type: AccessConstraintType
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
export type License = {
|
|
51
|
+
export type Constraint = {
|
|
58
52
|
text: string
|
|
59
53
|
url?: URL
|
|
60
54
|
}
|
|
@@ -66,6 +60,20 @@ export type SpatialRepresentationType =
|
|
|
66
60
|
| 'table'
|
|
67
61
|
| 'point'
|
|
68
62
|
|
|
63
|
+
export type KeywordType = 'place' | 'temporal' | 'theme' | 'other'
|
|
64
|
+
|
|
65
|
+
export type KeywordThesaurus = {
|
|
66
|
+
id: string
|
|
67
|
+
name?: string
|
|
68
|
+
url?: URL
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export interface Keyword {
|
|
72
|
+
label: string
|
|
73
|
+
type: KeywordType
|
|
74
|
+
thesaurus?: KeywordThesaurus
|
|
75
|
+
}
|
|
76
|
+
|
|
69
77
|
export interface BaseRecord {
|
|
70
78
|
uniqueIdentifier: Uuid
|
|
71
79
|
ownerOrganization: Organization
|
|
@@ -75,18 +83,17 @@ export interface BaseRecord {
|
|
|
75
83
|
recordCreated?: Date
|
|
76
84
|
recordUpdated: Date
|
|
77
85
|
kind: RecordKind
|
|
78
|
-
|
|
79
|
-
keywords: Array<
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
86
|
+
topics: Array<string> // TODO: handle codelists
|
|
87
|
+
keywords: Array<Keyword>
|
|
88
|
+
licenses: Array<Constraint>
|
|
89
|
+
legalConstraints: Array<Constraint>
|
|
90
|
+
securityConstraints: Array<Constraint>
|
|
91
|
+
otherConstraints: Array<Constraint>
|
|
84
92
|
overviews: Array<GraphicOverview>
|
|
85
93
|
extras?: Record<string, unknown>
|
|
86
94
|
landingPage?: URL
|
|
87
95
|
updateFrequency?: UpdateFrequency
|
|
88
96
|
|
|
89
|
-
// to add: iso19139.topicCategory
|
|
90
97
|
// to add: canonical url
|
|
91
98
|
// to add: source catalog (??)
|
|
92
99
|
// to add: is open data ?
|
|
@@ -15,8 +15,5 @@ export abstract class PlatformServiceInterface {
|
|
|
15
15
|
): Observable<UserModel[]>
|
|
16
16
|
abstract getOrganizations(): Observable<Organization[]>
|
|
17
17
|
abstract translateKey(key: string): Observable<string>
|
|
18
|
-
abstract
|
|
19
|
-
thesaurusName: string,
|
|
20
|
-
lang: string
|
|
21
|
-
): Observable<ThesaurusModel>
|
|
18
|
+
abstract getThesaurusByUri(uri: string): Observable<ThesaurusModel>
|
|
22
19
|
}
|
|
@@ -64,7 +64,7 @@ export const GROUPS_FIXTURE = deepFreeze([
|
|
|
64
64
|
defaultCategory: null,
|
|
65
65
|
allowedCategories: [],
|
|
66
66
|
enableAllowedCategories: false,
|
|
67
|
-
id:
|
|
67
|
+
id: 2,
|
|
68
68
|
email: 'ifremer.ifremer@ifremer.admin.fr',
|
|
69
69
|
referrer: null,
|
|
70
70
|
description: "Institut français de recherche pour l'exploitation de la mer",
|