From ad316f73160417943148717d9d9edd83b1310eca Mon Sep 17 00:00:00 2001 From: Yura Bondarenko Date: Thu, 25 Aug 2022 10:06:37 +0200 Subject: [PATCH] 93803: Resolve circular dependency src/app/core/cache/builders/build-decorators.ts > src/app/core/data/base/hal-data-service.interface.ts > src/app/core/data/paginated-list.model.ts --- .../browse/browse-definition-data.service.ts | 2 +- .../cache/builders/build-decorators.spec.ts | 43 +-------------- .../core/cache/builders/build-decorators.ts | 39 ------------- .../core/cache/builders/link.service.spec.ts | 3 +- src/app/core/cache/builders/link.service.ts | 2 +- .../submission-accesses-config.service.ts | 2 +- .../config/submission-forms-config.service.ts | 2 +- .../submission-uploads-config.service.ts | 2 +- .../core/data/access-status-data.service.ts | 2 +- .../data/base/data-service.decorator.spec.ts | 55 +++++++++++++++++++ .../core/data/base/data-service.decorator.ts | 51 +++++++++++++++++ src/app/core/data/bitstream-data.service.ts | 2 +- .../data/bitstream-format-data.service.ts | 2 +- src/app/core/data/bundle-data.service.ts | 2 +- src/app/core/data/collection-data.service.ts | 2 +- src/app/core/data/community-data.service.ts | 2 +- .../core/data/configuration-data.service.ts | 2 +- .../core/data/dspace-object-data.service.ts | 2 +- .../authorization-data.service.ts | 2 +- .../feature-data.service.ts | 2 +- src/app/core/data/href-only-data.service.ts | 2 +- src/app/core/data/item-data.service.ts | 2 +- .../core/data/metadata-field-data.service.ts | 2 +- .../core/data/metadata-schema-data.service.ts | 2 +- .../data/processes/process-data.service.ts | 2 +- .../data/processes/script-data.service.ts | 2 +- .../core/data/relationship-type.service.ts | 2 +- src/app/core/data/relationship.service.ts | 2 +- src/app/core/data/root-data.service.ts | 2 +- src/app/core/data/site-data.service.ts | 2 +- src/app/core/data/version-data.service.ts | 2 +- .../core/data/version-history-data.service.ts | 2 +- .../core/data/workflow-action-data.service.ts | 2 +- src/app/core/eperson/eperson-data.service.ts | 2 +- src/app/core/eperson/group-data.service.ts | 2 +- .../core/feedback/feedback-data.service.ts | 2 +- .../core/orcid/orcid-history-data.service.ts | 2 +- src/app/core/orcid/orcid-queue.service.ts | 2 +- .../profile/researcher-profile.service.ts | 2 +- .../resource-policy.service.ts | 2 +- .../statistics/usage-report-data.service.ts | 2 +- .../submission-cc-license-data.service.ts | 2 +- .../submission-cc-license-url-data.service.ts | 2 +- .../vocabulary-entry-details.data.service.ts | 2 +- .../vocabularies/vocabulary.data.service.ts | 2 +- .../submission/workflowitem-data.service.ts | 2 +- .../submission/workspaceitem-data.service.ts | 2 +- .../core/tasks/claimed-task-data.service.ts | 2 +- src/app/core/tasks/pool-task-data.service.ts | 2 +- .../eperson-group-list.component.ts | 2 +- .../resource-policy-target.resolver.ts | 2 +- 51 files changed, 155 insertions(+), 128 deletions(-) create mode 100644 src/app/core/data/base/data-service.decorator.spec.ts create mode 100644 src/app/core/data/base/data-service.decorator.ts diff --git a/src/app/core/browse/browse-definition-data.service.ts b/src/app/core/browse/browse-definition-data.service.ts index 3c9f6d6983..1c68885432 100644 --- a/src/app/core/browse/browse-definition-data.service.ts +++ b/src/app/core/browse/browse-definition-data.service.ts @@ -1,5 +1,4 @@ import { Injectable } from '@angular/core'; -import { dataService } from '../cache/builders/build-decorators'; import { BROWSE_DEFINITION } from '../shared/browse-definition.resource-type'; import { BrowseDefinition } from '../shared/browse-definition.model'; import { RequestService } from '../data/request.service'; @@ -13,6 +12,7 @@ import { PaginatedList } from '../data/paginated-list.model'; import { FindListOptions } from '../data/find-list-options.model'; import { IdentifiableDataService } from '../data/base/identifiable-data.service'; import { FindAllData, FindAllDataImpl } from '../data/base/find-all-data'; +import { dataService } from '../data/base/data-service.decorator'; @Injectable({ providedIn: 'root', diff --git a/src/app/core/cache/builders/build-decorators.spec.ts b/src/app/core/cache/builders/build-decorators.spec.ts index e397ca6516..150a07f006 100644 --- a/src/app/core/cache/builders/build-decorators.spec.ts +++ b/src/app/core/cache/builders/build-decorators.spec.ts @@ -1,23 +1,7 @@ -/* eslint-disable max-classes-per-file */ import { HALLink } from '../../shared/hal-link.model'; import { HALResource } from '../../shared/hal-resource.model'; import { ResourceType } from '../../shared/resource-type'; -import { dataService, getDataServiceFor, getLinkDefinition, link } from './build-decorators'; -import { HALDataService } from '../../data/base/hal-data-service.interface'; -import { BaseDataService } from '../../data/base/base-data.service'; - -class TestService extends BaseDataService { -} - -class AnotherTestService implements HALDataService { - public findAllByHref(href$, findListOptions, useCachedVersionIfAvailable, reRequestOnStale, ...linksToFollow): any { - return undefined; - } - - public findByHref(href$, useCachedVersionIfAvailable, reRequestOnStale, ...linksToFollow): any { - return undefined; - } -} +import { getLinkDefinition, link } from './build-decorators'; class TestHALResource implements HALResource { _links: { @@ -34,31 +18,6 @@ describe('build decorators', () => { beforeEach(() => { testType = new ResourceType('testType-' + new Date().getTime()); }); - describe('@dataService/getDataServiceFor', () => { - - it('should register a resourcetype for a dataservice', () => { - dataService(testType)(TestService); - expect(getDataServiceFor(testType)).toBe(TestService); - }); - - describe(`when the resource type isn't specified`, () => { - it(`should throw an error`, () => { - expect(() => { - dataService(undefined)(TestService); - }).toThrow(); - }); - }); - - describe(`when there already is a registered dataservice for a resourcetype`, () => { - it(`should throw an error`, () => { - dataService(testType)(TestService); - expect(() => { - dataService(testType)(AnotherTestService); - }).toThrow(); - }); - }); - - }); describe(`@link/getLinkDefinitions`, () => { it(`should register a link`, () => { diff --git a/src/app/core/cache/builders/build-decorators.ts b/src/app/core/cache/builders/build-decorators.ts index b421c927b3..9e5ebaed85 100644 --- a/src/app/core/cache/builders/build-decorators.ts +++ b/src/app/core/cache/builders/build-decorators.ts @@ -5,14 +5,8 @@ import { HALResource } from '../../shared/hal-resource.model'; import { ResourceType } from '../../shared/resource-type'; import { getResourceTypeValueFor } from '../object-cache.reducer'; import { InjectionToken } from '@angular/core'; -import { CacheableObject } from '../cacheable-object.model'; import { TypedObject } from '../typed-object.model'; -import { HALDataService } from '../../data/base/hal-data-service.interface'; -export const DATA_SERVICE_FACTORY = new InjectionToken<(resourceType: ResourceType) => GenericConstructor>>('getDataServiceFor', { - providedIn: 'root', - factory: () => getDataServiceFor, -}); export const LINK_DEFINITION_FACTORY = new InjectionToken<(source: GenericConstructor, linkName: keyof T['_links']) => LinkDefinition>('getLinkDefinition', { providedIn: 'root', factory: () => getLinkDefinition, @@ -26,7 +20,6 @@ const resolvedLinkKey = Symbol('resolvedLink'); const resolvedLinkMap = new Map(); const typeMap = new Map(); -const dataServiceMap = new Map(); const linkMap = new Map(); /** @@ -45,38 +38,6 @@ export function getClassForType(type: string | ResourceType) { return typeMap.get(getResourceTypeValueFor(type)); } -/** - * A class decorator to indicate that this class is a data service for a given HAL resource type. - * - * In most cases, a data service should extend {@link BaseDataService}. - * At the very least it must implement {@link HALDataService} in order for it to work with {@link LinkService}. - * - * @param resourceType the resource type the class is a dataservice for - */ -export function dataService(resourceType: ResourceType) { - return (target: GenericConstructor>): void => { - if (hasNoValue(resourceType)) { - throw new Error(`Invalid @dataService annotation on ${target}, resourceType needs to be defined`); - } - const existingDataservice = dataServiceMap.get(resourceType.value); - - if (hasValue(existingDataservice)) { - throw new Error(`Multiple dataservices for ${resourceType.value}: ${existingDataservice} and ${target}`); - } - - dataServiceMap.set(resourceType.value, target); - }; -} - -/** - * Return the dataservice matching the given resource type - * - * @param resourceType the resource type you want the matching dataservice for - */ -export function getDataServiceFor(resourceType: ResourceType): GenericConstructor> { - return dataServiceMap.get(resourceType.value); -} - /** * A class to represent the data that can be set by the @link decorator */ diff --git a/src/app/core/cache/builders/link.service.spec.ts b/src/app/core/cache/builders/link.service.spec.ts index 5e71a45053..ee44cfccb4 100644 --- a/src/app/core/cache/builders/link.service.spec.ts +++ b/src/app/core/cache/builders/link.service.spec.ts @@ -6,9 +6,10 @@ import { HALLink } from '../../shared/hal-link.model'; import { HALResource } from '../../shared/hal-resource.model'; import { ResourceType } from '../../shared/resource-type'; import { LinkService } from './link.service'; -import { DATA_SERVICE_FACTORY, LINK_DEFINITION_FACTORY, LINK_DEFINITION_MAP_FACTORY } from './build-decorators'; +import { LINK_DEFINITION_FACTORY, LINK_DEFINITION_MAP_FACTORY } from './build-decorators'; import { isEmpty } from 'rxjs/operators'; import { FindListOptions } from '../../data/find-list-options.model'; +import { DATA_SERVICE_FACTORY } from '../../data/base/data-service.decorator'; const TEST_MODEL = new ResourceType('testmodel'); let result: any; diff --git a/src/app/core/cache/builders/link.service.ts b/src/app/core/cache/builders/link.service.ts index 8d54d46d2d..a02f9841ad 100644 --- a/src/app/core/cache/builders/link.service.ts +++ b/src/app/core/cache/builders/link.service.ts @@ -3,8 +3,8 @@ import { hasNoValue, hasValue, isNotEmpty } from '../../../shared/empty.util'; import { FollowLinkConfig } from '../../../shared/utils/follow-link-config.model'; import { GenericConstructor } from '../../shared/generic-constructor'; import { HALResource } from '../../shared/hal-resource.model'; +import { DATA_SERVICE_FACTORY } from '../../data/base/data-service.decorator'; import { - DATA_SERVICE_FACTORY, LINK_DEFINITION_FACTORY, LINK_DEFINITION_MAP_FACTORY, LinkDefinition, diff --git a/src/app/core/config/submission-accesses-config.service.ts b/src/app/core/config/submission-accesses-config.service.ts index 4841e2e39d..3632bd0ead 100644 --- a/src/app/core/config/submission-accesses-config.service.ts +++ b/src/app/core/config/submission-accesses-config.service.ts @@ -3,7 +3,6 @@ import { ConfigService } from './config.service'; import { RequestService } from '../data/request.service'; import { HALEndpointService } from '../shared/hal-endpoint.service'; import { ObjectCacheService } from '../cache/object-cache.service'; -import { dataService } from '../cache/builders/build-decorators'; import { SUBMISSION_ACCESSES_TYPE } from './models/config-type'; import { RemoteDataBuildService } from '../cache/builders/remote-data-build.service'; import { Store } from '@ngrx/store'; @@ -16,6 +15,7 @@ import { RemoteData } from '../data/remote-data'; import { Observable } from 'rxjs'; import { FollowLinkConfig } from '../../shared/utils/follow-link-config.model'; import { CoreState } from '../core-state.model'; +import { dataService } from '../data/base/data-service.decorator'; /** * Provides methods to retrieve, from REST server, bitstream access conditions configurations applicable during the submission process. diff --git a/src/app/core/config/submission-forms-config.service.ts b/src/app/core/config/submission-forms-config.service.ts index abd3332cae..652f333247 100644 --- a/src/app/core/config/submission-forms-config.service.ts +++ b/src/app/core/config/submission-forms-config.service.ts @@ -6,12 +6,12 @@ import { HALEndpointService } from '../shared/hal-endpoint.service'; import { RemoteDataBuildService } from '../cache/builders/remote-data-build.service'; import { ObjectCacheService } from '../cache/object-cache.service'; import { ConfigObject } from './models/config.model'; -import { dataService } from '../cache/builders/build-decorators'; import { SUBMISSION_FORMS_TYPE } from './models/config-type'; import { SubmissionFormsModel } from './models/config-submission-forms.model'; import { RemoteData } from '../data/remote-data'; import { Observable } from 'rxjs'; import { FollowLinkConfig } from '../../shared/utils/follow-link-config.model'; +import { dataService } from '../data/base/data-service.decorator'; @Injectable() @dataService(SUBMISSION_FORMS_TYPE) diff --git a/src/app/core/config/submission-uploads-config.service.ts b/src/app/core/config/submission-uploads-config.service.ts index b166b895ac..bcb564d690 100644 --- a/src/app/core/config/submission-uploads-config.service.ts +++ b/src/app/core/config/submission-uploads-config.service.ts @@ -3,7 +3,6 @@ import { ConfigService } from './config.service'; import { RequestService } from '../data/request.service'; import { HALEndpointService } from '../shared/hal-endpoint.service'; import { ObjectCacheService } from '../cache/object-cache.service'; -import { dataService } from '../cache/builders/build-decorators'; import { SUBMISSION_UPLOADS_TYPE } from './models/config-type'; import { RemoteDataBuildService } from '../cache/builders/remote-data-build.service'; import { ConfigObject } from './models/config.model'; @@ -11,6 +10,7 @@ import { SubmissionUploadsModel } from './models/config-submission-uploads.model import { RemoteData } from '../data/remote-data'; import { Observable } from 'rxjs'; import { FollowLinkConfig } from '../../shared/utils/follow-link-config.model'; +import { dataService } from '../data/base/data-service.decorator'; /** * Provides methods to retrieve, from REST server, bitstream access conditions configurations applicable during the submission process. diff --git a/src/app/core/data/access-status-data.service.ts b/src/app/core/data/access-status-data.service.ts index 2b1dfd319a..aac9cc9136 100644 --- a/src/app/core/data/access-status-data.service.ts +++ b/src/app/core/data/access-status-data.service.ts @@ -1,5 +1,4 @@ import { Injectable } from '@angular/core'; -import { dataService } from '../cache/builders/build-decorators'; import { RemoteDataBuildService } from '../cache/builders/remote-data-build.service'; import { ObjectCacheService } from '../cache/object-cache.service'; import { HALEndpointService } from '../shared/hal-endpoint.service'; @@ -10,6 +9,7 @@ import { Observable } from 'rxjs'; import { RemoteData } from './remote-data'; import { Item } from '../shared/item.model'; import { BaseDataService } from './base/base-data.service'; +import { dataService } from './base/data-service.decorator'; @Injectable() @dataService(ACCESS_STATUS) diff --git a/src/app/core/data/base/data-service.decorator.spec.ts b/src/app/core/data/base/data-service.decorator.spec.ts new file mode 100644 index 0000000000..ec4c1c8f6f --- /dev/null +++ b/src/app/core/data/base/data-service.decorator.spec.ts @@ -0,0 +1,55 @@ +/* eslint-disable max-classes-per-file */ +/** + * The contents of this file are subject to the license and copyright + * detailed in the LICENSE and NOTICE files at the root of the source + * tree and available online at + * + * http://www.dspace.org/license/ + */ +import { ResourceType } from '../../shared/resource-type'; +import { BaseDataService } from './base-data.service'; +import { HALDataService } from './hal-data-service.interface'; +import { dataService, getDataServiceFor } from './data-service.decorator'; + +class TestService extends BaseDataService { +} + +class AnotherTestService implements HALDataService { + public findListByHref(href$, findListOptions, useCachedVersionIfAvailable, reRequestOnStale, ...linksToFollow): any { + return undefined; + } + + public findByHref(href$, useCachedVersionIfAvailable, reRequestOnStale, ...linksToFollow): any { + return undefined; + } +} + +let testType; + +describe('@dataService/getDataServiceFor', () => { + beforeEach(() => { + testType = new ResourceType('testType-' + new Date().getTime()); + }); + + it('should register a resourcetype for a dataservice', () => { + dataService(testType)(TestService); + expect(getDataServiceFor(testType)).toBe(TestService); + }); + + describe(`when the resource type isn't specified`, () => { + it(`should throw an error`, () => { + expect(() => { + dataService(undefined)(TestService); + }).toThrow(); + }); + }); + + describe(`when there already is a registered dataservice for a resourcetype`, () => { + it(`should throw an error`, () => { + dataService(testType)(TestService); + expect(() => { + dataService(testType)(AnotherTestService); + }).toThrow(); + }); + }); +}); diff --git a/src/app/core/data/base/data-service.decorator.ts b/src/app/core/data/base/data-service.decorator.ts new file mode 100644 index 0000000000..fbde9bd94f --- /dev/null +++ b/src/app/core/data/base/data-service.decorator.ts @@ -0,0 +1,51 @@ +/** + * The contents of this file are subject to the license and copyright + * detailed in the LICENSE and NOTICE files at the root of the source + * tree and available online at + * + * http://www.dspace.org/license/ + */ +import { InjectionToken } from '@angular/core'; +import { CacheableObject } from '../../cache/cacheable-object.model'; +import { ResourceType } from '../../shared/resource-type'; +import { GenericConstructor } from '../../shared/generic-constructor'; +import { hasNoValue, hasValue } from '../../../shared/empty.util'; +import { HALDataService } from './hal-data-service.interface'; + +export const DATA_SERVICE_FACTORY = new InjectionToken<(resourceType: ResourceType) => GenericConstructor>>('getDataServiceFor', { + providedIn: 'root', + factory: () => getDataServiceFor, +}); +const dataServiceMap = new Map(); + +/** + * A class decorator to indicate that this class is a data service for a given HAL resource type. + * + * In most cases, a data service should extend {@link BaseDataService}. + * At the very least it must implement {@link HALDataService} in order for it to work with {@link LinkService}. + * + * @param resourceType the resource type the class is a dataservice for + */ +export function dataService(resourceType: ResourceType) { + return (target: GenericConstructor>): void => { + if (hasNoValue(resourceType)) { + throw new Error(`Invalid @dataService annotation on ${target}, resourceType needs to be defined`); + } + const existingDataservice = dataServiceMap.get(resourceType.value); + + if (hasValue(existingDataservice)) { + throw new Error(`Multiple dataservices for ${resourceType.value}: ${existingDataservice} and ${target}`); + } + + dataServiceMap.set(resourceType.value, target); + }; +} + +/** + * Return the dataservice matching the given resource type + * + * @param resourceType the resource type you want the matching dataservice for + */ +export function getDataServiceFor(resourceType: ResourceType): GenericConstructor> { + return dataServiceMap.get(resourceType.value); +} diff --git a/src/app/core/data/bitstream-data.service.ts b/src/app/core/data/bitstream-data.service.ts index ab0a4c301c..6952f50214 100644 --- a/src/app/core/data/bitstream-data.service.ts +++ b/src/app/core/data/bitstream-data.service.ts @@ -4,7 +4,6 @@ import { combineLatest as observableCombineLatest, Observable } from 'rxjs'; import { map, switchMap, take } from 'rxjs/operators'; import { hasValue } from '../../shared/empty.util'; import { FollowLinkConfig } from '../../shared/utils/follow-link-config.model'; -import { dataService } from '../cache/builders/build-decorators'; import { RemoteDataBuildService } from '../cache/builders/remote-data-build.service'; import { ObjectCacheService } from '../cache/object-cache.service'; import { Bitstream } from '../shared/bitstream.model'; @@ -33,6 +32,7 @@ import { DeleteData, DeleteDataImpl } from './base/delete-data'; import { NotificationsService } from '../../shared/notifications/notifications.service'; import { NoContent } from '../shared/NoContent.model'; import { IdentifiableDataService } from './base/identifiable-data.service'; +import { dataService } from './base/data-service.decorator'; /** * A service to retrieve {@link Bitstream}s from the REST API diff --git a/src/app/core/data/bitstream-format-data.service.ts b/src/app/core/data/bitstream-format-data.service.ts index 72d14fbf68..0104389815 100644 --- a/src/app/core/data/bitstream-format-data.service.ts +++ b/src/app/core/data/bitstream-format-data.service.ts @@ -5,7 +5,6 @@ import { distinctUntilChanged, map, tap } from 'rxjs/operators'; import { BitstreamFormatsRegistryDeselectAction, BitstreamFormatsRegistryDeselectAllAction, BitstreamFormatsRegistrySelectAction } from '../../admin/admin-registries/bitstream-formats/bitstream-format.actions'; import { BitstreamFormatRegistryState } from '../../admin/admin-registries/bitstream-formats/bitstream-format.reducers'; import { NotificationsService } from '../../shared/notifications/notifications.service'; -import { dataService } from '../cache/builders/build-decorators'; import { RemoteDataBuildService } from '../cache/builders/remote-data-build.service'; import { ObjectCacheService } from '../cache/object-cache.service'; import { coreSelector } from '../core.selectors'; @@ -25,6 +24,7 @@ import { FollowLinkConfig } from 'src/app/shared/utils/follow-link-config.model' import { FindListOptions } from './find-list-options.model'; import { PaginatedList } from './paginated-list.model'; import { NoContent } from '../shared/NoContent.model'; +import { dataService } from './base/data-service.decorator'; const bitstreamFormatsStateSelector = createSelector( coreSelector, diff --git a/src/app/core/data/bundle-data.service.ts b/src/app/core/data/bundle-data.service.ts index bc559b4b65..77df37c510 100644 --- a/src/app/core/data/bundle-data.service.ts +++ b/src/app/core/data/bundle-data.service.ts @@ -3,7 +3,6 @@ import { Observable } from 'rxjs'; import { map, switchMap, take } from 'rxjs/operators'; import { hasValue } from '../../shared/empty.util'; import { FollowLinkConfig } from '../../shared/utils/follow-link-config.model'; -import { dataService } from '../cache/builders/build-decorators'; import { RemoteDataBuildService } from '../cache/builders/remote-data-build.service'; import { ObjectCacheService } from '../cache/object-cache.service'; import { Bundle } from '../shared/bundle.model'; @@ -23,6 +22,7 @@ import { PatchData, PatchDataImpl } from './base/patch-data'; import { DSOChangeAnalyzer } from './dso-change-analyzer.service'; import { RestRequestMethod } from './rest-request-method'; import { Operation } from 'fast-json-patch'; +import { dataService } from './base/data-service.decorator'; /** * A service to retrieve {@link Bundle}s from the REST API diff --git a/src/app/core/data/collection-data.service.ts b/src/app/core/data/collection-data.service.ts index c9ebc0e74f..36791520a9 100644 --- a/src/app/core/data/collection-data.service.ts +++ b/src/app/core/data/collection-data.service.ts @@ -8,7 +8,6 @@ import { NotificationOptions } from '../../shared/notifications/models/notificat import { INotification } from '../../shared/notifications/models/notification.model'; import { NotificationsService } from '../../shared/notifications/notifications.service'; import { FollowLinkConfig } from '../../shared/utils/follow-link-config.model'; -import { dataService } from '../cache/builders/build-decorators'; import { RemoteDataBuildService } from '../cache/builders/remote-data-build.service'; import { RequestParam } from '../cache/models/request-param.model'; import { ObjectCacheService } from '../cache/object-cache.service'; @@ -34,6 +33,7 @@ import { BitstreamDataService } from './bitstream-data.service'; import { RestRequest } from './rest-request.model'; import { FindListOptions } from './find-list-options.model'; import { Community } from '../shared/community.model'; +import { dataService } from './base/data-service.decorator'; @Injectable() @dataService(COLLECTION) diff --git a/src/app/core/data/community-data.service.ts b/src/app/core/data/community-data.service.ts index 3062b15b1e..e40ad06ddb 100644 --- a/src/app/core/data/community-data.service.ts +++ b/src/app/core/data/community-data.service.ts @@ -3,7 +3,6 @@ import { Injectable } from '@angular/core'; import { Observable } from 'rxjs'; import { filter, map, switchMap, take } from 'rxjs/operators'; import { NotificationsService } from '../../shared/notifications/notifications.service'; -import { dataService } from '../cache/builders/build-decorators'; import { RemoteDataBuildService } from '../cache/builders/remote-data-build.service'; import { ObjectCacheService } from '../cache/object-cache.service'; import { Community } from '../shared/community.model'; @@ -18,6 +17,7 @@ import { BitstreamDataService } from './bitstream-data.service'; import { FollowLinkConfig } from '../../shared/utils/follow-link-config.model'; import { isNotEmpty } from '../../shared/empty.util'; import { FindListOptions } from './find-list-options.model'; +import { dataService } from './base/data-service.decorator'; @Injectable() @dataService(COMMUNITY) diff --git a/src/app/core/data/configuration-data.service.ts b/src/app/core/data/configuration-data.service.ts index ed62ee4933..de044e25e3 100644 --- a/src/app/core/data/configuration-data.service.ts +++ b/src/app/core/data/configuration-data.service.ts @@ -1,7 +1,6 @@ /* eslint-disable max-classes-per-file */ import { Injectable } from '@angular/core'; import { Observable } from 'rxjs'; -import { dataService } from '../cache/builders/build-decorators'; import { RemoteDataBuildService } from '../cache/builders/remote-data-build.service'; import { ObjectCacheService } from '../cache/object-cache.service'; import { HALEndpointService } from '../shared/hal-endpoint.service'; @@ -10,6 +9,7 @@ import { RequestService } from './request.service'; import { ConfigurationProperty } from '../shared/configuration-property.model'; import { CONFIG_PROPERTY } from '../shared/config-property.resource-type'; import { IdentifiableDataService } from './base/identifiable-data.service'; +import { dataService } from './base/data-service.decorator'; @Injectable() @dataService(CONFIG_PROPERTY) diff --git a/src/app/core/data/dspace-object-data.service.ts b/src/app/core/data/dspace-object-data.service.ts index 7ab29506aa..2ad024133c 100644 --- a/src/app/core/data/dspace-object-data.service.ts +++ b/src/app/core/data/dspace-object-data.service.ts @@ -1,5 +1,4 @@ import { Injectable } from '@angular/core'; -import { dataService } from '../cache/builders/build-decorators'; import { RemoteDataBuildService } from '../cache/builders/remote-data-build.service'; import { ObjectCacheService } from '../cache/object-cache.service'; import { DSpaceObject } from '../shared/dspace-object.model'; @@ -7,6 +6,7 @@ import { DSPACE_OBJECT } from '../shared/dspace-object.resource-type'; import { HALEndpointService } from '../shared/hal-endpoint.service'; import { RequestService } from './request.service'; import { IdentifiableDataService } from './base/identifiable-data.service'; +import { dataService } from './base/data-service.decorator'; @Injectable() @dataService(DSPACE_OBJECT) diff --git a/src/app/core/data/feature-authorization/authorization-data.service.ts b/src/app/core/data/feature-authorization/authorization-data.service.ts index 85df98f399..a9aded4bfe 100644 --- a/src/app/core/data/feature-authorization/authorization-data.service.ts +++ b/src/app/core/data/feature-authorization/authorization-data.service.ts @@ -1,7 +1,6 @@ import { Observable, of as observableOf } from 'rxjs'; import { Injectable } from '@angular/core'; import { AUTHORIZATION } from '../../shared/authorization.resource-type'; -import { dataService } from '../../cache/builders/build-decorators'; import { Authorization } from '../../shared/authorization.model'; import { RequestService } from '../request.service'; import { RemoteDataBuildService } from '../../cache/builders/remote-data-build.service'; @@ -21,6 +20,7 @@ import { getFirstCompletedRemoteData } from '../../shared/operators'; import { FindListOptions } from '../find-list-options.model'; import { BaseDataService } from '../base/base-data.service'; import { SearchData, SearchDataImpl } from '../base/search-data'; +import { dataService } from '../base/data-service.decorator'; /** * A service to retrieve {@link Authorization}s from the REST API diff --git a/src/app/core/data/feature-authorization/feature-data.service.ts b/src/app/core/data/feature-authorization/feature-data.service.ts index bed6cd114d..eda8791153 100644 --- a/src/app/core/data/feature-authorization/feature-data.service.ts +++ b/src/app/core/data/feature-authorization/feature-data.service.ts @@ -1,12 +1,12 @@ import { Injectable } from '@angular/core'; import { FEATURE } from '../../shared/feature.resource-type'; -import { dataService } from '../../cache/builders/build-decorators'; import { Feature } from '../../shared/feature.model'; import { RequestService } from '../request.service'; import { RemoteDataBuildService } from '../../cache/builders/remote-data-build.service'; import { ObjectCacheService } from '../../cache/object-cache.service'; import { HALEndpointService } from '../../shared/hal-endpoint.service'; import { BaseDataService } from '../base/base-data.service'; +import { dataService } from '../base/data-service.decorator'; /** * A service to retrieve {@link Feature}s from the REST API diff --git a/src/app/core/data/href-only-data.service.ts b/src/app/core/data/href-only-data.service.ts index 9a36dcc128..b234d5d85a 100644 --- a/src/app/core/data/href-only-data.service.ts +++ b/src/app/core/data/href-only-data.service.ts @@ -5,7 +5,6 @@ import { HALEndpointService } from '../shared/hal-endpoint.service'; import { Injectable } from '@angular/core'; import { VOCABULARY_ENTRY } from '../submission/vocabularies/models/vocabularies.resource-type'; import { FollowLinkConfig } from '../../shared/utils/follow-link-config.model'; -import { dataService } from '../cache/builders/build-decorators'; import { RemoteData } from './remote-data'; import { Observable } from 'rxjs'; import { PaginatedList } from './paginated-list.model'; @@ -15,6 +14,7 @@ import { CacheableObject } from '../cache/cacheable-object.model'; import { FindListOptions } from './find-list-options.model'; import { BaseDataService } from './base/base-data.service'; import { HALDataService } from './base/hal-data-service.interface'; +import { dataService } from './base/data-service.decorator'; /** * A DataService with only findByHref methods. Its purpose is to be used for resources that don't diff --git a/src/app/core/data/item-data.service.ts b/src/app/core/data/item-data.service.ts index ecc9e0e502..11179d1e77 100644 --- a/src/app/core/data/item-data.service.ts +++ b/src/app/core/data/item-data.service.ts @@ -13,7 +13,6 @@ import { distinctUntilChanged, filter, find, map, switchMap, take } from 'rxjs/o import { hasValue, isNotEmpty, isNotEmptyOperator } from '../../shared/empty.util'; import { NotificationsService } from '../../shared/notifications/notifications.service'; import { BrowseService } from '../browse/browse.service'; -import { dataService } from '../cache/builders/build-decorators'; import { RemoteDataBuildService } from '../cache/builders/remote-data-build.service'; import { ObjectCacheService } from '../cache/object-cache.service'; import { HttpOptions } from '../dspace-rest/dspace-rest.service'; @@ -46,6 +45,7 @@ import { DeleteData, DeleteDataImpl } from './base/delete-data'; import { RestRequestMethod } from './rest-request-method'; import { CreateData, CreateDataImpl } from './base/create-data'; import { RequestParam } from '../cache/models/request-param.model'; +import { dataService } from './base/data-service.decorator'; /** * An abstract service for CRUD operations on Items diff --git a/src/app/core/data/metadata-field-data.service.ts b/src/app/core/data/metadata-field-data.service.ts index e54ccb71c3..db9361ee4c 100644 --- a/src/app/core/data/metadata-field-data.service.ts +++ b/src/app/core/data/metadata-field-data.service.ts @@ -1,6 +1,5 @@ import { Injectable } from '@angular/core'; import { hasValue } from '../../shared/empty.util'; -import { dataService } from '../cache/builders/build-decorators'; import { PaginatedList } from './paginated-list.model'; import { RemoteData } from './remote-data'; import { RequestService } from './request.service'; @@ -22,6 +21,7 @@ import { NotificationsService } from '../../shared/notifications/notifications.s import { ObjectCacheService } from '../cache/object-cache.service'; import { DeleteData, DeleteDataImpl } from './base/delete-data'; import { IdentifiableDataService } from './base/identifiable-data.service'; +import { dataService } from './base/data-service.decorator'; /** * A service responsible for fetching/sending data from/to the REST API on the metadatafields endpoint diff --git a/src/app/core/data/metadata-schema-data.service.ts b/src/app/core/data/metadata-schema-data.service.ts index 97f806d237..6bd633b8c6 100644 --- a/src/app/core/data/metadata-schema-data.service.ts +++ b/src/app/core/data/metadata-schema-data.service.ts @@ -1,6 +1,5 @@ import { Injectable } from '@angular/core'; import { NotificationsService } from '../../shared/notifications/notifications.service'; -import { dataService } from '../cache/builders/build-decorators'; import { RemoteDataBuildService } from '../cache/builders/remote-data-build.service'; import { ObjectCacheService } from '../cache/object-cache.service'; import { MetadataSchema } from '../metadata/metadata-schema.model'; @@ -20,6 +19,7 @@ import { FollowLinkConfig } from '../../shared/utils/follow-link-config.model'; import { PaginatedList } from './paginated-list.model'; import { IdentifiableDataService } from './base/identifiable-data.service'; import { DeleteData, DeleteDataImpl } from './base/delete-data'; +import { dataService } from './base/data-service.decorator'; /** * A service responsible for fetching/sending data from/to the REST API on the metadataschemas endpoint diff --git a/src/app/core/data/processes/process-data.service.ts b/src/app/core/data/processes/process-data.service.ts index 0168ded7c9..0a276cd7f2 100644 --- a/src/app/core/data/processes/process-data.service.ts +++ b/src/app/core/data/processes/process-data.service.ts @@ -4,7 +4,6 @@ import { RemoteDataBuildService } from '../../cache/builders/remote-data-build.s import { ObjectCacheService } from '../../cache/object-cache.service'; import { HALEndpointService } from '../../shared/hal-endpoint.service'; import { Process } from '../../../process-page/processes/process.model'; -import { dataService } from '../../cache/builders/build-decorators'; import { PROCESS } from '../../../process-page/processes/process.resource-type'; import { Observable } from 'rxjs'; import { switchMap } from 'rxjs/operators'; @@ -16,6 +15,7 @@ import { IdentifiableDataService } from '../base/identifiable-data.service'; import { FollowLinkConfig } from '../../../shared/utils/follow-link-config.model'; import { FindAllData, FindAllDataImpl } from '../base/find-all-data'; import { FindListOptions } from '../find-list-options.model'; +import { dataService } from '../base/data-service.decorator'; @Injectable() @dataService(PROCESS) diff --git a/src/app/core/data/processes/script-data.service.ts b/src/app/core/data/processes/script-data.service.ts index a05599c36c..ed228612ef 100644 --- a/src/app/core/data/processes/script-data.service.ts +++ b/src/app/core/data/processes/script-data.service.ts @@ -10,7 +10,6 @@ import { RemoteData } from '../remote-data'; import { MultipartPostRequest } from '../request.models'; import { RequestService } from '../request.service'; import { Observable } from 'rxjs'; -import { dataService } from '../../cache/builders/build-decorators'; import { SCRIPT } from '../../../process-page/scripts/script.resource-type'; import { Process } from '../../../process-page/processes/process.model'; import { hasValue } from '../../../shared/empty.util'; @@ -21,6 +20,7 @@ import { FindAllData, FindAllDataImpl } from '../base/find-all-data'; import { FindListOptions } from '../find-list-options.model'; import { FollowLinkConfig } from '../../../shared/utils/follow-link-config.model'; import { PaginatedList } from '../paginated-list.model'; +import { dataService } from '../base/data-service.decorator'; export const METADATA_IMPORT_SCRIPT_NAME = 'metadata-import'; export const METADATA_EXPORT_SCRIPT_NAME = 'metadata-export'; diff --git a/src/app/core/data/relationship-type.service.ts b/src/app/core/data/relationship-type.service.ts index e3b01c3024..20f1bca9bc 100644 --- a/src/app/core/data/relationship-type.service.ts +++ b/src/app/core/data/relationship-type.service.ts @@ -3,7 +3,6 @@ import { combineLatest as observableCombineLatest, Observable } from 'rxjs'; import { map, mergeMap, switchMap, toArray } from 'rxjs/operators'; import { hasValue } from '../../shared/empty.util'; import { followLink, FollowLinkConfig } from '../../shared/utils/follow-link-config.model'; -import { dataService } from '../cache/builders/build-decorators'; import { RemoteDataBuildService } from '../cache/builders/remote-data-build.service'; import { HALEndpointService } from '../shared/hal-endpoint.service'; import { ItemType } from '../shared/item-relationships/item-type.model'; @@ -17,6 +16,7 @@ import { BaseDataService } from './base/base-data.service'; import { FindAllDataImpl } from './base/find-all-data'; import { SearchDataImpl } from './base/search-data'; import { ObjectCacheService } from '../cache/object-cache.service'; +import { dataService } from './base/data-service.decorator'; /** * Check if one side of a RelationshipType is the ItemType with the given label diff --git a/src/app/core/data/relationship.service.ts b/src/app/core/data/relationship.service.ts index 8773b61473..50c84912f6 100644 --- a/src/app/core/data/relationship.service.ts +++ b/src/app/core/data/relationship.service.ts @@ -16,7 +16,6 @@ import { } from '../../shared/form/builder/ds-dynamic-form-ui/relation-lookup-modal/name-variant.actions'; import { NameVariantListState } from '../../shared/form/builder/ds-dynamic-form-ui/relation-lookup-modal/name-variant.reducer'; import { followLink, FollowLinkConfig } from '../../shared/utils/follow-link-config.model'; -import { dataService } from '../cache/builders/build-decorators'; import { RemoteDataBuildService } from '../cache/builders/remote-data-build.service'; import { RequestParam } from '../cache/models/request-param.model'; import { ObjectCacheService } from '../cache/object-cache.service'; @@ -45,6 +44,7 @@ import { FindListOptions } from './find-list-options.model'; import { SearchData, SearchDataImpl } from './base/search-data'; import { PutData, PutDataImpl } from './base/put-data'; import { IdentifiableDataService } from './base/identifiable-data.service'; +import { dataService } from './base/data-service.decorator'; const relationshipListsStateSelector = (state: AppState) => state.relationshipLists; diff --git a/src/app/core/data/root-data.service.ts b/src/app/core/data/root-data.service.ts index 4fbef3e556..54fe614d3e 100644 --- a/src/app/core/data/root-data.service.ts +++ b/src/app/core/data/root-data.service.ts @@ -1,7 +1,6 @@ import { Root } from './root.model'; import { Injectable } from '@angular/core'; import { ROOT } from './root.resource-type'; -import { dataService } from '../cache/builders/build-decorators'; import { RequestService } from './request.service'; import { RemoteDataBuildService } from '../cache/builders/remote-data-build.service'; import { HALEndpointService } from '../shared/hal-endpoint.service'; @@ -13,6 +12,7 @@ import { RawRestResponse } from '../dspace-rest/raw-rest-response.model'; import { catchError, map } from 'rxjs/operators'; import { BaseDataService } from './base/base-data.service'; import { ObjectCacheService } from '../cache/object-cache.service'; +import { dataService } from './base/data-service.decorator'; /** * A service to retrieve the {@link Root} object from the REST API. diff --git a/src/app/core/data/site-data.service.ts b/src/app/core/data/site-data.service.ts index 4b61cc5d9d..c2c4ffa466 100644 --- a/src/app/core/data/site-data.service.ts +++ b/src/app/core/data/site-data.service.ts @@ -1,7 +1,6 @@ import { Injectable } from '@angular/core'; import { Observable } from 'rxjs'; import { map } from 'rxjs/operators'; -import { dataService } from '../cache/builders/build-decorators'; import { RemoteDataBuildService } from '../cache/builders/remote-data-build.service'; import { HALEndpointService } from '../shared/hal-endpoint.service'; import { getFirstSucceededRemoteData } from '../shared/operators'; @@ -15,6 +14,7 @@ import { FindAllData, FindAllDataImpl } from './base/find-all-data'; import { FollowLinkConfig } from 'src/app/shared/utils/follow-link-config.model'; import { FindListOptions } from './find-list-options.model'; import { ObjectCacheService } from '../cache/object-cache.service'; +import { dataService } from './base/data-service.decorator'; /** * Service responsible for handling requests related to the Site object diff --git a/src/app/core/data/version-data.service.ts b/src/app/core/data/version-data.service.ts index 0c677a5541..ee7bdb2028 100644 --- a/src/app/core/data/version-data.service.ts +++ b/src/app/core/data/version-data.service.ts @@ -5,7 +5,6 @@ import { RemoteDataBuildService } from '../cache/builders/remote-data-build.serv import { ObjectCacheService } from '../cache/object-cache.service'; import { HALEndpointService } from '../shared/hal-endpoint.service'; import { EMPTY, Observable } from 'rxjs'; -import { dataService } from '../cache/builders/build-decorators'; import { VERSION } from '../shared/version.resource-type'; import { VersionHistory } from '../shared/version-history.model'; import { followLink } from '../../shared/utils/follow-link-config.model'; @@ -17,6 +16,7 @@ import { PatchData, PatchDataImpl } from './base/patch-data'; import { RestRequestMethod } from './rest-request-method'; import { DefaultChangeAnalyzer } from './default-change-analyzer.service'; import { IdentifiableDataService } from './base/identifiable-data.service'; +import { dataService } from './base/data-service.decorator'; /** * Service responsible for handling requests related to the Version object diff --git a/src/app/core/data/version-history-data.service.ts b/src/app/core/data/version-history-data.service.ts index 4c6891d5ea..75bc1a4b14 100644 --- a/src/app/core/data/version-history-data.service.ts +++ b/src/app/core/data/version-history-data.service.ts @@ -12,7 +12,6 @@ import { RemoteData } from './remote-data'; import { PaginatedList } from './paginated-list.model'; import { Version } from '../shared/version.model'; import { filter, map, switchMap, take } from 'rxjs/operators'; -import { dataService } from '../cache/builders/build-decorators'; import { VERSION_HISTORY } from '../shared/version-history.resource-type'; import { followLink, FollowLinkConfig } from '../../shared/utils/follow-link-config.model'; import { VersionDataService } from './version-data.service'; @@ -25,6 +24,7 @@ import { FindListOptions } from './find-list-options.model'; import { sendRequest } from '../shared/request.operators'; import { RestRequest } from './rest-request.model'; import { IdentifiableDataService } from './base/identifiable-data.service'; +import { dataService } from './base/data-service.decorator'; /** * Service responsible for handling requests related to the VersionHistory object diff --git a/src/app/core/data/workflow-action-data.service.ts b/src/app/core/data/workflow-action-data.service.ts index a89e997474..b2c4f0bd7b 100644 --- a/src/app/core/data/workflow-action-data.service.ts +++ b/src/app/core/data/workflow-action-data.service.ts @@ -4,9 +4,9 @@ import { RemoteDataBuildService } from '../cache/builders/remote-data-build.serv import { ObjectCacheService } from '../cache/object-cache.service'; import { HALEndpointService } from '../shared/hal-endpoint.service'; import { Injectable } from '@angular/core'; -import { dataService } from '../cache/builders/build-decorators'; import { WORKFLOW_ACTION } from '../tasks/models/workflow-action-object.resource-type'; import { BaseDataService } from './base/base-data.service'; +import { dataService } from './base/data-service.decorator'; /** * A service responsible for fetching/sending data from/to the REST API on the workflowactions endpoint diff --git a/src/app/core/eperson/eperson-data.service.ts b/src/app/core/eperson/eperson-data.service.ts index 2c2d52b258..2313d2b20e 100644 --- a/src/app/core/eperson/eperson-data.service.ts +++ b/src/app/core/eperson/eperson-data.service.ts @@ -9,7 +9,6 @@ import { AppState } from '../../app.reducer'; import { hasNoValue, hasValue } from '../../shared/empty.util'; import { NotificationsService } from '../../shared/notifications/notifications.service'; import { FollowLinkConfig } from '../../shared/utils/follow-link-config.model'; -import { dataService } from '../cache/builders/build-decorators'; import { RemoteDataBuildService } from '../cache/builders/remote-data-build.service'; import { RequestParam } from '../cache/models/request-param.model'; import { ObjectCacheService } from '../cache/object-cache.service'; @@ -31,6 +30,7 @@ import { SearchData, SearchDataImpl } from '../data/base/search-data'; import { PatchData, PatchDataImpl } from '../data/base/patch-data'; import { DeleteData, DeleteDataImpl } from '../data/base/delete-data'; import { RestRequestMethod } from '../data/rest-request-method'; +import { dataService } from '../data/base/data-service.decorator'; const ePeopleRegistryStateSelector = (state: AppState) => state.epeopleRegistry; const editEPersonSelector = createSelector(ePeopleRegistryStateSelector, (ePeopleRegistryState: EPeopleRegistryState) => ePeopleRegistryState.editEPerson); diff --git a/src/app/core/eperson/group-data.service.ts b/src/app/core/eperson/group-data.service.ts index 615132dca1..6e6d1fbb9b 100644 --- a/src/app/core/eperson/group-data.service.ts +++ b/src/app/core/eperson/group-data.service.ts @@ -26,7 +26,6 @@ import { HALEndpointService } from '../shared/hal-endpoint.service'; import { getFirstCompletedRemoteData } from '../shared/operators'; import { EPerson } from './models/eperson.model'; import { Group } from './models/group.model'; -import { dataService } from '../cache/builders/build-decorators'; import { GROUP } from './models/group.resource-type'; import { DSONameService } from '../breadcrumbs/dso-name.service'; import { Community } from '../shared/community.model'; @@ -40,6 +39,7 @@ import { PatchData, PatchDataImpl } from '../data/base/patch-data'; import { DeleteData, DeleteDataImpl } from '../data/base/delete-data'; import { Operation } from 'fast-json-patch'; import { RestRequestMethod } from '../data/rest-request-method'; +import { dataService } from '../data/base/data-service.decorator'; const groupRegistryStateSelector = (state: AppState) => state.groupRegistry; const editGroupSelector = createSelector(groupRegistryStateSelector, (groupRegistryState: GroupRegistryState) => groupRegistryState.editGroup); diff --git a/src/app/core/feedback/feedback-data.service.ts b/src/app/core/feedback/feedback-data.service.ts index bc8a44b6f5..3cc7df7653 100644 --- a/src/app/core/feedback/feedback-data.service.ts +++ b/src/app/core/feedback/feedback-data.service.ts @@ -2,7 +2,6 @@ import { Injectable } from '@angular/core'; import { Observable } from 'rxjs'; import { Feedback } from './models/feedback.model'; import { FEEDBACK } from './models/feedback.resource-type'; -import { dataService } from '../cache/builders/build-decorators'; import { RequestService } from '../data/request.service'; import { RemoteDataBuildService } from '../cache/builders/remote-data-build.service'; import { Store } from '@ngrx/store'; @@ -14,6 +13,7 @@ import { IdentifiableDataService } from '../data/base/identifiable-data.service' import { RemoteData } from '../data/remote-data'; import { RequestParam } from '../cache/models/request-param.model'; import { CreateData, CreateDataImpl } from '../data/base/create-data'; +import { dataService } from '../data/base/data-service.decorator'; /** * Service for checking and managing the feedback diff --git a/src/app/core/orcid/orcid-history-data.service.ts b/src/app/core/orcid/orcid-history-data.service.ts index 9abcbac63b..f06a270a44 100644 --- a/src/app/core/orcid/orcid-history-data.service.ts +++ b/src/app/core/orcid/orcid-history-data.service.ts @@ -2,7 +2,6 @@ import { HttpHeaders } from '@angular/common/http'; import { Injectable } from '@angular/core'; import { Observable } from 'rxjs'; import { map, switchMap } from 'rxjs/operators'; -import { dataService } from '../cache/builders/build-decorators'; import { RemoteDataBuildService } from '../cache/builders/remote-data-build.service'; import { ObjectCacheService } from '../cache/object-cache.service'; import { RemoteData } from '../data/remote-data'; @@ -16,6 +15,7 @@ import { HttpOptions } from '../dspace-rest/dspace-rest.service'; import { RestRequest } from '../data/rest-request.model'; import { sendRequest } from '../shared/request.operators'; import { IdentifiableDataService } from '../data/base/identifiable-data.service'; +import { dataService } from '../data/base/data-service.decorator'; /** * A service that provides methods to make REST requests with Orcid History endpoint. diff --git a/src/app/core/orcid/orcid-queue.service.ts b/src/app/core/orcid/orcid-queue.service.ts index 9b3f47747d..db61514b82 100644 --- a/src/app/core/orcid/orcid-queue.service.ts +++ b/src/app/core/orcid/orcid-queue.service.ts @@ -5,7 +5,6 @@ import { ObjectCacheService } from '../cache/object-cache.service'; import { HALEndpointService } from '../shared/hal-endpoint.service'; import { NotificationsService } from '../../shared/notifications/notifications.service'; import { Injectable } from '@angular/core'; -import { dataService } from '../cache/builders/build-decorators'; import { ORCID_QUEUE } from './model/orcid-queue.resource-type'; import { Observable } from 'rxjs'; import { RemoteData } from '../data/remote-data'; @@ -16,6 +15,7 @@ import { NoContent } from '../shared/NoContent.model'; import { DeleteData, DeleteDataImpl } from '../data/base/delete-data'; import { SearchData, SearchDataImpl } from '../data/base/search-data'; import { IdentifiableDataService } from '../data/base/identifiable-data.service'; +import { dataService } from '../data/base/data-service.decorator'; /** * A service that provides methods to make REST requests with Orcid Queue endpoint. diff --git a/src/app/core/profile/researcher-profile.service.ts b/src/app/core/profile/researcher-profile.service.ts index 2f9e7b3d18..1331a88bed 100644 --- a/src/app/core/profile/researcher-profile.service.ts +++ b/src/app/core/profile/researcher-profile.service.ts @@ -6,7 +6,6 @@ import { Operation, ReplaceOperation } from 'fast-json-patch'; import { Observable } from 'rxjs'; import { find, map } from 'rxjs/operators'; import { NotificationsService } from '../../shared/notifications/notifications.service'; -import { dataService } from '../cache/builders/build-decorators'; import { RemoteDataBuildService } from '../cache/builders/remote-data-build.service'; import { ObjectCacheService } from '../cache/object-cache.service'; import { DefaultChangeAnalyzer } from '../data/default-change-analyzer.service'; @@ -33,6 +32,7 @@ import { RestRequestMethod } from '../data/rest-request-method'; import { RequestParam } from '../cache/models/request-param.model'; import { FindListOptions } from '../data/find-list-options.model'; import { PaginatedList } from '../data/paginated-list.model'; +import { dataService } from '../data/base/data-service.decorator'; /** * A service that provides methods to make REST requests with researcher profile endpoint. diff --git a/src/app/core/resource-policy/resource-policy.service.ts b/src/app/core/resource-policy/resource-policy.service.ts index 2f5fb96c41..ac5236dd4e 100644 --- a/src/app/core/resource-policy/resource-policy.service.ts +++ b/src/app/core/resource-policy/resource-policy.service.ts @@ -2,7 +2,6 @@ import { Injectable } from '@angular/core'; import { HttpHeaders } from '@angular/common/http'; import { Observable } from 'rxjs'; import { FollowLinkConfig } from '../../shared/utils/follow-link-config.model'; -import { dataService } from '../cache/builders/build-decorators'; import { RequestService } from '../data/request.service'; import { Collection } from '../shared/collection.model'; import { HALEndpointService } from '../shared/hal-endpoint.service'; @@ -34,6 +33,7 @@ import { CreateDataImpl } from '../data/base/create-data'; import { SearchDataImpl } from '../data/base/search-data'; import { PatchDataImpl } from '../data/base/patch-data'; import { DeleteDataImpl } from '../data/base/delete-data'; +import { dataService } from '../data/base/data-service.decorator'; /** * A service responsible for fetching/sending data from/to the REST API on the resourcepolicies endpoint diff --git a/src/app/core/statistics/usage-report-data.service.ts b/src/app/core/statistics/usage-report-data.service.ts index 7511264de8..d2f3bef2fc 100644 --- a/src/app/core/statistics/usage-report-data.service.ts +++ b/src/app/core/statistics/usage-report-data.service.ts @@ -1,5 +1,4 @@ import { Injectable } from '@angular/core'; -import { dataService } from '../cache/builders/build-decorators'; import { RemoteDataBuildService } from '../cache/builders/remote-data-build.service'; import { ObjectCacheService } from '../cache/object-cache.service'; import { HALEndpointService } from '../shared/hal-endpoint.service'; @@ -15,6 +14,7 @@ import { FindListOptions } from '../data/find-list-options.model'; import { FollowLinkConfig } from '../../shared/utils/follow-link-config.model'; import { RemoteData } from '../data/remote-data'; import { PaginatedList } from '../data/paginated-list.model'; +import { dataService } from '../data/base/data-service.decorator'; /** * A service to retrieve {@link UsageReport}s from the REST API diff --git a/src/app/core/submission/submission-cc-license-data.service.ts b/src/app/core/submission/submission-cc-license-data.service.ts index 1a2d2f3d7d..976f2acf90 100644 --- a/src/app/core/submission/submission-cc-license-data.service.ts +++ b/src/app/core/submission/submission-cc-license-data.service.ts @@ -1,5 +1,4 @@ import { Injectable } from '@angular/core'; -import { dataService } from '../cache/builders/build-decorators'; import { RemoteDataBuildService } from '../cache/builders/remote-data-build.service'; import { ObjectCacheService } from '../cache/object-cache.service'; import { HALEndpointService } from '../shared/hal-endpoint.service'; @@ -13,6 +12,7 @@ import { FollowLinkConfig } from '../../shared/utils/follow-link-config.model'; import { Observable } from 'rxjs'; import { RemoteData } from '../data/remote-data'; import { PaginatedList } from '../data/paginated-list.model'; +import { dataService } from '../data/base/data-service.decorator'; @Injectable() @dataService(SUBMISSION_CC_LICENSE) diff --git a/src/app/core/submission/submission-cc-license-url-data.service.ts b/src/app/core/submission/submission-cc-license-url-data.service.ts index d40e75cdef..3934ea7cb2 100644 --- a/src/app/core/submission/submission-cc-license-url-data.service.ts +++ b/src/app/core/submission/submission-cc-license-url-data.service.ts @@ -1,5 +1,4 @@ import { Injectable } from '@angular/core'; -import { dataService } from '../cache/builders/build-decorators'; import { RemoteDataBuildService } from '../cache/builders/remote-data-build.service'; import { ObjectCacheService } from '../cache/object-cache.service'; import { HALEndpointService } from '../shared/hal-endpoint.service'; @@ -16,6 +15,7 @@ import { FindListOptions } from '../data/find-list-options.model'; import { FollowLinkConfig } from '../../shared/utils/follow-link-config.model'; import { RemoteData } from '../data/remote-data'; import { PaginatedList } from '../data/paginated-list.model'; +import { dataService } from '../data/base/data-service.decorator'; @Injectable() @dataService(SUBMISSION_CC_LICENSE_URL) diff --git a/src/app/core/submission/vocabularies/vocabulary-entry-details.data.service.ts b/src/app/core/submission/vocabularies/vocabulary-entry-details.data.service.ts index aaa0c23d20..f19c0c00c2 100644 --- a/src/app/core/submission/vocabularies/vocabulary-entry-details.data.service.ts +++ b/src/app/core/submission/vocabularies/vocabulary-entry-details.data.service.ts @@ -19,8 +19,8 @@ import { RemoteData } from '../../data/remote-data'; import { PaginatedList } from '../../data/paginated-list.model'; import { SearchData, SearchDataImpl } from '../../data/base/search-data'; import { Injectable } from '@angular/core'; -import { dataService } from '../../cache/builders/build-decorators'; import { VOCABULARY_ENTRY_DETAIL } from './models/vocabularies.resource-type'; +import { dataService } from '../../data/base/data-service.decorator'; @Injectable() @dataService(VOCABULARY_ENTRY_DETAIL) diff --git a/src/app/core/submission/vocabularies/vocabulary.data.service.ts b/src/app/core/submission/vocabularies/vocabulary.data.service.ts index 3e19ee4653..e4e17b7e73 100644 --- a/src/app/core/submission/vocabularies/vocabulary.data.service.ts +++ b/src/app/core/submission/vocabularies/vocabulary.data.service.ts @@ -18,8 +18,8 @@ import { Observable } from 'rxjs'; import { RemoteData } from '../../data/remote-data'; import { PaginatedList } from '../../data/paginated-list.model'; import { Injectable } from '@angular/core'; -import { dataService } from '../../cache/builders/build-decorators'; import { VOCABULARY } from './models/vocabularies.resource-type'; +import { dataService } from '../../data/base/data-service.decorator'; @Injectable() @dataService(VOCABULARY) diff --git a/src/app/core/submission/workflowitem-data.service.ts b/src/app/core/submission/workflowitem-data.service.ts index f89f850c15..c8cf9dd02f 100644 --- a/src/app/core/submission/workflowitem-data.service.ts +++ b/src/app/core/submission/workflowitem-data.service.ts @@ -1,5 +1,4 @@ import { Injectable } from '@angular/core'; -import { dataService } from '../cache/builders/build-decorators'; import { RemoteDataBuildService } from '../cache/builders/remote-data-build.service'; import { RequestService } from '../data/request.service'; import { WorkflowItem } from './models/workflowitem.model'; @@ -21,6 +20,7 @@ import { IdentifiableDataService } from '../data/base/identifiable-data.service' import { SearchData, SearchDataImpl } from '../data/base/search-data'; import { DeleteData, DeleteDataImpl } from '../data/base/delete-data'; import { PaginatedList } from '../data/paginated-list.model'; +import { dataService } from '../data/base/data-service.decorator'; /** * A service that provides methods to make REST requests with workflow items endpoint. diff --git a/src/app/core/submission/workspaceitem-data.service.ts b/src/app/core/submission/workspaceitem-data.service.ts index 551d40e665..f285fb6eca 100644 --- a/src/app/core/submission/workspaceitem-data.service.ts +++ b/src/app/core/submission/workspaceitem-data.service.ts @@ -1,5 +1,4 @@ import { Injectable } from '@angular/core'; -import { dataService } from '../cache/builders/build-decorators'; import { RemoteDataBuildService } from '../cache/builders/remote-data-build.service'; import { RequestService } from '../data/request.service'; import { HALEndpointService } from '../shared/hal-endpoint.service'; @@ -16,6 +15,7 @@ import { SearchData, SearchDataImpl } from '../data/base/search-data'; import { PaginatedList } from '../data/paginated-list.model'; import { DeleteData, DeleteDataImpl } from '../data/base/delete-data'; import { NoContent } from '../shared/NoContent.model'; +import { dataService } from '../data/base/data-service.decorator'; /** * A service that provides methods to make REST requests with workspaceitems endpoint. diff --git a/src/app/core/tasks/claimed-task-data.service.ts b/src/app/core/tasks/claimed-task-data.service.ts index 3f3edcb09e..4e5c43c146 100644 --- a/src/app/core/tasks/claimed-task-data.service.ts +++ b/src/app/core/tasks/claimed-task-data.service.ts @@ -1,7 +1,6 @@ import { HttpHeaders } from '@angular/common/http'; import { Injectable } from '@angular/core'; import { Observable } from 'rxjs'; -import { dataService } from '../cache/builders/build-decorators'; import { RemoteDataBuildService } from '../cache/builders/remote-data-build.service'; import { ObjectCacheService } from '../cache/object-cache.service'; import { RequestService } from '../data/request.service'; @@ -15,6 +14,7 @@ import { RequestParam } from '../cache/models/request-param.model'; import { HttpOptions } from '../dspace-rest/dspace-rest.service'; import { getFirstSucceededRemoteData } from '../shared/operators'; import { FindListOptions } from '../data/find-list-options.model'; +import { dataService } from '../data/base/data-service.decorator'; /** * The service handling all REST requests for ClaimedTask diff --git a/src/app/core/tasks/pool-task-data.service.ts b/src/app/core/tasks/pool-task-data.service.ts index fe0218eba1..ec44184934 100644 --- a/src/app/core/tasks/pool-task-data.service.ts +++ b/src/app/core/tasks/pool-task-data.service.ts @@ -1,7 +1,6 @@ import { Injectable } from '@angular/core'; import { Observable } from 'rxjs'; -import { dataService } from '../cache/builders/build-decorators'; import { RemoteDataBuildService } from '../cache/builders/remote-data-build.service'; import { ObjectCacheService } from '../cache/object-cache.service'; import { RequestService } from '../data/request.service'; @@ -13,6 +12,7 @@ import { RemoteData } from '../data/remote-data'; import { RequestParam } from '../cache/models/request-param.model'; import { getFirstCompletedRemoteData } from '../shared/operators'; import { FindListOptions } from '../data/find-list-options.model'; +import { dataService } from '../data/base/data-service.decorator'; /** * The service handling all REST requests for PoolTask diff --git a/src/app/shared/resource-policies/form/eperson-group-list/eperson-group-list.component.ts b/src/app/shared/resource-policies/form/eperson-group-list/eperson-group-list.component.ts index 3bb697beee..b120c3e016 100644 --- a/src/app/shared/resource-policies/form/eperson-group-list/eperson-group-list.component.ts +++ b/src/app/shared/resource-policies/form/eperson-group-list/eperson-group-list.component.ts @@ -10,7 +10,6 @@ import { DSpaceObject } from '../../../../core/shared/dspace-object.model'; import { PaginationComponentOptions } from '../../../pagination/pagination-component-options.model'; import { hasValue, isNotEmpty } from '../../../empty.util'; import { DSONameService } from '../../../../core/breadcrumbs/dso-name.service'; -import { getDataServiceFor } from '../../../../core/cache/builders/build-decorators'; import { EPERSON } from '../../../../core/eperson/models/eperson.resource-type'; import { GROUP } from '../../../../core/eperson/models/group.resource-type'; import { ResourceType } from '../../../../core/shared/resource-type'; @@ -20,6 +19,7 @@ import { fadeInOut } from '../../../animations/fade'; import { getFirstCompletedRemoteData } from '../../../../core/shared/operators'; import { PaginationService } from '../../../../core/pagination/pagination.service'; import { FindListOptions } from '../../../../core/data/find-list-options.model'; +import { getDataServiceFor } from '../../../../core/data/base/data-service.decorator'; export interface SearchEvent { scope: string; diff --git a/src/app/shared/resource-policies/resolvers/resource-policy-target.resolver.ts b/src/app/shared/resource-policies/resolvers/resource-policy-target.resolver.ts index db1340eb54..95f27c7934 100644 --- a/src/app/shared/resource-policies/resolvers/resource-policy-target.resolver.ts +++ b/src/app/shared/resource-policies/resolvers/resource-policy-target.resolver.ts @@ -3,13 +3,13 @@ import { ActivatedRouteSnapshot, Resolve, Router, RouterStateSnapshot } from '@a import { Observable } from 'rxjs'; -import { getDataServiceFor } from '../../../core/cache/builders/build-decorators'; import { ResourceType } from '../../../core/shared/resource-type'; import { DSpaceObject } from '../../../core/shared/dspace-object.model'; import { isEmpty } from '../../empty.util'; import { RemoteData } from '../../../core/data/remote-data'; import { getFirstCompletedRemoteData } from '../../../core/shared/operators'; import { IdentifiableDataService } from '../../../core/data/base/identifiable-data.service'; +import { getDataServiceFor } from '../../../core/data/base/data-service.decorator'; /** * This class represents a resolver that requests a specific item before the route is activated