mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 10:04:11 +00:00
[CST-5339] Rename ORCID service; add findById and findAllByHref
This commit is contained in:
@@ -174,7 +174,7 @@ import { ResearcherProfileService } from './profile/researcher-profile.service';
|
||||
import { ProfileClaimService } from '../profile-page/profile-claim/profile-claim.service';
|
||||
import { ResearcherProfile } from './profile/model/researcher-profile.model';
|
||||
import { OrcidQueueService } from './orcid/orcid-queue.service';
|
||||
import { OrcidHistoryService } from './orcid/orcid-history.service';
|
||||
import { OrcidHistoryDataService } from './orcid/orcid-history-data.service';
|
||||
import { OrcidQueue } from './orcid/model/orcid-queue.model';
|
||||
import { OrcidHistory } from './orcid/model/orcid-history.model';
|
||||
|
||||
@@ -306,7 +306,7 @@ const PROVIDERS = [
|
||||
ResearcherProfileService,
|
||||
ProfileClaimService,
|
||||
OrcidQueueService,
|
||||
OrcidHistoryService,
|
||||
OrcidHistoryDataService,
|
||||
];
|
||||
|
||||
/**
|
||||
|
@@ -22,6 +22,9 @@ import { HttpOptions } from '../dspace-rest/dspace-rest.service';
|
||||
import { CoreState } from '../core-state.model';
|
||||
import { RestRequest } from '../data/rest-request.model';
|
||||
import { sendRequest } from '../shared/request.operators';
|
||||
import { FollowLinkConfig } from '../../shared/utils/follow-link-config.model';
|
||||
import { FindListOptions } from '../data/find-list-options.model';
|
||||
import { PaginatedList } from '../data/paginated-list.model';
|
||||
|
||||
/**
|
||||
* A private DataService implementation to delegate specific methods to.
|
||||
@@ -48,7 +51,7 @@ class OrcidHistoryServiceImpl extends DataService<OrcidHistory> {
|
||||
*/
|
||||
@Injectable()
|
||||
@dataService(ORCID_HISTORY)
|
||||
export class OrcidHistoryService {
|
||||
export class OrcidHistoryDataService {
|
||||
|
||||
dataService: OrcidHistoryServiceImpl;
|
||||
|
||||
@@ -89,4 +92,35 @@ export class OrcidHistoryService {
|
||||
return this.halService.getEndpoint(this.dataService.linkPath);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an observable of {@link RemoteData} of an object, based on its ID, with a list of
|
||||
* {@link FollowLinkConfig}, to automatically resolve {@link HALLink}s of the object
|
||||
* @param id ID of object we want to retrieve
|
||||
* @param useCachedVersionIfAvailable If this is true, the request will only be sent if there's
|
||||
* no valid cached version. Defaults to true
|
||||
* @param reRequestOnStale Whether or not the request should automatically be re-
|
||||
* requested after the response becomes stale
|
||||
* @param linksToFollow List of {@link FollowLinkConfig} that indicate which
|
||||
* {@link HALLink}s should be automatically resolved
|
||||
*/
|
||||
findById(id: string, useCachedVersionIfAvailable = true, reRequestOnStale = true, ...linksToFollow: FollowLinkConfig<OrcidHistory>[]): Observable<RemoteData<OrcidHistory>> {
|
||||
return this.dataService.findById(id, useCachedVersionIfAvailable, reRequestOnStale, ...linksToFollow);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a list of observables of {@link RemoteData} of {@link OrcidHistory}s, based on an href, with a list of {@link FollowLinkConfig},
|
||||
* to automatically resolve {@link HALLink}s of the {@link OrcidHistory}
|
||||
* @param href The url of object we want to retrieve
|
||||
* @param findListOptions Find list options object
|
||||
* @param useCachedVersionIfAvailable If this is true, the request will only be sent if there's
|
||||
* no valid cached version. Defaults to true
|
||||
* @param reRequestOnStale Whether or not the request should automatically be re-
|
||||
* requested after the response becomes stale
|
||||
* @param linksToFollow List of {@link FollowLinkConfig} that indicate which
|
||||
* {@link HALLink}s should be automatically resolved
|
||||
*/
|
||||
findAllByHref(href: string, findListOptions: FindListOptions = {}, useCachedVersionIfAvailable = true, reRequestOnStale = true, ...linksToFollow: FollowLinkConfig<OrcidHistory>[]): Observable<RemoteData<PaginatedList<OrcidHistory>>> {
|
||||
return this.dataService.findAllByHref(href, findListOptions, useCachedVersionIfAvailable, reRequestOnStale, ...linksToFollow);
|
||||
}
|
||||
|
||||
}
|
@@ -9,7 +9,7 @@ import { PaginationService } from '../../../core/pagination/pagination.service';
|
||||
import { PaginationServiceStub } from '../../../shared/testing/pagination-service.stub';
|
||||
import { NotificationsService } from '../../../shared/notifications/notifications.service';
|
||||
import { NotificationsServiceStub } from '../../../shared/testing/notifications-service.stub';
|
||||
import { OrcidHistoryService } from '../../../core/orcid/orcid-history.service';
|
||||
import { OrcidHistoryDataService } from '../../../core/orcid/orcid-history-data.service';
|
||||
import { OrcidQueue } from '../../../core/orcid/model/orcid-queue.model';
|
||||
import { createSuccessfulRemoteDataObject$ } from '../../../shared/remote-data.utils';
|
||||
import { createPaginatedList } from '../../../shared/testing/utils.test';
|
||||
@@ -115,7 +115,7 @@ describe('OrcidQueueComponent test suite', () => {
|
||||
declarations: [OrcidQueueComponent],
|
||||
providers: [
|
||||
{ provide: OrcidQueueService, useValue: orcidQueueServiceSpy },
|
||||
{ provide: OrcidHistoryService, useValue: {} },
|
||||
{ provide: OrcidHistoryDataService, useValue: {} },
|
||||
{ provide: PaginationService, useValue: new PaginationServiceStub() },
|
||||
{ provide: NotificationsService, useValue: new NotificationsServiceStub() },
|
||||
],
|
||||
|
@@ -6,7 +6,7 @@ import { PaginatedList } from '../../../core/data/paginated-list.model';
|
||||
import { RemoteData } from '../../../core/data/remote-data';
|
||||
import { OrcidHistory } from '../../../core/orcid/model/orcid-history.model';
|
||||
import { OrcidQueue } from '../../../core/orcid/model/orcid-queue.model';
|
||||
import { OrcidHistoryService } from '../../../core/orcid/orcid-history.service';
|
||||
import { OrcidHistoryDataService } from '../../../core/orcid/orcid-history-data.service';
|
||||
import { OrcidQueueService } from '../../../core/orcid/orcid-queue.service';
|
||||
import { PaginationService } from '../../../core/pagination/pagination.service';
|
||||
import { getFinishedRemoteData, getFirstCompletedRemoteData } from '../../../core/shared/operators';
|
||||
@@ -61,7 +61,7 @@ export class OrcidQueueComponent implements OnInit, OnDestroy {
|
||||
protected translateService: TranslateService,
|
||||
private paginationService: PaginationService,
|
||||
private notificationsService: NotificationsService,
|
||||
private orcidHistoryService: OrcidHistoryService,
|
||||
private orcidHistoryService: OrcidHistoryDataService,
|
||||
) { }
|
||||
|
||||
ngOnInit(): void {
|
||||
|
Reference in New Issue
Block a user