diff --git a/src/app/core/submission/vocabularies/models/vocabulary-options.model.ts b/src/app/core/submission/vocabularies/models/vocabulary-options.model.ts index bdbd19f85f..fd103718e1 100644 --- a/src/app/core/submission/vocabularies/models/vocabulary-options.model.ts +++ b/src/app/core/submission/vocabularies/models/vocabulary-options.model.ts @@ -8,28 +8,14 @@ export class VocabularyOptions { */ name: string; - /** - * The metadata field name (e.g. "dc.type") for which the vocabulary is used: - */ - metadata?: string; - - /** - * The uuid of the collection where the item is being submitted - */ - scope?: string; - /** * A boolean representing if value is closely related to a vocabulary entry or not */ closed: boolean; constructor(name: string, - metadata?: string, - scope?: string, closed: boolean = false) { this.name = name; - this.metadata = metadata; - this.scope = scope; this.closed = closed; } } diff --git a/src/app/core/submission/vocabularies/vocabulary.service.spec.ts b/src/app/core/submission/vocabularies/vocabulary.service.spec.ts index a172ae2a45..1119d4f6e6 100644 --- a/src/app/core/submission/vocabularies/vocabulary.service.spec.ts +++ b/src/app/core/submission/vocabularies/vocabulary.service.spec.ts @@ -175,8 +175,6 @@ describe('VocabularyService', () => { const entryByIDRequestURL = `https://rest.api/rest/api/submission/vocabularies/${vocabulary.id}/entries?entryID=${entryID}`; const vocabularyOptions: VocabularyOptions = { name: vocabularyId, - metadata: metadata, - scope: collectionUUID, closed: false } const pageInfo = new PageInfo(); @@ -316,24 +314,6 @@ describe('VocabularyService', () => { expect(result).toBeObservable(expected); }); }); - - describe('searchVocabularyByMetadataAndCollection', () => { - it('should proxy the call to vocabularyDataService.findVocabularyByHref', () => { - scheduler.schedule(() => service.searchVocabularyByMetadataAndCollection(vocabularyOptions).subscribe()); - scheduler.flush(); - - expect((service as any).vocabularyDataService.findByHref).toHaveBeenCalledWith(searchRequestURL); - }); - - it('should return a RemoteData for the search', () => { - const result = service.searchVocabularyByMetadataAndCollection(vocabularyOptions); - const expected = cold('a|', { - a: vocabularyRD - }); - expect(result).toBeObservable(expected); - }); - - }); }); describe('', () => { diff --git a/src/app/core/submission/vocabularies/vocabulary.service.ts b/src/app/core/submission/vocabularies/vocabulary.service.ts index 90438e77e9..595edfc861 100644 --- a/src/app/core/submission/vocabularies/vocabulary.service.ts +++ b/src/app/core/submission/vocabularies/vocabulary.service.ts @@ -255,26 +255,6 @@ export class VocabularyService { ); } - /** - * Return the controlled {@link Vocabulary} configured for the specified metadata and collection if any. - * - * @param vocabularyOptions The {@link VocabularyOptions} for the request - * @param linksToFollow List of {@link FollowLinkConfig} that indicate which {@link HALLink}s should be automatically resolved - * @return {Observable>>} - * Return an observable that emits object list - */ - searchVocabularyByMetadataAndCollection(vocabularyOptions: VocabularyOptions, ...linksToFollow: Array>): Observable> { - const options: VocabularyFindOptions = new VocabularyFindOptions( - vocabularyOptions.scope, - vocabularyOptions.metadata - ); - - return this.vocabularyDataService.getSearchByHref(this.searchByMetadataAndCollectionMethod, options).pipe( - first((href: string) => hasValue(href)), - flatMap((href: string) => this.vocabularyDataService.findByHref(href)) - ) - } - /** * Returns an observable of {@link RemoteData} of a {@link VocabularyEntryDetail}, based on an href, with a list of {@link FollowLinkConfig}, * to automatically resolve {@link HALLink}s of the {@link VocabularyEntryDetail} diff --git a/src/app/shared/form/builder/ds-dynamic-form-ui/ds-dynamic-form-control-container.component.spec.ts b/src/app/shared/form/builder/ds-dynamic-form-ui/ds-dynamic-form-control-container.component.spec.ts index 81247dd266..0a4de25ebf 100644 --- a/src/app/shared/form/builder/ds-dynamic-form-ui/ds-dynamic-form-control-container.component.spec.ts +++ b/src/app/shared/form/builder/ds-dynamic-form-ui/ds-dynamic-form-control-container.component.spec.ts @@ -78,10 +78,8 @@ import { FormBuilderService } from '../form-builder.service'; describe('DsDynamicFormControlContainerComponent test suite', () => { const vocabularyOptions: VocabularyOptions = { - closed: false, - metadata: 'list', name: 'type_programme', - scope: 'c1c16450-d56f-41bc-bb81-27f1d1eb5c23' + closed: false }; const formModel = [ new DynamicCheckboxModel({ id: 'checkbox' }), diff --git a/src/app/shared/form/builder/ds-dynamic-form-ui/models/list/dynamic-list.component.spec.ts b/src/app/shared/form/builder/ds-dynamic-form-ui/models/list/dynamic-list.component.spec.ts index b35ee10e8a..b041736e34 100644 --- a/src/app/shared/form/builder/ds-dynamic-form-ui/models/list/dynamic-list.component.spec.ts +++ b/src/app/shared/form/builder/ds-dynamic-form-ui/models/list/dynamic-list.component.spec.ts @@ -36,10 +36,8 @@ export const LIST_TEST_GROUP = new FormGroup({ export const LIST_CHECKBOX_TEST_MODEL_CONFIG = { vocabularyOptions: { - closed: false, - metadata: 'listCheckbox', name: 'type_programme', - scope: 'c1c16450-d56f-41bc-bb81-27f1d1eb5c23' + closed: false } as VocabularyOptions, disabled: false, id: 'listCheckbox', @@ -53,10 +51,8 @@ export const LIST_CHECKBOX_TEST_MODEL_CONFIG = { export const LIST_RADIO_TEST_MODEL_CONFIG = { vocabularyOptions: { - closed: false, - metadata: 'listRadio', name: 'type_programme', - scope: 'c1c16450-d56f-41bc-bb81-27f1d1eb5c23' + closed: false } as VocabularyOptions, disabled: false, id: 'listRadio', diff --git a/src/app/shared/form/builder/ds-dynamic-form-ui/models/lookup/dynamic-lookup.component.spec.ts b/src/app/shared/form/builder/ds-dynamic-form-ui/models/lookup/dynamic-lookup.component.spec.ts index 30c40aebcc..f577e643cd 100644 --- a/src/app/shared/form/builder/ds-dynamic-form-ui/models/lookup/dynamic-lookup.component.spec.ts +++ b/src/app/shared/form/builder/ds-dynamic-form-ui/models/lookup/dynamic-lookup.component.spec.ts @@ -25,10 +25,8 @@ import { ObjNgFor } from '../../../../../utils/object-ngfor.pipe'; let LOOKUP_TEST_MODEL_CONFIG: DynamicLookupModelConfig = { vocabularyOptions: { - closed: false, - metadata: 'lookup', name: 'RPAuthority', - scope: 'c1c16450-d56f-41bc-bb81-27f1d1eb5c23' + closed: false } as VocabularyOptions, disabled: false, errorMessages: { required: 'Required field.' }, @@ -49,10 +47,8 @@ let LOOKUP_TEST_MODEL_CONFIG: DynamicLookupModelConfig = { let LOOKUP_NAME_TEST_MODEL_CONFIG = { vocabularyOptions: { - closed: false, - metadata: 'lookup-name', name: 'RPAuthority', - scope: 'c1c16450-d56f-41bc-bb81-27f1d1eb5c23' + closed: false } as VocabularyOptions, disabled: false, errorMessages: { required: 'Required field.' }, @@ -80,10 +76,8 @@ describe('Dynamic Lookup component', () => { function init() { LOOKUP_TEST_MODEL_CONFIG = { vocabularyOptions: { - closed: false, - metadata: 'lookup', name: 'RPAuthority', - scope: 'c1c16450-d56f-41bc-bb81-27f1d1eb5c23' + closed: false } as VocabularyOptions, disabled: false, errorMessages: { required: 'Required field.' }, @@ -104,10 +98,8 @@ describe('Dynamic Lookup component', () => { LOOKUP_NAME_TEST_MODEL_CONFIG = { vocabularyOptions: { - closed: false, - metadata: 'lookup-name', name: 'RPAuthority', - scope: 'c1c16450-d56f-41bc-bb81-27f1d1eb5c23' + closed: false } as VocabularyOptions, disabled: false, errorMessages: { required: 'Required field.' }, diff --git a/src/app/shared/form/builder/ds-dynamic-form-ui/models/onebox/dynamic-onebox.component.spec.ts b/src/app/shared/form/builder/ds-dynamic-form-ui/models/onebox/dynamic-onebox.component.spec.ts index e94d3a208c..7a18bcc6e4 100644 --- a/src/app/shared/form/builder/ds-dynamic-form-ui/models/onebox/dynamic-onebox.component.spec.ts +++ b/src/app/shared/form/builder/ds-dynamic-form-ui/models/onebox/dynamic-onebox.component.spec.ts @@ -50,9 +50,7 @@ function init() { ONEBOX_TEST_MODEL_CONFIG = { vocabularyOptions: { closed: false, - metadata: 'onebox', - name: 'vocabulary', - scope: 'c1c16450-d56f-41bc-bb81-27f1d1eb5c23' + name: 'vocabulary' } as VocabularyOptions, disabled: false, id: 'onebox', diff --git a/src/app/shared/form/builder/ds-dynamic-form-ui/models/scrollable-dropdown/dynamic-scrollable-dropdown.component.spec.ts b/src/app/shared/form/builder/ds-dynamic-form-ui/models/scrollable-dropdown/dynamic-scrollable-dropdown.component.spec.ts index 2318f3b0ae..9dbeb41ae8 100644 --- a/src/app/shared/form/builder/ds-dynamic-form-ui/models/scrollable-dropdown/dynamic-scrollable-dropdown.component.spec.ts +++ b/src/app/shared/form/builder/ds-dynamic-form-ui/models/scrollable-dropdown/dynamic-scrollable-dropdown.component.spec.ts @@ -24,9 +24,7 @@ export const SD_TEST_GROUP = new FormGroup({ export const SD_TEST_MODEL_CONFIG = { vocabularyOptions: { closed: false, - metadata: 'dropdown', - name: 'common_iso_languages', - scope: 'c1c16450-d56f-41bc-bb81-27f1d1eb5c23' + name: 'common_iso_languages' } as VocabularyOptions, disabled: false, errorMessages: { required: 'Required field.' }, diff --git a/src/app/shared/form/builder/ds-dynamic-form-ui/models/tag/dynamic-tag.component.spec.ts b/src/app/shared/form/builder/ds-dynamic-form-ui/models/tag/dynamic-tag.component.spec.ts index d0f7f4ec3b..d40ea72764 100644 --- a/src/app/shared/form/builder/ds-dynamic-form-ui/models/tag/dynamic-tag.component.spec.ts +++ b/src/app/shared/form/builder/ds-dynamic-form-ui/models/tag/dynamic-tag.component.spec.ts @@ -46,9 +46,7 @@ function init() { TAG_TEST_MODEL_CONFIG = { vocabularyOptions: { closed: false, - metadata: 'tag', - name: 'common_iso_languages', - scope: 'c1c16450-d56f-41bc-bb81-27f1d1eb5c23' + name: 'common_iso_languages' } as VocabularyOptions, disabled: false, id: 'tag', diff --git a/src/app/shared/form/builder/form-builder.service.spec.ts b/src/app/shared/form/builder/form-builder.service.spec.ts index 447ceb194d..46d058aae4 100644 --- a/src/app/shared/form/builder/form-builder.service.spec.ts +++ b/src/app/shared/form/builder/form-builder.service.spec.ts @@ -79,10 +79,8 @@ describe('FormBuilderService test suite', () => { }); const vocabularyOptions: VocabularyOptions = { - closed: false, - metadata: 'list', name: 'type_programme', - scope: 'c1c16450-d56f-41bc-bb81-27f1d1eb5c23' + closed: false }; testModel = [ diff --git a/src/app/shared/form/builder/parsers/dropdown-field-parser.ts b/src/app/shared/form/builder/parsers/dropdown-field-parser.ts index 7fb5fb206c..a73e270ed4 100644 --- a/src/app/shared/form/builder/parsers/dropdown-field-parser.ts +++ b/src/app/shared/form/builder/parsers/dropdown-field-parser.ts @@ -32,7 +32,7 @@ export class DropdownFieldParser extends FieldParser { let layout: DynamicFormControlLayout; if (isNotEmpty(this.configData.selectableMetadata[0].controlledVocabulary)) { - this.setVocabularyOptions(dropdownModelConfig, this.parserOptions.collectionUUID); + this.setVocabularyOptions(dropdownModelConfig); if (isNotEmpty(fieldValue)) { dropdownModelConfig.value = fieldValue; } diff --git a/src/app/shared/form/builder/parsers/field-parser.ts b/src/app/shared/form/builder/parsers/field-parser.ts index 6c6b8fddaf..c902e455d5 100644 --- a/src/app/shared/form/builder/parsers/field-parser.ts +++ b/src/app/shared/form/builder/parsers/field-parser.ts @@ -109,12 +109,10 @@ export abstract class FieldParser { } } - public setVocabularyOptions(controlModel, scope) { + public setVocabularyOptions(controlModel) { if (isNotEmpty(this.configData.selectableMetadata) && isNotEmpty(this.configData.selectableMetadata[0].controlledVocabulary)) { controlModel.vocabularyOptions = new VocabularyOptions( this.configData.selectableMetadata[0].controlledVocabulary, - this.configData.selectableMetadata[0].metadata, - scope, this.configData.selectableMetadata[0].closed ) } diff --git a/src/app/shared/form/builder/parsers/list-field-parser.ts b/src/app/shared/form/builder/parsers/list-field-parser.ts index e9c9f4e5be..48211b0aff 100644 --- a/src/app/shared/form/builder/parsers/list-field-parser.ts +++ b/src/app/shared/form/builder/parsers/list-field-parser.ts @@ -24,7 +24,7 @@ export class ListFieldParser extends FieldParser { } }); } - this.setVocabularyOptions(listModelConfig, this.parserOptions.collectionUUID); + this.setVocabularyOptions(listModelConfig); } let listModel; diff --git a/src/app/shared/form/builder/parsers/lookup-field-parser.ts b/src/app/shared/form/builder/parsers/lookup-field-parser.ts index 6e28194dad..2c35d2ceb8 100644 --- a/src/app/shared/form/builder/parsers/lookup-field-parser.ts +++ b/src/app/shared/form/builder/parsers/lookup-field-parser.ts @@ -8,7 +8,7 @@ export class LookupFieldParser extends FieldParser { if (this.configData.selectableMetadata[0].controlledVocabulary) { const lookupModelConfig: DynamicLookupModelConfig = this.initModel(null, label); - this.setVocabularyOptions(lookupModelConfig, this.parserOptions.collectionUUID); + this.setVocabularyOptions(lookupModelConfig); this.setValues(lookupModelConfig, fieldValue, true); diff --git a/src/app/shared/form/builder/parsers/lookup-name-field-parser.ts b/src/app/shared/form/builder/parsers/lookup-name-field-parser.ts index 26806742c8..c791e07e74 100644 --- a/src/app/shared/form/builder/parsers/lookup-name-field-parser.ts +++ b/src/app/shared/form/builder/parsers/lookup-name-field-parser.ts @@ -11,7 +11,7 @@ export class LookupNameFieldParser extends FieldParser { if (this.configData.selectableMetadata[0].controlledVocabulary) { const lookupModelConfig: DynamicLookupNameModelConfig = this.initModel(null, label); - this.setVocabularyOptions(lookupModelConfig, this.parserOptions.collectionUUID); + this.setVocabularyOptions(lookupModelConfig); this.setValues(lookupModelConfig, fieldValue, true); diff --git a/src/app/shared/form/builder/parsers/onebox-field-parser.ts b/src/app/shared/form/builder/parsers/onebox-field-parser.ts index 3eb5764a37..b9ac531c68 100644 --- a/src/app/shared/form/builder/parsers/onebox-field-parser.ts +++ b/src/app/shared/form/builder/parsers/onebox-field-parser.ts @@ -77,7 +77,7 @@ export class OneboxFieldParser extends FieldParser { return new DynamicQualdropModel(inputSelectGroup, clsGroup); } else if (this.configData.selectableMetadata[0].controlledVocabulary) { const oneboxModelConfig: DsDynamicOneboxModelConfig = this.initModel(null, label); - this.setVocabularyOptions(oneboxModelConfig, this.parserOptions.collectionUUID); + this.setVocabularyOptions(oneboxModelConfig); this.setValues(oneboxModelConfig, fieldValue, true); return new DynamicOneboxModel(oneboxModelConfig); diff --git a/src/app/shared/form/builder/parsers/tag-field-parser.ts b/src/app/shared/form/builder/parsers/tag-field-parser.ts index 08685e0e35..dcc2c5575f 100644 --- a/src/app/shared/form/builder/parsers/tag-field-parser.ts +++ b/src/app/shared/form/builder/parsers/tag-field-parser.ts @@ -8,7 +8,7 @@ export class TagFieldParser extends FieldParser { const tagModelConfig: DynamicTagModelConfig = this.initModel(null, label); if (this.configData.selectableMetadata[0].controlledVocabulary && this.configData.selectableMetadata[0].controlledVocabulary.length > 0) { - this.setVocabularyOptions(tagModelConfig, this.parserOptions.collectionUUID); + this.setVocabularyOptions(tagModelConfig); } this.setValues(tagModelConfig, fieldValue, null, true); diff --git a/src/app/shared/mocks/form-models.mock.ts b/src/app/shared/mocks/form-models.mock.ts index c5f78b9571..739de944f0 100644 --- a/src/app/shared/mocks/form-models.mock.ts +++ b/src/app/shared/mocks/form-models.mock.ts @@ -152,7 +152,7 @@ const relationGroupConfig = { export const MockRelationModel: DynamicRelationGroupModel = new DynamicRelationGroupModel(relationGroupConfig); export const inputWithLanguageAndAuthorityConfig = { - vocabularyOptions: new VocabularyOptions('testAuthority', 'testWithAuthority', 'scope'), + vocabularyOptions: new VocabularyOptions('testAuthority', false), languageCodes: [ { display: 'English', @@ -207,7 +207,7 @@ export const inputWithLanguageConfig = { export const mockInputWithLanguageModel = new DsDynamicInputModel(inputWithLanguageConfig); export const inputWithLanguageAndAuthorityArrayConfig = { - vocabularyOptions: new VocabularyOptions('testAuthority', 'testWithAuthority', 'scope'), + vocabularyOptions: new VocabularyOptions('testAuthority', false), languageCodes: [ { display: 'English', diff --git a/src/app/shared/vocabulary-treeview/vocabulary-treeview.component.spec.ts b/src/app/shared/vocabulary-treeview/vocabulary-treeview.component.spec.ts index 16ee2a55dd..6166dbc082 100644 --- a/src/app/shared/vocabulary-treeview/vocabulary-treeview.component.spec.ts +++ b/src/app/shared/vocabulary-treeview/vocabulary-treeview.component.spec.ts @@ -31,7 +31,7 @@ describe('VocabularyTreeviewComponent test suite', () => { const emptyNodeMap = new Map(); const storedNodeMap = new Map().set('test', new TreeviewFlatNode(item2)); const nodeMap = new Map().set('test', new TreeviewFlatNode(item)); - const vocabularyOptions = new VocabularyOptions('vocabularyTest', 'metadata.test', '123456'); + const vocabularyOptions = new VocabularyOptions('vocabularyTest', false); const modalStub = jasmine.createSpyObj('modalStub', ['close']); const vocabularyTreeviewServiceStub = jasmine.createSpyObj('VocabularyTreeviewService', { initialize: jasmine.createSpy('initialize'), @@ -224,7 +224,7 @@ describe('VocabularyTreeviewComponent test suite', () => { }) class TestComponent { - vocabularyOptions: VocabularyOptions = new VocabularyOptions('vocabularyTest', 'metadata.test', '123456'); + vocabularyOptions: VocabularyOptions = new VocabularyOptions('vocabularyTest', false); preloadLevel = 2; } diff --git a/src/app/shared/vocabulary-treeview/vocabulary-treeview.service.spec.ts b/src/app/shared/vocabulary-treeview/vocabulary-treeview.service.spec.ts index f45478f82b..060c7f4d9b 100644 --- a/src/app/shared/vocabulary-treeview/vocabulary-treeview.service.spec.ts +++ b/src/app/shared/vocabulary-treeview/vocabulary-treeview.service.spec.ts @@ -156,7 +156,7 @@ describe('VocabularyTreeviewService test suite', () => { searchNodeMap = new Map([ [item.id, searchItemNode], ]); - vocabularyOptions = new VocabularyOptions('vocabularyTest', 'metadata.test', '123456'); + vocabularyOptions = new VocabularyOptions('vocabularyTest', false); } beforeEach(async(() => {