Revert "93803: Update DataService constructor signatures"

This reverts commit a6fb4a6303.
This commit is contained in:
Yury Bondarenko
2022-09-12 12:29:04 +02:00
parent a6fb4a6303
commit abc9bbeae3
70 changed files with 180 additions and 290 deletions

View File

@@ -17,7 +17,6 @@ import { dataService } from './base/data-service.decorator';
@Injectable()
@dataService(ACCESS_STATUS)
export class AccessStatusDataService extends BaseDataService<AccessStatusObject> {
protected linkPath = 'accessStatus';
constructor(
protected requestService: RequestService,
@@ -25,7 +24,7 @@ export class AccessStatusDataService extends BaseDataService<AccessStatusObject>
protected objectCache: ObjectCacheService,
protected halService: HALEndpointService,
) {
super(requestService, rdbService, objectCache, halService);
super('accessStatus', requestService, rdbService, objectCache, halService);
}
/**

View File

@@ -32,7 +32,7 @@ class TestService extends BaseDataService<any> {
protected objectCache: ObjectCacheService,
protected halService: HALEndpointService,
) {
super(requestService, rdbService, objectCache, halService);
super(undefined, requestService, rdbService, objectCache, halService);
}
public getBrowseEndpoint(options: FindListOptions = {}, linkPath: string = this.linkPath): Observable<string> {

View File

@@ -8,7 +8,7 @@
import { AsyncSubject, from as observableFrom, Observable, of as observableOf } from 'rxjs';
import { map, mergeMap, skipWhile, switchMap, take, tap, toArray } from 'rxjs/operators';
import { hasValue, isEmpty, isNotEmpty, isNotEmptyOperator } from '../../../shared/empty.util';
import { hasValue, isNotEmpty, isNotEmptyOperator } from '../../../shared/empty.util';
import { FollowLinkConfig } from '../../../shared/utils/follow-link-config.model';
import { RemoteDataBuildService } from '../../cache/builders/remote-data-build.service';
import { RequestParam } from '../../cache/models/request-param.model';
@@ -31,23 +31,13 @@ import { HALDataService } from './hal-data-service.interface';
*
* All DataService (or DataService feature) classes must
* - extend this class (or {@link IdentifiableDataService})
* - specify a {@link linkPath}
* - implement any DataService features it requires in order to forward calls to it.
* {@link linkPath} and {@link responseMsToLive} must be passed through.
* - implement any DataService features it requires in order to forward calls to it
*
* ```
* export class SomeDataService extends BaseDataService<Something> implements CreateData<Something>, SearchData<Something> {
* protected linkPath = 'something';
* protected responseMsToLive = 3 * 60 * 1000; // not required
*
* private createData: CreateData<Something>;
* private searchData: SearchDataData<Something>;
*
* constructor(...) {
* this.createData = new CreateDataImpl(this.linkPath, this.responseMsToLive, ...);
* this.searchData = new SearchDataImpl(this.linkPath, this.responseMsToLive, ...);
* }
*
* create(...) {
* return this.createData.create(...);
* }
@@ -59,40 +49,19 @@ import { HALDataService } from './hal-data-service.interface';
* ```
*/
export class BaseDataService<T extends CacheableObject> implements HALDataService<T> {
/**
* The REST endpoint this data service communicates with
*/
protected linkPath: string;
/**
* Allows subclasses to reset the response cache time.
*/
protected responseMsToLive?: number;
/**
* @param requestService
* @param rdbService
* @param objectCache
* @param halService
* @param linkPath Optionally sets the {@link linkPath}; to be used by composable features.
* @param responseMsToLive Optionally sets the {@link responseMsToLive}; to be used by composable features.
*/
constructor(
protected linkPath: string,
protected requestService: RequestService,
protected rdbService: RemoteDataBuildService,
protected objectCache: ObjectCacheService,
protected halService: HALEndpointService,
linkPath?: string,
responseMsToLive?: number,
protected responseMsToLive?: number,
) {
if (isEmpty(this.linkPath) && isNotEmpty(linkPath)) {
this.linkPath = linkPath;
}
if (isEmpty(this.responseMsToLive) && isNotEmpty(responseMsToLive)) {
this.responseMsToLive = responseMsToLive;
}
}
/**
* Allows subclasses to reset the response cache time.
*/
/**
* Get the endpoint for browsing

View File

@@ -31,7 +31,7 @@ class TestService extends CreateDataImpl<any> {
protected halService: HALEndpointService,
protected notificationsService: NotificationsService,
) {
super(undefined, undefined, requestService, rdbService, objectCache, halService, notificationsService);
super(undefined, requestService, rdbService, objectCache, halService, notificationsService, undefined);
}
public getBrowseEndpoint(options: FindListOptions = {}, linkPath: string = this.linkPath): Observable<string> {

View File

@@ -45,14 +45,14 @@ export interface CreateData<T extends CacheableObject> {
export class CreateDataImpl<T extends CacheableObject> extends BaseDataService<T> implements CreateData<T> {
constructor(
protected linkPath: string,
protected responseMsToLive: number,
protected requestService: RequestService,
protected rdbService: RemoteDataBuildService,
protected objectCache: ObjectCacheService,
protected halService: HALEndpointService,
protected notificationsService: NotificationsService,
protected responseMsToLive: number,
) {
super(requestService, rdbService, objectCache, halService, linkPath, responseMsToLive);
super(linkPath, requestService, rdbService, objectCache, halService, responseMsToLive);
}
/**

View File

@@ -36,7 +36,7 @@ class TestService extends DeleteDataImpl<any> {
protected halService: HALEndpointService,
protected notificationsService: NotificationsService,
) {
super(undefined, undefined, constructIdEndpointDefault, requestService, rdbService, objectCache, halService, notificationsService);
super(undefined, requestService, rdbService, objectCache, halService, notificationsService, undefined, constructIdEndpointDefault);
}
public getBrowseEndpoint(options: FindListOptions = {}, linkPath: string = this.linkPath): Observable<string> {

View File

@@ -46,15 +46,15 @@ export interface DeleteData<T extends CacheableObject> {
export class DeleteDataImpl<T extends CacheableObject> extends IdentifiableDataService<T> implements DeleteData<T> {
constructor(
protected linkPath: string,
protected responseMsToLive: number,
protected constructIdEndpoint: ConstructIdEndpoint,
protected requestService: RequestService,
protected rdbService: RemoteDataBuildService,
protected objectCache: ObjectCacheService,
protected halService: HALEndpointService,
protected notificationsService: NotificationsService,
protected responseMsToLive: number,
protected constructIdEndpoint: ConstructIdEndpoint,
) {
super(requestService, rdbService, objectCache, halService);
super(linkPath, requestService, rdbService, objectCache, halService, responseMsToLive, constructIdEndpoint);
if (hasNoValue(constructIdEndpoint)) {
throw new Error(`DeleteDataImpl initialized without a constructIdEndpoint method (linkPath: ${linkPath})`);
}

View File

@@ -71,7 +71,7 @@ class TestService extends FindAllDataImpl<any> {
protected objectCache: ObjectCacheService,
protected halService: HALEndpointService,
) {
super(undefined, undefined, requestService, rdbService, objectCache, halService);
super(undefined, requestService, rdbService, objectCache, halService, undefined);
}
public getBrowseEndpoint(options: FindListOptions = {}, linkPath: string = this.linkPath): Observable<string> {

View File

@@ -61,13 +61,13 @@ export interface FindAllData<T extends CacheableObject> {
export class FindAllDataImpl<T extends CacheableObject> extends BaseDataService<T> implements FindAllData<T> {
constructor(
protected linkPath: string,
protected responseMsToLive: number,
protected requestService: RequestService,
protected rdbService: RemoteDataBuildService,
protected objectCache: ObjectCacheService,
protected halService: HALEndpointService,
protected responseMsToLive: number,
) {
super(requestService, rdbService, objectCache, halService, linkPath, responseMsToLive);
super(linkPath, requestService, rdbService, objectCache, halService, responseMsToLive);
}
/**

View File

@@ -29,7 +29,7 @@ class TestService extends IdentifiableDataService<any> {
protected objectCache: ObjectCacheService,
protected halService: HALEndpointService,
) {
super(requestService, rdbService, objectCache, halService);
super(undefined, requestService, rdbService, objectCache, halService);
}
public getBrowseEndpoint(options: FindListOptions = {}, linkPath: string = this.linkPath): Observable<string> {

View File

@@ -28,22 +28,21 @@ export const constructIdEndpointDefault = (endpoint, resourceID) => `${endpoint}
/**
* A type of data service that deals with objects that have an ID.
*
* The effective endpoint to use for the ID can be adjusted by providing a different {@link ConstructIdEndpoint} method.
* This method is passed as an argument so that it can be set on data service features without having to override them.
*/
export class IdentifiableDataService<T extends CacheableObject> extends BaseDataService<T> {
/**
* A method to construct the effective endpoint to use for the ID.
* Also passed as an optional constructor argument so that it can be set on data service features without having to override them.
* @protected
*/
protected constructIdEndpoint: ConstructIdEndpoint = constructIdEndpointDefault;
constructor(
protected linkPath: string,
protected requestService: RequestService,
protected rdbService: RemoteDataBuildService,
protected objectCache: ObjectCacheService,
protected halService: HALEndpointService,
protected responseMsToLive?: number,
protected constructIdEndpoint: ConstructIdEndpoint = constructIdEndpointDefault,
) {
super(requestService, rdbService, objectCache, halService);
super(linkPath, requestService, rdbService, objectCache, halService, responseMsToLive);
}
/**

View File

@@ -38,7 +38,7 @@ class TestService extends PatchDataImpl<any> {
protected halService: HALEndpointService,
protected comparator: ChangeAnalyzer<Item>,
) {
super(undefined, undefined, constructIdEndpointDefault, requestService, rdbService, objectCache, halService, comparator);
super(undefined, requestService, rdbService, objectCache, halService, comparator, undefined, constructIdEndpointDefault);
}
public getBrowseEndpoint(options: FindListOptions = {}, linkPath: string = this.linkPath): Observable<string> {

View File

@@ -65,15 +65,15 @@ export interface PatchData<T extends CacheableObject> {
export class PatchDataImpl<T extends CacheableObject> extends IdentifiableDataService<T> implements PatchData<T> {
constructor(
protected linkPath: string,
protected responseMsToLive: number,
protected constructIdEndpoint: ConstructIdEndpoint,
protected requestService: RequestService,
protected rdbService: RemoteDataBuildService,
protected objectCache: ObjectCacheService,
protected halService: HALEndpointService,
protected comparator: ChangeAnalyzer<T>,
protected responseMsToLive: number,
protected constructIdEndpoint: ConstructIdEndpoint,
) {
super(requestService, rdbService, objectCache, halService);
super(linkPath, requestService, rdbService, objectCache, halService, responseMsToLive, constructIdEndpoint);
if (hasNoValue(constructIdEndpoint)) {
throw new Error(`PatchDataImpl initialized without a constructIdEndpoint method (linkPath: ${linkPath})`);
}

View File

@@ -30,7 +30,7 @@ class TestService extends PutDataImpl<any> {
protected objectCache: ObjectCacheService,
protected halService: HALEndpointService,
) {
super(undefined, undefined, requestService, rdbService, objectCache, halService);
super(undefined, requestService, rdbService, objectCache, halService, undefined);
}
public getBrowseEndpoint(options: FindListOptions = {}, linkPath: string = this.linkPath): Observable<string> {

View File

@@ -39,13 +39,13 @@ export interface PutData<T extends CacheableObject> {
export class PutDataImpl<T extends CacheableObject> extends BaseDataService<T> implements PutData<T> {
constructor(
protected linkPath: string,
protected responseMsToLive: number,
protected requestService: RequestService,
protected rdbService: RemoteDataBuildService,
protected objectCache: ObjectCacheService,
protected halService: HALEndpointService,
protected responseMsToLive: number,
) {
super(requestService, rdbService, objectCache, halService, linkPath, responseMsToLive);
super(linkPath, requestService, rdbService, objectCache, halService, responseMsToLive);
}
/**

View File

@@ -68,7 +68,7 @@ class TestService extends SearchDataImpl<any> {
protected objectCache: ObjectCacheService,
protected halService: HALEndpointService,
) {
super(undefined, undefined, requestService, rdbService, objectCache, halService);
super(undefined, requestService, rdbService, objectCache, halService, undefined);
}
public getBrowseEndpoint(options: FindListOptions = {}, linkPath: string = this.linkPath): Observable<string> {

View File

@@ -80,14 +80,14 @@ export class SearchDataImpl<T extends CacheableObject> extends BaseDataService<T
*/
constructor(
protected linkPath: string,
protected responseMsToLive: number,
protected requestService: RequestService,
protected rdbService: RemoteDataBuildService,
protected objectCache: ObjectCacheService,
protected halService: HALEndpointService,
protected responseMsToLive: number,
private constructSearchEndpoint: ConstructSearchEndpoint = constructSearchEndpointDefault,
) {
super(requestService, rdbService, objectCache, halService, linkPath, responseMsToLive);
super(linkPath, requestService, rdbService, objectCache, halService, responseMsToLive);
if (hasNoValue(constructSearchEndpoint)) {
throw new Error(`SearchDataImpl initialized without a constructSearchEndpoint method (linkPath: ${linkPath})`);
}

View File

@@ -42,8 +42,6 @@ import { dataService } from './base/data-service.decorator';
})
@dataService(BITSTREAM)
export class BitstreamDataService extends IdentifiableDataService<Bitstream> implements SearchData<Bitstream>, PatchData<Bitstream>, DeleteData<Bitstream> {
protected linkPath = 'bitstreams';
private searchData: SearchDataImpl<Bitstream>;
private patchData: PatchDataImpl<Bitstream>;
private deleteData: DeleteDataImpl<Bitstream>;
@@ -58,11 +56,11 @@ export class BitstreamDataService extends IdentifiableDataService<Bitstream> imp
protected comparator: DSOChangeAnalyzer<Bitstream>,
protected notificationsService: NotificationsService,
) {
super(requestService, rdbService, objectCache, halService);
super('bitstreams', requestService, rdbService, objectCache, halService);
this.searchData = new SearchDataImpl(this.linkPath, this.responseMsToLive, requestService, rdbService, objectCache, halService);
this.patchData = new PatchDataImpl<Bitstream>(this.linkPath, this.responseMsToLive, this.constructIdEndpoint, requestService, rdbService, objectCache, halService, comparator);
this.deleteData = new DeleteDataImpl(this.linkPath, this.responseMsToLive, this.constructIdEndpoint, requestService, rdbService, objectCache, halService, notificationsService);
this.searchData = new SearchDataImpl(this.linkPath, requestService, rdbService, objectCache, halService, this.responseMsToLive);
this.patchData = new PatchDataImpl<Bitstream>(this.linkPath, requestService, rdbService, objectCache, halService, comparator, this.responseMsToLive, this.constructIdEndpoint);
this.deleteData = new DeleteDataImpl(this.linkPath, requestService, rdbService, objectCache, halService, notificationsService, this.responseMsToLive, this.constructIdEndpoint);
}
/**

View File

@@ -41,6 +41,7 @@ const selectedBitstreamFormatSelector = createSelector(
@Injectable()
@dataService(BITSTREAM_FORMAT)
export class BitstreamFormatDataService extends IdentifiableDataService<BitstreamFormat> implements FindAllData<BitstreamFormat>, DeleteData<BitstreamFormat> {
protected linkPath = 'bitstreamformats';
private findAllData: FindAllDataImpl<BitstreamFormat>;
@@ -54,10 +55,10 @@ export class BitstreamFormatDataService extends IdentifiableDataService<Bitstrea
protected notificationsService: NotificationsService,
protected store: Store<CoreState>,
) {
super(requestService, rdbService, objectCache, halService);
super('bitstreamformats', requestService, rdbService, objectCache, halService);
this.findAllData = new FindAllDataImpl(this.linkPath, this.responseMsToLive, requestService, rdbService, objectCache, halService);
this.deleteData = new DeleteDataImpl(this.linkPath, this.responseMsToLive, this.constructIdEndpoint, requestService, rdbService, objectCache, halService, notificationsService);
this.findAllData = new FindAllDataImpl(this.linkPath, requestService, rdbService, objectCache, halService, this.responseMsToLive);
this.deleteData = new DeleteDataImpl(this.linkPath, requestService, rdbService, objectCache, halService, notificationsService, this.responseMsToLive, this.constructIdEndpoint);
}
/**

View File

@@ -32,8 +32,6 @@ import { dataService } from './base/data-service.decorator';
)
@dataService(BUNDLE)
export class BundleDataService extends IdentifiableDataService<Bundle> implements PatchData<Bundle> {
protected linkPath = 'bundles';
private bitstreamsEndpoint = 'bitstreams';
private patchData: PatchDataImpl<Bundle>;
@@ -45,9 +43,9 @@ export class BundleDataService extends IdentifiableDataService<Bundle> implement
protected halService: HALEndpointService,
protected comparator: DSOChangeAnalyzer<Bundle>,
) {
super(requestService, rdbService, objectCache, halService);
super('bundles', requestService, rdbService, objectCache, halService);
this.patchData = new PatchDataImpl<Bundle>(this.linkPath, this.responseMsToLive, this.constructIdEndpoint, requestService, rdbService, objectCache, halService, comparator);
this.patchData = new PatchDataImpl<Bundle>(this.linkPath, requestService, rdbService, objectCache, halService, comparator, this.responseMsToLive, this.constructIdEndpoint);
}
/**

View File

@@ -38,8 +38,6 @@ import { dataService } from './base/data-service.decorator';
@Injectable()
@dataService(COLLECTION)
export class CollectionDataService extends ComColDataService<Collection> {
protected linkPath = 'collections';
protected errorTitle = 'collection.source.update.notifications.error.title';
protected contentSourceError = 'collection.source.update.notifications.error.content';
@@ -54,7 +52,7 @@ export class CollectionDataService extends ComColDataService<Collection> {
protected communityDataService: CommunityDataService,
protected translate: TranslateService,
) {
super(requestService, rdbService, objectCache, halService, comparator, notificationsService, bitstreamDataService);
super('collections', requestService, rdbService, objectCache, halService, comparator, notificationsService, bitstreamDataService);
}
/**

View File

@@ -33,7 +33,6 @@ const communitiesEndpoint = 'https://rest.api/core/communities';
const communityEndpoint = `${communitiesEndpoint}/${scopeID}`;
class TestService extends ComColDataService<any> {
protected linkPath = 'something';
constructor(
protected requestService: RequestService,
@@ -46,8 +45,9 @@ class TestService extends ComColDataService<any> {
protected http: HttpClient,
protected bitstreamDataService: BitstreamDataService,
protected comparator: DSOChangeAnalyzer<Community>,
protected linkPath: string
) {
super(requestService, rdbService, objectCache, halService, comparator, notificationsService, bitstreamDataService);
super('something', requestService, rdbService, objectCache, halService, comparator, notificationsService, bitstreamDataService);
}
protected getFindByParentHref(parentUUID: string): Observable<string> {
@@ -131,7 +131,8 @@ describe('ComColDataService', () => {
notificationsService,
http,
bitstreamDataService,
comparator
comparator,
LINK_NAME
);
}

View File

@@ -37,6 +37,7 @@ export abstract class ComColDataService<T extends Community | Collection> extend
private deleteData: DeleteData<T>;
protected constructor(
protected linkPath: string,
protected requestService: RequestService,
protected rdbService: RemoteDataBuildService,
protected objectCache: ObjectCacheService,
@@ -45,13 +46,13 @@ export abstract class ComColDataService<T extends Community | Collection> extend
protected notificationsService: NotificationsService,
protected bitstreamDataService: BitstreamDataService,
) {
super(requestService, rdbService, objectCache, halService);
super(linkPath, requestService, rdbService, objectCache, halService);
this.createData = new CreateDataImpl(this.linkPath, this.responseMsToLive, requestService, rdbService, objectCache, halService, notificationsService);
this.findAllData = new FindAllDataImpl(this.linkPath, this.responseMsToLive, requestService, rdbService, objectCache, halService, );
this.searchData = new SearchDataImpl<T>(this.linkPath, this.responseMsToLive, requestService, rdbService, objectCache, halService, );
this.patchData = new PatchDataImpl<T>(this.linkPath, this.responseMsToLive, this.constructIdEndpoint, requestService, rdbService, objectCache, halService, comparator);
this.deleteData = new DeleteDataImpl(this.linkPath, this.responseMsToLive, this.constructIdEndpoint, requestService, rdbService, objectCache, halService, notificationsService);
this.createData = new CreateDataImpl(this.linkPath, requestService, rdbService, objectCache, halService, notificationsService, this.responseMsToLive);
this.findAllData = new FindAllDataImpl(this.linkPath, requestService, rdbService, objectCache, halService, this.responseMsToLive);
this.searchData = new SearchDataImpl<T>(this.linkPath, requestService, rdbService, objectCache, halService, this.responseMsToLive);
this.patchData = new PatchDataImpl<T>(this.linkPath, requestService, rdbService, objectCache, halService, comparator, this.responseMsToLive, this.constructIdEndpoint);
this.deleteData = new DeleteDataImpl(this.linkPath, requestService, rdbService, objectCache, halService, notificationsService, this.responseMsToLive, this.constructIdEndpoint);
}
/**

View File

@@ -22,8 +22,6 @@ import { dataService } from './base/data-service.decorator';
@Injectable()
@dataService(COMMUNITY)
export class CommunityDataService extends ComColDataService<Community> {
protected linkPath = 'communities';
protected topLinkPath = 'search/top';
constructor(
@@ -35,7 +33,7 @@ export class CommunityDataService extends ComColDataService<Community> {
protected notificationsService: NotificationsService,
protected bitstreamDataService: BitstreamDataService,
) {
super(requestService, rdbService, objectCache, halService, comparator, notificationsService, bitstreamDataService);
super('communities', requestService, rdbService, objectCache, halService, comparator, notificationsService, bitstreamDataService);
}
getEndpoint() {

View File

@@ -17,7 +17,6 @@ import { dataService } from './base/data-service.decorator';
* Data Service responsible for retrieving Configuration properties
*/
export class ConfigurationDataService extends IdentifiableDataService<ConfigurationProperty> {
protected linkPath = 'properties';
constructor(
protected requestService: RequestService,
@@ -25,7 +24,7 @@ export class ConfigurationDataService extends IdentifiableDataService<Configurat
protected objectCache: ObjectCacheService,
protected halService: HALEndpointService,
) {
super(requestService, rdbService, objectCache, halService);
super('properties', requestService, rdbService, objectCache, halService);
}
/**

View File

@@ -31,18 +31,20 @@ const UUID_ENDPOINT = 'dso';
* {@link setLinkPath} must be called before each request.
*/
class DsoByIdOrUUIDDataService extends IdentifiableDataService<DSpaceObject> {
// interpolate id/uuid as query parameter
constructIdEndpoint = (endpoint: string, resourceID: string): string =>
endpoint.replace(/{\?id}/, `?id=${resourceID}`)
.replace(/{\?uuid}/, `?uuid=${resourceID}`);
constructor(
protected requestService: RequestService,
protected rdbService: RemoteDataBuildService,
protected objectCache: ObjectCacheService,
protected halService: HALEndpointService,
) {
super(requestService, rdbService, objectCache, halService);
super(
undefined, requestService, rdbService, objectCache, halService, undefined,
// interpolate id/uuid as query parameter
(endpoint: string, resourceID: string): string => {
return endpoint.replace(/{\?id}/, `?id=${resourceID}`)
.replace(/{\?uuid}/, `?uuid=${resourceID}`);
},
);
}
/**

View File

@@ -11,13 +11,6 @@ import { dataService } from './base/data-service.decorator';
@Injectable()
@dataService(DSPACE_OBJECT)
export class DSpaceObjectDataService extends IdentifiableDataService<DSpaceObject> {
protected linkPath = 'dso';
// interpolate uuid as query parameter
protected constructIdEndpoint = (endpoint: string, resourceID: string): string => {
return endpoint.replace(/{\?uuid}/, `?uuid=${resourceID}`);
};
constructor(
protected requestService: RequestService,
protected rdbService: RemoteDataBuildService,
@@ -25,7 +18,11 @@ export class DSpaceObjectDataService extends IdentifiableDataService<DSpaceObjec
protected halService: HALEndpointService,
) {
super(
requestService, rdbService, objectCache, halService,
'dso', requestService, rdbService, objectCache, halService, undefined,
// interpolate uuid as query parameter
(endpoint: string, resourceID: string): string => {
return endpoint.replace(/{\?uuid}/, `?uuid=${resourceID}`);
},
);
}
}

View File

@@ -22,8 +22,6 @@ import { FindAllData, FindAllDataImpl } from './base/find-all-data';
*/
@Injectable()
export class EntityTypeDataService extends BaseDataService<ItemType> implements FindAllData<ItemType>, SearchData<ItemType> {
protected linkPath = 'entitytypes';
private findAllData: FindAllData<ItemType>;
private searchData: SearchDataImpl<ItemType>;
@@ -34,10 +32,10 @@ export class EntityTypeDataService extends BaseDataService<ItemType> implements
protected halService: HALEndpointService,
protected relationshipTypeService: RelationshipTypeDataService,
) {
super(requestService, rdbService, objectCache, halService);
super('entitytypes', requestService, rdbService, objectCache, halService);
this.findAllData = new FindAllDataImpl(this.linkPath, this.responseMsToLive, requestService, rdbService, objectCache, halService);
this.searchData = new SearchDataImpl(this.linkPath, this.responseMsToLive, requestService, rdbService, objectCache, halService);
this.findAllData = new FindAllDataImpl(this.linkPath, requestService, rdbService, objectCache, halService, this.responseMsToLive);
this.searchData = new SearchDataImpl(this.linkPath, requestService, rdbService, objectCache, halService, this.responseMsToLive);
}
getBrowseEndpoint(options, linkPath?: string): Observable<string> {

View File

@@ -21,8 +21,6 @@ import { SearchData, SearchDataImpl } from './base/search-data';
*/
@Injectable()
export class ExternalSourceDataService extends IdentifiableDataService<ExternalSource> implements SearchData<ExternalSource> {
protected linkPath = 'externalsources';
private searchData: SearchData<ExternalSource>;
constructor(
@@ -31,9 +29,9 @@ export class ExternalSourceDataService extends IdentifiableDataService<ExternalS
protected objectCache: ObjectCacheService,
protected halService: HALEndpointService,
) {
super(requestService, rdbService, objectCache, halService);
super('externalsources', requestService, rdbService, objectCache, halService);
this.searchData = new SearchDataImpl(this.linkPath, this.responseMsToLive, requestService, rdbService, objectCache, halService);
this.searchData = new SearchDataImpl(this.linkPath, requestService, rdbService, objectCache, halService, this.responseMsToLive);
}
/**

View File

@@ -29,7 +29,6 @@ import { dataService } from '../base/data-service.decorator';
@dataService(AUTHORIZATION)
export class AuthorizationDataService extends BaseDataService<Authorization> implements SearchData<Authorization> {
protected linkPath = 'authorizations';
protected searchByObjectPath = 'object';
private searchData: SearchDataImpl<Authorization>;
@@ -41,9 +40,9 @@ export class AuthorizationDataService extends BaseDataService<Authorization> imp
protected halService: HALEndpointService,
protected siteService: SiteDataService,
) {
super(requestService, rdbService, objectCache, halService);
super('authorizations', requestService, rdbService, objectCache, halService);
this.searchData = new SearchDataImpl(this.linkPath, this.responseMsToLive, requestService, rdbService, objectCache, halService);
this.searchData = new SearchDataImpl(this.linkPath, requestService, rdbService, objectCache, halService, this.responseMsToLive);
}
/**

View File

@@ -22,6 +22,6 @@ export class FeatureDataService extends BaseDataService<Feature> {
protected objectCache: ObjectCacheService,
protected halService: HALEndpointService,
) {
super(requestService, rdbService, objectCache, halService);
super('features', requestService, rdbService, objectCache, halService);
}
}

View File

@@ -52,7 +52,7 @@ export class HrefOnlyDataService implements HALDataService<any> {
protected objectCache: ObjectCacheService,
protected halService: HALEndpointService,
) {
this.dataService = new BaseDataService(requestService, rdbService, objectCache, halService);
this.dataService = new BaseDataService(undefined, requestService, rdbService, objectCache, halService);
}
/**

View File

@@ -39,7 +39,7 @@ import { StatusCodeOnlyResponseParsingService } from './status-code-only-respons
import { sendRequest } from '../shared/request.operators';
import { RestRequest } from './rest-request.model';
import { FindListOptions } from './find-list-options.model';
import { IdentifiableDataService } from './base/identifiable-data.service';
import { ConstructIdEndpoint, IdentifiableDataService } from './base/identifiable-data.service';
import { PatchData, PatchDataImpl } from './base/patch-data';
import { DeleteData, DeleteDataImpl } from './base/delete-data';
import { RestRequestMethod } from './rest-request-method';
@@ -58,6 +58,7 @@ export abstract class BaseItemDataService extends IdentifiableDataService<Item>
private deleteData: DeleteData<Item>;
protected constructor(
protected linkPath,
protected requestService: RequestService,
protected rdbService: RemoteDataBuildService,
protected objectCache: ObjectCacheService,
@@ -66,12 +67,13 @@ export abstract class BaseItemDataService extends IdentifiableDataService<Item>
protected comparator: DSOChangeAnalyzer<Item>,
protected browseService: BrowseService,
protected bundleService: BundleDataService,
protected constructIdEndpoint: ConstructIdEndpoint = (endpoint, resourceID) => `${endpoint}/${resourceID}`,
) {
super(requestService, rdbService, objectCache, halService);
super(linkPath, requestService, rdbService, objectCache, halService, undefined, constructIdEndpoint);
this.createData = new CreateDataImpl(this.linkPath, this.responseMsToLive, requestService, rdbService, objectCache, halService, notificationsService);
this.patchData = new PatchDataImpl<Item>(this.linkPath, this.responseMsToLive, this.constructIdEndpoint, requestService, rdbService, objectCache, halService, comparator);
this.deleteData = new DeleteDataImpl(this.linkPath, this.responseMsToLive, this.constructIdEndpoint, requestService, rdbService, objectCache, halService, notificationsService);
this.createData = new CreateDataImpl(this.linkPath, requestService, rdbService, objectCache, halService, notificationsService, this.responseMsToLive);
this.patchData = new PatchDataImpl<Item>(this.linkPath, requestService, rdbService, objectCache, halService, comparator, this.responseMsToLive, this.constructIdEndpoint);
this.deleteData = new DeleteDataImpl(this.linkPath, requestService, rdbService, objectCache, halService, notificationsService, this.responseMsToLive, this.constructIdEndpoint);
}
/**
@@ -386,8 +388,6 @@ export abstract class BaseItemDataService extends IdentifiableDataService<Item>
@Injectable()
@dataService(ITEM)
export class ItemDataService extends BaseItemDataService {
protected linkPath = 'items';
constructor(
protected requestService: RequestService,
protected rdbService: RemoteDataBuildService,
@@ -398,6 +398,6 @@ export class ItemDataService extends BaseItemDataService {
protected browseService: BrowseService,
protected bundleService: BundleDataService,
) {
super(requestService, rdbService, objectCache, halService, notificationsService, comparator, browseService, bundleService);
super('items', requestService, rdbService, objectCache, halService, notificationsService, comparator, browseService, bundleService);
}
}

View File

@@ -23,15 +23,13 @@ import { IdentifiableDataService } from './base/identifiable-data.service';
providedIn: 'root',
})
export class ItemRequestDataService extends IdentifiableDataService<ItemRequest> {
protected linkPath = 'itemrequests';
constructor(
protected requestService: RequestService,
protected rdbService: RemoteDataBuildService,
protected objectCache: ObjectCacheService,
protected halService: HALEndpointService,
) {
super(requestService, rdbService, objectCache, halService);
super('itemrequests', requestService, rdbService, objectCache, halService);
}
getItemRequestEndpoint(): Observable<string> {

View File

@@ -22,8 +22,6 @@ import { CreateDataImpl } from './base/create-data';
* Data service for interacting with Item templates via their Collection
*/
class CollectionItemTemplateDataService extends IdentifiableDataService<Item> {
protected linkPath = 'itemtemplates';
private createData: CreateDataImpl<Item>;
constructor(
@@ -34,10 +32,10 @@ class CollectionItemTemplateDataService extends IdentifiableDataService<Item> {
protected notificationsService: NotificationsService,
protected collectionService: CollectionDataService,
) {
super(requestService, rdbService, objectCache, halService);
super('itemtemplates', requestService, rdbService, objectCache, halService, undefined);
// We only intend to use createOnEndpoint, so this inner data service feature doesn't need an endpoint at all
this.createData = new CreateDataImpl<Item>(this.linkPath, this.responseMsToLive, requestService, rdbService, objectCache, halService, notificationsService);
this.createData = new CreateDataImpl<Item>(undefined, requestService, rdbService, objectCache, halService, notificationsService, this.responseMsToLive);
}
/**
@@ -67,8 +65,6 @@ class CollectionItemTemplateDataService extends IdentifiableDataService<Item> {
*/
@Injectable()
export class ItemTemplateDataService extends BaseItemDataService {
protected linkPath = 'itemtemplates';
private byCollection: CollectionItemTemplateDataService;
constructor(
@@ -82,7 +78,7 @@ export class ItemTemplateDataService extends BaseItemDataService {
protected bundleService: BundleDataService,
protected collectionService: CollectionDataService,
) {
super(requestService, rdbService, objectCache, halService, notificationsService, comparator, browseService, bundleService);
super('itemtemplates', requestService, rdbService, objectCache, halService, notificationsService, comparator, browseService, bundleService);
this.byCollection = new CollectionItemTemplateDataService(requestService, rdbService, objectCache, halService, notificationsService, collectionService);
}

View File

@@ -29,8 +29,6 @@ import { dataService } from './base/data-service.decorator';
@Injectable()
@dataService(METADATA_FIELD)
export class MetadataFieldDataService extends IdentifiableDataService<MetadataField> implements CreateData<MetadataField>, PutData<MetadataField>, DeleteData<MetadataField>, SearchData<MetadataField> {
protected linkPath = 'metadatafields';
private createData: CreateData<MetadataField>;
private searchData: SearchData<MetadataField>;
private putData: PutData<MetadataField>;
@@ -46,12 +44,12 @@ export class MetadataFieldDataService extends IdentifiableDataService<MetadataFi
protected halService: HALEndpointService,
protected notificationsService: NotificationsService,
) {
super(requestService, rdbService, objectCache, halService);
super('metadatafields', requestService, rdbService, objectCache, halService);
this.createData = new CreateDataImpl(this.linkPath, this.responseMsToLive, requestService, rdbService, objectCache, halService, notificationsService, );
this.searchData = new SearchDataImpl(this.linkPath, this.responseMsToLive, requestService, rdbService, objectCache, halService);
this.putData = new PutDataImpl(this.linkPath, this.responseMsToLive, requestService, rdbService, objectCache, halService);
this.deleteData = new DeleteDataImpl(this.linkPath, this.responseMsToLive, this.constructIdEndpoint, requestService, rdbService, objectCache, halService, notificationsService);
this.createData = new CreateDataImpl(this.linkPath, requestService, rdbService, objectCache, halService, notificationsService, this.responseMsToLive);
this.searchData = new SearchDataImpl(this.linkPath, requestService, rdbService, objectCache, halService, this.responseMsToLive);
this.putData = new PutDataImpl(this.linkPath, requestService, rdbService, objectCache, halService, this.responseMsToLive);
this.deleteData = new DeleteDataImpl(this.linkPath, requestService, rdbService, objectCache, halService, notificationsService, this.responseMsToLive, this.constructIdEndpoint);
}
/**

View File

@@ -27,8 +27,6 @@ import { dataService } from './base/data-service.decorator';
@Injectable()
@dataService(METADATA_SCHEMA)
export class MetadataSchemaDataService extends IdentifiableDataService<MetadataSchema> implements FindAllData<MetadataSchema>, DeleteData<MetadataSchema> {
protected linkPath = 'metadataschemas';
private createData: CreateData<MetadataSchema>;
private findAllData: FindAllData<MetadataSchema>;
private putData: PutData<MetadataSchema>;
@@ -41,12 +39,12 @@ export class MetadataSchemaDataService extends IdentifiableDataService<MetadataS
protected halService: HALEndpointService,
protected notificationsService: NotificationsService,
) {
super(requestService, rdbService, objectCache, halService);
super('metadataschemas', requestService, rdbService, objectCache, halService);
this.createData = new CreateDataImpl(this.linkPath, this.responseMsToLive, requestService, rdbService, objectCache, halService, notificationsService);
this.putData = new PutDataImpl(this.linkPath, this.responseMsToLive, requestService, rdbService, objectCache, halService);
this.deleteData = new DeleteDataImpl(this.linkPath, this.responseMsToLive, this.constructIdEndpoint, requestService, rdbService, objectCache, halService, notificationsService);
this.findAllData = new FindAllDataImpl(this.linkPath, this.responseMsToLive, requestService, rdbService, objectCache, halService);
this.createData = new CreateDataImpl(this.linkPath, requestService, rdbService, objectCache, halService, notificationsService, this.responseMsToLive);
this.putData = new PutDataImpl(this.linkPath, requestService, rdbService, objectCache, halService, this.responseMsToLive);
this.deleteData = new DeleteDataImpl(this.linkPath, requestService, rdbService, objectCache, halService, notificationsService, this.responseMsToLive, this.constructIdEndpoint);
this.findAllData = new FindAllDataImpl(this.linkPath, requestService, rdbService, objectCache, halService, this.responseMsToLive);
}
/**

View File

@@ -20,8 +20,6 @@ import { dataService } from '../base/data-service.decorator';
@Injectable()
@dataService(PROCESS)
export class ProcessDataService extends IdentifiableDataService<Process> implements FindAllData<Process> {
protected linkPath = 'processes';
private findAllData: FindAllData<Process>;
constructor(
@@ -31,9 +29,9 @@ export class ProcessDataService extends IdentifiableDataService<Process> impleme
protected halService: HALEndpointService,
protected bitstreamDataService: BitstreamDataService,
) {
super(requestService, rdbService, objectCache, halService);
super('processes', requestService, rdbService, objectCache, halService);
this.findAllData = new FindAllDataImpl(this.linkPath, this.responseMsToLive, requestService, rdbService, objectCache, halService);
this.findAllData = new FindAllDataImpl(this.linkPath, requestService, rdbService, objectCache, halService, this.responseMsToLive);
}
/**

View File

@@ -28,8 +28,6 @@ export const METADATA_EXPORT_SCRIPT_NAME = 'metadata-export';
@Injectable()
@dataService(SCRIPT)
export class ScriptDataService extends IdentifiableDataService<Script> implements FindAllData<Script> {
protected linkPath = 'scripts';
private findAllData: FindAllDataImpl<Script>;
constructor(
@@ -38,9 +36,9 @@ export class ScriptDataService extends IdentifiableDataService<Script> implement
protected objectCache: ObjectCacheService,
protected halService: HALEndpointService,
) {
super(requestService, rdbService, objectCache, halService);
super('scripts', requestService, rdbService, objectCache, halService);
this.findAllData = new FindAllDataImpl(this.linkPath, this.responseMsToLive, requestService, rdbService, objectCache, halService);
this.findAllData = new FindAllDataImpl(this.linkPath, requestService, rdbService, objectCache, halService, this.responseMsToLive);
}
public invoke(scriptName: string, parameters: ProcessParameter[], files: File[]): Observable<RemoteData<Process>> {

View File

@@ -75,9 +75,6 @@ const compareItemsByUUID = (itemCheck: Item) =>
@Injectable()
@dataService(RELATIONSHIP)
export class RelationshipDataService extends IdentifiableDataService<Relationship> implements SearchData<Relationship> {
protected linkPath = 'relationships';
protected responseMsToLive = 15 * 60 * 1000;
private searchData: SearchData<Relationship>;
private putData: PutData<Relationship>;
@@ -90,10 +87,10 @@ export class RelationshipDataService extends IdentifiableDataService<Relationshi
protected appStore: Store<AppState>,
@Inject(PAGINATED_RELATIONS_TO_ITEMS_OPERATOR) private paginatedRelationsToItems: (thisId: string) => (source: Observable<RemoteData<PaginatedList<Relationship>>>) => Observable<RemoteData<PaginatedList<Item>>>,
) {
super(requestService, rdbService, objectCache, halService);
super('relationships', requestService, rdbService, objectCache, halService, 15 * 60 * 1000);
this.searchData = new SearchDataImpl(this.linkPath, this.responseMsToLive, requestService, rdbService, objectCache, halService);
this.putData = new PutDataImpl(this.linkPath, this.responseMsToLive, requestService, rdbService, objectCache, halService);
this.searchData = new SearchDataImpl(this.linkPath, requestService, rdbService, objectCache, halService, this.responseMsToLive);
this.putData = new PutDataImpl(this.linkPath, requestService, rdbService, objectCache, halService, this.responseMsToLive);
}
/**

View File

@@ -33,8 +33,6 @@ const checkSide = (typeRd: RemoteData<ItemType>, label: string): boolean =>
@Injectable()
@dataService(RELATIONSHIP_TYPE)
export class RelationshipTypeDataService extends BaseDataService<RelationshipType> {
protected linkPath = 'relationshiptypes';
private searchData: SearchDataImpl<RelationshipType>;
private findAllData: FindAllDataImpl<RelationshipType>;
@@ -44,10 +42,10 @@ export class RelationshipTypeDataService extends BaseDataService<RelationshipTyp
protected objectCache: ObjectCacheService,
protected halService: HALEndpointService,
) {
super(requestService, rdbService, objectCache, halService);
super('relationshiptypes', requestService, rdbService, objectCache, halService);
this.searchData = new SearchDataImpl(this.linkPath, this.responseMsToLive, requestService, rdbService, objectCache, halService);
this.findAllData = new FindAllDataImpl(this.linkPath, this.responseMsToLive, requestService, rdbService, objectCache, halService);
this.searchData = new SearchDataImpl(this.linkPath, requestService, rdbService, objectCache, halService, this.responseMsToLive);
this.findAllData = new FindAllDataImpl(this.linkPath, requestService, rdbService, objectCache, halService, this.responseMsToLive);
}
/**

View File

@@ -20,9 +20,6 @@ import { dataService } from './base/data-service.decorator';
@Injectable()
@dataService(ROOT)
export class RootDataService extends BaseDataService<Root> {
protected linkPath = '';
protected responseMsToLive = 6 * 60 * 60 * 1000;
constructor(
protected requestService: RequestService,
protected rdbService: RemoteDataBuildService,
@@ -30,7 +27,7 @@ export class RootDataService extends BaseDataService<Root> {
protected halService: HALEndpointService,
protected restService: DspaceRestService,
) {
super(requestService, rdbService, objectCache, halService);
super('', requestService, rdbService, objectCache, halService, 6 * 60 * 60 * 1000);
}
/**

View File

@@ -22,8 +22,6 @@ import { dataService } from './base/data-service.decorator';
@Injectable()
@dataService(SITE)
export class SiteDataService extends BaseDataService<Site> implements FindAllData<Site> {
protected linkPath = 'sites';
private findAllData: FindAllData<Site>;
constructor(
@@ -32,9 +30,9 @@ export class SiteDataService extends BaseDataService<Site> implements FindAllDat
protected objectCache: ObjectCacheService,
protected halService: HALEndpointService,
) {
super(requestService, rdbService, objectCache, halService);
super('sites', requestService, rdbService, objectCache, halService);
this.findAllData = new FindAllDataImpl(this.linkPath, this.responseMsToLive, requestService, rdbService, objectCache, halService);
this.findAllData = new FindAllDataImpl(this.linkPath, requestService, rdbService, objectCache, halService, this.responseMsToLive);
}
/**

View File

@@ -24,7 +24,6 @@ import { dataService } from './base/data-service.decorator';
@Injectable()
@dataService(VERSION)
export class VersionDataService extends IdentifiableDataService<Version> implements PatchData<Version> {
protected linkPath = 'versions';
private patchData: PatchData<Version>;
constructor(
@@ -34,9 +33,9 @@ export class VersionDataService extends IdentifiableDataService<Version> impleme
protected halService: HALEndpointService,
protected comparator: DefaultChangeAnalyzer<Version>,
) {
super(requestService, rdbService, objectCache, halService);
super('versions', requestService, rdbService, objectCache, halService);
this.patchData = new PatchDataImpl(this.linkPath, this.responseMsToLive, this.constructIdEndpoint, requestService, rdbService, objectCache, halService, comparator);
this.patchData = new PatchDataImpl(this.linkPath, requestService, rdbService, objectCache, halService, comparator, this.responseMsToLive, this.constructIdEndpoint);
}
/**

View File

@@ -32,7 +32,6 @@ import { dataService } from './base/data-service.decorator';
@Injectable()
@dataService(VERSION_HISTORY)
export class VersionHistoryDataService extends IdentifiableDataService<VersionHistory> {
protected linkPath = 'versionhistories';
protected versionsEndpoint = 'versions';
constructor(
@@ -42,7 +41,7 @@ export class VersionHistoryDataService extends IdentifiableDataService<VersionHi
protected halService: HALEndpointService,
protected versionDataService: VersionDataService,
) {
super(requestService, rdbService, objectCache, halService);
super('versionhistories', requestService, rdbService, objectCache, halService);
}
/**

View File

@@ -22,6 +22,6 @@ export class WorkflowActionDataService extends BaseDataService<WorkflowAction> {
protected objectCache: ObjectCacheService,
protected halService: HALEndpointService,
) {
super(requestService, rdbService, objectCache, halService);
super('workflowactions', requestService, rdbService, objectCache, halService);
}
}