workspaceitem-data.service.ts (dspace-angular-dspace-7.0) | : | workspaceitem-data.service.ts (dspace-angular-dspace-7.1) | ||
---|---|---|---|---|
skipping to change at line 15 | skipping to change at line 15 | |||
import { dataService } from '../cache/builders/build-decorators'; | import { dataService } from '../cache/builders/build-decorators'; | |||
import { RemoteDataBuildService } from '../cache/builders/remote-data-build.serv ice'; | import { RemoteDataBuildService } from '../cache/builders/remote-data-build.serv ice'; | |||
import { CoreState } from '../core.reducers'; | import { CoreState } from '../core.reducers'; | |||
import { DataService } from '../data/data.service'; | import { DataService } from '../data/data.service'; | |||
import { RequestService } from '../data/request.service'; | import { RequestService } from '../data/request.service'; | |||
import { HALEndpointService } from '../shared/hal-endpoint.service'; | import { HALEndpointService } from '../shared/hal-endpoint.service'; | |||
import { NotificationsService } from '../../shared/notifications/notifications.s ervice'; | import { NotificationsService } from '../../shared/notifications/notifications.s ervice'; | |||
import { ObjectCacheService } from '../cache/object-cache.service'; | import { ObjectCacheService } from '../cache/object-cache.service'; | |||
import { DSOChangeAnalyzer } from '../data/dso-change-analyzer.service'; | import { DSOChangeAnalyzer } from '../data/dso-change-analyzer.service'; | |||
import { WorkspaceItem } from './models/workspaceitem.model'; | import { WorkspaceItem } from './models/workspaceitem.model'; | |||
import { Observable } from 'rxjs'; | ||||
import { RemoteData } from '../data/remote-data'; | ||||
import { FindListOptions } from '../data/request.models'; | ||||
import { FollowLinkConfig } from '../../shared/utils/follow-link-config.model'; | ||||
import { RequestParam } from '../cache/models/request-param.model'; | ||||
/** | /** | |||
* A service that provides methods to make REST requests with workspaceitems end point. | * A service that provides methods to make REST requests with workspaceitems end point. | |||
*/ | */ | |||
@Injectable() | @Injectable() | |||
@dataService(WorkspaceItem.type) | @dataService(WorkspaceItem.type) | |||
export class WorkspaceitemDataService extends DataService<WorkspaceItem> { | export class WorkspaceitemDataService extends DataService<WorkspaceItem> { | |||
protected linkPath = 'workspaceitems'; | protected linkPath = 'workspaceitems'; | |||
protected searchByItemLinkPath = 'item'; | ||||
constructor( | constructor( | |||
protected comparator: DSOChangeAnalyzer<WorkspaceItem>, | protected comparator: DSOChangeAnalyzer<WorkspaceItem>, | |||
protected halService: HALEndpointService, | protected halService: HALEndpointService, | |||
protected http: HttpClient, | protected http: HttpClient, | |||
protected notificationsService: NotificationsService, | protected notificationsService: NotificationsService, | |||
protected requestService: RequestService, | protected requestService: RequestService, | |||
protected rdbService: RemoteDataBuildService, | protected rdbService: RemoteDataBuildService, | |||
protected objectCache: ObjectCacheService, | protected objectCache: ObjectCacheService, | |||
protected store: Store<CoreState>) { | protected store: Store<CoreState>) { | |||
super(); | super(); | |||
} | } | |||
/** | ||||
* Return the WorkspaceItem object found through the UUID of an item | ||||
* | ||||
* @param uuid The uuid of the item | ||||
* @param useCachedVersionIfAvailable If this is true, the request will only b | ||||
e sent if there's | ||||
* no valid cached version. Defaults to tru | ||||
e | ||||
* @param reRequestOnStale Whether or not the request should automa | ||||
tically be re- | ||||
* requested after the response becomes sta | ||||
le | ||||
* @param options The {@link FindListOptions} object | ||||
* @param linksToFollow List of {@link FollowLinkConfig} that indicate which | ||||
{@link HALLink}s should be automatically resolved | ||||
*/ | ||||
public findByItem(uuid: string, useCachedVersionIfAvailable = false, reRequest | ||||
OnStale = true, options: FindListOptions = {}, ...linksToFollow: FollowLinkConfi | ||||
g<WorkspaceItem>[]): Observable<RemoteData<WorkspaceItem>> { | ||||
const findListOptions = new FindListOptions(); | ||||
findListOptions.searchParams = [new RequestParam('uuid', encodeURIComponent( | ||||
uuid))]; | ||||
const href$ = this.getSearchByHref(this.searchByItemLinkPath, findListOption | ||||
s, ...linksToFollow); | ||||
return this.findByHref(href$, useCachedVersionIfAvailable, reRequestOnStale, | ||||
...linksToFollow); | ||||
} | ||||
} | } | |||
End of changes. 3 change blocks. | ||||
0 lines changed or deleted | 34 lines changed or added |