geonetwork-ui 2.2.0-dev.5b8d393f → 2.2.0-dev.6695ae4d
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/gn4.field.mapper.mjs +42 -51
- package/esm2022/libs/api/metadata-converter/src/lib/gn4/gn4.metadata.mapper.mjs +4 -3
- package/esm2022/libs/api/metadata-converter/src/lib/iso19139/converter.mjs +16 -11
- package/esm2022/libs/api/metadata-converter/src/lib/iso19139/read-parts.mjs +23 -16
- package/esm2022/libs/api/metadata-converter/src/lib/iso19139/write-parts.mjs +21 -18
- package/esm2022/libs/common/domain/src/lib/model/record/metadata.model.mjs +1 -1
- package/esm2022/libs/common/domain/src/lib/model/search/aggregation.model.mjs +1 -1
- package/esm2022/libs/common/domain/src/lib/model/search/field.model.mjs +2 -0
- package/esm2022/libs/common/domain/src/lib/model/search/filter.model.mjs +1 -1
- package/esm2022/libs/common/domain/src/lib/model/search/index.mjs +2 -1
- package/esm2022/libs/common/domain/src/lib/model/search/search.model.mjs +1 -1
- package/esm2022/libs/feature/record/src/lib/state/mdview.reducer.mjs +2 -2
- package/esm2022/libs/feature/search/src/index.mjs +3 -1
- package/esm2022/libs/feature/search/src/lib/feature-search.module.mjs +2 -6
- package/esm2022/libs/feature/search/src/lib/filter-geometry.token.mjs +4 -0
- package/esm2022/libs/feature/search/src/lib/fuzzy-search/fuzzy-search.component.mjs +7 -3
- package/esm2022/libs/feature/search/src/lib/record-url.token.mjs +4 -0
- package/esm2022/libs/feature/search/src/lib/results-list/results-list.container.component.mjs +2 -2
- package/esm2022/libs/feature/search/src/lib/results-table/results-table.component.mjs +3 -4
- package/esm2022/libs/feature/search/src/lib/state/effects.mjs +2 -2
- package/esm2022/libs/feature/search/src/lib/state/search.facade.mjs +3 -2
- package/esm2022/libs/ui/elements/src/lib/markdown-parser/markdown-parser.component.mjs +2 -2
- package/esm2022/libs/ui/elements/src/lib/metadata-info/metadata-info.component.mjs +35 -22
- package/esm2022/libs/ui/elements/src/lib/record-api-form/record-api-form.component.mjs +9 -6
- package/esm2022/libs/util/i18n/src/index.mjs +1 -2
- package/esm2022/translations/de.json +5 -4
- package/esm2022/translations/en.json +8 -7
- package/esm2022/translations/es.json +5 -4
- package/esm2022/translations/fr.json +7 -6
- package/esm2022/translations/it.json +7 -6
- package/esm2022/translations/nl.json +5 -4
- package/esm2022/translations/pt.json +5 -4
- package/fesm2022/geonetwork-ui.mjs +193 -286
- package/fesm2022/geonetwork-ui.mjs.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/iso19139/converter.d.ts.map +1 -1
- package/libs/api/metadata-converter/src/lib/iso19139/read-parts.d.ts +5 -4
- 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 +3 -2
- package/libs/api/metadata-converter/src/lib/iso19139/write-parts.d.ts.map +1 -1
- package/libs/common/domain/src/lib/model/record/metadata.model.d.ts +5 -10
- package/libs/common/domain/src/lib/model/record/metadata.model.d.ts.map +1 -1
- package/libs/common/domain/src/lib/model/search/aggregation.model.d.ts +1 -1
- package/libs/common/domain/src/lib/model/search/aggregation.model.d.ts.map +1 -1
- package/libs/common/domain/src/lib/model/search/field.model.d.ts +2 -0
- package/libs/common/domain/src/lib/model/search/field.model.d.ts.map +1 -0
- package/libs/common/domain/src/lib/model/search/filter.model.d.ts +1 -1
- package/libs/common/domain/src/lib/model/search/filter.model.d.ts.map +1 -1
- package/libs/common/domain/src/lib/model/search/index.d.ts +1 -0
- package/libs/common/domain/src/lib/model/search/index.d.ts.map +1 -1
- package/libs/common/domain/src/lib/model/search/search.model.d.ts +1 -1
- package/libs/common/domain/src/lib/model/search/search.model.d.ts.map +1 -1
- package/libs/feature/search/src/index.d.ts +2 -0
- package/libs/feature/search/src/index.d.ts.map +1 -1
- package/libs/feature/search/src/lib/feature-search.module.d.ts +0 -4
- package/libs/feature/search/src/lib/feature-search.module.d.ts.map +1 -1
- package/libs/feature/search/src/lib/filter-geometry.token.d.ts +4 -0
- package/libs/feature/search/src/lib/filter-geometry.token.d.ts.map +1 -0
- package/libs/feature/search/src/lib/fuzzy-search/fuzzy-search.component.d.ts +1 -1
- package/libs/feature/search/src/lib/fuzzy-search/fuzzy-search.component.d.ts.map +1 -1
- package/libs/feature/search/src/lib/record-url.token.d.ts +3 -0
- package/libs/feature/search/src/lib/record-url.token.d.ts.map +1 -0
- package/libs/feature/search/src/lib/results-table/results-table.component.d.ts +0 -1
- package/libs/feature/search/src/lib/results-table/results-table.component.d.ts.map +1 -1
- package/libs/feature/search/src/lib/state/search.facade.d.ts +1 -1
- package/libs/feature/search/src/lib/state/search.facade.d.ts.map +1 -1
- package/libs/ui/elements/src/lib/metadata-info/metadata-info.component.d.ts +7 -3
- package/libs/ui/elements/src/lib/metadata-info/metadata-info.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/util/i18n/src/index.d.ts +0 -1
- package/libs/util/i18n/src/index.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/libs/api/metadata-converter/src/lib/fixtures/generic.records.ts +6 -6
- package/src/libs/api/metadata-converter/src/lib/fixtures/geo2france.records.ts +5 -3
- package/src/libs/api/metadata-converter/src/lib/fixtures/geocat-ch.records.ts +22 -4
- package/src/libs/api/metadata-converter/src/lib/gn4/gn4.field.mapper.ts +69 -65
- package/src/libs/api/metadata-converter/src/lib/gn4/gn4.metadata.mapper.ts +3 -2
- package/src/libs/api/metadata-converter/src/lib/iso19139/converter.ts +19 -12
- package/src/libs/api/metadata-converter/src/lib/iso19139/read-parts.ts +62 -43
- package/src/libs/api/metadata-converter/src/lib/iso19139/write-parts.ts +91 -59
- package/src/libs/common/domain/src/lib/model/record/metadata.model.ts +5 -11
- package/src/libs/common/domain/src/lib/model/search/aggregation.model.ts +1 -1
- package/src/libs/common/domain/src/lib/model/search/field.model.ts +1 -0
- package/src/libs/common/domain/src/lib/model/search/filter.model.ts +1 -1
- package/src/libs/common/domain/src/lib/model/search/index.ts +1 -0
- package/src/libs/common/domain/src/lib/model/search/search.model.ts +1 -1
- package/src/libs/feature/record/src/lib/state/mdview.reducer.ts +1 -1
- package/src/libs/feature/search/src/index.ts +2 -0
- package/src/libs/feature/search/src/lib/feature-search.module.ts +1 -10
- package/src/libs/feature/search/src/lib/filter-geometry.token.ts +7 -0
- package/src/libs/feature/search/src/lib/fuzzy-search/fuzzy-search.component.ts +9 -3
- package/src/libs/feature/search/src/lib/record-url.token.ts +4 -0
- package/src/libs/feature/search/src/lib/results-list/results-list.container.component.ts +1 -1
- package/src/libs/feature/search/src/lib/results-table/results-table.component.html +104 -127
- package/src/libs/feature/search/src/lib/results-table/results-table.component.ts +0 -1
- package/src/libs/feature/search/src/lib/state/effects.ts +1 -1
- package/src/libs/feature/search/src/lib/state/search.facade.ts +2 -1
- package/src/libs/ui/elements/src/lib/markdown-parser/markdown-parser.component.css +2 -2
- package/src/libs/ui/elements/src/lib/metadata-info/metadata-info.component.html +45 -18
- package/src/libs/ui/elements/src/lib/metadata-info/metadata-info.component.ts +31 -12
- package/src/libs/ui/elements/src/lib/record-api-form/record-api-form.component.html +5 -5
- package/src/libs/ui/elements/src/lib/record-api-form/record-api-form.component.ts +12 -4
- package/src/libs/util/i18n/src/index.ts +0 -1
- package/translations/de.json +5 -4
- package/translations/en.json +8 -7
- package/translations/es.json +5 -4
- package/translations/fr.json +7 -6
- package/translations/it.json +7 -6
- package/translations/nl.json +5 -4
- package/translations/pt.json +5 -4
- package/translations/sk.json +5 -4
- package/esm2022/libs/util/i18n/src/lib/testing/test.translate.loader.mjs +0 -24
- package/esm2022/libs/util/i18n/src/lib/testing/test.translate.module.mjs +0 -109
- package/esm2022/libs/util/i18n/src/lib/testing/translations.model.mjs +0 -6
- package/libs/util/i18n/src/lib/testing/test.translate.loader.d.ts +0 -17
- package/libs/util/i18n/src/lib/testing/test.translate.loader.d.ts.map +0 -1
- package/libs/util/i18n/src/lib/testing/test.translate.module.d.ts +0 -131
- package/libs/util/i18n/src/lib/testing/test.translate.module.d.ts.map +0 -1
- package/libs/util/i18n/src/lib/testing/translations.model.d.ts +0 -21
- package/libs/util/i18n/src/lib/testing/translations.model.d.ts.map +0 -1
- package/src/libs/util/i18n/src/lib/testing/test.translate.loader.ts +0 -26
- package/src/libs/util/i18n/src/lib/testing/test.translate.module.ts +0 -235
- package/src/libs/util/i18n/src/lib/testing/translations.model.ts +0 -28
|
@@ -17,8 +17,8 @@ import { Injectable } from '@angular/core'
|
|
|
17
17
|
import { getStatusFromStatusCode } from '../iso19139/codelists/status.mapper'
|
|
18
18
|
import { getUpdateFrequencyFromFrequencyCode } from '../iso19139/codelists/update-frequency.mapper'
|
|
19
19
|
import {
|
|
20
|
-
AccessConstraintType,
|
|
21
20
|
CatalogRecord,
|
|
21
|
+
Constraint,
|
|
22
22
|
DatasetDistribution,
|
|
23
23
|
DatasetDistributionType,
|
|
24
24
|
DatasetDownloadDistribution,
|
|
@@ -185,37 +185,41 @@ export class Gn4FieldMapper {
|
|
|
185
185
|
],
|
|
186
186
|
}),
|
|
187
187
|
MD_ConstraintsUseLimitationObject: (output, source) =>
|
|
188
|
-
this.constraintField(
|
|
188
|
+
this.constraintField(
|
|
189
|
+
'other',
|
|
190
|
+
output,
|
|
191
|
+
getAsArray(selectField(source, 'MD_ConstraintsUseLimitationObject'))
|
|
192
|
+
),
|
|
189
193
|
MD_LegalConstraintsUseLimitationObject: (output, source) =>
|
|
190
194
|
this.constraintField(
|
|
191
|
-
'
|
|
195
|
+
'legal',
|
|
192
196
|
output,
|
|
193
|
-
|
|
197
|
+
getAsArray(
|
|
198
|
+
selectField(source, 'MD_LegalConstraintsUseLimitationObject')
|
|
199
|
+
)
|
|
194
200
|
),
|
|
195
201
|
MD_LegalConstraintsOtherConstraintsObject: (output, source) =>
|
|
196
202
|
this.constraintField(
|
|
197
|
-
'
|
|
203
|
+
'legal',
|
|
198
204
|
output,
|
|
199
|
-
|
|
205
|
+
getAsArray(
|
|
206
|
+
selectField(source, 'MD_LegalConstraintsOtherConstraintsObject')
|
|
207
|
+
)
|
|
200
208
|
),
|
|
201
209
|
MD_SecurityConstraintsUseLimitationObject: (output, source) =>
|
|
202
210
|
this.constraintField(
|
|
203
|
-
'
|
|
211
|
+
'security',
|
|
204
212
|
output,
|
|
205
|
-
|
|
213
|
+
getAsArray(
|
|
214
|
+
selectField(source, 'MD_SecurityConstraintsUseLimitationObject')
|
|
215
|
+
)
|
|
216
|
+
),
|
|
217
|
+
licenseObject: (output, source) =>
|
|
218
|
+
this.constraintField(
|
|
219
|
+
'license',
|
|
220
|
+
output,
|
|
221
|
+
getAsArray(selectField(source, 'licenseObject'))
|
|
206
222
|
),
|
|
207
|
-
licenseObject: (output, source) => ({
|
|
208
|
-
...output,
|
|
209
|
-
licenses: getAsArray(
|
|
210
|
-
selectField<SourceWithUnknownProps[]>(source, 'licenseObject')
|
|
211
|
-
).map((license) => {
|
|
212
|
-
const link = getAsUrl(selectField(license, 'link'))
|
|
213
|
-
return {
|
|
214
|
-
text: selectTranslatedValue<string>(license, this.lang3),
|
|
215
|
-
...(link ? { link } : {}),
|
|
216
|
-
}
|
|
217
|
-
}),
|
|
218
|
-
}),
|
|
219
223
|
lineageObject: (output, source) => ({
|
|
220
224
|
...output,
|
|
221
225
|
lineage: selectTranslatedField(source, 'lineageObject', this.lang3),
|
|
@@ -305,53 +309,53 @@ export class Gn4FieldMapper {
|
|
|
305
309
|
|
|
306
310
|
private genericField = (output) => output
|
|
307
311
|
|
|
308
|
-
private constraintField = (
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
312
|
+
private constraintField = (
|
|
313
|
+
type: 'license' | 'legal' | 'security' | 'other',
|
|
314
|
+
output: Partial<CatalogRecord>,
|
|
315
|
+
constraintArray: SourceWithUnknownProps[]
|
|
316
|
+
) => {
|
|
317
|
+
let outputField: string
|
|
318
|
+
switch (type) {
|
|
319
|
+
case 'license':
|
|
320
|
+
outputField = 'licenses'
|
|
321
|
+
break
|
|
322
|
+
case 'legal':
|
|
323
|
+
outputField = 'legalConstraints'
|
|
324
|
+
break
|
|
325
|
+
case 'security':
|
|
326
|
+
outputField = 'securityConstraints'
|
|
327
|
+
break
|
|
328
|
+
case 'other':
|
|
329
|
+
outputField = 'otherConstraints'
|
|
330
|
+
break
|
|
331
|
+
}
|
|
332
|
+
const outputArray: Constraint[] =
|
|
333
|
+
outputField in output ? output[outputField] : []
|
|
334
|
+
outputArray.push(
|
|
335
|
+
...constraintArray.map((item) => {
|
|
336
|
+
const text = selectTranslatedValue(item, this.lang3) as string
|
|
337
|
+
const url = getAsUrl(selectField(item, 'link'))
|
|
338
|
+
return {
|
|
339
|
+
text,
|
|
340
|
+
...(url ? { url } : {}),
|
|
331
341
|
}
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
case 'MD_LegalConstraintsUseLimitationObject':
|
|
348
|
-
return 'legal'
|
|
349
|
-
case 'MD_SecurityConstraintsUseLimitationObject':
|
|
350
|
-
return 'security'
|
|
351
|
-
case 'MD_ConstraintsUseLimitationObject':
|
|
352
|
-
default:
|
|
353
|
-
return 'other'
|
|
342
|
+
})
|
|
343
|
+
)
|
|
344
|
+
const result = {
|
|
345
|
+
...output,
|
|
346
|
+
[outputField]: outputArray,
|
|
347
|
+
}
|
|
348
|
+
// avoid legal constraints being duplicates of licenses
|
|
349
|
+
if (
|
|
350
|
+
'legalConstraints' in result &&
|
|
351
|
+
(type === 'legal' || type === 'license')
|
|
352
|
+
) {
|
|
353
|
+
result.legalConstraints = result.legalConstraints.filter(
|
|
354
|
+
(constraint) =>
|
|
355
|
+
!output.licenses?.some((license) => license.text === constraint.text)
|
|
356
|
+
)
|
|
354
357
|
}
|
|
358
|
+
return result
|
|
355
359
|
}
|
|
356
360
|
|
|
357
361
|
getMappingFn(fieldName: string) {
|
|
@@ -26,12 +26,13 @@ export class Gn4MetadataMapper extends MetadataBaseMapper<Gn4Record> {
|
|
|
26
26
|
recordUpdated: null,
|
|
27
27
|
ownerOrganization: null,
|
|
28
28
|
licenses: [],
|
|
29
|
+
legalConstraints: [],
|
|
30
|
+
securityConstraints: [],
|
|
31
|
+
otherConstraints: [],
|
|
29
32
|
contacts: [],
|
|
30
33
|
contactsForResource: [],
|
|
31
|
-
accessConstraints: [],
|
|
32
34
|
keywords: [],
|
|
33
35
|
themes: [],
|
|
34
|
-
useLimitations: [],
|
|
35
36
|
spatialExtents: [],
|
|
36
37
|
temporalExtents: [],
|
|
37
38
|
overviews: [],
|
|
@@ -12,7 +12,6 @@ import {
|
|
|
12
12
|
} from '../xml-utils'
|
|
13
13
|
import {
|
|
14
14
|
writeAbstract,
|
|
15
|
-
writeAccessConstraints,
|
|
16
15
|
writeContacts,
|
|
17
16
|
writeDatasetCreated,
|
|
18
17
|
writeDatasetUpdated,
|
|
@@ -20,22 +19,23 @@ import {
|
|
|
20
19
|
writeGraphicOverviews,
|
|
21
20
|
writeKeywords,
|
|
22
21
|
writeKind,
|
|
22
|
+
writeLegalConstraints,
|
|
23
23
|
writeLicenses,
|
|
24
24
|
writeLineage,
|
|
25
25
|
writeOnlineResources,
|
|
26
|
+
writeOtherConstraints,
|
|
26
27
|
writeOwnerOrganization,
|
|
27
28
|
writeRecordUpdated,
|
|
29
|
+
writeSecurityConstraints,
|
|
28
30
|
writeSpatialRepresentation,
|
|
29
31
|
writeStatus,
|
|
30
32
|
writeThemes,
|
|
31
33
|
writeTitle,
|
|
32
34
|
writeUniqueIdentifier,
|
|
33
35
|
writeUpdateFrequency,
|
|
34
|
-
writeUseLimitations,
|
|
35
36
|
} from './write-parts'
|
|
36
37
|
import {
|
|
37
38
|
readAbstract,
|
|
38
|
-
readAccessConstraints,
|
|
39
39
|
readContacts,
|
|
40
40
|
readDatasetCreated,
|
|
41
41
|
readDatasetUpdated,
|
|
@@ -43,12 +43,15 @@ import {
|
|
|
43
43
|
readIsoTopics,
|
|
44
44
|
readKeywords,
|
|
45
45
|
readKind,
|
|
46
|
+
readLegalConstraints,
|
|
46
47
|
readLicenses,
|
|
47
48
|
readLineage,
|
|
48
49
|
readOnlineResources,
|
|
50
|
+
readOtherConstraints,
|
|
49
51
|
readOverviews,
|
|
50
52
|
readOwnerOrganization,
|
|
51
53
|
readRecordUpdated,
|
|
54
|
+
readSecurityConstraints,
|
|
52
55
|
readSpatialExtents,
|
|
53
56
|
readSpatialRepresentation,
|
|
54
57
|
readStatus,
|
|
@@ -57,7 +60,6 @@ import {
|
|
|
57
60
|
readTitle,
|
|
58
61
|
readUniqueIdentifier,
|
|
59
62
|
readUpdateFrequency,
|
|
60
|
-
readUseLimitations,
|
|
61
63
|
} from './read-parts'
|
|
62
64
|
import { isEqual } from '../convert-utils'
|
|
63
65
|
|
|
@@ -75,8 +77,9 @@ export function toModel(xml: string): CatalogRecord {
|
|
|
75
77
|
const recordCreated = recordUpdated
|
|
76
78
|
const keywords = readKeywords(rootEl)
|
|
77
79
|
const themes = readThemes(rootEl)
|
|
78
|
-
const
|
|
79
|
-
const
|
|
80
|
+
const legalConstraints = readLegalConstraints(rootEl)
|
|
81
|
+
const otherConstraints = readOtherConstraints(rootEl)
|
|
82
|
+
const securityConstraints = readSecurityConstraints(rootEl)
|
|
80
83
|
const licenses = readLicenses(rootEl)
|
|
81
84
|
const overviews = readOverviews(rootEl)
|
|
82
85
|
|
|
@@ -107,9 +110,10 @@ export function toModel(xml: string): CatalogRecord {
|
|
|
107
110
|
contactsForResource: [], // FIXME: is that really useful??
|
|
108
111
|
keywords,
|
|
109
112
|
themes,
|
|
110
|
-
accessConstraints,
|
|
111
|
-
useLimitations,
|
|
112
113
|
licenses,
|
|
114
|
+
legalConstraints,
|
|
115
|
+
securityConstraints,
|
|
116
|
+
otherConstraints,
|
|
113
117
|
...(datasetCreated && { datasetCreated }),
|
|
114
118
|
...(datasetUpdated && { datasetUpdated }),
|
|
115
119
|
lineage,
|
|
@@ -133,9 +137,10 @@ export function toModel(xml: string): CatalogRecord {
|
|
|
133
137
|
contacts,
|
|
134
138
|
keywords,
|
|
135
139
|
themes,
|
|
136
|
-
accessConstraints,
|
|
137
|
-
useLimitations,
|
|
138
140
|
licenses,
|
|
141
|
+
legalConstraints,
|
|
142
|
+
securityConstraints,
|
|
143
|
+
otherConstraints,
|
|
139
144
|
overviews,
|
|
140
145
|
onlineResources,
|
|
141
146
|
} as ServiceRecord
|
|
@@ -164,9 +169,11 @@ export function toXml(record: CatalogRecord, originalXml?: string): string {
|
|
|
164
169
|
fieldChanged('contacts') && writeContacts(record, rootEl)
|
|
165
170
|
fieldChanged('keywords') && writeKeywords(record, rootEl)
|
|
166
171
|
fieldChanged('themes') && writeThemes(record, rootEl)
|
|
167
|
-
fieldChanged('
|
|
172
|
+
fieldChanged('legalConstraints') && writeLegalConstraints(record, rootEl)
|
|
173
|
+
fieldChanged('securityConstraints') &&
|
|
174
|
+
writeSecurityConstraints(record, rootEl)
|
|
168
175
|
fieldChanged('licenses') && writeLicenses(record, rootEl)
|
|
169
|
-
fieldChanged('
|
|
176
|
+
fieldChanged('otherConstraints') && writeOtherConstraints(record, rootEl)
|
|
170
177
|
|
|
171
178
|
if (record.kind === 'dataset') {
|
|
172
179
|
writeStatus(record, rootEl)
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
AccessConstraintType,
|
|
2
|
+
Constraint,
|
|
4
3
|
DatasetDistribution,
|
|
5
4
|
DatasetSpatialExtent,
|
|
6
5
|
DatasetTemporalExtent,
|
|
7
6
|
GraphicOverview,
|
|
8
7
|
Individual,
|
|
9
|
-
License,
|
|
10
8
|
Organization,
|
|
11
9
|
RecordKind,
|
|
12
10
|
RecordStatus,
|
|
@@ -183,59 +181,69 @@ function extractStatus(): ChainableFunction<XmlElement, RecordStatus> {
|
|
|
183
181
|
}
|
|
184
182
|
|
|
185
183
|
// from gmd:resourceConstraints
|
|
186
|
-
function
|
|
184
|
+
function extractLegalConstraints(): ChainableFunction<
|
|
187
185
|
XmlElement,
|
|
188
|
-
Array<
|
|
186
|
+
Array<Constraint>
|
|
189
187
|
> {
|
|
190
|
-
|
|
188
|
+
return pipe(
|
|
191
189
|
findChildrenElement('gmd:MD_LegalConstraints', false),
|
|
192
190
|
filterArray(
|
|
193
191
|
pipe(
|
|
194
192
|
findChildrenElement('gmd:MD_RestrictionCode'),
|
|
195
193
|
mapArray(readAttribute('codeListValue')),
|
|
196
|
-
map(
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
194
|
+
map((values) => values.indexOf('license') === -1)
|
|
195
|
+
)
|
|
196
|
+
),
|
|
197
|
+
mapArray(
|
|
198
|
+
combine(
|
|
199
|
+
findChildrenElement('gmd:otherConstraints'),
|
|
200
|
+
findChildrenElement('gmd:useLimitation')
|
|
201
201
|
)
|
|
202
202
|
),
|
|
203
|
-
mapArray(findChildrenElement('gmd:otherConstraints')),
|
|
204
203
|
flattenArray(),
|
|
205
|
-
|
|
206
|
-
mapArray((
|
|
204
|
+
flattenArray(),
|
|
205
|
+
mapArray(combine(extractCharacterString(), extractUrl())),
|
|
206
|
+
mapArray(([text, url]) => ({
|
|
207
|
+
...(url && { url }),
|
|
207
208
|
text,
|
|
208
|
-
type: 'other' as AccessConstraintType,
|
|
209
209
|
}))
|
|
210
210
|
)
|
|
211
|
-
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
// from gmd:resourceConstraints
|
|
214
|
+
function extractSecurityConstraints(): ChainableFunction<
|
|
215
|
+
XmlElement,
|
|
216
|
+
Array<Constraint>
|
|
217
|
+
> {
|
|
218
|
+
return pipe(
|
|
212
219
|
findNestedElements('gmd:MD_SecurityConstraints', 'gmd:useLimitation'),
|
|
213
|
-
|
|
214
|
-
mapArray((
|
|
220
|
+
flattenArray(),
|
|
221
|
+
mapArray(combine(extractCharacterString(), extractUrl())),
|
|
222
|
+
mapArray(([text, url]) => ({
|
|
223
|
+
...(url && { url }),
|
|
215
224
|
text,
|
|
216
|
-
type: 'security' as AccessConstraintType,
|
|
217
225
|
}))
|
|
218
226
|
)
|
|
219
|
-
return pipe(
|
|
220
|
-
combine(getOtherConstraints, getSecurityConstraints),
|
|
221
|
-
flattenArray()
|
|
222
|
-
)
|
|
223
227
|
}
|
|
224
228
|
|
|
225
229
|
// from gmd:resourceConstraints
|
|
226
|
-
function
|
|
230
|
+
function extractOtherConstraints(): ChainableFunction<
|
|
231
|
+
XmlElement,
|
|
232
|
+
Array<Constraint>
|
|
233
|
+
> {
|
|
227
234
|
return pipe(
|
|
228
|
-
|
|
229
|
-
findNestedElements('gmd:MD_Constraints', 'gmd:useLimitation'),
|
|
230
|
-
findNestedElements('gmd:MD_LegalConstraints', 'gmd:useLimitation')
|
|
231
|
-
),
|
|
235
|
+
findNestedElements('gmd:MD_Constraints', 'gmd:useLimitation'),
|
|
232
236
|
flattenArray(),
|
|
233
|
-
mapArray(extractCharacterString())
|
|
237
|
+
mapArray(combine(extractCharacterString(), extractUrl())),
|
|
238
|
+
mapArray(([text, url]) => ({
|
|
239
|
+
...(url && { url }),
|
|
240
|
+
text,
|
|
241
|
+
}))
|
|
234
242
|
)
|
|
235
243
|
}
|
|
236
244
|
|
|
237
245
|
// from gmd:resourceConstraints
|
|
238
|
-
function extractLicenses(): ChainableFunction<XmlElement, Array<
|
|
246
|
+
function extractLicenses(): ChainableFunction<XmlElement, Array<Constraint>> {
|
|
239
247
|
return pipe(
|
|
240
248
|
findChildrenElement('gmd:MD_LegalConstraints', false),
|
|
241
249
|
filterArray(
|
|
@@ -246,15 +254,18 @@ function extractLicenses(): ChainableFunction<XmlElement, Array<License>> {
|
|
|
246
254
|
)
|
|
247
255
|
),
|
|
248
256
|
mapArray(
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
map(([text, url]) => ({
|
|
253
|
-
...(url && { url }),
|
|
254
|
-
text,
|
|
255
|
-
}))
|
|
257
|
+
combine(
|
|
258
|
+
findChildrenElement('gmd:otherConstraints'),
|
|
259
|
+
findChildrenElement('gmd:useLimitation')
|
|
256
260
|
)
|
|
257
|
-
)
|
|
261
|
+
),
|
|
262
|
+
flattenArray(),
|
|
263
|
+
flattenArray(),
|
|
264
|
+
mapArray(combine(extractCharacterString(), extractUrl())),
|
|
265
|
+
mapArray(([text, url]) => ({
|
|
266
|
+
...(url && { url }),
|
|
267
|
+
text,
|
|
268
|
+
}))
|
|
258
269
|
)
|
|
259
270
|
}
|
|
260
271
|
|
|
@@ -579,24 +590,32 @@ const getConstraints = pipe(
|
|
|
579
590
|
findChildrenElement('gmd:resourceConstraints', false)
|
|
580
591
|
)
|
|
581
592
|
|
|
582
|
-
export function
|
|
593
|
+
export function readLegalConstraints(rootEl: XmlElement): Constraint[] {
|
|
583
594
|
return pipe(
|
|
584
595
|
getConstraints,
|
|
585
|
-
mapArray(
|
|
596
|
+
mapArray(extractLegalConstraints()),
|
|
586
597
|
flattenArray(),
|
|
587
598
|
flattenArray()
|
|
588
599
|
)(rootEl)
|
|
589
600
|
}
|
|
590
601
|
|
|
591
|
-
export function
|
|
602
|
+
export function readSecurityConstraints(rootEl: XmlElement): Constraint[] {
|
|
603
|
+
return pipe(
|
|
604
|
+
getConstraints,
|
|
605
|
+
mapArray(extractSecurityConstraints()),
|
|
606
|
+
flattenArray()
|
|
607
|
+
)(rootEl)
|
|
608
|
+
}
|
|
609
|
+
|
|
610
|
+
export function readOtherConstraints(rootEl: XmlElement): Constraint[] {
|
|
592
611
|
return pipe(
|
|
593
612
|
getConstraints,
|
|
594
|
-
mapArray(
|
|
613
|
+
mapArray(extractOtherConstraints()),
|
|
595
614
|
flattenArray()
|
|
596
615
|
)(rootEl)
|
|
597
616
|
}
|
|
598
617
|
|
|
599
|
-
export function readLicenses(rootEl: XmlElement):
|
|
618
|
+
export function readLicenses(rootEl: XmlElement): Constraint[] {
|
|
600
619
|
return pipe(
|
|
601
620
|
getConstraints,
|
|
602
621
|
mapArray(extractLicenses()),
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
|
-
AccessConstraint,
|
|
3
2
|
CatalogRecord,
|
|
3
|
+
Constraint,
|
|
4
4
|
DatasetDistribution,
|
|
5
5
|
DatasetRecord,
|
|
6
6
|
DatasetServiceDistribution,
|
|
7
7
|
Individual,
|
|
8
|
-
License,
|
|
9
8
|
RecordStatus,
|
|
10
9
|
Role,
|
|
11
10
|
ServiceEndpoint,
|
|
@@ -374,35 +373,11 @@ function appendKeywords(keywords: string[], type: string | null) {
|
|
|
374
373
|
)
|
|
375
374
|
}
|
|
376
375
|
|
|
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') {
|
|
376
|
+
function createConstraint(
|
|
377
|
+
constraint: Constraint,
|
|
378
|
+
type: 'legal' | 'security' | 'other'
|
|
379
|
+
) {
|
|
380
|
+
if (type === 'security') {
|
|
406
381
|
return pipe(
|
|
407
382
|
createElement('gmd:resourceConstraints'),
|
|
408
383
|
createChild('gmd:MD_SecurityConstraints'),
|
|
@@ -422,29 +397,41 @@ function createAccessConstraint(constraint: AccessConstraint) {
|
|
|
422
397
|
)
|
|
423
398
|
)
|
|
424
399
|
)
|
|
400
|
+
} else if (type === 'legal') {
|
|
401
|
+
return pipe(
|
|
402
|
+
createElement('gmd:resourceConstraints'),
|
|
403
|
+
createChild('gmd:MD_LegalConstraints'),
|
|
404
|
+
appendChildren(
|
|
405
|
+
pipe(
|
|
406
|
+
createElement('gmd:accessConstraints'),
|
|
407
|
+
createChild('gmd:MD_RestrictionCode'),
|
|
408
|
+
addAttribute(
|
|
409
|
+
'codeList',
|
|
410
|
+
'http://standards.iso.org/iso/19139/resources/gmxCodelists.xml#MD_RestrictionCode'
|
|
411
|
+
),
|
|
412
|
+
addAttribute('codeListValue', 'otherRestrictions')
|
|
413
|
+
),
|
|
414
|
+
pipe(
|
|
415
|
+
createElement('gmd:otherConstraints'),
|
|
416
|
+
writeCharacterString(constraint.text)
|
|
417
|
+
)
|
|
418
|
+
)
|
|
419
|
+
)
|
|
425
420
|
}
|
|
421
|
+
|
|
426
422
|
return pipe(
|
|
427
423
|
createElement('gmd:resourceConstraints'),
|
|
428
|
-
createChild('gmd:
|
|
424
|
+
createChild('gmd:MD_Constraints'),
|
|
429
425
|
appendChildren(
|
|
430
426
|
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'),
|
|
427
|
+
createElement('gmd:useLimitation'),
|
|
441
428
|
writeCharacterString(constraint.text)
|
|
442
429
|
)
|
|
443
430
|
)
|
|
444
431
|
)
|
|
445
432
|
}
|
|
446
433
|
|
|
447
|
-
function
|
|
434
|
+
function removeOtherConstraints() {
|
|
448
435
|
return removeChildren(
|
|
449
436
|
pipe(
|
|
450
437
|
findChildrenElement('gmd:resourceConstraints'),
|
|
@@ -458,12 +445,37 @@ function removeUseLimitations() {
|
|
|
458
445
|
)
|
|
459
446
|
}
|
|
460
447
|
|
|
461
|
-
function
|
|
462
|
-
return
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
448
|
+
function removeSecurityConstraints() {
|
|
449
|
+
return removeChildren(
|
|
450
|
+
pipe(
|
|
451
|
+
findChildrenElement('gmd:resourceConstraints'),
|
|
452
|
+
filterArray(
|
|
453
|
+
pipe(
|
|
454
|
+
findNestedElements('gmd:MD_SecurityConstraints', 'gmd:useLimitation'),
|
|
455
|
+
(array) => array.length > 0
|
|
456
|
+
)
|
|
457
|
+
)
|
|
458
|
+
)
|
|
459
|
+
)
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
function removeLegalConstraints() {
|
|
463
|
+
return removeChildren(
|
|
464
|
+
pipe(
|
|
465
|
+
findChildrenElement('gmd:resourceConstraints'),
|
|
466
|
+
filterArray(
|
|
467
|
+
pipe(
|
|
468
|
+
findNestedElements(
|
|
469
|
+
'gmd:MD_LegalConstraints',
|
|
470
|
+
'gmd:accessConstraints',
|
|
471
|
+
'gmd:MD_RestrictionCode'
|
|
472
|
+
),
|
|
473
|
+
mapArray(readAttribute('codeListValue')),
|
|
474
|
+
(restrictionCodes) =>
|
|
475
|
+
restrictionCodes.every((code) => code !== 'license')
|
|
476
|
+
)
|
|
477
|
+
)
|
|
478
|
+
)
|
|
467
479
|
)
|
|
468
480
|
}
|
|
469
481
|
|
|
@@ -487,7 +499,7 @@ function removeLicenses() {
|
|
|
487
499
|
)
|
|
488
500
|
}
|
|
489
501
|
|
|
490
|
-
function createLicense(license:
|
|
502
|
+
function createLicense(license: Constraint) {
|
|
491
503
|
return pipe(
|
|
492
504
|
createElement('gmd:resourceConstraints'),
|
|
493
505
|
createChild('gmd:MD_LegalConstraints'),
|
|
@@ -741,30 +753,50 @@ export function writeThemes(record: CatalogRecord, rootEl: XmlElement) {
|
|
|
741
753
|
)(rootEl)
|
|
742
754
|
}
|
|
743
755
|
|
|
744
|
-
export function
|
|
756
|
+
export function writeLicenses(record: CatalogRecord, rootEl: XmlElement) {
|
|
757
|
+
pipe(
|
|
758
|
+
findOrCreateIdentification(),
|
|
759
|
+
removeLicenses(),
|
|
760
|
+
appendChildren(...record.licenses.map(createLicense))
|
|
761
|
+
)(rootEl)
|
|
762
|
+
}
|
|
763
|
+
|
|
764
|
+
export function writeLegalConstraints(
|
|
745
765
|
record: CatalogRecord,
|
|
746
766
|
rootEl: XmlElement
|
|
747
767
|
) {
|
|
748
768
|
pipe(
|
|
749
769
|
findOrCreateIdentification(),
|
|
750
|
-
|
|
751
|
-
appendChildren(
|
|
770
|
+
removeLegalConstraints(),
|
|
771
|
+
appendChildren(
|
|
772
|
+
...record.legalConstraints.map((c) => createConstraint(c, 'legal'))
|
|
773
|
+
)
|
|
752
774
|
)(rootEl)
|
|
753
775
|
}
|
|
754
776
|
|
|
755
|
-
export function
|
|
777
|
+
export function writeSecurityConstraints(
|
|
778
|
+
record: CatalogRecord,
|
|
779
|
+
rootEl: XmlElement
|
|
780
|
+
) {
|
|
756
781
|
pipe(
|
|
757
782
|
findOrCreateIdentification(),
|
|
758
|
-
|
|
759
|
-
appendChildren(
|
|
783
|
+
removeSecurityConstraints(),
|
|
784
|
+
appendChildren(
|
|
785
|
+
...record.securityConstraints.map((c) => createConstraint(c, 'security'))
|
|
786
|
+
)
|
|
760
787
|
)(rootEl)
|
|
761
788
|
}
|
|
762
789
|
|
|
763
|
-
export function
|
|
790
|
+
export function writeOtherConstraints(
|
|
791
|
+
record: CatalogRecord,
|
|
792
|
+
rootEl: XmlElement
|
|
793
|
+
) {
|
|
764
794
|
pipe(
|
|
765
795
|
findOrCreateIdentification(),
|
|
766
|
-
|
|
767
|
-
appendChildren(
|
|
796
|
+
removeOtherConstraints(),
|
|
797
|
+
appendChildren(
|
|
798
|
+
...record.otherConstraints.map((c) => createConstraint(c, 'other'))
|
|
799
|
+
)
|
|
768
800
|
)(rootEl)
|
|
769
801
|
}
|
|
770
802
|
|