Renamed cache property and replaced conditional with hasValue.

This commit is contained in:
Michael W Spalti
2019-09-22 21:51:04 -07:00
parent 8ae5e415db
commit 7bda63bc5a
5 changed files with 11 additions and 11 deletions

View File

@@ -52,7 +52,7 @@ export abstract class DataService<T extends CacheableObject> {
/** /**
* Allows subclasses to reset the response cache time. * Allows subclasses to reset the response cache time.
*/ */
protected resetMsToLive: number; protected responseMsToLive: number;
public abstract getBrowseEndpoint(options: FindAllOptions, linkPath?: string): Observable<string> 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))) first((href: string) => hasValue(href)))
.subscribe((href: string) => { .subscribe((href: string) => {
const request = new FindAllRequest(this.requestService.generateRequestId(), href, options); const request = new FindAllRequest(this.requestService.generateRequestId(), href, options);
if (this.resetMsToLive !== undefined) { if (hasValue(this.responseMsToLive)) {
request.responseMsToLive = this.resetMsToLive; request.responseMsToLive = this.responseMsToLive;
} }
this.requestService.configure(request); this.requestService.configure(request);
}); });
@@ -160,8 +160,8 @@ export abstract class DataService<T extends CacheableObject> {
find((href: string) => hasValue(href))) find((href: string) => hasValue(href)))
.subscribe((href: string) => { .subscribe((href: string) => {
const request = new FindByIDRequest(this.requestService.generateRequestId(), href, id); const request = new FindByIDRequest(this.requestService.generateRequestId(), href, id);
if (this.resetMsToLive !== undefined) { if (hasValue(this.responseMsToLive)) {
request.responseMsToLive = this.resetMsToLive; request.responseMsToLive = this.responseMsToLive;
} }
this.requestService.configure(request); this.requestService.configure(request);
}); });
@@ -171,8 +171,8 @@ export abstract class DataService<T extends CacheableObject> {
findByHref(href: string, options?: HttpOptions): Observable<RemoteData<T>> { findByHref(href: string, options?: HttpOptions): Observable<RemoteData<T>> {
const request = new GetRequest(this.requestService.generateRequestId(), href, null, options); const request = new GetRequest(this.requestService.generateRequestId(), href, null, options);
if (this.resetMsToLive !== undefined) { if (hasValue(this.responseMsToLive)) {
request.responseMsToLive = this.resetMsToLive; request.responseMsToLive = this.responseMsToLive;
} }
this.requestService.configure(request); this.requestService.configure(request);
return this.rdbService.buildSingle<T>(href); return this.rdbService.buildSingle<T>(href);

View File

@@ -20,7 +20,7 @@ import { DSOChangeAnalyzer } from '../data/dso-change-analyzer.service';
@Injectable() @Injectable()
export class WorkflowItemDataService extends DataService<WorkflowItem> { export class WorkflowItemDataService extends DataService<WorkflowItem> {
protected linkPath = 'workflowitems'; protected linkPath = 'workflowitems';
protected resetMsToLive = 0; protected responseMsToLive = 0;
constructor( constructor(
protected comparator: DSOChangeAnalyzer<WorkflowItem>, protected comparator: DSOChangeAnalyzer<WorkflowItem>,

View File

@@ -20,7 +20,7 @@ import { WorkspaceItem } from './models/workspaceitem.model';
@Injectable() @Injectable()
export class WorkspaceitemDataService extends DataService<WorkspaceItem> { export class WorkspaceitemDataService extends DataService<WorkspaceItem> {
protected linkPath = 'workspaceitems'; protected linkPath = 'workspaceitems';
protected resetMsToLive = 0; protected responseMsToLive = 0;
constructor( constructor(
protected comparator: DSOChangeAnalyzer<WorkspaceItem>, protected comparator: DSOChangeAnalyzer<WorkspaceItem>,

View File

@@ -22,7 +22,7 @@ import { ProcessTaskResponse } from './models/process-task-response';
@Injectable() @Injectable()
export class ClaimedTaskDataService extends TasksService<ClaimedTask> { export class ClaimedTaskDataService extends TasksService<ClaimedTask> {
protected resetMsToLive = 0; protected responseMsToLive = 0;
/** /**
* The endpoint link name * The endpoint link name

View File

@@ -27,7 +27,7 @@ export class PoolTaskDataService extends TasksService<PoolTask> {
*/ */
protected linkPath = 'pooltasks'; protected linkPath = 'pooltasks';
protected resetMsToLive = 0; protected responseMsToLive = 0;
/** /**
* Initialize instance variables * Initialize instance variables