mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 18:14:17 +00:00
65600: Renamed FindAllOptions to FindListOptions
This commit is contained in:
@@ -5,7 +5,7 @@ import { PaginatedList } from '../../../core/data/paginated-list';
|
|||||||
import { PaginationComponentOptions } from '../../../shared/pagination/pagination-component-options.model';
|
import { PaginationComponentOptions } from '../../../shared/pagination/pagination-component-options.model';
|
||||||
import { BitstreamFormat } from '../../../core/shared/bitstream-format.model';
|
import { BitstreamFormat } from '../../../core/shared/bitstream-format.model';
|
||||||
import { BitstreamFormatDataService } from '../../../core/data/bitstream-format-data.service';
|
import { BitstreamFormatDataService } from '../../../core/data/bitstream-format-data.service';
|
||||||
import { FindAllOptions } from '../../../core/data/request.models';
|
import { FindListOptions } from '../../../core/data/request.models';
|
||||||
import { map, switchMap, take } from 'rxjs/operators';
|
import { map, switchMap, take } from 'rxjs/operators';
|
||||||
import { hasValue } from '../../../shared/empty.util';
|
import { hasValue } from '../../../shared/empty.util';
|
||||||
import { NotificationsService } from '../../../shared/notifications/notifications.service';
|
import { NotificationsService } from '../../../shared/notifications/notifications.service';
|
||||||
@@ -35,7 +35,7 @@ export class BitstreamFormatsComponent implements OnInit {
|
|||||||
* The current pagination configuration for the page used by the FindAll method
|
* The current pagination configuration for the page used by the FindAll method
|
||||||
* Currently simply renders all bitstream formats
|
* Currently simply renders all bitstream formats
|
||||||
*/
|
*/
|
||||||
config: FindAllOptions = Object.assign(new FindAllOptions(), {
|
config: FindListOptions = Object.assign(new FindListOptions(), {
|
||||||
elementsPerPage: 20
|
elementsPerPage: 20
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -145,7 +145,7 @@ export class BitstreamFormatsComponent implements OnInit {
|
|||||||
* @param event The page change event
|
* @param event The page change event
|
||||||
*/
|
*/
|
||||||
onPageChange(event) {
|
onPageChange(event) {
|
||||||
this.config = Object.assign(new FindAllOptions(), this.config, {
|
this.config = Object.assign(new FindListOptions(), this.config, {
|
||||||
currentPage: event,
|
currentPage: event,
|
||||||
});
|
});
|
||||||
this.pageConfig.currentPage = event;
|
this.pageConfig.currentPage = event;
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Class representing a query parameter (query?fieldName=fieldValue) used in FindAllOptions object
|
* Class representing a query parameter (query?fieldName=fieldValue) used in FindListOptions object
|
||||||
*/
|
*/
|
||||||
export class SearchParam {
|
export class SearchParam {
|
||||||
constructor(public fieldName: string, public fieldValue: any) {
|
constructor(public fieldName: string, public fieldValue: any) {
|
||||||
|
@@ -3,7 +3,7 @@ import { TestScheduler } from 'rxjs/testing';
|
|||||||
import { getMockRequestService } from '../../shared/mocks/mock-request.service';
|
import { getMockRequestService } from '../../shared/mocks/mock-request.service';
|
||||||
import { ConfigService } from './config.service';
|
import { ConfigService } from './config.service';
|
||||||
import { RequestService } from '../data/request.service';
|
import { RequestService } from '../data/request.service';
|
||||||
import { ConfigRequest, FindAllOptions } from '../data/request.models';
|
import { ConfigRequest, FindListOptions } from '../data/request.models';
|
||||||
import { HALEndpointService } from '../shared/hal-endpoint.service';
|
import { HALEndpointService } from '../shared/hal-endpoint.service';
|
||||||
import { HALEndpointServiceStub } from '../../shared/testing/hal-endpoint-service-stub';
|
import { HALEndpointServiceStub } from '../../shared/testing/hal-endpoint-service-stub';
|
||||||
|
|
||||||
@@ -27,7 +27,7 @@ describe('ConfigService', () => {
|
|||||||
let requestService: RequestService;
|
let requestService: RequestService;
|
||||||
let halService: any;
|
let halService: any;
|
||||||
|
|
||||||
const findOptions: FindAllOptions = new FindAllOptions();
|
const findOptions: FindListOptions = new FindListOptions();
|
||||||
|
|
||||||
const scopeName = 'traditional';
|
const scopeName = 'traditional';
|
||||||
const scopeID = 'd9d30c0c-69b7-4369-8397-ca67c888974d';
|
const scopeID = 'd9d30c0c-69b7-4369-8397-ca67c888974d';
|
||||||
|
@@ -2,7 +2,7 @@ import { merge as observableMerge, Observable, throwError as observableThrowErro
|
|||||||
import { distinctUntilChanged, filter, map, mergeMap, tap } from 'rxjs/operators';
|
import { distinctUntilChanged, filter, map, mergeMap, tap } from 'rxjs/operators';
|
||||||
import { RequestService } from '../data/request.service';
|
import { RequestService } from '../data/request.service';
|
||||||
import { ConfigSuccessResponse } from '../cache/response.models';
|
import { ConfigSuccessResponse } from '../cache/response.models';
|
||||||
import { ConfigRequest, FindAllOptions, RestRequest } from '../data/request.models';
|
import { ConfigRequest, FindListOptions, RestRequest } from '../data/request.models';
|
||||||
import { hasValue, isNotEmpty } from '../../shared/empty.util';
|
import { hasValue, isNotEmpty } from '../../shared/empty.util';
|
||||||
import { HALEndpointService } from '../shared/hal-endpoint.service';
|
import { HALEndpointService } from '../shared/hal-endpoint.service';
|
||||||
import { ConfigData } from './config-data';
|
import { ConfigData } from './config-data';
|
||||||
@@ -35,7 +35,7 @@ export abstract class ConfigService {
|
|||||||
return `${endpoint}/${resourceName}`;
|
return `${endpoint}/${resourceName}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected getConfigSearchHref(endpoint, options: FindAllOptions = {}): string {
|
protected getConfigSearchHref(endpoint, options: FindListOptions = {}): string {
|
||||||
let result;
|
let result;
|
||||||
const args = [];
|
const args = [];
|
||||||
|
|
||||||
@@ -93,7 +93,7 @@ export abstract class ConfigService {
|
|||||||
distinctUntilChanged());
|
distinctUntilChanged());
|
||||||
}
|
}
|
||||||
|
|
||||||
public getConfigBySearch(options: FindAllOptions = {}): Observable<ConfigData> {
|
public getConfigBySearch(options: FindListOptions = {}): Observable<ConfigData> {
|
||||||
return this.halService.getEndpoint(this.linkPath).pipe(
|
return this.halService.getEndpoint(this.linkPath).pipe(
|
||||||
map((endpoint: string) => this.getConfigSearchHref(endpoint, options)),
|
map((endpoint: string) => this.getConfigSearchHref(endpoint, options)),
|
||||||
filter((href: string) => isNotEmpty(href)),
|
filter((href: string) => isNotEmpty(href)),
|
||||||
|
@@ -11,7 +11,7 @@ import { HALEndpointService } from '../shared/hal-endpoint.service';
|
|||||||
import { NotificationsService } from '../../shared/notifications/notifications.service';
|
import { NotificationsService } from '../../shared/notifications/notifications.service';
|
||||||
import { HttpClient } from '@angular/common/http';
|
import { HttpClient } from '@angular/common/http';
|
||||||
import { DefaultChangeAnalyzer } from './default-change-analyzer.service';
|
import { DefaultChangeAnalyzer } from './default-change-analyzer.service';
|
||||||
import { DeleteByIDRequest, FindAllOptions, PostRequest, PutRequest } from './request.models';
|
import { DeleteByIDRequest, FindListOptions, PostRequest, PutRequest } from './request.models';
|
||||||
import { Observable } from 'rxjs';
|
import { Observable } from 'rxjs';
|
||||||
import { find, map, tap } from 'rxjs/operators';
|
import { find, map, tap } from 'rxjs/operators';
|
||||||
import { configureRequest, getResponseFromEntry } from '../shared/operators';
|
import { configureRequest, getResponseFromEntry } from '../shared/operators';
|
||||||
@@ -54,10 +54,10 @@ export class BitstreamFormatDataService extends DataService<BitstreamFormat> {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the endpoint for browsing bitstream formats
|
* Get the endpoint for browsing bitstream formats
|
||||||
* @param {FindAllOptions} options
|
* @param {FindListOptions} options
|
||||||
* @returns {Observable<string>}
|
* @returns {Observable<string>}
|
||||||
*/
|
*/
|
||||||
getBrowseEndpoint(options: FindAllOptions = {}, linkPath?: string): Observable<string> {
|
getBrowseEndpoint(options: FindListOptions = {}, linkPath?: string): Observable<string> {
|
||||||
return this.halService.getEndpoint(this.linkPath);
|
return this.halService.getEndpoint(this.linkPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -16,7 +16,7 @@ import { HttpClient } from '@angular/common/http';
|
|||||||
import { NormalizedObjectBuildService } from '../cache/builders/normalized-object-build.service';
|
import { NormalizedObjectBuildService } from '../cache/builders/normalized-object-build.service';
|
||||||
import { DSOChangeAnalyzer } from './dso-change-analyzer.service';
|
import { DSOChangeAnalyzer } from './dso-change-analyzer.service';
|
||||||
import { Observable } from 'rxjs/internal/Observable';
|
import { Observable } from 'rxjs/internal/Observable';
|
||||||
import { FindAllOptions, GetRequest } from './request.models';
|
import { FindListOptions, GetRequest } from './request.models';
|
||||||
import { RemoteData } from './remote-data';
|
import { RemoteData } from './remote-data';
|
||||||
import { PaginatedList } from './paginated-list';
|
import { PaginatedList } from './paginated-list';
|
||||||
import { configureRequest } from '../shared/operators';
|
import { configureRequest } from '../shared/operators';
|
||||||
@@ -50,11 +50,11 @@ export class CollectionDataService extends ComColDataService<Collection> {
|
|||||||
/**
|
/**
|
||||||
* Get all collections the user is authorized to submit to
|
* Get all collections the user is authorized to submit to
|
||||||
*
|
*
|
||||||
* @param options The [[FindAllOptions]] object
|
* @param options The [[FindListOptions]] object
|
||||||
* @return Observable<RemoteData<PaginatedList<Collection>>>
|
* @return Observable<RemoteData<PaginatedList<Collection>>>
|
||||||
* collection list
|
* collection list
|
||||||
*/
|
*/
|
||||||
getAuthorizedCollection(options: FindAllOptions = {}): Observable<RemoteData<PaginatedList<Collection>>> {
|
getAuthorizedCollection(options: FindListOptions = {}): Observable<RemoteData<PaginatedList<Collection>>> {
|
||||||
const searchHref = 'findAuthorized';
|
const searchHref = 'findAuthorized';
|
||||||
|
|
||||||
return this.searchBy(searchHref, options).pipe(
|
return this.searchBy(searchHref, options).pipe(
|
||||||
@@ -65,11 +65,11 @@ export class CollectionDataService extends ComColDataService<Collection> {
|
|||||||
* Get all collections the user is authorized to submit to, by community
|
* Get all collections the user is authorized to submit to, by community
|
||||||
*
|
*
|
||||||
* @param communityId The community id
|
* @param communityId The community id
|
||||||
* @param options The [[FindAllOptions]] object
|
* @param options The [[FindListOptions]] object
|
||||||
* @return Observable<RemoteData<PaginatedList<Collection>>>
|
* @return Observable<RemoteData<PaginatedList<Collection>>>
|
||||||
* collection list
|
* collection list
|
||||||
*/
|
*/
|
||||||
getAuthorizedCollectionByCommunity(communityId: string, options: FindAllOptions = {}): Observable<RemoteData<PaginatedList<Collection>>> {
|
getAuthorizedCollectionByCommunity(communityId: string, options: FindListOptions = {}): Observable<RemoteData<PaginatedList<Collection>>> {
|
||||||
const searchHref = 'findAuthorizedByCommunity';
|
const searchHref = 'findAuthorizedByCommunity';
|
||||||
options.searchParams = [new SearchParam('uuid', communityId)];
|
options.searchParams = [new SearchParam('uuid', communityId)];
|
||||||
|
|
||||||
@@ -85,7 +85,7 @@ export class CollectionDataService extends ComColDataService<Collection> {
|
|||||||
*/
|
*/
|
||||||
hasAuthorizedCollection(): Observable<boolean> {
|
hasAuthorizedCollection(): Observable<boolean> {
|
||||||
const searchHref = 'findAuthorized';
|
const searchHref = 'findAuthorized';
|
||||||
const options = new FindAllOptions();
|
const options = new FindListOptions();
|
||||||
options.elementsPerPage = 1;
|
options.elementsPerPage = 1;
|
||||||
|
|
||||||
return this.searchBy(searchHref, options).pipe(
|
return this.searchBy(searchHref, options).pipe(
|
||||||
|
@@ -8,7 +8,7 @@ import { ObjectCacheService } from '../cache/object-cache.service';
|
|||||||
import { CoreState } from '../core.reducers';
|
import { CoreState } from '../core.reducers';
|
||||||
import { ComColDataService } from './comcol-data.service';
|
import { ComColDataService } from './comcol-data.service';
|
||||||
import { CommunityDataService } from './community-data.service';
|
import { CommunityDataService } from './community-data.service';
|
||||||
import { FindAllOptions, FindByIDRequest } from './request.models';
|
import { FindListOptions, FindByIDRequest } from './request.models';
|
||||||
import { RequestService } from './request.service';
|
import { RequestService } from './request.service';
|
||||||
import { NormalizedObject } from '../cache/models/normalized-object.model';
|
import { NormalizedObject } from '../cache/models/normalized-object.model';
|
||||||
import { HALEndpointService } from '../shared/hal-endpoint.service';
|
import { HALEndpointService } from '../shared/hal-endpoint.service';
|
||||||
@@ -66,7 +66,7 @@ describe('ComColDataService', () => {
|
|||||||
const dataBuildService = {} as NormalizedObjectBuildService;
|
const dataBuildService = {} as NormalizedObjectBuildService;
|
||||||
|
|
||||||
const scopeID = 'd9d30c0c-69b7-4369-8397-ca67c888974d';
|
const scopeID = 'd9d30c0c-69b7-4369-8397-ca67c888974d';
|
||||||
const options = Object.assign(new FindAllOptions(), {
|
const options = Object.assign(new FindListOptions(), {
|
||||||
scopeID: scopeID
|
scopeID: scopeID
|
||||||
});
|
});
|
||||||
const getRequestEntry$ = (successful: boolean) => {
|
const getRequestEntry$ = (successful: boolean) => {
|
||||||
|
@@ -6,7 +6,7 @@ import { ObjectCacheService } from '../cache/object-cache.service';
|
|||||||
import { CommunityDataService } from './community-data.service';
|
import { CommunityDataService } from './community-data.service';
|
||||||
|
|
||||||
import { DataService } from './data.service';
|
import { DataService } from './data.service';
|
||||||
import { FindAllOptions, FindByIDRequest } from './request.models';
|
import { FindListOptions, FindByIDRequest } from './request.models';
|
||||||
import { HALEndpointService } from '../shared/hal-endpoint.service';
|
import { HALEndpointService } from '../shared/hal-endpoint.service';
|
||||||
import { getResponseFromEntry } from '../shared/operators';
|
import { getResponseFromEntry } from '../shared/operators';
|
||||||
import { CacheableObject } from '../cache/object-cache.reducer';
|
import { CacheableObject } from '../cache/object-cache.reducer';
|
||||||
@@ -26,7 +26,7 @@ export abstract class ComColDataService<T extends CacheableObject> extends DataS
|
|||||||
* @return { Observable<string> }
|
* @return { Observable<string> }
|
||||||
* an Observable<string> containing the scoped URL
|
* an Observable<string> containing the scoped URL
|
||||||
*/
|
*/
|
||||||
public getBrowseEndpoint(options: FindAllOptions = {}, linkPath: string = this.linkPath): Observable<string> {
|
public getBrowseEndpoint(options: FindListOptions = {}, linkPath: string = this.linkPath): Observable<string> {
|
||||||
if (isEmpty(options.scopeID)) {
|
if (isEmpty(options.scopeID)) {
|
||||||
return this.halService.getEndpoint(linkPath);
|
return this.halService.getEndpoint(linkPath);
|
||||||
} else {
|
} else {
|
||||||
|
@@ -9,7 +9,7 @@ import { Community } from '../shared/community.model';
|
|||||||
import { ComColDataService } from './comcol-data.service';
|
import { ComColDataService } from './comcol-data.service';
|
||||||
import { RequestService } from './request.service';
|
import { RequestService } from './request.service';
|
||||||
import { HALEndpointService } from '../shared/hal-endpoint.service';
|
import { HALEndpointService } from '../shared/hal-endpoint.service';
|
||||||
import { FindAllOptions, FindAllRequest } from './request.models';
|
import { FindListOptions, FindAllRequest } from './request.models';
|
||||||
import { RemoteData } from './remote-data';
|
import { RemoteData } from './remote-data';
|
||||||
import { hasValue } from '../../shared/empty.util';
|
import { hasValue } from '../../shared/empty.util';
|
||||||
import { Observable } from 'rxjs';
|
import { Observable } from 'rxjs';
|
||||||
@@ -44,7 +44,7 @@ export class CommunityDataService extends ComColDataService<Community> {
|
|||||||
return this.halService.getEndpoint(this.linkPath);
|
return this.halService.getEndpoint(this.linkPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
findTop(options: FindAllOptions = {}): Observable<RemoteData<PaginatedList<Community>>> {
|
findTop(options: FindListOptions = {}): Observable<RemoteData<PaginatedList<Community>>> {
|
||||||
const hrefObs = this.getFindAllHref(options, this.topLinkPath);
|
const hrefObs = this.getFindAllHref(options, this.topLinkPath);
|
||||||
hrefObs.pipe(
|
hrefObs.pipe(
|
||||||
filter((href: string) => hasValue(href)),
|
filter((href: string) => hasValue(href)),
|
||||||
@@ -57,7 +57,7 @@ export class CommunityDataService extends ComColDataService<Community> {
|
|||||||
return this.rdbService.buildList<Community>(hrefObs) as Observable<RemoteData<PaginatedList<Community>>>;
|
return this.rdbService.buildList<Community>(hrefObs) as Observable<RemoteData<PaginatedList<Community>>>;
|
||||||
}
|
}
|
||||||
|
|
||||||
findSubCommunitiesPerParentCommunity(parentCommunityUUID: string, options: FindAllOptions = {}): Observable<RemoteData<PaginatedList<Community>>> {
|
findSubCommunitiesPerParentCommunity(parentCommunityUUID: string, options: FindListOptions = {}): Observable<RemoteData<PaginatedList<Community>>> {
|
||||||
const hrefObs = this.getFindAllHref(options, this.subcommunitiesLinkPath + '?parent=' + parentCommunityUUID);
|
const hrefObs = this.getFindAllHref(options, this.subcommunitiesLinkPath + '?parent=' + parentCommunityUUID);
|
||||||
console.log('subcomurl', hrefObs.pipe(take(1)).subscribe((val) => console.log('subcomurl', val)));
|
console.log('subcomurl', hrefObs.pipe(take(1)).subscribe((val) => console.log('subcomurl', val)));
|
||||||
|
|
||||||
|
@@ -6,7 +6,7 @@ import { CoreState } from '../core.reducers';
|
|||||||
import { Store } from '@ngrx/store';
|
import { Store } from '@ngrx/store';
|
||||||
import { HALEndpointService } from '../shared/hal-endpoint.service';
|
import { HALEndpointService } from '../shared/hal-endpoint.service';
|
||||||
import { Observable, of as observableOf } from 'rxjs';
|
import { Observable, of as observableOf } from 'rxjs';
|
||||||
import { FindAllOptions } from './request.models';
|
import { FindListOptions } from './request.models';
|
||||||
import { SortDirection, SortOptions } from '../cache/models/sort-options.model';
|
import { SortDirection, SortOptions } from '../cache/models/sort-options.model';
|
||||||
import { ObjectCacheService } from '../cache/object-cache.service';
|
import { ObjectCacheService } from '../cache/object-cache.service';
|
||||||
import { compare, Operation } from 'fast-json-patch';
|
import { compare, Operation } from 'fast-json-patch';
|
||||||
@@ -40,7 +40,7 @@ class TestService extends DataService<any> {
|
|||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
public getBrowseEndpoint(options: FindAllOptions = {}, linkPath: string = this.linkPath): Observable<string> {
|
public getBrowseEndpoint(options: FindListOptions = {}, linkPath: string = this.linkPath): Observable<string> {
|
||||||
return observableOf(endpoint);
|
return observableOf(endpoint);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -53,7 +53,7 @@ class DummyChangeAnalyzer implements ChangeAnalyzer<NormalizedTestObject> {
|
|||||||
}
|
}
|
||||||
describe('DataService', () => {
|
describe('DataService', () => {
|
||||||
let service: TestService;
|
let service: TestService;
|
||||||
let options: FindAllOptions;
|
let options: FindListOptions;
|
||||||
const requestService = {} as RequestService;
|
const requestService = {} as RequestService;
|
||||||
const halService = {} as HALEndpointService;
|
const halService = {} as HALEndpointService;
|
||||||
const rdbService = {} as RemoteDataBuildService;
|
const rdbService = {} as RemoteDataBuildService;
|
||||||
|
@@ -14,7 +14,7 @@ import { RemoteData } from './remote-data';
|
|||||||
import {
|
import {
|
||||||
CreateRequest,
|
CreateRequest,
|
||||||
DeleteByIDRequest,
|
DeleteByIDRequest,
|
||||||
FindAllOptions,
|
FindListOptions,
|
||||||
FindAllRequest,
|
FindAllRequest,
|
||||||
FindByIDRequest,
|
FindByIDRequest,
|
||||||
GetRequest
|
GetRequest
|
||||||
@@ -54,17 +54,17 @@ export abstract class DataService<T extends CacheableObject> {
|
|||||||
*/
|
*/
|
||||||
protected responseMsToLive: number;
|
protected responseMsToLive: number;
|
||||||
|
|
||||||
public abstract getBrowseEndpoint(options: FindAllOptions, linkPath?: string): Observable<string>
|
public abstract getBrowseEndpoint(options: FindListOptions, linkPath?: string): Observable<string>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create the HREF with given options object
|
* Create the HREF with given options object
|
||||||
*
|
*
|
||||||
* @param options The [[FindAllOptions]] object
|
* @param options The [[FindListOptions]] object
|
||||||
* @param linkPath The link path for the object
|
* @param linkPath The link path for the object
|
||||||
* @return {Observable<string>}
|
* @return {Observable<string>}
|
||||||
* Return an observable that emits created HREF
|
* Return an observable that emits created HREF
|
||||||
*/
|
*/
|
||||||
protected getFindAllHref(options: FindAllOptions = {}, linkPath?: string): Observable<string> {
|
protected getFindAllHref(options: FindListOptions = {}, linkPath?: string): Observable<string> {
|
||||||
let result: Observable<string>;
|
let result: Observable<string>;
|
||||||
const args = [];
|
const args = [];
|
||||||
|
|
||||||
@@ -77,11 +77,11 @@ export abstract class DataService<T extends CacheableObject> {
|
|||||||
* Create the HREF for a specific object's search method with given options object
|
* Create the HREF for a specific object's search method with given options object
|
||||||
*
|
*
|
||||||
* @param searchMethod The search method for the object
|
* @param searchMethod The search method for the object
|
||||||
* @param options The [[FindAllOptions]] object
|
* @param options The [[FindListOptions]] object
|
||||||
* @return {Observable<string>}
|
* @return {Observable<string>}
|
||||||
* Return an observable that emits created HREF
|
* Return an observable that emits created HREF
|
||||||
*/
|
*/
|
||||||
protected getSearchByHref(searchMethod: string, options: FindAllOptions = {}): Observable<string> {
|
protected getSearchByHref(searchMethod: string, options: FindListOptions = {}): Observable<string> {
|
||||||
let result: Observable<string>;
|
let result: Observable<string>;
|
||||||
const args = [];
|
const args = [];
|
||||||
|
|
||||||
@@ -101,11 +101,11 @@ export abstract class DataService<T extends CacheableObject> {
|
|||||||
*
|
*
|
||||||
* @param href$ The HREF to which the query string should be appended
|
* @param href$ The HREF to which the query string should be appended
|
||||||
* @param args Array with additional params to combine with query string
|
* @param args Array with additional params to combine with query string
|
||||||
* @param options The [[FindAllOptions]] object
|
* @param options The [[FindListOptions]] object
|
||||||
* @return {Observable<string>}
|
* @return {Observable<string>}
|
||||||
* Return an observable that emits created HREF
|
* Return an observable that emits created HREF
|
||||||
*/
|
*/
|
||||||
protected buildHrefFromFindOptions(href$: Observable<string>, args: string[], options: FindAllOptions): Observable<string> {
|
protected buildHrefFromFindOptions(href$: Observable<string>, args: string[], options: FindListOptions): Observable<string> {
|
||||||
|
|
||||||
if (hasValue(options.currentPage) && typeof options.currentPage === 'number') {
|
if (hasValue(options.currentPage) && typeof options.currentPage === 'number') {
|
||||||
/* TODO: this is a temporary fix for the pagination start index (0 or 1) discrepancy between the rest and the frontend respectively */
|
/* TODO: this is a temporary fix for the pagination start index (0 or 1) discrepancy between the rest and the frontend respectively */
|
||||||
@@ -127,7 +127,7 @@ export abstract class DataService<T extends CacheableObject> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
findAll(options: FindAllOptions = {}): Observable<RemoteData<PaginatedList<T>>> {
|
findAll(options: FindListOptions = {}): Observable<RemoteData<PaginatedList<T>>> {
|
||||||
const hrefObs = this.getFindAllHref(options);
|
const hrefObs = this.getFindAllHref(options);
|
||||||
|
|
||||||
hrefObs.pipe(
|
hrefObs.pipe(
|
||||||
@@ -194,11 +194,11 @@ export abstract class DataService<T extends CacheableObject> {
|
|||||||
* Make a new FindAllRequest with given search method
|
* Make a new FindAllRequest with given search method
|
||||||
*
|
*
|
||||||
* @param searchMethod The search method for the object
|
* @param searchMethod The search method for the object
|
||||||
* @param options The [[FindAllOptions]] object
|
* @param options The [[FindListOptions]] object
|
||||||
* @return {Observable<RemoteData<PaginatedList<T>>}
|
* @return {Observable<RemoteData<PaginatedList<T>>}
|
||||||
* Return an observable that emits response from the server
|
* Return an observable that emits response from the server
|
||||||
*/
|
*/
|
||||||
protected searchBy(searchMethod: string, options: FindAllOptions = {}): Observable<RemoteData<PaginatedList<T>>> {
|
protected searchBy(searchMethod: string, options: FindListOptions = {}): Observable<RemoteData<PaginatedList<T>>> {
|
||||||
|
|
||||||
const hrefObs = this.getSearchByHref(searchMethod, options);
|
const hrefObs = this.getSearchByHref(searchMethod, options);
|
||||||
|
|
||||||
|
@@ -8,7 +8,7 @@ import { HALEndpointService } from '../shared/hal-endpoint.service';
|
|||||||
import { DataService } from './data.service';
|
import { DataService } from './data.service';
|
||||||
import { RemoteData } from './remote-data';
|
import { RemoteData } from './remote-data';
|
||||||
import { RequestService } from './request.service';
|
import { RequestService } from './request.service';
|
||||||
import { FindAllOptions } from './request.models';
|
import { FindListOptions } from './request.models';
|
||||||
import { ObjectCacheService } from '../cache/object-cache.service';
|
import { ObjectCacheService } from '../cache/object-cache.service';
|
||||||
import { NotificationsService } from '../../shared/notifications/notifications.service';
|
import { NotificationsService } from '../../shared/notifications/notifications.service';
|
||||||
import { HttpClient } from '@angular/common/http';
|
import { HttpClient } from '@angular/common/http';
|
||||||
@@ -32,7 +32,7 @@ class DataServiceImpl extends DataService<DSpaceObject> {
|
|||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
getBrowseEndpoint(options: FindAllOptions = {}, linkPath: string = this.linkPath): Observable<string> {
|
getBrowseEndpoint(options: FindListOptions = {}, linkPath: string = this.linkPath): Observable<string> {
|
||||||
return this.halService.getEndpoint(linkPath);
|
return this.halService.getEndpoint(linkPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -2,14 +2,13 @@ import { Store } from '@ngrx/store';
|
|||||||
import { cold, getTestScheduler } from 'jasmine-marbles';
|
import { cold, getTestScheduler } from 'jasmine-marbles';
|
||||||
import { TestScheduler } from 'rxjs/testing';
|
import { TestScheduler } from 'rxjs/testing';
|
||||||
import { BrowseService } from '../browse/browse.service';
|
import { BrowseService } from '../browse/browse.service';
|
||||||
import { RemoteDataBuildService } from '../cache/builders/remote-data-build.service';
|
|
||||||
import { CoreState } from '../core.reducers';
|
import { CoreState } from '../core.reducers';
|
||||||
import { ItemDataService } from './item-data.service';
|
import { ItemDataService } from './item-data.service';
|
||||||
import { RequestService } from './request.service';
|
import { RequestService } from './request.service';
|
||||||
import { HALEndpointService } from '../shared/hal-endpoint.service';
|
import { HALEndpointService } from '../shared/hal-endpoint.service';
|
||||||
import {
|
import {
|
||||||
DeleteRequest,
|
DeleteRequest,
|
||||||
FindAllOptions,
|
FindListOptions,
|
||||||
GetRequest,
|
GetRequest,
|
||||||
MappedCollectionsRequest,
|
MappedCollectionsRequest,
|
||||||
PostRequest,
|
PostRequest,
|
||||||
@@ -58,7 +57,7 @@ describe('ItemDataService', () => {
|
|||||||
} as HALEndpointService;
|
} as HALEndpointService;
|
||||||
|
|
||||||
const scopeID = '4af28e99-6a9c-4036-a199-e1b587046d39';
|
const scopeID = '4af28e99-6a9c-4036-a199-e1b587046d39';
|
||||||
const options = Object.assign(new FindAllOptions(), {
|
const options = Object.assign(new FindListOptions(), {
|
||||||
scopeID: scopeID,
|
scopeID: scopeID,
|
||||||
sort: {
|
sort: {
|
||||||
field: '',
|
field: '',
|
||||||
|
@@ -14,7 +14,7 @@ import { RequestService } from './request.service';
|
|||||||
import { HALEndpointService } from '../shared/hal-endpoint.service';
|
import { HALEndpointService } from '../shared/hal-endpoint.service';
|
||||||
import {
|
import {
|
||||||
DeleteRequest,
|
DeleteRequest,
|
||||||
FindAllOptions,
|
FindListOptions,
|
||||||
MappedCollectionsRequest,
|
MappedCollectionsRequest,
|
||||||
PatchRequest,
|
PatchRequest,
|
||||||
PostRequest, PutRequest,
|
PostRequest, PutRequest,
|
||||||
@@ -59,10 +59,10 @@ export class ItemDataService extends DataService<Item> {
|
|||||||
/**
|
/**
|
||||||
* Get the endpoint for browsing items
|
* Get the endpoint for browsing items
|
||||||
* (When options.sort.field is empty, the default field to browse by will be 'dc.date.issued')
|
* (When options.sort.field is empty, the default field to browse by will be 'dc.date.issued')
|
||||||
* @param {FindAllOptions} options
|
* @param {FindListOptions} options
|
||||||
* @returns {Observable<string>}
|
* @returns {Observable<string>}
|
||||||
*/
|
*/
|
||||||
public getBrowseEndpoint(options: FindAllOptions = {}, linkPath: string = this.linkPath): Observable<string> {
|
public getBrowseEndpoint(options: FindListOptions = {}, linkPath: string = this.linkPath): Observable<string> {
|
||||||
let field = 'dc.date.issued';
|
let field = 'dc.date.issued';
|
||||||
if (options.sort && options.sort.field) {
|
if (options.sort && options.sort.field) {
|
||||||
field = options.sort.field;
|
field = options.sort.field;
|
||||||
|
@@ -7,7 +7,7 @@ import { CoreState } from '../core.reducers';
|
|||||||
import { DataService } from './data.service';
|
import { DataService } from './data.service';
|
||||||
import { RequestService } from './request.service';
|
import { RequestService } from './request.service';
|
||||||
import { HALEndpointService } from '../shared/hal-endpoint.service';
|
import { HALEndpointService } from '../shared/hal-endpoint.service';
|
||||||
import { FindAllOptions } from './request.models';
|
import { FindListOptions } from './request.models';
|
||||||
import { ObjectCacheService } from '../cache/object-cache.service';
|
import { ObjectCacheService } from '../cache/object-cache.service';
|
||||||
import { NormalizedObjectBuildService } from '../cache/builders/normalized-object-build.service';
|
import { NormalizedObjectBuildService } from '../cache/builders/normalized-object-build.service';
|
||||||
import { HttpClient } from '@angular/common/http';
|
import { HttpClient } from '@angular/common/http';
|
||||||
@@ -33,7 +33,7 @@ class DataServiceImpl extends DataService<MetadataSchema> {
|
|||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
getBrowseEndpoint(options: FindAllOptions = {}, linkPath: string = this.linkPath): Observable<string> {
|
getBrowseEndpoint(options: FindListOptions = {}, linkPath: string = this.linkPath): Observable<string> {
|
||||||
return this.halService.getEndpoint(linkPath);
|
return this.halService.getEndpoint(linkPath);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -138,7 +138,7 @@ export class FindByIDRequest extends GetRequest {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export class FindAllOptions {
|
export class FindListOptions {
|
||||||
scopeID?: string;
|
scopeID?: string;
|
||||||
elementsPerPage?: number;
|
elementsPerPage?: number;
|
||||||
currentPage?: number;
|
currentPage?: number;
|
||||||
@@ -151,7 +151,7 @@ export class FindAllRequest extends GetRequest {
|
|||||||
constructor(
|
constructor(
|
||||||
uuid: string,
|
uuid: string,
|
||||||
href: string,
|
href: string,
|
||||||
public body?: FindAllOptions,
|
public body?: FindListOptions,
|
||||||
) {
|
) {
|
||||||
super(uuid, href);
|
super(uuid, href);
|
||||||
}
|
}
|
||||||
|
@@ -6,7 +6,7 @@ import { Observable } from 'rxjs';
|
|||||||
|
|
||||||
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 { FindAllOptions } from '../data/request.models';
|
import { FindListOptions } from '../data/request.models';
|
||||||
import { HALEndpointService } from '../shared/hal-endpoint.service';
|
import { HALEndpointService } from '../shared/hal-endpoint.service';
|
||||||
import { ResourcePolicy } from '../shared/resource-policy.model';
|
import { ResourcePolicy } from '../shared/resource-policy.model';
|
||||||
import { RemoteData } from '../data/remote-data';
|
import { RemoteData } from '../data/remote-data';
|
||||||
@@ -36,7 +36,7 @@ class DataServiceImpl extends DataService<ResourcePolicy> {
|
|||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
getBrowseEndpoint(options: FindAllOptions = {}, linkPath: string = this.linkPath): Observable<string> {
|
getBrowseEndpoint(options: FindListOptions = {}, linkPath: string = this.linkPath): Observable<string> {
|
||||||
return this.halService.getEndpoint(linkPath);
|
return this.halService.getEndpoint(linkPath);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
import { Observable } from 'rxjs';
|
import { Observable } from 'rxjs';
|
||||||
import { FindAllOptions } from '../data/request.models';
|
import { FindListOptions } from '../data/request.models';
|
||||||
import { DataService } from '../data/data.service';
|
import { DataService } from '../data/data.service';
|
||||||
import { CacheableObject } from '../cache/object-cache.reducer';
|
import { CacheableObject } from '../cache/object-cache.reducer';
|
||||||
|
|
||||||
@@ -8,7 +8,7 @@ import { CacheableObject } from '../cache/object-cache.reducer';
|
|||||||
*/
|
*/
|
||||||
export abstract class EpersonService<TDomain extends CacheableObject> extends DataService<TDomain> {
|
export abstract class EpersonService<TDomain extends CacheableObject> extends DataService<TDomain> {
|
||||||
|
|
||||||
public getBrowseEndpoint(options: FindAllOptions): Observable<string> {
|
public getBrowseEndpoint(options: FindListOptions): Observable<string> {
|
||||||
return this.halService.getEndpoint(this.linkPath);
|
return this.halService.getEndpoint(this.linkPath);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -7,7 +7,7 @@ import { filter, map, take } from 'rxjs/operators';
|
|||||||
|
|
||||||
import { EpersonService } from './eperson.service';
|
import { EpersonService } from './eperson.service';
|
||||||
import { RequestService } from '../data/request.service';
|
import { RequestService } from '../data/request.service';
|
||||||
import { FindAllOptions } from '../data/request.models';
|
import { FindListOptions } from '../data/request.models';
|
||||||
import { HALEndpointService } from '../shared/hal-endpoint.service';
|
import { HALEndpointService } from '../shared/hal-endpoint.service';
|
||||||
import { Group } from './models/group.model';
|
import { Group } from './models/group.model';
|
||||||
import { RemoteDataBuildService } from '../cache/builders/remote-data-build.service';
|
import { RemoteDataBuildService } from '../cache/builders/remote-data-build.service';
|
||||||
@@ -52,7 +52,7 @@ export class GroupEpersonService extends EpersonService<Group> {
|
|||||||
*/
|
*/
|
||||||
isMemberOf(groupName: string): Observable<boolean> {
|
isMemberOf(groupName: string): Observable<boolean> {
|
||||||
const searchHref = 'isMemberOf';
|
const searchHref = 'isMemberOf';
|
||||||
const options = new FindAllOptions();
|
const options = new FindListOptions();
|
||||||
options.searchParams = [new SearchParam('groupName', groupName)];
|
options.searchParams = [new SearchParam('groupName', groupName)];
|
||||||
|
|
||||||
return this.searchBy(searchHref, options).pipe(
|
return this.searchBy(searchHref, options).pipe(
|
||||||
|
@@ -8,7 +8,7 @@ import { DataService } from '../data/data.service';
|
|||||||
import { RequestService } from '../data/request.service';
|
import { RequestService } from '../data/request.service';
|
||||||
import { WorkflowItem } from './models/workflowitem.model';
|
import { WorkflowItem } from './models/workflowitem.model';
|
||||||
import { HALEndpointService } from '../shared/hal-endpoint.service';
|
import { HALEndpointService } from '../shared/hal-endpoint.service';
|
||||||
import { FindAllOptions } from '../data/request.models';
|
import { FindListOptions } from '../data/request.models';
|
||||||
import { NormalizedObjectBuildService } from '../cache/builders/normalized-object-build.service';
|
import { NormalizedObjectBuildService } from '../cache/builders/normalized-object-build.service';
|
||||||
import { NotificationsService } from '../../shared/notifications/notifications.service';
|
import { NotificationsService } from '../../shared/notifications/notifications.service';
|
||||||
import { ObjectCacheService } from '../cache/object-cache.service';
|
import { ObjectCacheService } from '../cache/object-cache.service';
|
||||||
@@ -35,7 +35,7 @@ export class WorkflowItemDataService extends DataService<WorkflowItem> {
|
|||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
public getBrowseEndpoint(options: FindAllOptions) {
|
public getBrowseEndpoint(options: FindListOptions) {
|
||||||
return this.halService.getEndpoint(this.linkPath);
|
return this.halService.getEndpoint(this.linkPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -7,7 +7,7 @@ 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 { FindAllOptions } from '../data/request.models';
|
import { FindListOptions } from '../data/request.models';
|
||||||
import { NormalizedObjectBuildService } from '../cache/builders/normalized-object-build.service';
|
import { NormalizedObjectBuildService } from '../cache/builders/normalized-object-build.service';
|
||||||
import { NotificationsService } from '../../shared/notifications/notifications.service';
|
import { NotificationsService } from '../../shared/notifications/notifications.service';
|
||||||
import { ObjectCacheService } from '../cache/object-cache.service';
|
import { ObjectCacheService } from '../cache/object-cache.service';
|
||||||
@@ -35,7 +35,7 @@ export class WorkspaceitemDataService extends DataService<WorkspaceItem> {
|
|||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
public getBrowseEndpoint(options: FindAllOptions) {
|
public getBrowseEndpoint(options: FindListOptions) {
|
||||||
return this.halService.getEndpoint(this.linkPath);
|
return this.halService.getEndpoint(this.linkPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -4,7 +4,7 @@ import { merge as observableMerge, Observable, of as observableOf } from 'rxjs';
|
|||||||
import { distinctUntilChanged, filter, flatMap, map, mergeMap, tap } from 'rxjs/operators';
|
import { distinctUntilChanged, filter, flatMap, map, mergeMap, tap } from 'rxjs/operators';
|
||||||
|
|
||||||
import { DataService } from '../data/data.service';
|
import { DataService } from '../data/data.service';
|
||||||
import { DeleteRequest, FindAllOptions, PostRequest, TaskDeleteRequest, TaskPostRequest } from '../data/request.models';
|
import { DeleteRequest, FindListOptions, PostRequest, TaskDeleteRequest, TaskPostRequest } from '../data/request.models';
|
||||||
import { isNotEmpty } from '../../shared/empty.util';
|
import { isNotEmpty } from '../../shared/empty.util';
|
||||||
import { HttpOptions } from '../dspace-rest-v2/dspace-rest-v2.service';
|
import { HttpOptions } from '../dspace-rest-v2/dspace-rest-v2.service';
|
||||||
import { ProcessTaskResponse } from './models/process-task-response';
|
import { ProcessTaskResponse } from './models/process-task-response';
|
||||||
@@ -18,7 +18,7 @@ import { CacheableObject } from '../cache/object-cache.reducer';
|
|||||||
*/
|
*/
|
||||||
export abstract class TasksService<T extends CacheableObject> extends DataService<T> {
|
export abstract class TasksService<T extends CacheableObject> extends DataService<T> {
|
||||||
|
|
||||||
public getBrowseEndpoint(options: FindAllOptions): Observable<string> {
|
public getBrowseEndpoint(options: FindListOptions): Observable<string> {
|
||||||
return this.halService.getEndpoint(this.linkPath);
|
return this.halService.getEndpoint(this.linkPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -36,7 +36,7 @@ import { SubmissionService } from '../../submission.service';
|
|||||||
import { SubmissionObject } from '../../../core/submission/models/submission-object.model';
|
import { SubmissionObject } from '../../../core/submission/models/submission-object.model';
|
||||||
import { SubmissionJsonPatchOperationsService } from '../../../core/submission/submission-json-patch-operations.service';
|
import { SubmissionJsonPatchOperationsService } from '../../../core/submission/submission-json-patch-operations.service';
|
||||||
import { CollectionDataService } from '../../../core/data/collection-data.service';
|
import { CollectionDataService } from '../../../core/data/collection-data.service';
|
||||||
import { FindAllOptions } from '../../../core/data/request.models';
|
import { FindListOptions } from '../../../core/data/request.models';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An interface to represent a collection entry
|
* An interface to represent a collection entry
|
||||||
@@ -205,7 +205,7 @@ export class SubmissionFormCollectionComponent implements OnChanges, OnInit {
|
|||||||
map((collectionRD: RemoteData<Collection>) => collectionRD.payload.name)
|
map((collectionRD: RemoteData<Collection>) => collectionRD.payload.name)
|
||||||
);
|
);
|
||||||
|
|
||||||
const findOptions: FindAllOptions = {
|
const findOptions: FindListOptions = {
|
||||||
elementsPerPage: 1000
|
elementsPerPage: 1000
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user