Skip to content

Commit a13f4ee

Browse files
authored
Merge pull request DSpace#1791 from atmire/w2p-93803_Refactor-DataServices-to-use-Composition
Refactor data services to use composition
2 parents 3665071 + c517ed0 commit a13f4ee

250 files changed

Lines changed: 6099 additions & 3975 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

cypress/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
screenshots/
22
videos/
3+
downloads/

src/app/access-control/epeople-registry/eperson-form/eperson-form.component.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ describe('EPersonFormComponent', () => {
177177

178178
});
179179
groupsDataService = jasmine.createSpyObj('groupsDataService', {
180-
findAllByHref: createSuccessfulRemoteDataObject$(createPaginatedList([])),
180+
findListByHref: createSuccessfulRemoteDataObject$(createPaginatedList([])),
181181
getGroupRegistryRouterLink: ''
182182
});
183183

src/app/access-control/epeople-registry/eperson-form/eperson-form.component.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ export class EPersonFormComponent implements OnInit, OnDestroy {
265265
this.formGroup = this.formBuilderService.createFormGroup(this.formModel);
266266
this.subs.push(this.epersonService.getActiveEPerson().subscribe((eperson: EPerson) => {
267267
if (eperson != null) {
268-
this.groups = this.groupsDataService.findAllByHref(eperson._links.groups.href, {
268+
this.groups = this.groupsDataService.findListByHref(eperson._links.groups.href, {
269269
currentPage: 1,
270270
elementsPerPage: this.config.pageSize
271271
});
@@ -297,7 +297,7 @@ export class EPersonFormComponent implements OnInit, OnDestroy {
297297
}),
298298
switchMap(([eperson, findListOptions]) => {
299299
if (eperson != null) {
300-
return this.groupsDataService.findAllByHref(eperson._links.groups.href, findListOptions, true, true, followLink('object'));
300+
return this.groupsDataService.findListByHref(eperson._links.groups.href, findListOptions, true, true, followLink('object'));
301301
}
302302
return observableOf(undefined);
303303
})
@@ -554,7 +554,7 @@ export class EPersonFormComponent implements OnInit, OnDestroy {
554554
*/
555555
private updateGroups(options) {
556556
this.subs.push(this.epersonService.getActiveEPerson().subscribe((eperson: EPerson) => {
557-
this.groups = this.groupsDataService.findAllByHref(eperson._links.groups.href, options);
557+
this.groups = this.groupsDataService.findListByHref(eperson._links.groups.href, options);
558558
}));
559559
}
560560
}

src/app/access-control/group-registry/group-form/members-list/members-list.component.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ describe('MembersListComponent', () => {
5353
activeGroup: activeGroup,
5454
epersonMembers: epersonMembers,
5555
subgroupMembers: subgroupMembers,
56-
findAllByHref(href: string): Observable<RemoteData<PaginatedList<EPerson>>> {
56+
findListByHref(href: string): Observable<RemoteData<PaginatedList<EPerson>>> {
5757
return createSuccessfulRemoteDataObject$(buildPaginatedList<EPerson>(new PageInfo(), groupsDataServiceStub.getEPersonMembers()));
5858
},
5959
searchByScope(scope: string, query: string): Observable<RemoteData<PaginatedList<EPerson>>> {

src/app/access-control/group-registry/group-form/members-list/members-list.component.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ export class MembersListComponent implements OnInit, OnDestroy {
129129
this.subs.set(SubKey.MembersDTO,
130130
this.paginationService.getCurrentPagination(this.config.id, this.config).pipe(
131131
switchMap((currentPagination) => {
132-
return this.ePersonDataService.findAllByHref(this.groupBeingEdited._links.epersons.href, {
132+
return this.ePersonDataService.findListByHref(this.groupBeingEdited._links.epersons.href, {
133133
currentPage: currentPagination.currentPage,
134134
elementsPerPage: currentPagination.pageSize
135135
}
@@ -171,7 +171,7 @@ export class MembersListComponent implements OnInit, OnDestroy {
171171
return this.groupDataService.getActiveGroup().pipe(take(1),
172172
mergeMap((group: Group) => {
173173
if (group != null) {
174-
return this.ePersonDataService.findAllByHref(group._links.epersons.href, {
174+
return this.ePersonDataService.findListByHref(group._links.epersons.href, {
175175
currentPage: 1,
176176
elementsPerPage: 9999
177177
}, false)

src/app/access-control/group-registry/group-form/subgroup-list/subgroups-list.component.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ describe('SubgroupsListComponent', () => {
6565
getSubgroups(): Group {
6666
return this.activeGroup;
6767
},
68-
findAllByHref(href: string): Observable<RemoteData<PaginatedList<Group>>> {
68+
findListByHref(href: string): Observable<RemoteData<PaginatedList<Group>>> {
6969
return this.subgroups$.pipe(
7070
map((currentGroups: Group[]) => {
7171
return createSuccessfulRemoteDataObject(buildPaginatedList<Group>(new PageInfo(), currentGroups));

src/app/access-control/group-registry/group-form/subgroup-list/subgroups-list.component.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ export class SubgroupsListComponent implements OnInit, OnDestroy {
115115
this.subs.set(
116116
SubKey.Members,
117117
this.paginationService.getCurrentPagination(this.config.id, this.config).pipe(
118-
switchMap((config) => this.groupDataService.findAllByHref(this.groupBeingEdited._links.subgroups.href, {
118+
switchMap((config) => this.groupDataService.findListByHref(this.groupBeingEdited._links.subgroups.href, {
119119
currentPage: config.currentPage,
120120
elementsPerPage: config.pageSize
121121
},
@@ -139,7 +139,7 @@ export class SubgroupsListComponent implements OnInit, OnDestroy {
139139
if (activeGroup.uuid === possibleSubgroup.uuid) {
140140
return observableOf(false);
141141
} else {
142-
return this.groupDataService.findAllByHref(activeGroup._links.subgroups.href, {
142+
return this.groupDataService.findListByHref(activeGroup._links.subgroups.href, {
143143
currentPage: 1,
144144
elementsPerPage: 9999
145145
})

src/app/access-control/group-registry/groups-registry.component.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ describe('GroupRegistryComponent', () => {
6969
mockGroups = [GroupMock, GroupMock2];
7070
mockEPeople = [EPersonMock, EPersonMock2];
7171
ePersonDataServiceStub = {
72-
findAllByHref(href: string): Observable<RemoteData<PaginatedList<EPerson>>> {
72+
findListByHref(href: string): Observable<RemoteData<PaginatedList<EPerson>>> {
7373
switch (href) {
7474
case 'https://dspace.4science.it/dspace-spring-rest/api/eperson/groups/testgroupid2/epersons':
7575
return createSuccessfulRemoteDataObject$(buildPaginatedList(new PageInfo({
@@ -97,7 +97,7 @@ describe('GroupRegistryComponent', () => {
9797
};
9898
groupsDataServiceStub = {
9999
allGroups: mockGroups,
100-
findAllByHref(href: string): Observable<RemoteData<PaginatedList<Group>>> {
100+
findListByHref(href: string): Observable<RemoteData<PaginatedList<Group>>> {
101101
switch (href) {
102102
case 'https://dspace.4science.it/dspace-spring-rest/api/eperson/groups/testgroupid2/groups':
103103
return createSuccessfulRemoteDataObject$(buildPaginatedList(new PageInfo({

src/app/access-control/group-registry/groups-registry.component.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -213,15 +213,15 @@ export class GroupsRegistryComponent implements OnInit, OnDestroy {
213213
* @param group
214214
*/
215215
getMembers(group: Group): Observable<RemoteData<PaginatedList<EPerson>>> {
216-
return this.ePersonDataService.findAllByHref(group._links.epersons.href).pipe(getFirstSucceededRemoteData());
216+
return this.ePersonDataService.findListByHref(group._links.epersons.href).pipe(getFirstSucceededRemoteData());
217217
}
218218

219219
/**
220220
* Get the subgroups (groups embedded value of a group)
221221
* @param group
222222
*/
223223
getSubgroups(group: Group): Observable<RemoteData<PaginatedList<Group>>> {
224-
return this.groupService.findAllByHref(group._links.subgroups.href).pipe(getFirstSucceededRemoteData());
224+
return this.groupService.findListByHref(group._links.subgroups.href).pipe(getFirstSucceededRemoteData());
225225
}
226226

227227
/**

src/app/collection-page/collection-form/collection-form.component.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import { CommunityDataService } from '../../core/data/community-data.service';
1616
import { AuthService } from '../../core/auth/auth.service';
1717
import { RequestService } from '../../core/data/request.service';
1818
import { ObjectCacheService } from '../../core/cache/object-cache.service';
19-
import { EntityTypeService } from '../../core/data/entity-type.service';
19+
import { EntityTypeDataService } from '../../core/data/entity-type-data.service';
2020
import { ItemType } from '../../core/shared/item-relationships/item-type.model';
2121
import { MetadataValue } from '../../core/shared/metadata.models';
2222
import { getFirstSucceededRemoteListPayload } from '../../core/shared/operators';
@@ -61,7 +61,7 @@ export class CollectionFormComponent extends ComColFormComponent<Collection> imp
6161
protected dsoService: CommunityDataService,
6262
protected requestService: RequestService,
6363
protected objectCache: ObjectCacheService,
64-
protected entityTypeService: EntityTypeService) {
64+
protected entityTypeService: EntityTypeDataService) {
6565
super(formService, translate, notificationsService, authService, requestService, objectCache);
6666
}
6767

0 commit comments

Comments
 (0)