diff --git a/src/app/core/cache/object-cache.service.ts b/src/app/core/cache/object-cache.service.ts index 7dc659d89c..e12629fa27 100644 --- a/src/app/core/cache/object-cache.service.ts +++ b/src/app/core/cache/object-cache.service.ts @@ -75,15 +75,15 @@ export class ObjectCacheService { /** * Get an observable of the object with the specified UUID * - * @param id + * @param uuid * The UUID of the object to get * @return Observable> * An observable of the requested object in normalized form */ - getObjectByID(id: string): + getObjectByUUID(uuid: string): Observable> { return this.store.pipe( - select(selfLinkFromUuidSelector(id)), + select(selfLinkFromUuidSelector(uuid)), mergeMap((selfLink: string) => this.getObjectBySelfLink(selfLink) ) ) @@ -189,17 +189,17 @@ export class ObjectCacheService { /** * Check whether the object with the specified UUID is cached * - * @param id + * @param uuid * The UUID of the object to check * @return boolean * true if the object with the specified UUID is cached, * false otherwise */ - hasById(id: string): boolean { + hasByUUID(uuid: string): boolean { let result: boolean; this.store.pipe( - select(selfLinkFromUuidSelector(id)), + select(selfLinkFromUuidSelector(uuid)), take(1) ).subscribe((selfLink: string) => result = this.hasBySelfLink(selfLink)); diff --git a/src/app/core/data/comcol-data.service.spec.ts b/src/app/core/data/comcol-data.service.spec.ts index de17d7a39f..b5232b0bff 100644 --- a/src/app/core/data/comcol-data.service.spec.ts +++ b/src/app/core/data/comcol-data.service.spec.ts @@ -95,7 +95,7 @@ describe('ComColDataService', () => { function initMockObjectCacheService(): ObjectCacheService { return jasmine.createSpyObj('objectCache', { - getObjectByID: cold('d-', { + getObjectByUUID: cold('d-', { d: { _links: { [LINK_NAME]: scopedEndpoint @@ -160,7 +160,7 @@ describe('ComColDataService', () => { it('should fetch the scope Community from the cache', () => { scheduler.schedule(() => service.getBrowseEndpoint(options).subscribe()); scheduler.flush(); - expect(objectCache.getObjectByID).toHaveBeenCalledWith(scopeID); + expect(objectCache.getObjectByUUID).toHaveBeenCalledWith(scopeID); }); it('should return the endpoint to fetch resources within the given scope', () => { diff --git a/src/app/core/data/comcol-data.service.ts b/src/app/core/data/comcol-data.service.ts index 3059d568df..68eb3e4880 100644 --- a/src/app/core/data/comcol-data.service.ts +++ b/src/app/core/data/comcol-data.service.ts @@ -49,7 +49,7 @@ export abstract class ComColDataService extends DataS ); const successResponses = responses.pipe( filter((response) => response.isSuccessful), - mergeMap(() => this.objectCache.getObjectByID(options.scopeID)), + mergeMap(() => this.objectCache.getObjectByUUID(options.scopeID)), map((nc: NormalizedCommunity) => nc._links[linkPath]), filter((href) => isNotEmpty(href)) ); diff --git a/src/app/core/data/data.service.ts b/src/app/core/data/data.service.ts index 77392a8528..6b3994f416 100644 --- a/src/app/core/data/data.service.ts +++ b/src/app/core/data/data.service.ts @@ -149,7 +149,7 @@ export abstract class DataService { findById(id: string): Observable> { const hrefObs = this.halService.getEndpoint(this.linkPath).pipe( - map((endpoint: string) => this.getIDHref(endpoint, encodeURIComponent(id)))) + map((endpoint: string) => this.getIDHref(endpoint, encodeURIComponent(id)))); hrefObs.pipe( find((href: string) => hasValue(href))) diff --git a/src/app/core/data/request.service.spec.ts b/src/app/core/data/request.service.spec.ts index 2a3f26f1bb..5807666d66 100644 --- a/src/app/core/data/request.service.spec.ts +++ b/src/app/core/data/request.service.spec.ts @@ -298,7 +298,7 @@ describe('RequestService', () => { describe('in the ObjectCache', () => { beforeEach(() => { (objectCache.hasBySelfLink as any).and.returnValue(true); - (objectCache.hasById as any).and.returnValue(true); + (objectCache.hasByUUID as any).and.returnValue(true); spyOn(serviceAsAny, 'hasByHref').and.returnValue(false); }); diff --git a/src/app/shared/mocks/mock-object-cache.service.ts b/src/app/shared/mocks/mock-object-cache.service.ts index d096cfdf5f..9e35a519ff 100644 --- a/src/app/shared/mocks/mock-object-cache.service.ts +++ b/src/app/shared/mocks/mock-object-cache.service.ts @@ -4,12 +4,12 @@ export function getMockObjectCacheService(): ObjectCacheService { return jasmine.createSpyObj('objectCacheService', [ 'add', 'remove', - 'getByID', + 'getByUUID', 'getBySelfLink', 'getRequestHrefBySelfLink', 'getRequestHrefByUUID', 'getList', - 'hasById', + 'hasByUUID', 'hasBySelfLink' ]);