mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-10 11:33:04 +00:00
64961: UUID filtering on compare + formToBitstream refactoring
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { isEmpty, isNotUndefined, isUndefined } from '../../shared/empty.util';
|
||||
import { isEmpty, isNotEmpty, isNotUndefined, isUndefined } from '../../shared/empty.util';
|
||||
import {
|
||||
MetadataMapInterface,
|
||||
MetadataValue,
|
||||
@@ -215,4 +215,19 @@ export class Metadata {
|
||||
});
|
||||
return metadataMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the first value of a metadata by field key
|
||||
* Creates a new MetadataValue if the field doesn't exist yet
|
||||
* @param mdMap The map to add/change values in
|
||||
* @param key The metadata field
|
||||
* @param value The value to add
|
||||
*/
|
||||
public static setFirstValue(mdMap: MetadataMapInterface, key: string, value: string) {
|
||||
if (isNotEmpty(mdMap[key])) {
|
||||
mdMap[key][0].value = value;
|
||||
} else {
|
||||
mdMap[key] = [Object.assign(new MetadataValue(), { value: value })]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user