Skip to content

Commit

Permalink
Merge branch 'DSpace:main' into orcid-settings-button-accessibility
Browse files Browse the repository at this point in the history
  • Loading branch information
doana committed May 17, 2023
2 parents bd1881f + e2c5171 commit 0272f9a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
Expand Up @@ -53,7 +53,7 @@ export abstract class DsDynamicVocabularyComponent extends DynamicFormControlCom
*/
getInitValueFromModel(): Observable<FormFieldMetadataValueObject> {
let initValue$: Observable<FormFieldMetadataValueObject>;
if (isNotEmpty(this.model.value) && (this.model.value instanceof FormFieldMetadataValueObject)) {
if (isNotEmpty(this.model.value) && (this.model.value instanceof FormFieldMetadataValueObject) && !this.model.value.hasAuthorityToGenerate()) {
let initEntry$: Observable<VocabularyEntry>;
if (this.model.value.hasAuthority()) {
initEntry$ = this.vocabularyService.getVocabularyEntryByID(this.model.value.authority, this.model.vocabularyOptions);
Expand Down
Expand Up @@ -11,6 +11,10 @@ export interface OtherInformation {
* A class representing a specific input-form field's value
*/
export class FormFieldMetadataValueObject implements MetadataValueInterface {

static readonly AUTHORITY_SPLIT: string = '::';
static readonly AUTHORITY_GENERATE: string = 'will be generated' + FormFieldMetadataValueObject.AUTHORITY_SPLIT;

metadata?: string;
value: any;
display: string;
Expand Down Expand Up @@ -58,6 +62,13 @@ export class FormFieldMetadataValueObject implements MetadataValueInterface {
return isNotEmpty(this.authority);
}

/**
* Returns true if this object has an authority value that needs to be generated
*/
hasAuthorityToGenerate(): boolean {
return isNotEmpty(this.authority) && this.authority.startsWith(FormFieldMetadataValueObject.AUTHORITY_GENERATE);
}

/**
* Returns true if this this object has a value
*/
Expand Down

0 comments on commit 0272f9a

Please sign in to comment.