93803: Rename findAllByHref to findListByHref

To avoid confusion with FindAllData:
- findAll is a "feature" to retrieve all resources from the endpoint itself ~ a plain GET
- findAllByHref is retrieves lists of resources in general
This commit is contained in:
Yura Bondarenko
2022-08-24 17:05:08 +02:00
parent ad316f7316
commit 05b131edb9
49 changed files with 111 additions and 111 deletions

View File

@@ -177,7 +177,7 @@ describe('EPersonFormComponent', () => {
}); });
groupsDataService = jasmine.createSpyObj('groupsDataService', { groupsDataService = jasmine.createSpyObj('groupsDataService', {
findAllByHref: createSuccessfulRemoteDataObject$(createPaginatedList([])), findListByHref: createSuccessfulRemoteDataObject$(createPaginatedList([])),
getGroupRegistryRouterLink: '' getGroupRegistryRouterLink: ''
}); });

View File

@@ -265,7 +265,7 @@ export class EPersonFormComponent implements OnInit, OnDestroy {
this.formGroup = this.formBuilderService.createFormGroup(this.formModel); this.formGroup = this.formBuilderService.createFormGroup(this.formModel);
this.subs.push(this.epersonService.getActiveEPerson().subscribe((eperson: EPerson) => { this.subs.push(this.epersonService.getActiveEPerson().subscribe((eperson: EPerson) => {
if (eperson != null) { if (eperson != null) {
this.groups = this.groupsDataService.findAllByHref(eperson._links.groups.href, { this.groups = this.groupsDataService.findListByHref(eperson._links.groups.href, {
currentPage: 1, currentPage: 1,
elementsPerPage: this.config.pageSize elementsPerPage: this.config.pageSize
}); });
@@ -297,7 +297,7 @@ export class EPersonFormComponent implements OnInit, OnDestroy {
}), }),
switchMap(([eperson, findListOptions]) => { switchMap(([eperson, findListOptions]) => {
if (eperson != null) { if (eperson != null) {
return this.groupsDataService.findAllByHref(eperson._links.groups.href, findListOptions, true, true, followLink('object')); return this.groupsDataService.findListByHref(eperson._links.groups.href, findListOptions, true, true, followLink('object'));
} }
return observableOf(undefined); return observableOf(undefined);
}) })
@@ -554,7 +554,7 @@ export class EPersonFormComponent implements OnInit, OnDestroy {
*/ */
private updateGroups(options) { private updateGroups(options) {
this.subs.push(this.epersonService.getActiveEPerson().subscribe((eperson: EPerson) => { this.subs.push(this.epersonService.getActiveEPerson().subscribe((eperson: EPerson) => {
this.groups = this.groupsDataService.findAllByHref(eperson._links.groups.href, options); this.groups = this.groupsDataService.findListByHref(eperson._links.groups.href, options);
})); }));
} }
} }

View File

@@ -53,7 +53,7 @@ describe('MembersListComponent', () => {
activeGroup: activeGroup, activeGroup: activeGroup,
epersonMembers: epersonMembers, epersonMembers: epersonMembers,
subgroupMembers: subgroupMembers, subgroupMembers: subgroupMembers,
findAllByHref(href: string): Observable<RemoteData<PaginatedList<EPerson>>> { findListByHref(href: string): Observable<RemoteData<PaginatedList<EPerson>>> {
return createSuccessfulRemoteDataObject$(buildPaginatedList<EPerson>(new PageInfo(), groupsDataServiceStub.getEPersonMembers())); return createSuccessfulRemoteDataObject$(buildPaginatedList<EPerson>(new PageInfo(), groupsDataServiceStub.getEPersonMembers()));
}, },
searchByScope(scope: string, query: string): Observable<RemoteData<PaginatedList<EPerson>>> { searchByScope(scope: string, query: string): Observable<RemoteData<PaginatedList<EPerson>>> {

View File

@@ -129,7 +129,7 @@ export class MembersListComponent implements OnInit, OnDestroy {
this.subs.set(SubKey.MembersDTO, this.subs.set(SubKey.MembersDTO,
this.paginationService.getCurrentPagination(this.config.id, this.config).pipe( this.paginationService.getCurrentPagination(this.config.id, this.config).pipe(
switchMap((currentPagination) => { switchMap((currentPagination) => {
return this.ePersonDataService.findAllByHref(this.groupBeingEdited._links.epersons.href, { return this.ePersonDataService.findListByHref(this.groupBeingEdited._links.epersons.href, {
currentPage: currentPagination.currentPage, currentPage: currentPagination.currentPage,
elementsPerPage: currentPagination.pageSize elementsPerPage: currentPagination.pageSize
} }
@@ -171,7 +171,7 @@ export class MembersListComponent implements OnInit, OnDestroy {
return this.groupDataService.getActiveGroup().pipe(take(1), return this.groupDataService.getActiveGroup().pipe(take(1),
mergeMap((group: Group) => { mergeMap((group: Group) => {
if (group != null) { if (group != null) {
return this.ePersonDataService.findAllByHref(group._links.epersons.href, { return this.ePersonDataService.findListByHref(group._links.epersons.href, {
currentPage: 1, currentPage: 1,
elementsPerPage: 9999 elementsPerPage: 9999
}, false) }, false)

View File

@@ -65,7 +65,7 @@ describe('SubgroupsListComponent', () => {
getSubgroups(): Group { getSubgroups(): Group {
return this.activeGroup; return this.activeGroup;
}, },
findAllByHref(href: string): Observable<RemoteData<PaginatedList<Group>>> { findListByHref(href: string): Observable<RemoteData<PaginatedList<Group>>> {
return this.subgroups$.pipe( return this.subgroups$.pipe(
map((currentGroups: Group[]) => { map((currentGroups: Group[]) => {
return createSuccessfulRemoteDataObject(buildPaginatedList<Group>(new PageInfo(), currentGroups)); return createSuccessfulRemoteDataObject(buildPaginatedList<Group>(new PageInfo(), currentGroups));

View File

@@ -115,7 +115,7 @@ export class SubgroupsListComponent implements OnInit, OnDestroy {
this.subs.set( this.subs.set(
SubKey.Members, SubKey.Members,
this.paginationService.getCurrentPagination(this.config.id, this.config).pipe( this.paginationService.getCurrentPagination(this.config.id, this.config).pipe(
switchMap((config) => this.groupDataService.findAllByHref(this.groupBeingEdited._links.subgroups.href, { switchMap((config) => this.groupDataService.findListByHref(this.groupBeingEdited._links.subgroups.href, {
currentPage: config.currentPage, currentPage: config.currentPage,
elementsPerPage: config.pageSize elementsPerPage: config.pageSize
}, },
@@ -139,7 +139,7 @@ export class SubgroupsListComponent implements OnInit, OnDestroy {
if (activeGroup.uuid === possibleSubgroup.uuid) { if (activeGroup.uuid === possibleSubgroup.uuid) {
return observableOf(false); return observableOf(false);
} else { } else {
return this.groupDataService.findAllByHref(activeGroup._links.subgroups.href, { return this.groupDataService.findListByHref(activeGroup._links.subgroups.href, {
currentPage: 1, currentPage: 1,
elementsPerPage: 9999 elementsPerPage: 9999
}) })

View File

@@ -69,7 +69,7 @@ describe('GroupRegistryComponent', () => {
mockGroups = [GroupMock, GroupMock2]; mockGroups = [GroupMock, GroupMock2];
mockEPeople = [EPersonMock, EPersonMock2]; mockEPeople = [EPersonMock, EPersonMock2];
ePersonDataServiceStub = { ePersonDataServiceStub = {
findAllByHref(href: string): Observable<RemoteData<PaginatedList<EPerson>>> { findListByHref(href: string): Observable<RemoteData<PaginatedList<EPerson>>> {
switch (href) { switch (href) {
case 'https://dspace.4science.it/dspace-spring-rest/api/eperson/groups/testgroupid2/epersons': case 'https://dspace.4science.it/dspace-spring-rest/api/eperson/groups/testgroupid2/epersons':
return createSuccessfulRemoteDataObject$(buildPaginatedList(new PageInfo({ return createSuccessfulRemoteDataObject$(buildPaginatedList(new PageInfo({
@@ -97,7 +97,7 @@ describe('GroupRegistryComponent', () => {
}; };
groupsDataServiceStub = { groupsDataServiceStub = {
allGroups: mockGroups, allGroups: mockGroups,
findAllByHref(href: string): Observable<RemoteData<PaginatedList<Group>>> { findListByHref(href: string): Observable<RemoteData<PaginatedList<Group>>> {
switch (href) { switch (href) {
case 'https://dspace.4science.it/dspace-spring-rest/api/eperson/groups/testgroupid2/groups': case 'https://dspace.4science.it/dspace-spring-rest/api/eperson/groups/testgroupid2/groups':
return createSuccessfulRemoteDataObject$(buildPaginatedList(new PageInfo({ return createSuccessfulRemoteDataObject$(buildPaginatedList(new PageInfo({

View File

@@ -213,7 +213,7 @@ export class GroupsRegistryComponent implements OnInit, OnDestroy {
* @param group * @param group
*/ */
getMembers(group: Group): Observable<RemoteData<PaginatedList<EPerson>>> { getMembers(group: Group): Observable<RemoteData<PaginatedList<EPerson>>> {
return this.ePersonDataService.findAllByHref(group._links.epersons.href).pipe(getFirstSucceededRemoteData()); return this.ePersonDataService.findListByHref(group._links.epersons.href).pipe(getFirstSucceededRemoteData());
} }
/** /**
@@ -221,7 +221,7 @@ export class GroupsRegistryComponent implements OnInit, OnDestroy {
* @param group * @param group
*/ */
getSubgroups(group: Group): Observable<RemoteData<PaginatedList<Group>>> { getSubgroups(group: Group): Observable<RemoteData<PaginatedList<Group>>> {
return this.groupService.findAllByHref(group._links.subgroups.href).pipe(getFirstSucceededRemoteData()); return this.groupService.findListByHref(group._links.subgroups.href).pipe(getFirstSucceededRemoteData());
} }
/** /**

View File

@@ -94,7 +94,7 @@ describe('CollectionItemMapperComponent', () => {
const emptyList = createSuccessfulRemoteDataObject(createPaginatedList([])); const emptyList = createSuccessfulRemoteDataObject(createPaginatedList([]));
const itemDataServiceStub = { const itemDataServiceStub = {
mapToCollection: () => createSuccessfulRemoteDataObject$({}), mapToCollection: () => createSuccessfulRemoteDataObject$({}),
findAllByHref: () => observableOf(emptyList) findListByHref: () => observableOf(emptyList),
}; };
const activatedRouteStub = { const activatedRouteStub = {
parent: { parent: {
@@ -152,7 +152,7 @@ describe('CollectionItemMapperComponent', () => {
}); });
const groupDataService = jasmine.createSpyObj('groupsDataService', { const groupDataService = jasmine.createSpyObj('groupsDataService', {
findAllByHref: createSuccessfulRemoteDataObject$(createPaginatedList([])), findListByHref: createSuccessfulRemoteDataObject$(createPaginatedList([])),
getGroupRegistryRouterLink: '', getGroupRegistryRouterLink: '',
getUUIDFromString: '', getUUIDFromString: '',
}); });

View File

@@ -143,7 +143,7 @@ export class CollectionItemMapperComponent implements OnInit {
if (shouldUpdate === true) { if (shouldUpdate === true) {
this.shouldUpdate$.next(false); this.shouldUpdate$.next(false);
} }
return this.itemDataService.findAllByHref(collectionRD.payload._links.mappedItems.href, Object.assign(options, { return this.itemDataService.findListByHref(collectionRD.payload._links.mappedItems.href, Object.assign(options, {
sort: this.defaultSortOptions sort: this.defaultSortOptions
}),!shouldUpdate, false, followLink('owningCollection')).pipe( }),!shouldUpdate, false, followLink('owningCollection')).pipe(
getAllSucceededRemoteData() getAllSucceededRemoteData()

View File

@@ -135,7 +135,7 @@ describe('CommunityPageSubCollectionList Component', () => {
}); });
const groupDataService = jasmine.createSpyObj('groupsDataService', { const groupDataService = jasmine.createSpyObj('groupsDataService', {
findAllByHref: createSuccessfulRemoteDataObject$(createPaginatedList([])), findListByHref: createSuccessfulRemoteDataObject$(createPaginatedList([])),
getGroupRegistryRouterLink: '', getGroupRegistryRouterLink: '',
getUUIDFromString: '', getUUIDFromString: '',
}); });

View File

@@ -131,7 +131,7 @@ describe('CommunityPageSubCommunityListComponent Component', () => {
}); });
const groupDataService = jasmine.createSpyObj('groupsDataService', { const groupDataService = jasmine.createSpyObj('groupsDataService', {
findAllByHref: createSuccessfulRemoteDataObject$(createPaginatedList([])), findListByHref: createSuccessfulRemoteDataObject$(createPaginatedList([])),
getGroupRegistryRouterLink: '', getGroupRegistryRouterLink: '',
getUUIDFromString: '', getUUIDFromString: '',
}); });

View File

@@ -139,13 +139,13 @@ describe('BrowseService', () => {
}); });
describe('when getBrowseEntriesFor is called with a valid browse definition id', () => { describe('when getBrowseEntriesFor is called with a valid browse definition id', () => {
it('should call hrefOnlyDataService.findAllByHref with the expected href', () => { it('should call hrefOnlyDataService.findListByHref with the expected href', () => {
const expected = browseDefinitions[1]._links.entries.href; const expected = browseDefinitions[1]._links.entries.href;
scheduler.schedule(() => service.getBrowseEntriesFor(new BrowseEntrySearchOptions(browseDefinitions[1].id)).subscribe()); scheduler.schedule(() => service.getBrowseEntriesFor(new BrowseEntrySearchOptions(browseDefinitions[1].id)).subscribe());
scheduler.flush(); scheduler.flush();
expect(getFirstUsedArgumentOfSpyMethod(hrefOnlyDataService.findAllByHref)).toBeObservable(cold('(a|)', { expect(getFirstUsedArgumentOfSpyMethod(hrefOnlyDataService.findListByHref)).toBeObservable(cold('(a|)', {
a: expected a: expected
})); }));
}); });
@@ -153,20 +153,20 @@ describe('BrowseService', () => {
}); });
describe('when findList is called with a valid browse definition id', () => { describe('when findList is called with a valid browse definition id', () => {
it('should call hrefOnlyDataService.findAllByHref with the expected href', () => { it('should call hrefOnlyDataService.findListByHref with the expected href', () => {
const expected = browseDefinitions[1]._links.items.href + '?filterValue=' + encodeURIComponent(mockAuthorName); const expected = browseDefinitions[1]._links.items.href + '?filterValue=' + encodeURIComponent(mockAuthorName);
scheduler.schedule(() => service.getBrowseItemsFor(mockAuthorName, undefined, new BrowseEntrySearchOptions(browseDefinitions[1].id)).subscribe()); scheduler.schedule(() => service.getBrowseItemsFor(mockAuthorName, undefined, new BrowseEntrySearchOptions(browseDefinitions[1].id)).subscribe());
scheduler.flush(); scheduler.flush();
expect(getFirstUsedArgumentOfSpyMethod(hrefOnlyDataService.findAllByHref)).toBeObservable(cold('(a|)', { expect(getFirstUsedArgumentOfSpyMethod(hrefOnlyDataService.findListByHref)).toBeObservable(cold('(a|)', {
a: expected a: expected
})); }));
}); });
}); });
describe('when getBrowseItemsFor is called with a valid filter value and authority key', () => { describe('when getBrowseItemsFor is called with a valid filter value and authority key', () => {
it('should call hrefOnlyDataService.findAllByHref with the expected href', () => { it('should call hrefOnlyDataService.findListByHref with the expected href', () => {
const expected = browseDefinitions[1]._links.items.href + const expected = browseDefinitions[1]._links.items.href +
'?filterValue=' + encodeURIComponent(mockAuthorName) + '?filterValue=' + encodeURIComponent(mockAuthorName) +
'&filterAuthority=' + encodeURIComponent(mockAuthorityKey); '&filterAuthority=' + encodeURIComponent(mockAuthorityKey);
@@ -174,7 +174,7 @@ describe('BrowseService', () => {
scheduler.schedule(() => service.getBrowseItemsFor(mockAuthorName, mockAuthorityKey, new BrowseEntrySearchOptions(browseDefinitions[1].id)).subscribe()); scheduler.schedule(() => service.getBrowseItemsFor(mockAuthorName, mockAuthorityKey, new BrowseEntrySearchOptions(browseDefinitions[1].id)).subscribe());
scheduler.flush(); scheduler.flush();
expect(getFirstUsedArgumentOfSpyMethod(hrefOnlyDataService.findAllByHref)).toBeObservable(cold('(a|)', { expect(getFirstUsedArgumentOfSpyMethod(hrefOnlyDataService.findListByHref)).toBeObservable(cold('(a|)', {
a: expected a: expected
})); }));
}); });
@@ -267,11 +267,11 @@ describe('BrowseService', () => {
describe('when getFirstItemFor is called with a valid browse definition id', () => { describe('when getFirstItemFor is called with a valid browse definition id', () => {
const expectedURL = browseDefinitions[1]._links.items.href + '?page=0&size=1'; const expectedURL = browseDefinitions[1]._links.items.href + '?page=0&size=1';
it('should call hrefOnlyDataService.findAllByHref with the expected href', () => { it('should call hrefOnlyDataService.findListByHref with the expected href', () => {
scheduler.schedule(() => service.getFirstItemFor(browseDefinitions[1].id).subscribe()); scheduler.schedule(() => service.getFirstItemFor(browseDefinitions[1].id).subscribe());
scheduler.flush(); scheduler.flush();
expect(getFirstUsedArgumentOfSpyMethod(hrefOnlyDataService.findAllByHref)).toBeObservable(cold('(a|)', { expect(getFirstUsedArgumentOfSpyMethod(hrefOnlyDataService.findListByHref)).toBeObservable(cold('(a|)', {
a: expectedURL a: expectedURL
})); }));
}); });

View File

@@ -96,7 +96,7 @@ export class BrowseService {
return href; return href;
}) })
); );
return this.hrefOnlyDataService.findAllByHref<BrowseEntry>(href$); return this.hrefOnlyDataService.findListByHref<BrowseEntry>(href$);
} }
/** /**
@@ -141,7 +141,7 @@ export class BrowseService {
return href; return href;
}), }),
); );
return this.hrefOnlyDataService.findAllByHref<Item>(href$); return this.hrefOnlyDataService.findListByHref<Item>(href$);
} }
/** /**
@@ -172,7 +172,7 @@ export class BrowseService {
}) })
); );
return this.hrefOnlyDataService.findAllByHref<Item>(href$).pipe( return this.hrefOnlyDataService.findListByHref<Item>(href$).pipe(
getFirstSucceededRemoteData(), getFirstSucceededRemoteData(),
getFirstOccurrence() getFirstOccurrence()
); );
@@ -184,7 +184,7 @@ export class BrowseService {
* @param items * @param items
*/ */
getPrevBrowseItems(items: RemoteData<PaginatedList<Item>>): Observable<RemoteData<PaginatedList<Item>>> { getPrevBrowseItems(items: RemoteData<PaginatedList<Item>>): Observable<RemoteData<PaginatedList<Item>>> {
return this.hrefOnlyDataService.findAllByHref<Item>(items.payload.prev); return this.hrefOnlyDataService.findListByHref<Item>(items.payload.prev);
} }
/** /**
@@ -192,7 +192,7 @@ export class BrowseService {
* @param items * @param items
*/ */
getNextBrowseItems(items: RemoteData<PaginatedList<Item>>): Observable<RemoteData<PaginatedList<Item>>> { getNextBrowseItems(items: RemoteData<PaginatedList<Item>>): Observable<RemoteData<PaginatedList<Item>>> {
return this.hrefOnlyDataService.findAllByHref<Item>(items.payload.next); return this.hrefOnlyDataService.findListByHref<Item>(items.payload.next);
} }
/** /**
@@ -200,7 +200,7 @@ export class BrowseService {
* @param entries * @param entries
*/ */
getPrevBrowseEntries(entries: RemoteData<PaginatedList<BrowseEntry>>): Observable<RemoteData<PaginatedList<BrowseEntry>>> { getPrevBrowseEntries(entries: RemoteData<PaginatedList<BrowseEntry>>): Observable<RemoteData<PaginatedList<BrowseEntry>>> {
return this.hrefOnlyDataService.findAllByHref<BrowseEntry>(entries.payload.prev); return this.hrefOnlyDataService.findListByHref<BrowseEntry>(entries.payload.prev);
} }
/** /**
@@ -208,7 +208,7 @@ export class BrowseService {
* @param entries * @param entries
*/ */
getNextBrowseEntries(entries: RemoteData<PaginatedList<BrowseEntry>>): Observable<RemoteData<PaginatedList<BrowseEntry>>> { getNextBrowseEntries(entries: RemoteData<PaginatedList<BrowseEntry>>): Observable<RemoteData<PaginatedList<BrowseEntry>>> {
return this.hrefOnlyDataService.findAllByHref<BrowseEntry>(entries.payload.next); return this.hrefOnlyDataService.findListByHref<BrowseEntry>(entries.payload.next);
} }
/** /**

View File

@@ -33,8 +33,8 @@ class TestModel implements HALResource {
@Injectable() @Injectable()
class TestDataService { class TestDataService {
findAllByHref(href: string, findListOptions: FindListOptions = {}, useCachedVersionIfAvailable = true, reRequestOnStale = true, ...linksToFollow: FollowLinkConfig<any>[]) { findListByHref(href: string, findListOptions: FindListOptions = {}, useCachedVersionIfAvailable = true, reRequestOnStale = true, ...linksToFollow: FollowLinkConfig<any>[]) {
return 'findAllByHref'; return 'findListByHref';
} }
findByHref(href: string, useCachedVersionIfAvailable = true, reRequestOnStale = true, ...linksToFollow: FollowLinkConfig<any>[]) { findByHref(href: string, useCachedVersionIfAvailable = true, reRequestOnStale = true, ...linksToFollow: FollowLinkConfig<any>[]) {
@@ -65,7 +65,7 @@ describe('LinkService', () => {
} }
}); });
testDataService = new TestDataService(); testDataService = new TestDataService();
spyOn(testDataService, 'findAllByHref').and.callThrough(); spyOn(testDataService, 'findListByHref').and.callThrough();
spyOn(testDataService, 'findByHref').and.callThrough(); spyOn(testDataService, 'findByHref').and.callThrough();
TestBed.configureTestingModule({ TestBed.configureTestingModule({
providers: [LinkService, { providers: [LinkService, {
@@ -119,8 +119,8 @@ describe('LinkService', () => {
}); });
service.resolveLink(testModel, followLink('predecessor', { findListOptions: { some: 'options ' } as any }, followLink('successor'))); service.resolveLink(testModel, followLink('predecessor', { findListOptions: { some: 'options ' } as any }, followLink('successor')));
}); });
it('should call dataservice.findAllByHref with the correct href, findListOptions, and nested links', () => { it('should call dataservice.findListByHref with the correct href, findListOptions, and nested links', () => {
expect(testDataService.findAllByHref).toHaveBeenCalledWith(testModel._links.predecessor.href, { some: 'options ' } as any, true, true, followLink('successor')); expect(testDataService.findListByHref).toHaveBeenCalledWith(testModel._links.predecessor.href, { some: 'options ' } as any, true, true, followLink('successor'));
}); });
}); });
describe('either way', () => { describe('either way', () => {

View File

@@ -74,7 +74,7 @@ export class LinkService {
try { try {
if (matchingLinkDef.isList) { if (matchingLinkDef.isList) {
return service.findAllByHref(href, linkToFollow.findListOptions, linkToFollow.useCachedVersionIfAvailable, linkToFollow.reRequestOnStale, ...linkToFollow.linksToFollow); return service.findListByHref(href, linkToFollow.findListOptions, linkToFollow.useCachedVersionIfAvailable, linkToFollow.reRequestOnStale, ...linkToFollow.linksToFollow);
} else { } else {
return service.findByHref(href, linkToFollow.useCachedVersionIfAvailable, linkToFollow.reRequestOnStale, ...linkToFollow.linksToFollow); return service.findByHref(href, linkToFollow.useCachedVersionIfAvailable, linkToFollow.reRequestOnStale, ...linkToFollow.linksToFollow);
} }

View File

@@ -370,7 +370,7 @@ describe('BaseDataService', () => {
}); });
describe(`findAllByHref`, () => { describe(`findListByHref`, () => {
let findListOptions; let findListOptions;
beforeEach(() => { beforeEach(() => {
findListOptions = { currentPage: 5 }; findListOptions = { currentPage: 5 };
@@ -383,7 +383,7 @@ describe('BaseDataService', () => {
spyOn(rdbService, 'buildList').and.returnValue(cold('a', { a: remoteDataMocks.Success })); spyOn(rdbService, 'buildList').and.returnValue(cold('a', { a: remoteDataMocks.Success }));
spyOn(service as any, 'reRequestStaleRemoteData').and.returnValue(() => cold('a', { a: remoteDataMocks.Success })); spyOn(service as any, 'reRequestStaleRemoteData').and.returnValue(() => cold('a', { a: remoteDataMocks.Success }));
service.findAllByHref(selfLink, findListOptions, true, true, ...linksToFollow); service.findListByHref(selfLink, findListOptions, true, true, ...linksToFollow);
expect(service.buildHrefFromFindOptions).toHaveBeenCalledWith(selfLink, findListOptions, [], ...linksToFollow); expect(service.buildHrefFromFindOptions).toHaveBeenCalledWith(selfLink, findListOptions, [], ...linksToFollow);
}); });
}); });
@@ -394,11 +394,11 @@ describe('BaseDataService', () => {
spyOn(rdbService, 'buildList').and.returnValue(cold('a', { a: remoteDataMocks.Success })); spyOn(rdbService, 'buildList').and.returnValue(cold('a', { a: remoteDataMocks.Success }));
spyOn(service as any, 'reRequestStaleRemoteData').and.returnValue(() => cold('a', { a: remoteDataMocks.Success })); spyOn(service as any, 'reRequestStaleRemoteData').and.returnValue(() => cold('a', { a: remoteDataMocks.Success }));
service.findAllByHref(selfLink, findListOptions, true, true, ...linksToFollow); service.findListByHref(selfLink, findListOptions, true, true, ...linksToFollow);
expect((service as any).createAndSendGetRequest).toHaveBeenCalledWith(jasmine.anything(), true); expect((service as any).createAndSendGetRequest).toHaveBeenCalledWith(jasmine.anything(), true);
expectObservable(rdbService.buildList.calls.argsFor(0)[0]).toBe('(a|)', { a: 'bingo!' }); expectObservable(rdbService.buildList.calls.argsFor(0)[0]).toBe('(a|)', { a: 'bingo!' });
service.findAllByHref(selfLink, findListOptions, false, true, ...linksToFollow); service.findListByHref(selfLink, findListOptions, false, true, ...linksToFollow);
expect((service as any).createAndSendGetRequest).toHaveBeenCalledWith(jasmine.anything(), false); expect((service as any).createAndSendGetRequest).toHaveBeenCalledWith(jasmine.anything(), false);
expectObservable(rdbService.buildList.calls.argsFor(1)[0]).toBe('(a|)', { a: 'bingo!' }); expectObservable(rdbService.buildList.calls.argsFor(1)[0]).toBe('(a|)', { a: 'bingo!' });
}); });
@@ -410,29 +410,29 @@ describe('BaseDataService', () => {
spyOn(rdbService, 'buildList').and.returnValue(cold('a', { a: remoteDataMocks.Success })); spyOn(rdbService, 'buildList').and.returnValue(cold('a', { a: remoteDataMocks.Success }));
spyOn(service as any, 'reRequestStaleRemoteData').and.returnValue(() => cold('a', { a: remoteDataMocks.Success })); spyOn(service as any, 'reRequestStaleRemoteData').and.returnValue(() => cold('a', { a: remoteDataMocks.Success }));
service.findAllByHref(selfLink, findListOptions, true, true, ...linksToFollow); service.findListByHref(selfLink, findListOptions, true, true, ...linksToFollow);
expect(rdbService.buildList).toHaveBeenCalledWith(jasmine.anything() as any, ...linksToFollow); expect(rdbService.buildList).toHaveBeenCalledWith(jasmine.anything() as any, ...linksToFollow);
expectObservable(rdbService.buildList.calls.argsFor(0)[0]).toBe('(a|)', { a: 'bingo!' }); expectObservable(rdbService.buildList.calls.argsFor(0)[0]).toBe('(a|)', { a: 'bingo!' });
}); });
}); });
it(`should call reRequestStaleRemoteData with reRequestOnStale and the exact same findAllByHref call as a callback`, () => { it(`should call reRequestStaleRemoteData with reRequestOnStale and the exact same findListByHref call as a callback`, () => {
testScheduler.run(({ cold, expectObservable }) => { testScheduler.run(({ cold, expectObservable }) => {
spyOn(service, 'buildHrefFromFindOptions').and.returnValue('bingo!'); spyOn(service, 'buildHrefFromFindOptions').and.returnValue('bingo!');
spyOn(rdbService, 'buildList').and.returnValue(cold('a', { a: remoteDataMocks.SuccessStale })); spyOn(rdbService, 'buildList').and.returnValue(cold('a', { a: remoteDataMocks.SuccessStale }));
spyOn(service as any, 'reRequestStaleRemoteData').and.returnValue(() => cold('a', { a: remoteDataMocks.SuccessStale })); spyOn(service as any, 'reRequestStaleRemoteData').and.returnValue(() => cold('a', { a: remoteDataMocks.SuccessStale }));
service.findAllByHref(selfLink, findListOptions, true, true, ...linksToFollow); service.findListByHref(selfLink, findListOptions, true, true, ...linksToFollow);
expect((service as any).reRequestStaleRemoteData.calls.argsFor(0)[0]).toBeTrue(); expect((service as any).reRequestStaleRemoteData.calls.argsFor(0)[0]).toBeTrue();
spyOn(service, 'findAllByHref').and.returnValue(cold('a', { a: remoteDataMocks.SuccessStale })); spyOn(service, 'findListByHref').and.returnValue(cold('a', { a: remoteDataMocks.SuccessStale }));
// prove that the spy we just added hasn't been called yet // prove that the spy we just added hasn't been called yet
expect(service.findAllByHref).not.toHaveBeenCalled(); expect(service.findListByHref).not.toHaveBeenCalled();
// call the callback passed to reRequestStaleRemoteData // call the callback passed to reRequestStaleRemoteData
(service as any).reRequestStaleRemoteData.calls.argsFor(0)[1](); (service as any).reRequestStaleRemoteData.calls.argsFor(0)[1]();
// verify that findAllByHref _has_ been called now, with the same params as the original call // verify that findListByHref _has_ been called now, with the same params as the original call
expect(service.findAllByHref).toHaveBeenCalledWith(jasmine.anything(), findListOptions, true, true, ...linksToFollow); expect(service.findListByHref).toHaveBeenCalledWith(jasmine.anything(), findListOptions, true, true, ...linksToFollow);
// ... except for selflink, which will have been turned in to an observable. // ... except for selflink, which will have been turned in to an observable.
expectObservable((service.findAllByHref as jasmine.Spy).calls.argsFor(0)[0]).toBe('(a|)', { a: selfLink }); expectObservable((service.findListByHref as jasmine.Spy).calls.argsFor(0)[0]).toBe('(a|)', { a: selfLink });
}); });
}); });
@@ -446,7 +446,7 @@ describe('BaseDataService', () => {
a: 'bingo!', a: 'bingo!',
}; };
expectObservable(service.findAllByHref(selfLink, findListOptions, true, true, ...linksToFollow)).toBe(expected, values); expectObservable(service.findListByHref(selfLink, findListOptions, true, true, ...linksToFollow)).toBe(expected, values);
}); });
}); });
@@ -474,7 +474,7 @@ describe('BaseDataService', () => {
e: remoteDataMocks.SuccessStale, e: remoteDataMocks.SuccessStale,
}; };
expectObservable(service.findAllByHref(selfLink, findListOptions, true, true, ...linksToFollow)).toBe(expected, values); expectObservable(service.findListByHref(selfLink, findListOptions, true, true, ...linksToFollow)).toBe(expected, values);
}); });
}); });
@@ -495,7 +495,7 @@ describe('BaseDataService', () => {
e: remoteDataMocks.SuccessStale, e: remoteDataMocks.SuccessStale,
}; };
expectObservable(service.findAllByHref(selfLink, findListOptions, true, true, ...linksToFollow)).toBe(expected, values); expectObservable(service.findListByHref(selfLink, findListOptions, true, true, ...linksToFollow)).toBe(expected, values);
}); });
}); });
@@ -525,7 +525,7 @@ describe('BaseDataService', () => {
e: remoteDataMocks.SuccessStale, e: remoteDataMocks.SuccessStale,
}; };
expectObservable(service.findAllByHref(selfLink, findListOptions, false, true, ...linksToFollow)).toBe(expected, values); expectObservable(service.findListByHref(selfLink, findListOptions, false, true, ...linksToFollow)).toBe(expected, values);
}); });
}); });
@@ -546,7 +546,7 @@ describe('BaseDataService', () => {
e: remoteDataMocks.SuccessStale, e: remoteDataMocks.SuccessStale,
}; };
expectObservable(service.findAllByHref(selfLink, findListOptions, false, true, ...linksToFollow)).toBe(expected, values); expectObservable(service.findListByHref(selfLink, findListOptions, false, true, ...linksToFollow)).toBe(expected, values);
}); });
}); });

View File

@@ -287,7 +287,7 @@ export class BaseDataService<T extends CacheableObject> implements HALDataServic
* @param reRequestOnStale Whether or not the request should automatically be re-requested after the response becomes stale * @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 * @param linksToFollow List of {@link FollowLinkConfig} that indicate which {@link HALLink}s should be automatically resolved
*/ */
findAllByHref(href$: string | Observable<string>, options: FindListOptions = {}, useCachedVersionIfAvailable = true, reRequestOnStale = true, ...linksToFollow: FollowLinkConfig<T>[]): Observable<RemoteData<PaginatedList<T>>> { findListByHref(href$: string | Observable<string>, options: FindListOptions = {}, useCachedVersionIfAvailable = true, reRequestOnStale = true, ...linksToFollow: FollowLinkConfig<T>[]): Observable<RemoteData<PaginatedList<T>>> {
if (typeof href$ === 'string') { if (typeof href$ === 'string') {
href$ = observableOf(href$); href$ = observableOf(href$);
} }
@@ -307,7 +307,7 @@ export class BaseDataService<T extends CacheableObject> implements HALDataServic
// cached completed object // cached completed object
skipWhile((rd: RemoteData<PaginatedList<T>>) => useCachedVersionIfAvailable ? rd.isStale : rd.hasCompleted), skipWhile((rd: RemoteData<PaginatedList<T>>) => useCachedVersionIfAvailable ? rd.isStale : rd.hasCompleted),
this.reRequestStaleRemoteData(reRequestOnStale, () => this.reRequestStaleRemoteData(reRequestOnStale, () =>
this.findAllByHref(href$, options, useCachedVersionIfAvailable, reRequestOnStale, ...linksToFollow)), this.findListByHref(href$, options, useCachedVersionIfAvailable, reRequestOnStale, ...linksToFollow)),
); );
} }

View File

@@ -85,7 +85,7 @@ export class FindAllDataImpl<T extends CacheableObject> extends BaseDataService<
* Return an observable that emits object list * Return an observable that emits object list
*/ */
findAll(options: FindListOptions = {}, useCachedVersionIfAvailable = true, reRequestOnStale = true, ...linksToFollow: FollowLinkConfig<T>[]): Observable<RemoteData<PaginatedList<T>>> { findAll(options: FindListOptions = {}, useCachedVersionIfAvailable = true, reRequestOnStale = true, ...linksToFollow: FollowLinkConfig<T>[]): Observable<RemoteData<PaginatedList<T>>> {
return this.findAllByHref(this.getFindAllHref(options), options, useCachedVersionIfAvailable, reRequestOnStale, ...linksToFollow); return this.findListByHref(this.getFindAllHref(options), options, useCachedVersionIfAvailable, reRequestOnStale, ...linksToFollow);
} }
/** /**

View File

@@ -37,5 +37,5 @@ export interface HALDataService<T extends HALResource> {
* @param reRequestOnStale Whether or not the request should automatically be re-requested after the response becomes stale * @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 * @param linksToFollow List of {@link FollowLinkConfig} that indicate which {@link HALLink}s should be automatically resolved
*/ */
findAllByHref(href$: string | Observable<string>, findListOptions?: FindListOptions, useCachedVersionIfAvailable?: boolean, reRequestOnStale?: boolean, ...linksToFollow: FollowLinkConfig<T>[]): Observable<RemoteData<PaginatedList<T>>>; findListByHref(href$: string | Observable<string>, findListOptions?: FindListOptions, useCachedVersionIfAvailable?: boolean, reRequestOnStale?: boolean, ...linksToFollow: FollowLinkConfig<T>[]): Observable<RemoteData<PaginatedList<T>>>;
} }

View File

@@ -110,7 +110,7 @@ export class SearchDataImpl<T extends CacheableObject> extends BaseDataService<T
searchBy(searchMethod: string, options: FindListOptions = {}, useCachedVersionIfAvailable = true, reRequestOnStale = true, ...linksToFollow: FollowLinkConfig<T>[]): Observable<RemoteData<PaginatedList<T>>> { searchBy(searchMethod: string, options: FindListOptions = {}, useCachedVersionIfAvailable = true, reRequestOnStale = true, ...linksToFollow: FollowLinkConfig<T>[]): Observable<RemoteData<PaginatedList<T>>> {
const hrefObs = this.getSearchByHref(searchMethod, options, ...linksToFollow); const hrefObs = this.getSearchByHref(searchMethod, options, ...linksToFollow);
return this.findAllByHref(hrefObs, undefined, useCachedVersionIfAvailable, reRequestOnStale, ...linksToFollow); return this.findListByHref(hrefObs, undefined, useCachedVersionIfAvailable, reRequestOnStale, ...linksToFollow);
} }
/** /**

View File

@@ -76,7 +76,7 @@ export class BitstreamDataService extends IdentifiableDataService<Bitstream> imp
* {@link HALLink}s should be automatically resolved * {@link HALLink}s should be automatically resolved
*/ */
findAllByBundle(bundle: Bundle, options?: FindListOptions, useCachedVersionIfAvailable = true, reRequestOnStale = true, ...linksToFollow: FollowLinkConfig<Bitstream>[]): Observable<RemoteData<PaginatedList<Bitstream>>> { findAllByBundle(bundle: Bundle, options?: FindListOptions, useCachedVersionIfAvailable = true, reRequestOnStale = true, ...linksToFollow: FollowLinkConfig<Bitstream>[]): Observable<RemoteData<PaginatedList<Bitstream>>> {
return this.findAllByHref(bundle._links.bitstreams.href, options, useCachedVersionIfAvailable, reRequestOnStale, ...linksToFollow); return this.findListByHref(bundle._links.bitstreams.href, options, useCachedVersionIfAvailable, reRequestOnStale, ...linksToFollow);
} }
/** /**

View File

@@ -73,12 +73,12 @@ describe('BundleDataService', () => {
describe('findAllByItem', () => { describe('findAllByItem', () => {
beforeEach(() => { beforeEach(() => {
spyOn(service, 'findAllByHref'); spyOn(service, 'findListByHref');
service.findAllByItem(item); service.findAllByItem(item);
}); });
it('should call findAllByHref with the item\'s bundles link', () => { it('should call findListByHref with the item\'s bundles link', () => {
expect(service.findAllByHref).toHaveBeenCalledWith(bundleLink, undefined, true, true); expect(service.findListByHref).toHaveBeenCalledWith(bundleLink, undefined, true, true);
}); });
}); });

View File

@@ -61,7 +61,7 @@ export class BundleDataService extends IdentifiableDataService<Bundle> implement
* {@link HALLink}s should be automatically resolved * {@link HALLink}s should be automatically resolved
*/ */
findAllByItem(item: Item, options?: FindListOptions, useCachedVersionIfAvailable = true, reRequestOnStale = true, ...linksToFollow: FollowLinkConfig<Bundle>[]): Observable<RemoteData<PaginatedList<Bundle>>> { findAllByItem(item: Item, options?: FindListOptions, useCachedVersionIfAvailable = true, reRequestOnStale = true, ...linksToFollow: FollowLinkConfig<Bundle>[]): Observable<RemoteData<PaginatedList<Bundle>>> {
return this.findAllByHref(item._links.bundles.href, options, useCachedVersionIfAvailable, reRequestOnStale, ...linksToFollow); return this.findListByHref(item._links.bundles.href, options, useCachedVersionIfAvailable, reRequestOnStale, ...linksToFollow);
} }
/** /**

View File

@@ -280,7 +280,7 @@ export class CollectionDataService extends ComColDataService<Collection> {
* @param findListOptions Pagination and search options. * @param findListOptions Pagination and search options.
*/ */
findMappedCollectionsFor(item: Item, findListOptions?: FindListOptions): Observable<RemoteData<PaginatedList<Collection>>> { findMappedCollectionsFor(item: Item, findListOptions?: FindListOptions): Observable<RemoteData<PaginatedList<Collection>>> {
return this.findAllByHref(item._links.mappedCollections.href, findListOptions); return this.findListByHref(item._links.mappedCollections.href, findListOptions);
} }

View File

@@ -98,7 +98,7 @@ export abstract class ComColDataService<T extends Community | Collection> extend
const href$ = this.getFindByParentHref(parentUUID).pipe( const href$ = this.getFindByParentHref(parentUUID).pipe(
map((href: string) => this.buildHrefFromFindOptions(href, options)) map((href: string) => this.buildHrefFromFindOptions(href, options))
); );
return this.findAllByHref(href$, options, true, true, ...linksToFollow); return this.findListByHref(href$, options, true, true, ...linksToFollow);
} }
/** /**

View File

@@ -42,7 +42,7 @@ export class CommunityDataService extends ComColDataService<Community> {
findTop(options: FindListOptions = {}, ...linksToFollow: FollowLinkConfig<Community>[]): Observable<RemoteData<PaginatedList<Community>>> { findTop(options: FindListOptions = {}, ...linksToFollow: FollowLinkConfig<Community>[]): Observable<RemoteData<PaginatedList<Community>>> {
const hrefObs = this.getFindAllHref(options, this.topLinkPath); const hrefObs = this.getFindAllHref(options, this.topLinkPath);
return this.findAllByHref(hrefObs, undefined, true, true, ...linksToFollow); return this.findListByHref(hrefObs, undefined, true, true, ...linksToFollow);
} }
protected getFindByParentHref(parentUUID: string): Observable<string> { protected getFindByParentHref(parentUUID: string): Observable<string> {

View File

@@ -145,7 +145,7 @@ export class EntityTypeService extends BaseDataService<ItemType> implements Find
*/ */
getEntityTypeRelationships(entityTypeId: string, useCachedVersionIfAvailable = true, reRequestOnStale = true, ...linksToFollow: FollowLinkConfig<RelationshipType>[]): Observable<RemoteData<PaginatedList<RelationshipType>>> { getEntityTypeRelationships(entityTypeId: string, useCachedVersionIfAvailable = true, reRequestOnStale = true, ...linksToFollow: FollowLinkConfig<RelationshipType>[]): Observable<RemoteData<PaginatedList<RelationshipType>>> {
const href$ = this.getRelationshipTypesEndpoint(entityTypeId); const href$ = this.getRelationshipTypesEndpoint(entityTypeId);
return this.relationshipTypeService.findAllByHref(href$, undefined, useCachedVersionIfAvailable, reRequestOnStale, ...linksToFollow); return this.relationshipTypeService.findListByHref(href$, undefined, useCachedVersionIfAvailable, reRequestOnStale, ...linksToFollow);
} }
/** /**

View File

@@ -74,7 +74,7 @@ export class ExternalSourceService extends IdentifiableDataService<ExternalSourc
); );
// TODO create a dedicated ExternalSourceEntryDataService and move this entire method to it. Then the "as any"s won't be necessary // TODO create a dedicated ExternalSourceEntryDataService and move this entire method to it. Then the "as any"s won't be necessary
return this.findAllByHref(href$, undefined, useCachedVersionIfAvailable, reRequestOnStale, ...linksToFollow as any) as any; return this.findListByHref(href$, undefined, useCachedVersionIfAvailable, reRequestOnStale, ...linksToFollow as any) as any;
} }
/** /**

View File

@@ -48,33 +48,33 @@ describe(`HrefOnlyDataService`, () => {
}); });
}); });
describe(`findAllByHref`, () => { describe(`findListByHref`, () => {
beforeEach(() => { beforeEach(() => {
spy = spyOn((service as any).dataService, 'findAllByHref').and.returnValue(createSuccessfulRemoteDataObject$(null)); spy = spyOn((service as any).dataService, 'findListByHref').and.returnValue(createSuccessfulRemoteDataObject$(null));
}); });
it(`should delegate to findAllByHref on the internal DataService`, () => { it(`should delegate to findListByHref on the internal DataService`, () => {
service.findAllByHref(href, findListOptions, false, false, ...followLinks); service.findListByHref(href, findListOptions, false, false, ...followLinks);
expect(spy).toHaveBeenCalledWith(href, findListOptions, false, false, ...followLinks); expect(spy).toHaveBeenCalledWith(href, findListOptions, false, false, ...followLinks);
}); });
describe(`when findListOptions is omitted`, () => { describe(`when findListOptions is omitted`, () => {
it(`should call findAllByHref on the internal DataService with findListOptions = {}`, () => { it(`should call findListByHref on the internal DataService with findListOptions = {}`, () => {
service.findAllByHref(href); service.findListByHref(href);
expect(spy).toHaveBeenCalledWith(jasmine.anything(), {}, jasmine.anything(), jasmine.anything()); expect(spy).toHaveBeenCalledWith(jasmine.anything(), {}, jasmine.anything(), jasmine.anything());
}); });
}); });
describe(`when useCachedVersionIfAvailable is omitted`, () => { describe(`when useCachedVersionIfAvailable is omitted`, () => {
it(`should call findAllByHref on the internal DataService with useCachedVersionIfAvailable = true`, () => { it(`should call findListByHref on the internal DataService with useCachedVersionIfAvailable = true`, () => {
service.findAllByHref(href); service.findListByHref(href);
expect(spy).toHaveBeenCalledWith(jasmine.anything(), jasmine.anything(), true, jasmine.anything()); expect(spy).toHaveBeenCalledWith(jasmine.anything(), jasmine.anything(), true, jasmine.anything());
}); });
}); });
describe(`when reRequestOnStale is omitted`, () => { describe(`when reRequestOnStale is omitted`, () => {
it(`should call findAllByHref on the internal DataService with reRequestOnStale = true`, () => { it(`should call findListByHref on the internal DataService with reRequestOnStale = true`, () => {
service.findAllByHref(href); service.findListByHref(href);
expect(spy).toHaveBeenCalledWith(jasmine.anything(), jasmine.anything(), jasmine.anything(), true); expect(spy).toHaveBeenCalledWith(jasmine.anything(), jasmine.anything(), jasmine.anything(), true);
}); });
}); });

View File

@@ -27,8 +27,8 @@ import { dataService } from './base/data-service.decorator';
* Additionally, this service may be used to retrieve objects by `href` regardless of their type * Additionally, this service may be used to retrieve objects by `href` regardless of their type
* For example * For example
* ``` * ```
* const items$: Observable<RemoteData<PaginatedList<Item>>> = hrefOnlyDataService.findAllByHref<Item>(href); * const items$: Observable<RemoteData<PaginatedList<Item>>> = hrefOnlyDataService.findListByHref<Item>(href);
* const sites$: Observable<RemoteData<PaginatedList<Site>>> = hrefOnlyDataService.findAllByHref<Site>(href); * const sites$: Observable<RemoteData<PaginatedList<Site>>> = hrefOnlyDataService.findListByHref<Site>(href);
* ``` * ```
* This means we cannot extend from {@link BaseDataService} directly because the method signatures would not match. * This means we cannot extend from {@link BaseDataService} directly because the method signatures would not match.
*/ */
@@ -82,7 +82,7 @@ export class HrefOnlyDataService implements HALDataService<any> {
* @param linksToFollow List of {@link FollowLinkConfig} that indicate which * @param linksToFollow List of {@link FollowLinkConfig} that indicate which
* {@link HALLink}s should be automatically resolved * {@link HALLink}s should be automatically resolved
*/ */
findAllByHref<T extends CacheableObject>(href: string | Observable<string>, findListOptions: FindListOptions = {}, useCachedVersionIfAvailable = true, reRequestOnStale = true, ...linksToFollow: FollowLinkConfig<T>[]): Observable<RemoteData<PaginatedList<T>>> { findListByHref<T extends CacheableObject>(href: string | Observable<string>, findListOptions: FindListOptions = {}, useCachedVersionIfAvailable = true, reRequestOnStale = true, ...linksToFollow: FollowLinkConfig<T>[]): Observable<RemoteData<PaginatedList<T>>> {
return this.dataService.findAllByHref(href, findListOptions, useCachedVersionIfAvailable, reRequestOnStale, ...linksToFollow); return this.dataService.findListByHref(href, findListOptions, useCachedVersionIfAvailable, reRequestOnStale, ...linksToFollow);
} }
} }

View File

@@ -50,7 +50,7 @@ export class ProcessDataService extends IdentifiableDataService<Process> impleme
*/ */
getFiles(processId: string): Observable<RemoteData<PaginatedList<Bitstream>>> { getFiles(processId: string): Observable<RemoteData<PaginatedList<Bitstream>>> {
const href$ = this.getFilesEndpoint(processId); const href$ = this.getFilesEndpoint(processId);
return this.bitstreamDataService.findAllByHref(href$); return this.bitstreamDataService.findListByHref(href$);
} }
/** /**

View File

@@ -196,7 +196,7 @@ export class RelationshipService extends IdentifiableDataService<Relationship> i
* should be automatically resolved * should be automatically resolved
*/ */
getItemRelationshipsArray(item: Item, ...linksToFollow: FollowLinkConfig<Relationship>[]): Observable<Relationship[]> { getItemRelationshipsArray(item: Item, ...linksToFollow: FollowLinkConfig<Relationship>[]): Observable<Relationship[]> {
return this.findAllByHref(item._links.relationships.href, undefined, true, false, ...linksToFollow).pipe( return this.findListByHref(item._links.relationships.href, undefined, true, false, ...linksToFollow).pipe(
getFirstSucceededRemoteData(), getFirstSucceededRemoteData(),
getRemoteDataPayload(), getRemoteDataPayload(),
map((rels: PaginatedList<Relationship>) => rels.page), map((rels: PaginatedList<Relationship>) => rels.page),

View File

@@ -106,7 +106,7 @@ describe('VersionHistoryDataService', () => {
}); });
versionService = jasmine.createSpyObj('objectCache', { versionService = jasmine.createSpyObj('objectCache', {
findByHref: jasmine.createSpy('findByHref'), findByHref: jasmine.createSpy('findByHref'),
findAllByHref: jasmine.createSpy('findAllByHref'), findListByHref: jasmine.createSpy('findListByHref'),
getHistoryFromVersion: jasmine.createSpy('getHistoryFromVersion'), getHistoryFromVersion: jasmine.createSpy('getHistoryFromVersion'),
}); });
halService = new HALEndpointServiceStub(url); halService = new HALEndpointServiceStub(url);
@@ -132,8 +132,8 @@ describe('VersionHistoryDataService', () => {
result = service.getVersions('1'); result = service.getVersions('1');
}); });
it('should call versionService.findAllByHref', () => { it('should call versionService.findListByHref', () => {
expect(versionService.findAllByHref).toHaveBeenCalled(); expect(versionService.findListByHref).toHaveBeenCalled();
}); });
}); });
@@ -141,8 +141,8 @@ describe('VersionHistoryDataService', () => {
beforeEach(waitForAsync(() => { beforeEach(waitForAsync(() => {
service.getVersions(versionHistoryId); service.getVersions(versionHistoryId);
})); }));
it('findAllByHref should have been called', () => { it('findListByHref should have been called', () => {
expect(versionService.findAllByHref).toHaveBeenCalled(); expect(versionService.findListByHref).toHaveBeenCalled();
}); });
}); });

View File

@@ -77,7 +77,7 @@ export class VersionHistoryDataService extends IdentifiableDataService<VersionHi
map((href) => searchOptions ? searchOptions.toRestUrl(href) : href) map((href) => searchOptions ? searchOptions.toRestUrl(href) : href)
); );
return this.versionDataService.findAllByHref(hrefObs, undefined, useCachedVersionIfAvailable, reRequestOnStale, ...linksToFollow); return this.versionDataService.findListByHref(hrefObs, undefined, useCachedVersionIfAvailable, reRequestOnStale, ...linksToFollow);
} }
/** /**

View File

@@ -52,7 +52,7 @@ describe('MetadataService', () => {
findRoot: createSuccessfulRemoteDataObject$({ dspaceVersion: 'mock-dspace-version' }) findRoot: createSuccessfulRemoteDataObject$({ dspaceVersion: 'mock-dspace-version' })
}); });
bitstreamDataService = jasmine.createSpyObj({ bitstreamDataService = jasmine.createSpyObj({
findAllByHref: createSuccessfulRemoteDataObject$(createPaginatedList([MockBitstream3])) findListByHref: createSuccessfulRemoteDataObject$(createPaginatedList([MockBitstream3])),
}); });
bundleDataService = jasmine.createSpyObj({ bundleDataService = jasmine.createSpyObj({
findByItemAndName: mockBundleRD$([MockBitstream3]) findByItemAndName: mockBundleRD$([MockBitstream3])
@@ -361,7 +361,7 @@ describe('MetadataService', () => {
it('should link to first Bitstream with allowed format', fakeAsync(() => { it('should link to first Bitstream with allowed format', fakeAsync(() => {
const bitstreams = [MockBitstream3, MockBitstream3, MockBitstream1]; const bitstreams = [MockBitstream3, MockBitstream3, MockBitstream1];
(bundleDataService.findByItemAndName as jasmine.Spy).and.returnValue(mockBundleRD$(bitstreams)); (bundleDataService.findByItemAndName as jasmine.Spy).and.returnValue(mockBundleRD$(bitstreams));
(bitstreamDataService.findAllByHref as jasmine.Spy).and.returnValues( (bitstreamDataService.findListByHref as jasmine.Spy).and.returnValues(
...mockBitstreamPages$(bitstreams).map(bp => createSuccessfulRemoteDataObject$(bp)), ...mockBitstreamPages$(bitstreams).map(bp => createSuccessfulRemoteDataObject$(bp)),
); );

View File

@@ -379,7 +379,7 @@ export class MetadataService {
return EMPTY; return EMPTY;
} else { } else {
// Otherwise retrieve the next page // Otherwise retrieve the next page
return this.bitstreamDataService.findAllByHref( return this.bitstreamDataService.findListByHref(
paginatedList.next, paginatedList.next,
undefined, undefined,
true, true,

View File

@@ -121,7 +121,7 @@ export class ResourcePolicyService extends IdentifiableDataService<ResourcePolic
* @param findListOptions the {@link FindListOptions} for the request * @param findListOptions the {@link FindListOptions} for the request
*/ */
getDefaultAccessConditionsFor(collection: Collection, findListOptions?: FindListOptions): Observable<RemoteData<PaginatedList<ResourcePolicy>>> { getDefaultAccessConditionsFor(collection: Collection, findListOptions?: FindListOptions): Observable<RemoteData<PaginatedList<ResourcePolicy>>> {
return this.findAllByHref(collection._links.defaultAccessConditions.href, findListOptions); return this.findListByHref(collection._links.defaultAccessConditions.href, findListOptions);
} }
/** /**

View File

@@ -419,7 +419,7 @@ describe('VocabularyService', () => {
spyOn((service as any).vocabularyEntryDetailDataService, 'findById').and.callThrough(); spyOn((service as any).vocabularyEntryDetailDataService, 'findById').and.callThrough();
spyOn((service as any).vocabularyEntryDetailDataService, 'findAll').and.callThrough(); spyOn((service as any).vocabularyEntryDetailDataService, 'findAll').and.callThrough();
spyOn((service as any).vocabularyEntryDetailDataService, 'findByHref').and.callThrough(); spyOn((service as any).vocabularyEntryDetailDataService, 'findByHref').and.callThrough();
spyOn((service as any).vocabularyEntryDetailDataService, 'findAllByHref').and.callThrough(); spyOn((service as any).vocabularyEntryDetailDataService, 'findListByHref').and.callThrough();
spyOn((service as any).vocabularyEntryDetailDataService, 'searchBy').and.callThrough(); spyOn((service as any).vocabularyEntryDetailDataService, 'searchBy').and.callThrough();
spyOn((service as any).vocabularyEntryDetailDataService, 'getSearchByHref').and.returnValue(observableOf(searchRequestURL)); spyOn((service as any).vocabularyEntryDetailDataService, 'getSearchByHref').and.returnValue(observableOf(searchRequestURL));
spyOn((service as any).vocabularyEntryDetailDataService, 'getFindAllHref').and.returnValue(observableOf(entryDetailChildrenRequestURL)); spyOn((service as any).vocabularyEntryDetailDataService, 'getFindAllHref').and.returnValue(observableOf(entryDetailChildrenRequestURL));
@@ -494,7 +494,7 @@ describe('VocabularyService', () => {
scheduler.schedule(() => service.getEntryDetailChildren('testValue', hierarchicalVocabulary.id, pageInfo).subscribe()); scheduler.schedule(() => service.getEntryDetailChildren('testValue', hierarchicalVocabulary.id, pageInfo).subscribe());
scheduler.flush(); scheduler.flush();
expect((service as any).vocabularyEntryDetailDataService.findAllByHref).toHaveBeenCalledWith(entryDetailChildrenRequestURL, options, true, true); expect((service as any).vocabularyEntryDetailDataService.findListByHref).toHaveBeenCalledWith(entryDetailChildrenRequestURL, options, true, true);
}); });
it('should return a RemoteData<PaginatedList<ResourcePolicy>> for the object with the given URL', () => { it('should return a RemoteData<PaginatedList<ResourcePolicy>> for the object with the given URL', () => {

View File

@@ -282,7 +282,7 @@ export class VocabularyService {
pageInfo.currentPage pageInfo.currentPage
); );
return this.vocabularyEntryDetailDataService.getFindAllHref(options, linkPath).pipe( return this.vocabularyEntryDetailDataService.getFindAllHref(options, linkPath).pipe(
mergeMap((href) => this.vocabularyEntryDetailDataService.findAllByHref(href, options, useCachedVersionIfAvailable, reRequestOnStale, ...linksToFollow)) mergeMap((href) => this.vocabularyEntryDetailDataService.findListByHref(href, options, useCachedVersionIfAvailable, reRequestOnStale, ...linksToFollow)),
); );
} }

View File

@@ -126,7 +126,7 @@ describe('TopLevelCommunityList Component', () => {
}); });
const groupDataService = jasmine.createSpyObj('groupsDataService', { const groupDataService = jasmine.createSpyObj('groupsDataService', {
findAllByHref: createSuccessfulRemoteDataObject$(createPaginatedList([])), findListByHref: createSuccessfulRemoteDataObject$(createPaginatedList([])),
getGroupRegistryRouterLink: '', getGroupRegistryRouterLink: '',
getUUIDFromString: '', getUUIDFromString: '',
}); });

View File

@@ -89,7 +89,7 @@ describe('ItemCollectionMapperComponent', () => {
/* eslint-enable no-empty,@typescript-eslint/no-empty-function */ /* eslint-enable no-empty,@typescript-eslint/no-empty-function */
}; };
const collectionDataServiceStub = { const collectionDataServiceStub = {
findAllByHref: () => observableOf(mockCollectionsRD) findListByHref: () => observableOf(mockCollectionsRD),
}; };
const searchServiceStub = Object.assign(new SearchServiceStub(), { const searchServiceStub = Object.assign(new SearchServiceStub(), {
search: () => observableOf(mockCollectionsRD), search: () => observableOf(mockCollectionsRD),

View File

@@ -123,7 +123,7 @@ export class ItemCollectionMapperComponent implements OnInit {
if (shouldUpdate === true) { if (shouldUpdate === true) {
this.shouldUpdate$.next(false); this.shouldUpdate$.next(false);
} }
return this.collectionDataService.findAllByHref( return this.collectionDataService.findListByHref(
this.itemDataService.getMappedCollectionsEndpoint(item.id), this.itemDataService.getMappedCollectionsEndpoint(item.id),
undefined, undefined,
!shouldUpdate, !shouldUpdate,

View File

@@ -187,7 +187,7 @@ describe('EditRelationshipListComponent', () => {
}); });
const groupDataService = jasmine.createSpyObj('groupsDataService', { const groupDataService = jasmine.createSpyObj('groupsDataService', {
findAllByHref: createSuccessfulRemoteDataObject$(createPaginatedList([])), findListByHref: createSuccessfulRemoteDataObject$(createPaginatedList([])),
getGroupRegistryRouterLink: '', getGroupRegistryRouterLink: '',
getUUIDFromString: '', getUUIDFromString: '',
}); });

View File

@@ -80,7 +80,7 @@ describe('BrowseByComponent', () => {
const mockItemsRD$ = createSuccessfulRemoteDataObject$(buildPaginatedList(new PageInfo(), mockItems)); const mockItemsRD$ = createSuccessfulRemoteDataObject$(buildPaginatedList(new PageInfo(), mockItems));
const groupDataService = jasmine.createSpyObj('groupsDataService', { const groupDataService = jasmine.createSpyObj('groupsDataService', {
findAllByHref: createSuccessfulRemoteDataObject$(createPaginatedList([])), findListByHref: createSuccessfulRemoteDataObject$(createPaginatedList([])),
getGroupRegistryRouterLink: '', getGroupRegistryRouterLink: '',
getUUIDFromString: '', getUUIDFromString: '',
}); });

View File

@@ -6,10 +6,10 @@ import { createPaginatedList } from '../testing/utils.test';
export function getMockHrefOnlyDataService( export function getMockHrefOnlyDataService(
findByHref$: Observable<RemoteData<any>> = createNoContentRemoteDataObject$(), findByHref$: Observable<RemoteData<any>> = createNoContentRemoteDataObject$(),
findAllByHref$: Observable<RemoteData<PaginatedList<any>>> = createSuccessfulRemoteDataObject$(createPaginatedList([])) findListByHref$: Observable<RemoteData<PaginatedList<any>>> = createSuccessfulRemoteDataObject$(createPaginatedList([])),
) { ) {
return jasmine.createSpyObj('hrefOnlyDataService', { return jasmine.createSpyObj('hrefOnlyDataService', {
findByHref: findByHref$, findByHref: findByHref$,
findAllByHref: findAllByHref$, findListByHref: findListByHref$,
}); });
} }

View File

@@ -55,7 +55,7 @@ describe('CollectionSelectComponent', () => {
}); });
const groupDataService = jasmine.createSpyObj('groupsDataService', { const groupDataService = jasmine.createSpyObj('groupsDataService', {
findAllByHref: createSuccessfulRemoteDataObject$(createPaginatedList([])), findListByHref: createSuccessfulRemoteDataObject$(createPaginatedList([])),
getGroupRegistryRouterLink: '', getGroupRegistryRouterLink: '',
getUUIDFromString: '', getUUIDFromString: '',
}); });

View File

@@ -81,7 +81,7 @@ describe('ItemSelectComponent', () => {
}); });
const groupDataService = jasmine.createSpyObj('groupsDataService', { const groupDataService = jasmine.createSpyObj('groupsDataService', {
findAllByHref: createSuccessfulRemoteDataObject$(createPaginatedList([])), findListByHref: createSuccessfulRemoteDataObject$(createPaginatedList([])),
getGroupRegistryRouterLink: '', getGroupRegistryRouterLink: '',
getUUIDFromString: '', getUUIDFromString: '',
}); });

View File

@@ -66,7 +66,7 @@ describe('RssComponent', () => {
sort: new SortOptions('dc.title', SortDirection.ASC), sort: new SortOptions('dc.title', SortDirection.ASC),
})); }));
groupDataService = jasmine.createSpyObj('groupsDataService', { groupDataService = jasmine.createSpyObj('groupsDataService', {
findAllByHref: createSuccessfulRemoteDataObject$(createPaginatedList([])), findListByHref: createSuccessfulRemoteDataObject$(createPaginatedList([])),
getGroupRegistryRouterLink: '', getGroupRegistryRouterLink: '',
getUUIDFromString: '', getUUIDFromString: '',
}); });