From 7bda63bc5a78815ae2dea58829e42e5bc2adb030 Mon Sep 17 00:00:00 2001 From: Michael W Spalti <mspalti@gmail.com> Date: Sun, 22 Sep 2019 21:51:04 -0700 Subject: [PATCH] Renamed cache property and replaced conditional with hasValue. --- src/app/core/data/data.service.ts | 14 +++++++------- .../core/submission/workflowitem-data.service.ts | 2 +- .../core/submission/workspaceitem-data.service.ts | 2 +- src/app/core/tasks/claimed-task-data.service.ts | 2 +- src/app/core/tasks/pool-task-data.service.ts | 2 +- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/app/core/data/data.service.ts b/src/app/core/data/data.service.ts index aad527ea7a..8362358d61 100644 --- a/src/app/core/data/data.service.ts +++ b/src/app/core/data/data.service.ts @@ -52,7 +52,7 @@ export abstract class DataService<T extends CacheableObject> { /** * Allows subclasses to reset the response cache time. */ - protected resetMsToLive: number; + protected responseMsToLive: number; public abstract getBrowseEndpoint(options: FindAllOptions, linkPath?: string): Observable<string> @@ -134,8 +134,8 @@ export abstract class DataService<T extends CacheableObject> { first((href: string) => hasValue(href))) .subscribe((href: string) => { const request = new FindAllRequest(this.requestService.generateRequestId(), href, options); - if (this.resetMsToLive !== undefined) { - request.responseMsToLive = this.resetMsToLive; + if (hasValue(this.responseMsToLive)) { + request.responseMsToLive = this.responseMsToLive; } this.requestService.configure(request); }); @@ -160,8 +160,8 @@ export abstract class DataService<T extends CacheableObject> { find((href: string) => hasValue(href))) .subscribe((href: string) => { const request = new FindByIDRequest(this.requestService.generateRequestId(), href, id); - if (this.resetMsToLive !== undefined) { - request.responseMsToLive = this.resetMsToLive; + if (hasValue(this.responseMsToLive)) { + request.responseMsToLive = this.responseMsToLive; } this.requestService.configure(request); }); @@ -171,8 +171,8 @@ export abstract class DataService<T extends CacheableObject> { findByHref(href: string, options?: HttpOptions): Observable<RemoteData<T>> { const request = new GetRequest(this.requestService.generateRequestId(), href, null, options); - if (this.resetMsToLive !== undefined) { - request.responseMsToLive = this.resetMsToLive; + if (hasValue(this.responseMsToLive)) { + request.responseMsToLive = this.responseMsToLive; } this.requestService.configure(request); return this.rdbService.buildSingle<T>(href); diff --git a/src/app/core/submission/workflowitem-data.service.ts b/src/app/core/submission/workflowitem-data.service.ts index b641531892..218de9c81a 100644 --- a/src/app/core/submission/workflowitem-data.service.ts +++ b/src/app/core/submission/workflowitem-data.service.ts @@ -20,7 +20,7 @@ import { DSOChangeAnalyzer } from '../data/dso-change-analyzer.service'; @Injectable() export class WorkflowItemDataService extends DataService<WorkflowItem> { protected linkPath = 'workflowitems'; - protected resetMsToLive = 0; + protected responseMsToLive = 0; constructor( protected comparator: DSOChangeAnalyzer<WorkflowItem>, diff --git a/src/app/core/submission/workspaceitem-data.service.ts b/src/app/core/submission/workspaceitem-data.service.ts index b49cb065bd..70e07edd5e 100644 --- a/src/app/core/submission/workspaceitem-data.service.ts +++ b/src/app/core/submission/workspaceitem-data.service.ts @@ -20,7 +20,7 @@ import { WorkspaceItem } from './models/workspaceitem.model'; @Injectable() export class WorkspaceitemDataService extends DataService<WorkspaceItem> { protected linkPath = 'workspaceitems'; - protected resetMsToLive = 0; + protected responseMsToLive = 0; constructor( protected comparator: DSOChangeAnalyzer<WorkspaceItem>, diff --git a/src/app/core/tasks/claimed-task-data.service.ts b/src/app/core/tasks/claimed-task-data.service.ts index 546c4343b6..fecffaabe1 100644 --- a/src/app/core/tasks/claimed-task-data.service.ts +++ b/src/app/core/tasks/claimed-task-data.service.ts @@ -22,7 +22,7 @@ import { ProcessTaskResponse } from './models/process-task-response'; @Injectable() export class ClaimedTaskDataService extends TasksService<ClaimedTask> { - protected resetMsToLive = 0; + protected responseMsToLive = 0; /** * The endpoint link name diff --git a/src/app/core/tasks/pool-task-data.service.ts b/src/app/core/tasks/pool-task-data.service.ts index ee3568e585..62689c4cfc 100644 --- a/src/app/core/tasks/pool-task-data.service.ts +++ b/src/app/core/tasks/pool-task-data.service.ts @@ -27,7 +27,7 @@ export class PoolTaskDataService extends TasksService<PoolTask> { */ protected linkPath = 'pooltasks'; - protected resetMsToLive = 0; + protected responseMsToLive = 0; /** * Initialize instance variables -- GitLab