mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 01:54:15 +00:00
68405: separate resource types, missing @link paras/followLinks, start test fix
This commit is contained in:

committed by
Art Lowel

parent
b2f966eb83
commit
f17e204712
@@ -4,6 +4,7 @@ import { DeleteRelationship, FieldUpdate, FieldUpdates } from '../../../core/dat
|
||||
import { Observable } from 'rxjs/internal/Observable';
|
||||
import { filter, map, switchMap, take } from 'rxjs/operators';
|
||||
import { zip as observableZip } from 'rxjs';
|
||||
import { followLink } from '../../../shared/utils/follow-link-config.model';
|
||||
import { AbstractItemUpdateComponent } from '../abstract-item-update/abstract-item-update.component';
|
||||
import { ItemDataService } from '../../../core/data/item-data.service';
|
||||
import { ObjectUpdatesService } from '../../../core/data/object-updates/object-updates.service';
|
||||
@@ -71,7 +72,10 @@ export class ItemRelationshipsComponent extends AbstractItemUpdateComponent impl
|
||||
super.ngOnInit();
|
||||
this.itemUpdateSubscription = this.requestService.hasByHrefObservable(this.item.self).pipe(
|
||||
filter((exists: boolean) => !exists),
|
||||
switchMap(() => this.itemService.findById(this.item.uuid)),
|
||||
switchMap(() => this.itemService.findById(this.item.uuid,
|
||||
followLink('owningCollection'),
|
||||
followLink('bundles'),
|
||||
followLink('relationships'))),
|
||||
getSucceededRemoteData(),
|
||||
).subscribe((itemRD: RemoteData<Item>) => {
|
||||
this.item = itemRD.payload;
|
||||
|
@@ -1,12 +1,12 @@
|
||||
import { getSucceededRemoteData } from '../../../../core/shared/operators';
|
||||
import { hasValue } from '../../../../shared/empty.util';
|
||||
import { Observable } from 'rxjs/internal/Observable';
|
||||
import { Relationship } from '../../../../core/shared/item-relationships/relationship.model';
|
||||
import { distinctUntilChanged, flatMap, map, switchMap } from 'rxjs/operators';
|
||||
import { combineLatest as observableCombineLatest, zip as observableZip } from 'rxjs';
|
||||
import { Item } from '../../../../core/shared/item.model';
|
||||
import { Observable } from 'rxjs/internal/Observable';
|
||||
import { distinctUntilChanged, flatMap, map, switchMap } from 'rxjs/operators';
|
||||
import { PaginatedList } from '../../../../core/data/paginated-list';
|
||||
import { RemoteData } from '../../../../core/data/remote-data';
|
||||
import { Relationship } from '../../../../core/shared/item-relationships/relationship.model';
|
||||
import { Item } from '../../../../core/shared/item.model';
|
||||
import { getFinishedRemoteData, getSucceededRemoteData } from '../../../../core/shared/operators';
|
||||
import { hasValue } from '../../../../shared/empty.util';
|
||||
|
||||
/**
|
||||
* Operator for comparing arrays using a mapping function
|
||||
@@ -75,7 +75,7 @@ export const paginatedRelationsToItems = (thisId: string) =>
|
||||
getSucceededRemoteData(),
|
||||
switchMap((relationshipsRD: RemoteData<PaginatedList<Relationship>>) => {
|
||||
return observableCombineLatest(
|
||||
...relationshipsRD.payload.page.map((rel: Relationship) => observableCombineLatest(rel.leftItem, rel.rightItem))
|
||||
...relationshipsRD.payload.page.map((rel: Relationship) => observableCombineLatest(rel.leftItem.pipe(getFinishedRemoteData()), rel.rightItem.pipe(getFinishedRemoteData())))
|
||||
).pipe(
|
||||
map((arr) =>
|
||||
arr
|
||||
|
@@ -1,18 +1,19 @@
|
||||
import { Observable } from 'rxjs';
|
||||
import { link } from '../../cache/builders/build-decorators';
|
||||
import { CacheableObject } from '../../cache/object-cache.reducer';
|
||||
import { RemoteData } from '../../data/remote-data';
|
||||
import { EPerson } from '../../eperson/models/eperson.model';
|
||||
import { EPERSON } from '../../eperson/models/eperson.resource-type';
|
||||
import { HALLink } from '../../shared/hal-link.model';
|
||||
import { AuthError } from './auth-error.model';
|
||||
import { AUTH_STATUS } from './auth-status.resource-type';
|
||||
import { AuthTokenInfo } from './auth-token-info.model';
|
||||
import { EPerson } from '../../eperson/models/eperson.model';
|
||||
import { RemoteData } from '../../data/remote-data';
|
||||
import { Observable } from 'rxjs';
|
||||
import { CacheableObject } from '../../cache/object-cache.reducer';
|
||||
import { ResourceType } from '../../shared/resource-type';
|
||||
|
||||
/**
|
||||
* Object that represents the authenticated status of a user
|
||||
*/
|
||||
export class AuthStatus implements CacheableObject {
|
||||
static type = new ResourceType('status');
|
||||
static type = AUTH_STATUS;
|
||||
|
||||
/**
|
||||
* The unique identifier of this auth status
|
||||
@@ -42,8 +43,8 @@ export class AuthStatus implements CacheableObject {
|
||||
/**
|
||||
* The eperson of this auth status
|
||||
*/
|
||||
@link(EPerson.type)
|
||||
eperson: Observable<RemoteData<EPerson>>;
|
||||
@link(EPERSON)
|
||||
eperson?: Observable<RemoteData<EPerson>>;
|
||||
|
||||
/**
|
||||
* True if the token is valid, false if there was no token or the token wasn't valid
|
||||
|
9
src/app/core/auth/models/auth-status.resource-type.ts
Normal file
9
src/app/core/auth/models/auth-status.resource-type.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
import { ResourceType } from '../../shared/resource-type';
|
||||
|
||||
/**
|
||||
* The resource type for AuthStatus
|
||||
*
|
||||
* Needs to be in a separate file to prevent circular
|
||||
* dependencies in webpack.
|
||||
*/
|
||||
export const AUTH_STATUS = new ResourceType('status');
|
@@ -1,15 +1,16 @@
|
||||
import { filter, map, switchMap, take } from 'rxjs/operators';
|
||||
import { HttpHeaders } from '@angular/common/http';
|
||||
import { Injectable } from '@angular/core';
|
||||
|
||||
import { Observable } from 'rxjs';
|
||||
import { HttpHeaders } from '@angular/common/http';
|
||||
import { filter, map, switchMap, take } from 'rxjs/operators';
|
||||
import { isNotEmpty } from '../../shared/empty.util';
|
||||
import { followLink } from '../../shared/utils/follow-link-config.model';
|
||||
import { HttpOptions } from '../dspace-rest-v2/dspace-rest-v2.service';
|
||||
import { AuthStatus } from './models/auth-status.model';
|
||||
import { isEmpty, isNotEmpty } from '../../shared/empty.util';
|
||||
import { AuthService, LOGIN_ROUTE } from './auth.service';
|
||||
import { AuthTokenInfo } from './models/auth-token-info.model';
|
||||
import { CheckAuthenticationTokenAction } from './auth.actions';
|
||||
import { EPerson } from '../eperson/models/eperson.model';
|
||||
import { CheckAuthenticationTokenAction } from './auth.actions';
|
||||
import { AuthService } from './auth.service';
|
||||
import { AuthStatus } from './models/auth-status.model';
|
||||
import { AuthTokenInfo } from './models/auth-token-info.model';
|
||||
|
||||
/**
|
||||
* The auth service.
|
||||
@@ -34,7 +35,7 @@ export class ServerAuthService extends AuthService {
|
||||
|
||||
options.headers = headers;
|
||||
return this.authRequestService.getRequest('status', options).pipe(
|
||||
map((status) => this.rdbService.build(status)),
|
||||
map((status) => this.rdbService.build(status, followLink<AuthStatus>('eperson'))),
|
||||
switchMap((status: AuthStatus) => {
|
||||
if (status.authenticated) {
|
||||
return status.eperson.pipe(map((eperson) => eperson.payload));
|
||||
|
@@ -1,16 +1,16 @@
|
||||
import { cold, getTestScheduler, hot } from 'jasmine-marbles';
|
||||
import { of as observableOf } from 'rxjs';
|
||||
import { TestScheduler } from 'rxjs/testing';
|
||||
import { getMockRemoteDataBuildService } from '../../shared/mocks/mock-remote-data-build.service';
|
||||
import { getMockRequestService } from '../../shared/mocks/mock-request.service';
|
||||
import { HALEndpointServiceStub } from '../../shared/testing/hal-endpoint-service-stub';
|
||||
import { RemoteDataBuildService } from '../cache/builders/remote-data-build.service';
|
||||
import { BrowseEndpointRequest, BrowseEntriesRequest, BrowseItemsRequest } from '../data/request.models';
|
||||
import { RequestEntry } from '../data/request.reducer';
|
||||
import { RequestService } from '../data/request.service';
|
||||
import { BrowseDefinition } from '../shared/browse-definition.model';
|
||||
import { BrowseService } from './browse.service';
|
||||
import { BrowseEntrySearchOptions } from './browse-entry-search-options.model';
|
||||
import { RequestEntry } from '../data/request.reducer';
|
||||
import { of as observableOf } from 'rxjs';
|
||||
import { BrowseService } from './browse.service';
|
||||
|
||||
describe('BrowseService', () => {
|
||||
let scheduler: TestScheduler;
|
||||
@@ -150,7 +150,7 @@ describe('BrowseService', () => {
|
||||
|
||||
describe('when getBrowseEntriesFor is called with a valid browse definition id', () => {
|
||||
it('should configure a new BrowseEntriesRequest', () => {
|
||||
const expected = new BrowseEntriesRequest(requestService.generateRequestId(), browseDefinitions[1]._links.entries);
|
||||
const expected = new BrowseEntriesRequest(requestService.generateRequestId(), browseDefinitions[1]._links.entries.href);
|
||||
|
||||
scheduler.schedule(() => service.getBrowseEntriesFor(new BrowseEntrySearchOptions(browseDefinitions[1].id)).subscribe());
|
||||
scheduler.flush();
|
||||
@@ -169,7 +169,7 @@ describe('BrowseService', () => {
|
||||
|
||||
describe('when getBrowseItemsFor is called with a valid browse definition id', () => {
|
||||
it('should configure a new BrowseItemsRequest', () => {
|
||||
const expected = new BrowseItemsRequest(requestService.generateRequestId(), browseDefinitions[1]._links.items + '?filterValue=' + mockAuthorName);
|
||||
const expected = new BrowseItemsRequest(requestService.generateRequestId(), browseDefinitions[1]._links.items.href + '?filterValue=' + mockAuthorName);
|
||||
|
||||
scheduler.schedule(() => service.getBrowseItemsFor(mockAuthorName, new BrowseEntrySearchOptions(browseDefinitions[1].id)).subscribe());
|
||||
scheduler.flush();
|
||||
@@ -295,7 +295,7 @@ describe('BrowseService', () => {
|
||||
});
|
||||
|
||||
describe('when getFirstItemFor is called with a valid browse definition id', () => {
|
||||
const expectedURL = browseDefinitions[1]._links.items + '?page=0&size=1';
|
||||
const expectedURL = browseDefinitions[1]._links.items.href + '?page=0&size=1';
|
||||
|
||||
it('should configure a new BrowseItemsRequest', () => {
|
||||
const expected = new BrowseItemsRequest(requestService.generateRequestId(), expectedURL);
|
||||
|
@@ -10,18 +10,16 @@ import {
|
||||
isNotEmptyOperator
|
||||
} from '../../shared/empty.util';
|
||||
import { RemoteDataBuildService } from '../cache/builders/remote-data-build.service';
|
||||
import { GenericSuccessResponse } from '../cache/response.models';
|
||||
import { PaginatedList } from '../data/paginated-list';
|
||||
import { RemoteData } from '../data/remote-data';
|
||||
import {
|
||||
BrowseEndpointRequest,
|
||||
BrowseEntriesRequest,
|
||||
BrowseItemsRequest,
|
||||
RestRequest
|
||||
} from '../data/request.models';
|
||||
import { BrowseEndpointRequest, BrowseEntriesRequest, BrowseItemsRequest, RestRequest } from '../data/request.models';
|
||||
import { RequestService } from '../data/request.service';
|
||||
import { BrowseDefinition } from '../shared/browse-definition.model';
|
||||
import { BrowseEntry } from '../shared/browse-entry.model';
|
||||
import { DSpaceObject } from '../shared/dspace-object.model';
|
||||
import { HALEndpointService } from '../shared/hal-endpoint.service';
|
||||
import { Item } from '../shared/item.model';
|
||||
import {
|
||||
configureRequest,
|
||||
filterSuccessfulResponses,
|
||||
@@ -31,10 +29,7 @@ import {
|
||||
getRequestFromRequestHref
|
||||
} from '../shared/operators';
|
||||
import { URLCombiner } from '../url-combiner/url-combiner';
|
||||
import { Item } from '../shared/item.model';
|
||||
import { DSpaceObject } from '../shared/dspace-object.model';
|
||||
import { BrowseEntrySearchOptions } from './browse-entry-search-options.model';
|
||||
import { GenericSuccessResponse } from '../cache/response.models';
|
||||
|
||||
/**
|
||||
* The service handling all browse requests
|
||||
@@ -81,10 +76,11 @@ export class BrowseService {
|
||||
map((response: GenericSuccessResponse<BrowseDefinition[]>) => response.payload),
|
||||
ensureArrayHasValue(),
|
||||
map((definitions: BrowseDefinition[]) => definitions
|
||||
.map((definition: BrowseDefinition) => Object.assign(new BrowseDefinition(), definition))),
|
||||
distinctUntilChanged()
|
||||
.map((definition: BrowseDefinition) => {
|
||||
return Object.assign(new BrowseDefinition(), definition)
|
||||
})),
|
||||
distinctUntilChanged(),
|
||||
);
|
||||
|
||||
return this.rdb.toRemoteDataObservable(requestEntry$, payload$);
|
||||
}
|
||||
|
||||
@@ -96,7 +92,10 @@ export class BrowseService {
|
||||
return this.getBrowseDefinitions().pipe(
|
||||
getBrowseDefinitionLinks(options.metadataDefinition),
|
||||
hasValueOperator(),
|
||||
map((_links: any) => _links.entries),
|
||||
map((_links: any) => {
|
||||
const entriesLink = _links.entries.href || _links.entries;
|
||||
return entriesLink;
|
||||
}),
|
||||
hasValueOperator(),
|
||||
map((href: string) => {
|
||||
// TODO nearly identical to PaginatedSearchOptions => refactor
|
||||
@@ -133,7 +132,10 @@ export class BrowseService {
|
||||
return this.getBrowseDefinitions().pipe(
|
||||
getBrowseDefinitionLinks(options.metadataDefinition),
|
||||
hasValueOperator(),
|
||||
map((_links: any) => _links.items),
|
||||
map((_links: any) => {
|
||||
const itemsLink = _links.items.href || _links.items;
|
||||
return itemsLink;
|
||||
}),
|
||||
hasValueOperator(),
|
||||
map((href: string) => {
|
||||
const args = [];
|
||||
@@ -171,7 +173,10 @@ export class BrowseService {
|
||||
return this.getBrowseDefinitions().pipe(
|
||||
getBrowseDefinitionLinks(definition),
|
||||
hasValueOperator(),
|
||||
map((_links: any) => _links.items),
|
||||
map((_links: any) => {
|
||||
const itemsLink = _links.items.href || _links.items;
|
||||
return itemsLink;
|
||||
}),
|
||||
hasValueOperator(),
|
||||
map((href: string) => {
|
||||
const args = [];
|
||||
@@ -249,7 +254,7 @@ export class BrowseService {
|
||||
if (isEmpty(def) || isEmpty(def._links) || isEmpty(def._links[linkPath])) {
|
||||
throw new Error(`A browse endpoint for ${linkPath} on ${metadataKey} isn't configured`);
|
||||
} else {
|
||||
return def._links[linkPath];
|
||||
return def._links[linkPath] || def._links[linkPath].href;
|
||||
}
|
||||
}),
|
||||
startWith(undefined),
|
||||
|
@@ -1,11 +1,6 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
|
||||
import {
|
||||
combineLatest as observableCombineLatest,
|
||||
Observable,
|
||||
of as observableOf,
|
||||
race as observableRace
|
||||
} from 'rxjs';
|
||||
import { combineLatest as observableCombineLatest, Observable, of as observableOf, race as observableRace } from 'rxjs';
|
||||
import { distinctUntilChanged, map, startWith, switchMap } from 'rxjs/operators';
|
||||
|
||||
import {
|
||||
@@ -112,6 +107,13 @@ export class RemoteDataBuildService {
|
||||
);
|
||||
}
|
||||
}
|
||||
console.log('RD', new RemoteData(
|
||||
requestPending,
|
||||
responsePending,
|
||||
isSuccessful,
|
||||
error,
|
||||
payload
|
||||
));
|
||||
return new RemoteData(
|
||||
requestPending,
|
||||
responsePending,
|
||||
@@ -124,6 +126,7 @@ export class RemoteDataBuildService {
|
||||
}
|
||||
|
||||
buildList<T extends CacheableObject>(href$: string | Observable<string>, ...linksToFollow: Array<FollowLinkConfig<T>>): Observable<RemoteData<PaginatedList<T>>> {
|
||||
console.log('rdbBuildList')
|
||||
if (typeof href$ === 'string') {
|
||||
href$ = observableOf(href$);
|
||||
}
|
||||
@@ -132,6 +135,7 @@ export class RemoteDataBuildService {
|
||||
const tDomainList$ = requestEntry$.pipe(
|
||||
getResourceLinksFromResponse(),
|
||||
switchMap((resourceUUIDs: string[]) => {
|
||||
console.log('resourceUUIDs', resourceUUIDs)
|
||||
return this.objectCache.getList(resourceUUIDs).pipe(
|
||||
map((normList: Array<NormalizedObject<T>>) => {
|
||||
return normList.map((normalized: NormalizedObject<T>) => {
|
||||
@@ -145,6 +149,7 @@ export class RemoteDataBuildService {
|
||||
const pageInfo$ = requestEntry$.pipe(
|
||||
filterSuccessfulResponses(),
|
||||
map((response: DSOSuccessResponse) => {
|
||||
console.log('rdb pageInfo', response)
|
||||
if (hasValue((response as DSOSuccessResponse).pageInfo)) {
|
||||
const resPageInfo = (response as DSOSuccessResponse).pageInfo;
|
||||
if (isNotEmpty(resPageInfo) && resPageInfo.currentPage >= 0) {
|
||||
@@ -158,6 +163,7 @@ export class RemoteDataBuildService {
|
||||
|
||||
const payload$ = observableCombineLatest(tDomainList$, pageInfo$).pipe(
|
||||
map(([tDomainList, pageInfo]) => {
|
||||
console.log('rdb domainlist', tDomainList)
|
||||
return new PaginatedList(pageInfo, tDomainList);
|
||||
})
|
||||
);
|
||||
|
@@ -1,9 +1,9 @@
|
||||
import { autoserialize, inheritSerialization } from 'cerialize';
|
||||
|
||||
import { NormalizedDSpaceObject } from './normalized-dspace-object.model';
|
||||
import { Bitstream } from '../../shared/bitstream.model';
|
||||
import { Bundle } from '../../shared/bundle.model';
|
||||
import { mapsTo, relationship } from '../builders/build-decorators';
|
||||
import { Bitstream } from '../../shared/bitstream.model';
|
||||
|
||||
import { NormalizedDSpaceObject } from './normalized-dspace-object.model';
|
||||
|
||||
/**
|
||||
* Normalized model class for a DSpace Bundle
|
||||
@@ -25,16 +25,6 @@ export class NormalizedBundle extends NormalizedDSpaceObject<Bundle> {
|
||||
@relationship(Bitstream, false, false)
|
||||
primaryBitstream: string;
|
||||
|
||||
/**
|
||||
* An array of Items that are direct parents of this Bundle
|
||||
*/
|
||||
parents: string[];
|
||||
|
||||
/**
|
||||
* The Item that owns this Bundle
|
||||
*/
|
||||
owner: string;
|
||||
|
||||
/**
|
||||
* List of Bitstreams that are part of this Bundle
|
||||
*/
|
||||
|
@@ -1,17 +1,11 @@
|
||||
import { autoserialize, deserialize, inheritSerialization } from 'cerialize';
|
||||
import { Bitstream } from '../../shared/bitstream.model';
|
||||
import { Collection } from '../../shared/collection.model';
|
||||
import { Item } from '../../shared/item.model';
|
||||
import { ResourcePolicy } from '../../shared/resource-policy.model';
|
||||
import { mapsTo, relationship } from '../builders/build-decorators';
|
||||
|
||||
import { NormalizedDSpaceObject } from './normalized-dspace-object.model';
|
||||
import { Collection } from '../../shared/collection.model';
|
||||
import { mapsTo, relationship } from '../builders/build-decorators';
|
||||
import { NormalizedResourcePolicy } from './normalized-resource-policy.model';
|
||||
import { NormalizedBitstream } from './normalized-bitstream.model';
|
||||
import { NormalizedCommunity } from './normalized-community.model';
|
||||
import { NormalizedItem } from './normalized-item.model';
|
||||
import { License } from '../../shared/license.model';
|
||||
import { ResourcePolicy } from '../../shared/resource-policy.model';
|
||||
import { Bitstream } from '../../shared/bitstream.model';
|
||||
import { Community } from '../../shared/community.model';
|
||||
import { Item } from '../../shared/item.model';
|
||||
|
||||
/**
|
||||
* Normalized model class for a DSpace Collection
|
||||
@@ -46,20 +40,6 @@ export class NormalizedCollection extends NormalizedDSpaceObject<Collection> {
|
||||
@relationship(Bitstream, false, false)
|
||||
logo: string;
|
||||
|
||||
/**
|
||||
* An array of Communities that are direct parents of this Collection
|
||||
*/
|
||||
@deserialize
|
||||
@relationship(Community, true, false)
|
||||
parents: string[];
|
||||
|
||||
/**
|
||||
* The Community that owns this Collection
|
||||
*/
|
||||
@deserialize
|
||||
@relationship(Community, false, false)
|
||||
owner: string;
|
||||
|
||||
/**
|
||||
* List of Items that are part of (not necessarily owned by) this Collection
|
||||
*/
|
||||
|
@@ -1,7 +1,8 @@
|
||||
import { ConfigObject } from './config.model';
|
||||
import { SubmissionSectionModel } from './config-submission-section.model';
|
||||
import { PaginatedList } from '../../data/paginated-list';
|
||||
import { HALLink } from '../../shared/hal-link.model';
|
||||
import { ResourceType } from '../../shared/resource-type';
|
||||
import { SubmissionSectionModel } from './config-submission-section.model';
|
||||
import { ConfigObject } from './config.model';
|
||||
|
||||
/**
|
||||
* Class for the configuration describing the submission
|
||||
@@ -19,4 +20,13 @@ export class SubmissionDefinitionModel extends ConfigObject {
|
||||
*/
|
||||
sections: PaginatedList<SubmissionSectionModel>;
|
||||
|
||||
/**
|
||||
* The links to all related resources returned by the rest api.
|
||||
*/
|
||||
_links: {
|
||||
self: HALLink,
|
||||
collections: HALLink,
|
||||
sections: HALLink
|
||||
};
|
||||
|
||||
}
|
||||
|
@@ -1,6 +1,5 @@
|
||||
import { CacheableObject } from '../../cache/object-cache.reducer';
|
||||
import { HALLink } from '../../shared/hal-link.model';
|
||||
import { ResourceType } from '../../shared/resource-type';
|
||||
|
||||
export abstract class ConfigObject implements CacheableObject {
|
||||
|
||||
|
@@ -1,10 +1,9 @@
|
||||
import { autoserialize, autoserializeAs, inheritSerialization } from 'cerialize';
|
||||
import { SubmissionSectionModel } from './config-submission-section.model';
|
||||
import { PaginatedList } from '../../data/paginated-list';
|
||||
import { NormalizedConfigObject } from './normalized-config.model';
|
||||
import { SubmissionDefinitionsModel } from './config-submission-definitions.model';
|
||||
import { mapsTo } from '../../cache/builders/build-decorators';
|
||||
import { PaginatedList } from '../../data/paginated-list';
|
||||
import { SubmissionDefinitionModel } from './config-submission-definition.model';
|
||||
import { SubmissionSectionModel } from './config-submission-section.model';
|
||||
import { NormalizedConfigObject } from './normalized-config.model';
|
||||
|
||||
/**
|
||||
* Normalized class for the configuration describing the submission
|
||||
|
@@ -1,10 +1,4 @@
|
||||
import { autoserialize, inheritSerialization } from 'cerialize';
|
||||
import { SectionsType } from '../../../submission/sections/sections-type';
|
||||
import { NormalizedConfigObject } from './normalized-config.model';
|
||||
import {
|
||||
SubmissionSectionModel,
|
||||
SubmissionSectionVisibility
|
||||
} from './config-submission-section.model';
|
||||
import { inheritSerialization } from 'cerialize';
|
||||
import { mapsTo } from '../../cache/builders/build-decorators';
|
||||
import { SubmissionSectionsModel } from './config-submission-sections.model';
|
||||
import { NormalizedSubmissionSectionModel } from './normalized-config-submission-section.model';
|
||||
|
@@ -1,8 +1,7 @@
|
||||
import { autoserialize, inheritSerialization } from 'cerialize';
|
||||
import { NormalizedObject } from '../../cache/models/normalized-object.model';
|
||||
import { CacheableObject, TypedObject } from '../../cache/object-cache.reducer';
|
||||
import { CacheableObject } from '../../cache/object-cache.reducer';
|
||||
import { HALLink } from '../../shared/hal-link.model';
|
||||
import { ResourceType } from '../../shared/resource-type';
|
||||
|
||||
/**
|
||||
* Normalized abstract class for a configuration object
|
||||
|
@@ -3,7 +3,7 @@ import { Injectable } from '@angular/core';
|
||||
import { Store } from '@ngrx/store';
|
||||
import { Observable } from 'rxjs/internal/Observable';
|
||||
import { map, switchMap } from 'rxjs/operators';
|
||||
import { hasNoValue, hasValue } from '../../shared/empty.util';
|
||||
import { hasValue } from '../../shared/empty.util';
|
||||
import { NotificationsService } from '../../shared/notifications/notifications.service';
|
||||
import { FollowLinkConfig } from '../../shared/utils/follow-link-config.model';
|
||||
import { dataService } from '../cache/builders/build-decorators';
|
||||
@@ -12,6 +12,7 @@ import { RemoteDataBuildService } from '../cache/builders/remote-data-build.serv
|
||||
import { ObjectCacheService } from '../cache/object-cache.service';
|
||||
import { CoreState } from '../core.reducers';
|
||||
import { Bitstream } from '../shared/bitstream.model';
|
||||
import { BITSTREAM } from '../shared/bitstream.resource-type';
|
||||
import { Bundle } from '../shared/bundle.model';
|
||||
import { HALEndpointService } from '../shared/hal-endpoint.service';
|
||||
import { Item } from '../shared/item.model';
|
||||
@@ -28,7 +29,7 @@ import { RequestService } from './request.service';
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
@dataService(Bitstream.type)
|
||||
@dataService(BITSTREAM)
|
||||
export class BitstreamDataService extends DataService<Bitstream> {
|
||||
|
||||
protected linkPath = 'bitstreams';
|
||||
|
@@ -1,34 +1,35 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { dataService } from '../cache/builders/build-decorators';
|
||||
import { Bitstream } from '../shared/bitstream.model';
|
||||
import { DataService } from './data.service';
|
||||
import { BitstreamFormat } from '../shared/bitstream-format.model';
|
||||
import { RemoteData } from './remote-data';
|
||||
import { RequestService } from './request.service';
|
||||
import { RemoteDataBuildService } from '../cache/builders/remote-data-build.service';
|
||||
import { NormalizedObjectBuildService } from '../cache/builders/normalized-object-build.service';
|
||||
import { createSelector, select, Store } from '@ngrx/store';
|
||||
import { ObjectCacheService } from '../cache/object-cache.service';
|
||||
import { HALEndpointService } from '../shared/hal-endpoint.service';
|
||||
import { NotificationsService } from '../../shared/notifications/notifications.service';
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { DefaultChangeAnalyzer } from './default-change-analyzer.service';
|
||||
import { DeleteByIDRequest, PostRequest, PutRequest } from './request.models';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { createSelector, select, Store } from '@ngrx/store';
|
||||
import { Observable } from 'rxjs';
|
||||
import { find, map, tap } from 'rxjs/operators';
|
||||
import { configureRequest, getResponseFromEntry } from '../shared/operators';
|
||||
import { distinctUntilChanged } from 'rxjs/internal/operators/distinctUntilChanged';
|
||||
import { RestResponse } from '../cache/response.models';
|
||||
import { BitstreamFormatRegistryState } from '../../+admin/admin-registries/bitstream-formats/bitstream-format.reducers';
|
||||
import { find, map, tap } from 'rxjs/operators';
|
||||
import {
|
||||
BitstreamFormatsRegistryDeselectAction,
|
||||
BitstreamFormatsRegistryDeselectAllAction,
|
||||
BitstreamFormatsRegistrySelectAction
|
||||
} from '../../+admin/admin-registries/bitstream-formats/bitstream-format.actions';
|
||||
import { BitstreamFormatRegistryState } from '../../+admin/admin-registries/bitstream-formats/bitstream-format.reducers';
|
||||
import { hasValue } from '../../shared/empty.util';
|
||||
import { RequestEntry } from './request.reducer';
|
||||
import { NotificationsService } from '../../shared/notifications/notifications.service';
|
||||
import { dataService } from '../cache/builders/build-decorators';
|
||||
import { NormalizedObjectBuildService } from '../cache/builders/normalized-object-build.service';
|
||||
import { RemoteDataBuildService } from '../cache/builders/remote-data-build.service';
|
||||
import { ObjectCacheService } from '../cache/object-cache.service';
|
||||
import { RestResponse } from '../cache/response.models';
|
||||
import { CoreState } from '../core.reducers';
|
||||
import { coreSelector } from '../core.selectors';
|
||||
import { BitstreamFormat } from '../shared/bitstream-format.model';
|
||||
import { BITSTREAM_FORMAT } from '../shared/bitstream-format.resource-type';
|
||||
import { Bitstream } from '../shared/bitstream.model';
|
||||
import { HALEndpointService } from '../shared/hal-endpoint.service';
|
||||
import { configureRequest, getResponseFromEntry } from '../shared/operators';
|
||||
import { DataService } from './data.service';
|
||||
import { DefaultChangeAnalyzer } from './default-change-analyzer.service';
|
||||
import { RemoteData } from './remote-data';
|
||||
import { DeleteByIDRequest, PostRequest, PutRequest } from './request.models';
|
||||
import { RequestEntry } from './request.reducer';
|
||||
import { RequestService } from './request.service';
|
||||
|
||||
const bitstreamFormatsStateSelector = createSelector(
|
||||
coreSelector,
|
||||
@@ -41,7 +42,7 @@ const selectedBitstreamFormatSelector = createSelector(bitstreamFormatsStateSele
|
||||
* A service responsible for fetching/sending data from/to the REST API on the bitstreamformats endpoint
|
||||
*/
|
||||
@Injectable()
|
||||
@dataService(BitstreamFormat.type)
|
||||
@dataService(BITSTREAM_FORMAT)
|
||||
export class BitstreamFormatDataService extends DataService<BitstreamFormat> {
|
||||
|
||||
protected linkPath = 'bitstreamformats';
|
||||
|
@@ -12,6 +12,7 @@ import { RemoteDataBuildService } from '../cache/builders/remote-data-build.serv
|
||||
import { ObjectCacheService } from '../cache/object-cache.service';
|
||||
import { CoreState } from '../core.reducers';
|
||||
import { Bundle } from '../shared/bundle.model';
|
||||
import { BUNDLE } from '../shared/bundle.resource-type';
|
||||
import { HALEndpointService } from '../shared/hal-endpoint.service';
|
||||
import { Item } from '../shared/item.model';
|
||||
import { DataService } from './data.service';
|
||||
@@ -27,7 +28,7 @@ import { RequestService } from './request.service';
|
||||
@Injectable(
|
||||
{providedIn: 'root'}
|
||||
)
|
||||
@dataService(Bundle.type)
|
||||
@dataService(BUNDLE)
|
||||
export class BundleDataService extends DataService<Bundle> {
|
||||
protected linkPath = 'bundles';
|
||||
protected forceBypassCache = false;
|
||||
|
@@ -1,55 +1,54 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
|
||||
import { distinctUntilChanged, filter, map, switchMap, take } from 'rxjs/operators';
|
||||
import { Store } from '@ngrx/store';
|
||||
import { dataService } from '../cache/builders/build-decorators';
|
||||
|
||||
import { RemoteDataBuildService } from '../cache/builders/remote-data-build.service';
|
||||
import { ObjectCacheService } from '../cache/object-cache.service';
|
||||
import { CoreState } from '../core.reducers';
|
||||
import { Collection } from '../shared/collection.model';
|
||||
import { Item } from '../shared/item.model';
|
||||
import { ComColDataService } from './comcol-data.service';
|
||||
import { CommunityDataService } from './community-data.service';
|
||||
import { RequestService } from './request.service';
|
||||
import { HALEndpointService } from '../shared/hal-endpoint.service';
|
||||
import { NotificationsService } from '../../shared/notifications/notifications.service';
|
||||
import { HttpClient, HttpHeaders } from '@angular/common/http';
|
||||
import { NormalizedObjectBuildService } from '../cache/builders/normalized-object-build.service';
|
||||
import { DSOChangeAnalyzer } from './dso-change-analyzer.service';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Store } from '@ngrx/store';
|
||||
import { TranslateService } from '@ngx-translate/core';
|
||||
import { Observable } from 'rxjs/internal/Observable';
|
||||
import {
|
||||
ContentSourceRequest,
|
||||
RestRequest,
|
||||
UpdateContentSourceRequest,
|
||||
GetRequest,
|
||||
FindListOptions
|
||||
} from './request.models';
|
||||
import { RemoteData } from './remote-data';
|
||||
import { PaginatedList } from './paginated-list';
|
||||
import { distinctUntilChanged, filter, map, switchMap, take } from 'rxjs/operators';
|
||||
import { hasValue, isNotEmpty, isNotEmptyOperator } from '../../shared/empty.util';
|
||||
import { NotificationOptions } from '../../shared/notifications/models/notification-options.model';
|
||||
import { INotification } from '../../shared/notifications/models/notification.model';
|
||||
import { NotificationsService } from '../../shared/notifications/notifications.service';
|
||||
import { PaginatedSearchOptions } from '../../shared/search/paginated-search-options.model';
|
||||
import { dataService } from '../cache/builders/build-decorators';
|
||||
import { NormalizedObjectBuildService } from '../cache/builders/normalized-object-build.service';
|
||||
import { RemoteDataBuildService } from '../cache/builders/remote-data-build.service';
|
||||
import { SearchParam } from '../cache/models/search-param.model';
|
||||
import { ObjectCacheService } from '../cache/object-cache.service';
|
||||
import { ContentSourceSuccessResponse, RestResponse } from '../cache/response.models';
|
||||
import { CoreState } from '../core.reducers';
|
||||
import { DSpaceRESTv2Serializer } from '../dspace-rest-v2/dspace-rest-v2.serializer';
|
||||
import { HttpOptions } from '../dspace-rest-v2/dspace-rest-v2.service';
|
||||
import { Collection } from '../shared/collection.model';
|
||||
import { COLLECTION } from '../shared/collection.resource-type';
|
||||
import { ContentSource } from '../shared/content-source.model';
|
||||
import { DSpaceObject } from '../shared/dspace-object.model';
|
||||
import { GenericConstructor } from '../shared/generic-constructor';
|
||||
import { HALEndpointService } from '../shared/hal-endpoint.service';
|
||||
import { Item } from '../shared/item.model';
|
||||
import {
|
||||
configureRequest,
|
||||
filterSuccessfulResponses,
|
||||
getRequestFromRequestHref,
|
||||
getResponseFromEntry
|
||||
} from '../shared/operators';
|
||||
import { ContentSourceSuccessResponse, RestResponse } from '../cache/response.models';
|
||||
import { HttpOptions } from '../dspace-rest-v2/dspace-rest-v2.service';
|
||||
import { DSpaceRESTv2Serializer } from '../dspace-rest-v2/dspace-rest-v2.serializer';
|
||||
import { hasValue, isNotEmpty, isNotEmptyOperator } from '../../shared/empty.util';
|
||||
import { NotificationOptions } from '../../shared/notifications/models/notification-options.model';
|
||||
import { TranslateService } from '@ngx-translate/core';
|
||||
import { SearchParam } from '../cache/models/search-param.model';
|
||||
import { ComColDataService } from './comcol-data.service';
|
||||
import { CommunityDataService } from './community-data.service';
|
||||
import { DSOChangeAnalyzer } from './dso-change-analyzer.service';
|
||||
import { DSOResponseParsingService } from './dso-response-parsing.service';
|
||||
import { PaginatedList } from './paginated-list';
|
||||
import { ResponseParsingService } from './parsing.service';
|
||||
import { GenericConstructor } from '../shared/generic-constructor';
|
||||
import { DSpaceObject } from '../shared/dspace-object.model';
|
||||
import { INotification } from '../../shared/notifications/models/notification.model';
|
||||
import { PaginatedSearchOptions } from '../../shared/search/paginated-search-options.model';
|
||||
import { RemoteData } from './remote-data';
|
||||
import {
|
||||
ContentSourceRequest,
|
||||
FindListOptions,
|
||||
GetRequest,
|
||||
RestRequest,
|
||||
UpdateContentSourceRequest
|
||||
} from './request.models';
|
||||
import { RequestService } from './request.service';
|
||||
|
||||
@Injectable()
|
||||
@dataService(Collection.type)
|
||||
@dataService(COLLECTION)
|
||||
export class CollectionDataService extends ComColDataService<Collection> {
|
||||
protected linkPath = 'collections';
|
||||
protected errorTitle = 'collection.source.update.notifications.error.title';
|
||||
|
@@ -1,27 +1,28 @@
|
||||
import { filter, switchMap, take } from 'rxjs/operators';
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { Injectable } from '@angular/core';
|
||||
|
||||
import { Store } from '@ngrx/store';
|
||||
import { Observable } from 'rxjs';
|
||||
import { filter, switchMap, take } from 'rxjs/operators';
|
||||
import { hasValue } from '../../shared/empty.util';
|
||||
import { NotificationsService } from '../../shared/notifications/notifications.service';
|
||||
import { dataService } from '../cache/builders/build-decorators';
|
||||
import { NormalizedObjectBuildService } from '../cache/builders/normalized-object-build.service';
|
||||
import { RemoteDataBuildService } from '../cache/builders/remote-data-build.service';
|
||||
import { ObjectCacheService } from '../cache/object-cache.service';
|
||||
import { CoreState } from '../core.reducers';
|
||||
import { Community } from '../shared/community.model';
|
||||
import { ComColDataService } from './comcol-data.service';
|
||||
import { RequestService } from './request.service';
|
||||
import { COMMUNITY } from '../shared/community.resource-type';
|
||||
import { HALEndpointService } from '../shared/hal-endpoint.service';
|
||||
import { FindListOptions, FindListRequest } from './request.models';
|
||||
import { RemoteData } from './remote-data';
|
||||
import { hasValue } from '../../shared/empty.util';
|
||||
import { Observable } from 'rxjs';
|
||||
import { PaginatedList } from './paginated-list';
|
||||
import { NotificationsService } from '../../shared/notifications/notifications.service';
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { NormalizedObjectBuildService } from '../cache/builders/normalized-object-build.service';
|
||||
import { ComColDataService } from './comcol-data.service';
|
||||
import { DSOChangeAnalyzer } from './dso-change-analyzer.service';
|
||||
import { PaginatedList } from './paginated-list';
|
||||
import { RemoteData } from './remote-data';
|
||||
import { FindListOptions, FindListRequest } from './request.models';
|
||||
import { RequestService } from './request.service';
|
||||
|
||||
@Injectable()
|
||||
@dataService(Community.type)
|
||||
@dataService(COMMUNITY)
|
||||
export class CommunityDataService extends ComColDataService<Community> {
|
||||
protected linkPath = 'communities';
|
||||
protected topLinkPath = 'communities/search/top';
|
||||
|
@@ -1,19 +1,20 @@
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Store } from '@ngrx/store';
|
||||
import { Observable } from 'rxjs';
|
||||
import { NotificationsService } from '../../shared/notifications/notifications.service';
|
||||
import { dataService } from '../cache/builders/build-decorators';
|
||||
import { NormalizedObjectBuildService } from '../cache/builders/normalized-object-build.service';
|
||||
import { RemoteDataBuildService } from '../cache/builders/remote-data-build.service';
|
||||
import { ObjectCacheService } from '../cache/object-cache.service';
|
||||
import { CoreState } from '../core.reducers';
|
||||
import { DSpaceObject } from '../shared/dspace-object.model';
|
||||
import { DSPACE_OBJECT } from '../shared/dspace-object.resource-type';
|
||||
import { HALEndpointService } from '../shared/hal-endpoint.service';
|
||||
import { DataService } from './data.service';
|
||||
import { DSOChangeAnalyzer } from './dso-change-analyzer.service';
|
||||
import { RemoteData } from './remote-data';
|
||||
import { RequestService } from './request.service';
|
||||
import { ObjectCacheService } from '../cache/object-cache.service';
|
||||
import { NotificationsService } from '../../shared/notifications/notifications.service';
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { NormalizedObjectBuildService } from '../cache/builders/normalized-object-build.service';
|
||||
import { DSOChangeAnalyzer } from './dso-change-analyzer.service';
|
||||
|
||||
/* tslint:disable:max-classes-per-file */
|
||||
class DataServiceImpl extends DataService<DSpaceObject> {
|
||||
@@ -33,12 +34,12 @@ class DataServiceImpl extends DataService<DSpaceObject> {
|
||||
}
|
||||
|
||||
getIDHref(endpoint, resourceID): string {
|
||||
return endpoint.replace(/\{\?uuid\}/,`?uuid=${resourceID}`);
|
||||
return endpoint.replace(/\{\?uuid\}/, `?uuid=${resourceID}`);
|
||||
}
|
||||
}
|
||||
|
||||
@Injectable()
|
||||
@dataService(DSpaceObject.type)
|
||||
@dataService(DSPACE_OBJECT)
|
||||
export class DSpaceObjectDataService {
|
||||
protected linkPath = 'dso';
|
||||
private dataService: DataServiceImpl;
|
||||
|
@@ -1,47 +1,48 @@
|
||||
import { distinctUntilChanged, filter, find, map, switchMap, take } from 'rxjs/operators';
|
||||
import { HttpClient, HttpHeaders } from '@angular/common/http';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Store } from '@ngrx/store';
|
||||
import { Observable } from 'rxjs';
|
||||
import { distinctUntilChanged, filter, find, map, switchMap } from 'rxjs/operators';
|
||||
import { hasValue, isNotEmpty, isNotEmptyOperator } from '../../shared/empty.util';
|
||||
import { NotificationsService } from '../../shared/notifications/notifications.service';
|
||||
import { BrowseService } from '../browse/browse.service';
|
||||
import { dataService } from '../cache/builders/build-decorators';
|
||||
import { NormalizedObjectBuildService } from '../cache/builders/normalized-object-build.service';
|
||||
import { RemoteDataBuildService } from '../cache/builders/remote-data-build.service';
|
||||
import { ObjectCacheService } from '../cache/object-cache.service';
|
||||
import { GenericSuccessResponse, RestResponse } from '../cache/response.models';
|
||||
import { CoreState } from '../core.reducers';
|
||||
import { HttpOptions } from '../dspace-rest-v2/dspace-rest-v2.service';
|
||||
import { Collection } from '../shared/collection.model';
|
||||
import { HALEndpointService } from '../shared/hal-endpoint.service';
|
||||
import { Item } from '../shared/item.model';
|
||||
import { ITEM } from '../shared/item.resource-type';
|
||||
import {
|
||||
configureRequest,
|
||||
filterSuccessfulResponses,
|
||||
getRequestFromRequestHref,
|
||||
getResponseFromEntry
|
||||
} from '../shared/operators';
|
||||
import { URLCombiner } from '../url-combiner/url-combiner';
|
||||
|
||||
import { DataService } from './data.service';
|
||||
import { RequestService } from './request.service';
|
||||
import { HALEndpointService } from '../shared/hal-endpoint.service';
|
||||
import { DSOChangeAnalyzer } from './dso-change-analyzer.service';
|
||||
import { PaginatedList } from './paginated-list';
|
||||
import { RemoteData } from './remote-data';
|
||||
import {
|
||||
DeleteRequest,
|
||||
FindListOptions,
|
||||
MappedCollectionsRequest,
|
||||
PatchRequest,
|
||||
PostRequest, PutRequest,
|
||||
PostRequest,
|
||||
PutRequest,
|
||||
RestRequest
|
||||
} from './request.models';
|
||||
import { ObjectCacheService } from '../cache/object-cache.service';
|
||||
import { NotificationsService } from '../../shared/notifications/notifications.service';
|
||||
import { DSOChangeAnalyzer } from './dso-change-analyzer.service';
|
||||
import { HttpClient, HttpHeaders } from '@angular/common/http';
|
||||
import { NormalizedObjectBuildService } from '../cache/builders/normalized-object-build.service';
|
||||
import {
|
||||
configureRequest,
|
||||
filterSuccessfulResponses,
|
||||
getRequestFromRequestHref,
|
||||
getResponseFromEntry, getSucceededRemoteData
|
||||
} from '../shared/operators';
|
||||
import { RequestEntry } from './request.reducer';
|
||||
import { GenericSuccessResponse, RestResponse } from '../cache/response.models';
|
||||
import { HttpOptions } from '../dspace-rest-v2/dspace-rest-v2.service';
|
||||
import { Collection } from '../shared/collection.model';
|
||||
import { RemoteData } from './remote-data';
|
||||
import { PaginatedList } from './paginated-list';
|
||||
import { ExternalSourceEntry } from '../shared/external-source-entry.model';
|
||||
import { RequestService } from './request.service';
|
||||
|
||||
@Injectable()
|
||||
@dataService(Item.type)
|
||||
@dataService(ITEM)
|
||||
export class ItemDataService extends DataService<Item> {
|
||||
protected linkPath = 'items';
|
||||
|
||||
@@ -56,7 +57,7 @@ export class ItemDataService extends DataService<Item> {
|
||||
protected notificationsService: NotificationsService,
|
||||
protected http: HttpClient,
|
||||
protected comparator: DSOChangeAnalyzer<Item>,
|
||||
) {
|
||||
) {
|
||||
super();
|
||||
}
|
||||
|
||||
|
@@ -1,19 +1,20 @@
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Store } from '@ngrx/store';
|
||||
import { NotificationsService } from '../../shared/notifications/notifications.service';
|
||||
import { dataService } from '../cache/builders/build-decorators';
|
||||
import { NormalizedObjectBuildService } from '../cache/builders/normalized-object-build.service';
|
||||
import { RemoteDataBuildService } from '../cache/builders/remote-data-build.service';
|
||||
import { ObjectCacheService } from '../cache/object-cache.service';
|
||||
import { CoreState } from '../core.reducers';
|
||||
import { MetadataSchema } from '../metadata/metadata-schema.model';
|
||||
import { METADATA_SCHEMA } from '../metadata/metadata-schema.resource-type';
|
||||
import { HALEndpointService } from '../shared/hal-endpoint.service';
|
||||
import { ChangeAnalyzer } from './change-analyzer';
|
||||
|
||||
import { DataService } from './data.service';
|
||||
import { RequestService } from './request.service';
|
||||
import { HALEndpointService } from '../shared/hal-endpoint.service';
|
||||
import { ObjectCacheService } from '../cache/object-cache.service';
|
||||
import { NormalizedObjectBuildService } from '../cache/builders/normalized-object-build.service';
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { NotificationsService } from '../../shared/notifications/notifications.service';
|
||||
import { ChangeAnalyzer } from './change-analyzer';
|
||||
import { DefaultChangeAnalyzer } from './default-change-analyzer.service';
|
||||
import { MetadataSchema } from '../metadata/metadata-schema.model';
|
||||
import { RequestService } from './request.service';
|
||||
|
||||
/* tslint:disable:max-classes-per-file */
|
||||
class DataServiceImpl extends DataService<MetadataSchema> {
|
||||
@@ -38,7 +39,7 @@ class DataServiceImpl extends DataService<MetadataSchema> {
|
||||
* A service responsible for fetching/sending data from/to the REST API on the metadataschemas endpoint
|
||||
*/
|
||||
@Injectable()
|
||||
@dataService(MetadataSchema.type)
|
||||
@dataService(METADATA_SCHEMA)
|
||||
export class MetadataSchemaDataService {
|
||||
private dataService: DataServiceImpl;
|
||||
|
||||
|
@@ -1,14 +1,15 @@
|
||||
import { RequestService } from './request.service';
|
||||
import { HALEndpointServiceStub } from '../../shared/testing/hal-endpoint-service-stub';
|
||||
import { getMockRemoteDataBuildService } from '../../shared/mocks/mock-remote-data-build.service';
|
||||
import { RelationshipType } from '../shared/item-relationships/relationship-type.model';
|
||||
import { getMockRequestService } from '../../shared/mocks/mock-request.service';
|
||||
import { PaginatedList } from './paginated-list';
|
||||
import { PageInfo } from '../shared/page-info.model';
|
||||
import { createSuccessfulRemoteDataObject, createSuccessfulRemoteDataObject$ } from '../../shared/testing/utils';
|
||||
import { RelationshipTypeService } from './relationship-type.service';
|
||||
import { of as observableOf } from 'rxjs';
|
||||
import { getMockRemoteDataBuildService } from '../../shared/mocks/mock-remote-data-build.service';
|
||||
import { getMockRequestService } from '../../shared/mocks/mock-request.service';
|
||||
import { HALEndpointServiceStub } from '../../shared/testing/hal-endpoint-service-stub';
|
||||
import { createSuccessfulRemoteDataObject, createSuccessfulRemoteDataObject$ } from '../../shared/testing/utils';
|
||||
import { ObjectCacheService } from '../cache/object-cache.service';
|
||||
import { ItemType } from '../shared/item-relationships/item-type.model';
|
||||
import { RelationshipType } from '../shared/item-relationships/relationship-type.model';
|
||||
import { PageInfo } from '../shared/page-info.model';
|
||||
import { PaginatedList } from './paginated-list';
|
||||
import { RelationshipTypeService } from './relationship-type.service';
|
||||
import { RequestService } from './request.service';
|
||||
|
||||
describe('RelationshipTypeService', () => {
|
||||
let service: RelationshipTypeService;
|
||||
@@ -25,8 +26,10 @@ describe('RelationshipTypeService', () => {
|
||||
let relationshipType1;
|
||||
let relationshipType2;
|
||||
|
||||
let itemService;
|
||||
let buildList;
|
||||
let rdbService;
|
||||
let objectCache;
|
||||
|
||||
function init() {
|
||||
restEndpointURL = 'https://rest.api/relationshiptypes';
|
||||
@@ -58,13 +61,33 @@ describe('RelationshipTypeService', () => {
|
||||
|
||||
buildList = createSuccessfulRemoteDataObject(new PaginatedList(new PageInfo(), [relationshipType1, relationshipType2]));
|
||||
rdbService = getMockRemoteDataBuildService(undefined, observableOf(buildList));
|
||||
objectCache = Object.assign({
|
||||
/* tslint:disable:no-empty */
|
||||
remove: () => {
|
||||
},
|
||||
hasBySelfLinkObservable: () => observableOf(false)
|
||||
/* tslint:enable:no-empty */
|
||||
}) as ObjectCacheService;
|
||||
|
||||
itemService = jasmine.createSpyObj('itemService', {
|
||||
// findById: (uuid) => new RemoteData(false, false, true, undefined, relatedItems.find((relatedItem) => relatedItem.id === uuid)),
|
||||
// findByHref: createSuccessfulRemoteDataObject$(relatedItems[0])
|
||||
});
|
||||
|
||||
}
|
||||
function initTestService() {
|
||||
return new RelationshipTypeService(
|
||||
itemService,
|
||||
requestService,
|
||||
rdbService,
|
||||
null,
|
||||
null,
|
||||
halService,
|
||||
rdbService
|
||||
objectCache,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null
|
||||
);
|
||||
}
|
||||
|
||||
|
@@ -1,34 +1,36 @@
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Store } from '@ngrx/store';
|
||||
import { combineLatest as observableCombineLatest } from 'rxjs';
|
||||
import { Observable } from 'rxjs/internal/Observable';
|
||||
import { filter, find, map, switchMap } from 'rxjs/operators';
|
||||
import { AppState } from '../../app.reducer';
|
||||
import { isNotUndefined } from '../../shared/empty.util';
|
||||
import { NotificationsService } from '../../shared/notifications/notifications.service';
|
||||
import { followLink } from '../../shared/utils/follow-link-config.model';
|
||||
import { dataService } from '../cache/builders/build-decorators';
|
||||
import { NormalizedObjectBuildService } from '../cache/builders/normalized-object-build.service';
|
||||
import { RemoteDataBuildService } from '../cache/builders/remote-data-build.service';
|
||||
import { ObjectCacheService } from '../cache/object-cache.service';
|
||||
import { CoreState } from '../core.reducers';
|
||||
import { HALEndpointService } from '../shared/hal-endpoint.service';
|
||||
import { ItemType } from '../shared/item-relationships/item-type.model';
|
||||
import { RelationshipType } from '../shared/item-relationships/relationship-type.model';
|
||||
import { RELATIONSHIP_TYPE } from '../shared/item-relationships/relationship-type.resource-type';
|
||||
import { configureRequest, getSucceededRemoteData } from '../shared/operators';
|
||||
import { DataService } from './data.service';
|
||||
import { DefaultChangeAnalyzer } from './default-change-analyzer.service';
|
||||
import { ItemDataService } from './item-data.service';
|
||||
import { RequestService } from './request.service';
|
||||
import { HALEndpointService } from '../shared/hal-endpoint.service';
|
||||
import { RemoteDataBuildService } from '../cache/builders/remote-data-build.service';
|
||||
import { filter, find, map, switchMap } from 'rxjs/operators';
|
||||
import { configureRequest, getSucceededRemoteData } from '../shared/operators';
|
||||
import { Observable } from 'rxjs/internal/Observable';
|
||||
import { RelationshipType } from '../shared/item-relationships/relationship-type.model';
|
||||
import { RemoteData } from './remote-data';
|
||||
import { PaginatedList } from './paginated-list';
|
||||
import { combineLatest as observableCombineLatest } from 'rxjs';
|
||||
import { ItemType } from '../shared/item-relationships/item-type.model';
|
||||
import { isNotUndefined } from '../../shared/empty.util';
|
||||
import { RemoteData } from './remote-data';
|
||||
import { FindListOptions, FindListRequest } from './request.models';
|
||||
import { RequestService } from './request.service';
|
||||
|
||||
/**
|
||||
* The service handling all relationship type requests
|
||||
*/
|
||||
@Injectable()
|
||||
@dataService(RelationshipType.type)
|
||||
@dataService(RELATIONSHIP_TYPE)
|
||||
export class RelationshipTypeService extends DataService<RelationshipType> {
|
||||
protected linkPath = 'relationshiptypes';
|
||||
|
||||
@@ -62,7 +64,7 @@ export class RelationshipTypeService extends DataService<RelationshipType> {
|
||||
.pipe(
|
||||
map((endpointURL: string) => new FindListRequest(this.requestService.generateRequestId(), endpointURL, options)),
|
||||
configureRequest(this.requestService),
|
||||
switchMap(() => this.rdbService.buildList(link$))
|
||||
switchMap(() => this.rdbService.buildList(link$, followLink('leftType'), followLink('rightType')))
|
||||
) as Observable<RemoteData<PaginatedList<RelationshipType>>>;
|
||||
}
|
||||
|
||||
|
@@ -1,26 +1,26 @@
|
||||
import { RelationshipService } from './relationship.service';
|
||||
import { RequestService } from './request.service';
|
||||
import { HALEndpointServiceStub } from '../../shared/testing/hal-endpoint-service-stub';
|
||||
import { getMockRemoteDataBuildService } from '../../shared/mocks/mock-remote-data-build.service';
|
||||
import { Observable } from 'rxjs/internal/Observable';
|
||||
import { of as observableOf } from 'rxjs/internal/observable/of';
|
||||
import { RequestEntry } from './request.reducer';
|
||||
import { getMockRemoteDataBuildServiceHrefMap } from '../../shared/mocks/mock-remote-data-build.service';
|
||||
import { getMockRequestService } from '../../shared/mocks/mock-request.service';
|
||||
import { HALEndpointServiceStub } from '../../shared/testing/hal-endpoint-service-stub';
|
||||
import { createSuccessfulRemoteDataObject$ } from '../../shared/testing/utils';
|
||||
import { ObjectCacheService } from '../cache/object-cache.service';
|
||||
import { RelationshipType } from '../shared/item-relationships/relationship-type.model';
|
||||
import { Relationship } from '../shared/item-relationships/relationship.model';
|
||||
import { RemoteData } from './remote-data';
|
||||
import { getMockRequestService } from '../../shared/mocks/mock-request.service';
|
||||
import { Item } from '../shared/item.model';
|
||||
import { PaginatedList } from './paginated-list';
|
||||
import { PageInfo } from '../shared/page-info.model';
|
||||
import { PaginatedList } from './paginated-list';
|
||||
import { RelationshipService } from './relationship.service';
|
||||
import { RemoteData } from './remote-data';
|
||||
import { DeleteRequest } from './request.models';
|
||||
import { ObjectCacheService } from '../cache/object-cache.service';
|
||||
import { Observable } from 'rxjs/internal/Observable';
|
||||
import { createSuccessfulRemoteDataObject$ } from '../../shared/testing/utils';
|
||||
import { RequestEntry } from './request.reducer';
|
||||
import { RequestService } from './request.service';
|
||||
|
||||
describe('RelationshipService', () => {
|
||||
fdescribe('RelationshipService', () => {
|
||||
let service: RelationshipService;
|
||||
let requestService: RequestService;
|
||||
|
||||
const restEndpointURL = 'https://rest.api/';
|
||||
const restEndpointURL = 'https://rest.api/core';
|
||||
const relationshipsEndpointURL = `${restEndpointURL}/relationships`;
|
||||
const halService: any = new HALEndpointServiceStub(restEndpointURL);
|
||||
|
||||
@@ -44,13 +44,16 @@ describe('RelationshipService', () => {
|
||||
relationshipType: observableOf(new RemoteData(false, false, true, undefined, relationshipType))
|
||||
});
|
||||
|
||||
const relationships = [ relationship1, relationship2 ];
|
||||
const relationships = [relationship1, relationship2];
|
||||
|
||||
const item = Object.assign(new Item(), {
|
||||
self: 'fake-item-url/publication',
|
||||
self: restEndpointURL + '/publication',
|
||||
id: 'publication',
|
||||
uuid: 'publication',
|
||||
relationships: observableOf(new RemoteData(false, false, true, undefined, new PaginatedList(new PageInfo(), relationships)))
|
||||
relationships: observableOf(new RemoteData(false, false, true, undefined, new PaginatedList(new PageInfo(), relationships))),
|
||||
_links: {
|
||||
relationships: { href: restEndpointURL + '/publication/relationships' }
|
||||
}
|
||||
});
|
||||
|
||||
const relatedItem1 = Object.assign(new Item(), {
|
||||
@@ -70,10 +73,12 @@ describe('RelationshipService', () => {
|
||||
const relatedItems = [relatedItem1, relatedItem2];
|
||||
|
||||
const buildList$ = createSuccessfulRemoteDataObject$(new PaginatedList(new PageInfo(), [relatedItems]));
|
||||
const rdbService = getMockRemoteDataBuildService(undefined, buildList$);
|
||||
const relationships$ = createSuccessfulRemoteDataObject$(new PaginatedList(new PageInfo(), [relationships]));
|
||||
const rdbService = getMockRemoteDataBuildServiceHrefMap(undefined, {'href': buildList$, 'https://rest.api/core/publication/relationships': relationships$});
|
||||
const objectCache = Object.assign({
|
||||
/* tslint:disable:no-empty */
|
||||
remove: () => {},
|
||||
remove: () => {
|
||||
},
|
||||
hasBySelfLinkObservable: () => observableOf(false)
|
||||
/* tslint:enable:no-empty */
|
||||
}) as ObjectCacheService;
|
||||
@@ -133,7 +138,9 @@ describe('RelationshipService', () => {
|
||||
describe('getItemRelationshipsArray', () => {
|
||||
it('should return the item\'s relationships in the form of an array', () => {
|
||||
service.getItemRelationshipsArray(item).subscribe((result) => {
|
||||
expect(result).toEqual(relationships);
|
||||
result.forEach((relResult: any) => {
|
||||
expect(relResult).toEqual(relationships);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@@ -1,37 +1,50 @@
|
||||
import { HttpClient, HttpHeaders } from '@angular/common/http';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { followLink, FollowLinkConfig } from '../../shared/utils/follow-link-config.model';
|
||||
import { dataService } from '../cache/builders/build-decorators';
|
||||
import { MemoizedSelector, select, Store } from '@ngrx/store';
|
||||
import { combineLatest, combineLatest as observableCombineLatest } from 'rxjs';
|
||||
import { Observable } from 'rxjs/internal/Observable';
|
||||
import { distinctUntilChanged, filter, map, mergeMap, startWith, switchMap, take, tap } from 'rxjs/operators';
|
||||
import { compareArraysUsingIds, paginatedRelationsToItems, relationsToItems } from '../../+item-page/simple/item-types/shared/item-relationships-utils';
|
||||
import {
|
||||
compareArraysUsingIds,
|
||||
paginatedRelationsToItems,
|
||||
relationsToItems
|
||||
} from '../../+item-page/simple/item-types/shared/item-relationships-utils';
|
||||
import { AppState, keySelector } from '../../app.reducer';
|
||||
import { hasValue, hasValueOperator, isNotEmpty, isNotEmptyOperator } from '../../shared/empty.util';
|
||||
import { ReorderableRelationship } from '../../shared/form/builder/ds-dynamic-form-ui/existing-metadata-list-element/existing-metadata-list-element.component';
|
||||
import { RemoveNameVariantAction, SetNameVariantAction } from '../../shared/form/builder/ds-dynamic-form-ui/relation-lookup-modal/name-variant.actions';
|
||||
import {
|
||||
RemoveNameVariantAction,
|
||||
SetNameVariantAction
|
||||
} from '../../shared/form/builder/ds-dynamic-form-ui/relation-lookup-modal/name-variant.actions';
|
||||
import { NameVariantListState } from '../../shared/form/builder/ds-dynamic-form-ui/relation-lookup-modal/name-variant.reducer';
|
||||
import { NotificationsService } from '../../shared/notifications/notifications.service';
|
||||
import { followLink, FollowLinkConfig } from '../../shared/utils/follow-link-config.model';
|
||||
import { dataService } from '../cache/builders/build-decorators';
|
||||
import { NormalizedObjectBuildService } from '../cache/builders/normalized-object-build.service';
|
||||
import { RemoteDataBuildService } from '../cache/builders/remote-data-build.service';
|
||||
import { configureRequest, getRemoteDataPayload, getResponseFromEntry, getSucceededRemoteData } from '../shared/operators';
|
||||
import { SearchParam } from '../cache/models/search-param.model';
|
||||
import { ObjectCacheService } from '../cache/object-cache.service';
|
||||
import { DeleteRequest, FindListOptions, PostRequest, RestRequest } from './request.models';
|
||||
import { RestResponse } from '../cache/response.models';
|
||||
import { CoreState } from '../core.reducers';
|
||||
import { HttpOptions } from '../dspace-rest-v2/dspace-rest-v2.service';
|
||||
import { HALEndpointService } from '../shared/hal-endpoint.service';
|
||||
import { RelationshipType } from '../shared/item-relationships/relationship-type.model';
|
||||
import { RemoteData, RemoteDataState } from './remote-data';
|
||||
import { PaginatedList } from './paginated-list';
|
||||
import { ItemDataService } from './item-data.service';
|
||||
import { Relationship } from '../shared/item-relationships/relationship.model';
|
||||
import { RELATIONSHIP } from '../shared/item-relationships/relationship.resource-type';
|
||||
import { Item } from '../shared/item.model';
|
||||
import {
|
||||
configureRequest,
|
||||
getRemoteDataPayload,
|
||||
getResponseFromEntry,
|
||||
getSucceededRemoteData
|
||||
} from '../shared/operators';
|
||||
import { DataService } from './data.service';
|
||||
import { DefaultChangeAnalyzer } from './default-change-analyzer.service';
|
||||
import { ItemDataService } from './item-data.service';
|
||||
import { PaginatedList } from './paginated-list';
|
||||
import { RemoteData, RemoteDataState } from './remote-data';
|
||||
import { DeleteRequest, FindListOptions, PostRequest, RestRequest } from './request.models';
|
||||
import { RequestService } from './request.service';
|
||||
import { Observable } from 'rxjs/internal/Observable';
|
||||
|
||||
const relationshipListsStateSelector = (state: AppState) => state.relationshipLists;
|
||||
|
||||
@@ -47,7 +60,7 @@ const relationshipStateSelector = (listID: string, itemID: string): MemoizedSele
|
||||
* The service handling all relationship requests
|
||||
*/
|
||||
@Injectable()
|
||||
@dataService(Relationship.type)
|
||||
@dataService(RELATIONSHIP)
|
||||
export class RelationshipService extends DataService<Relationship> {
|
||||
protected linkPath = 'relationships';
|
||||
|
||||
@@ -168,9 +181,13 @@ export class RelationshipService extends DataService<Relationship> {
|
||||
* @param item
|
||||
*/
|
||||
getItemRelationshipsArray(item: Item, ...linksToFollow: Array<FollowLinkConfig<Relationship>>): Observable<Relationship[]> {
|
||||
console.log('item', item)
|
||||
console.log('item._links.relationships.href', item._links.relationships.href)
|
||||
console.log('...linksToFollow', ...linksToFollow)
|
||||
return this.findAllByHref(item._links.relationships.href, undefined, ...linksToFollow).pipe(
|
||||
getSucceededRemoteData(),
|
||||
getRemoteDataPayload(),
|
||||
tap((result) => console.log('resultpage', result.page)),
|
||||
map((rels: PaginatedList<Relationship>) => rels.page),
|
||||
hasValueOperator(),
|
||||
distinctUntilChanged(compareArraysUsingIds())
|
||||
@@ -287,8 +304,8 @@ export class RelationshipService extends DataService<Relationship> {
|
||||
* @param item2 The second item in the relationship
|
||||
* @param label The rightward or leftward type of the relationship
|
||||
*/
|
||||
getRelationshipByItemsAndLabel(item1: Item, item2: Item, label: string): Observable<Relationship> {
|
||||
return this.getItemRelationshipsByLabel(item1, label)
|
||||
getRelationshipByItemsAndLabel(item1: Item, item2: Item, label: string, options?: FindListOptions): Observable<Relationship> {
|
||||
return this.getItemRelationshipsByLabel(item1, label, options, followLink('relationshipType'), followLink('leftItem'), followLink('rightItem'))
|
||||
.pipe(
|
||||
getSucceededRemoteData(),
|
||||
isNotEmptyOperator(),
|
||||
|
@@ -1,28 +1,29 @@
|
||||
import { dataService } from '../cache/builders/build-decorators';
|
||||
import { DataService } from './data.service';
|
||||
import { Site } from '../shared/site.model';
|
||||
import { RequestService } from './request.service';
|
||||
import { RemoteDataBuildService } from '../cache/builders/remote-data-build.service';
|
||||
import { NormalizedObjectBuildService } from '../cache/builders/normalized-object-build.service';
|
||||
import { Store } from '@ngrx/store';
|
||||
import { CoreState } from '../core.reducers';
|
||||
import { ObjectCacheService } from '../cache/object-cache.service';
|
||||
import { HALEndpointService } from '../shared/hal-endpoint.service';
|
||||
import { NotificationsService } from '../../shared/notifications/notifications.service';
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { DSOChangeAnalyzer } from './dso-change-analyzer.service';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Store } from '@ngrx/store';
|
||||
import { Observable } from 'rxjs';
|
||||
import { map } from 'rxjs/operators';
|
||||
import { RemoteData } from './remote-data';
|
||||
import { PaginatedList } from './paginated-list';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { NotificationsService } from '../../shared/notifications/notifications.service';
|
||||
import { dataService } from '../cache/builders/build-decorators';
|
||||
import { NormalizedObjectBuildService } from '../cache/builders/normalized-object-build.service';
|
||||
import { RemoteDataBuildService } from '../cache/builders/remote-data-build.service';
|
||||
import { ObjectCacheService } from '../cache/object-cache.service';
|
||||
import { CoreState } from '../core.reducers';
|
||||
import { HALEndpointService } from '../shared/hal-endpoint.service';
|
||||
import { getSucceededRemoteData } from '../shared/operators';
|
||||
import { Site } from '../shared/site.model';
|
||||
import { SITE } from '../shared/site.resource-type';
|
||||
import { DataService } from './data.service';
|
||||
import { DSOChangeAnalyzer } from './dso-change-analyzer.service';
|
||||
import { PaginatedList } from './paginated-list';
|
||||
import { RemoteData } from './remote-data';
|
||||
import { RequestService } from './request.service';
|
||||
|
||||
/**
|
||||
* Service responsible for handling requests related to the Site object
|
||||
*/
|
||||
@Injectable()
|
||||
@dataService(Site.type)
|
||||
@dataService(SITE)
|
||||
export class SiteDataService extends DataService<Site> {
|
||||
protected linkPath = 'sites';
|
||||
|
||||
|
@@ -7,14 +7,15 @@ import { NormalizedObjectBuildService } from '../cache/builders/normalized-objec
|
||||
import { RemoteDataBuildService } from '../cache/builders/remote-data-build.service';
|
||||
import { ObjectCacheService } from '../cache/object-cache.service';
|
||||
import { CoreState } from '../core.reducers';
|
||||
import { DSOChangeAnalyzer } from '../data/dso-change-analyzer.service';
|
||||
import { DataService } from '../data/data.service';
|
||||
import { DSOChangeAnalyzer } from '../data/dso-change-analyzer.service';
|
||||
import { RequestService } from '../data/request.service';
|
||||
import { HALEndpointService } from '../shared/hal-endpoint.service';
|
||||
import { EPerson } from './models/eperson.model';
|
||||
import { EPERSON } from './models/eperson.resource-type';
|
||||
|
||||
@Injectable()
|
||||
@dataService(EPerson.type)
|
||||
@dataService(EPERSON)
|
||||
export class EPersonDataService extends DataService<EPerson> {
|
||||
|
||||
protected linkPath: 'eperson/epersons';
|
||||
|
@@ -1,13 +1,14 @@
|
||||
import { Observable } from 'rxjs';
|
||||
import { PaginatedList } from '../../data/paginated-list';
|
||||
import { RemoteData } from '../../data/remote-data';
|
||||
|
||||
import { DSpaceObject } from '../../shared/dspace-object.model';
|
||||
import { HALLink } from '../../shared/hal-link.model';
|
||||
import { EPERSON } from './eperson.resource-type';
|
||||
import { Group } from './group.model';
|
||||
import { RemoteData } from '../../data/remote-data';
|
||||
import { PaginatedList } from '../../data/paginated-list';
|
||||
import { ResourceType } from '../../shared/resource-type';
|
||||
|
||||
export class EPerson extends DSpaceObject {
|
||||
static type = new ResourceType('eperson');
|
||||
static type = EPERSON;
|
||||
|
||||
/**
|
||||
* A string representing the unique handle of this Collection
|
||||
@@ -55,4 +56,9 @@ export class EPerson extends DSpaceObject {
|
||||
get name(): string {
|
||||
return this.firstMetadataValue('eperson.firstname') + ' ' + this.firstMetadataValue('eperson.lastname');
|
||||
}
|
||||
|
||||
_links: {
|
||||
self: HALLink,
|
||||
groups: HALLink,
|
||||
}
|
||||
}
|
||||
|
10
src/app/core/eperson/models/eperson.resource-type.ts
Normal file
10
src/app/core/eperson/models/eperson.resource-type.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
import { ResourceType } from '../../shared/resource-type';
|
||||
|
||||
/**
|
||||
* The resource type for EPerson
|
||||
*
|
||||
* Needs to be in a separate file to prevent circular
|
||||
* dependencies in webpack.
|
||||
*/
|
||||
|
||||
export const EPERSON = new ResourceType('eperson');
|
@@ -1,12 +1,12 @@
|
||||
import { Observable } from 'rxjs';
|
||||
|
||||
import { DSpaceObject } from '../../shared/dspace-object.model';
|
||||
import { PaginatedList } from '../../data/paginated-list';
|
||||
import { RemoteData } from '../../data/remote-data';
|
||||
import { ResourceType } from '../../shared/resource-type';
|
||||
|
||||
import { DSpaceObject } from '../../shared/dspace-object.model';
|
||||
import { GROUP } from './group.resource-type';
|
||||
|
||||
export class Group extends DSpaceObject {
|
||||
static type = new ResourceType('group');
|
||||
static type = GROUP;
|
||||
|
||||
/**
|
||||
* List of Groups that this Group belong to
|
||||
|
10
src/app/core/eperson/models/group.resource-type.ts
Normal file
10
src/app/core/eperson/models/group.resource-type.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
import { ResourceType } from '../../shared/resource-type';
|
||||
|
||||
/**
|
||||
* The resource type for Group
|
||||
*
|
||||
* Needs to be in a separate file to prevent circular
|
||||
* dependencies in webpack.
|
||||
*/
|
||||
|
||||
export const GROUP = new ResourceType('group');
|
10
src/app/core/integration/models/authority.resource-type.ts
Normal file
10
src/app/core/integration/models/authority.resource-type.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
import { ResourceType } from '../../shared/resource-type';
|
||||
|
||||
/**
|
||||
* The resource type for AuthorityValue
|
||||
*
|
||||
* Needs to be in a separate file to prevent circular
|
||||
* dependencies in webpack.
|
||||
*/
|
||||
|
||||
export const AUTHORITY_VALUE = new ResourceType('authority');
|
@@ -1,15 +1,16 @@
|
||||
import { IntegrationModel } from './integration.model';
|
||||
import { isNotEmpty } from '../../../shared/empty.util';
|
||||
import { PLACEHOLDER_PARENT_METADATA } from '../../../shared/form/builder/ds-dynamic-form-ui/models/relation-group/dynamic-relation-group.model';
|
||||
import { OtherInformation } from '../../../shared/form/builder/models/form-field-metadata-value.model';
|
||||
import { HALLink } from '../../shared/hal-link.model';
|
||||
import { MetadataValueInterface } from '../../shared/metadata.models';
|
||||
import { ResourceType } from '../../shared/resource-type';
|
||||
import { AUTHORITY_VALUE } from './authority.resource-type';
|
||||
import { IntegrationModel } from './integration.model';
|
||||
|
||||
/**
|
||||
* Class representing an authority object
|
||||
*/
|
||||
export class AuthorityValue extends IntegrationModel implements MetadataValueInterface {
|
||||
static type = new ResourceType('authority');
|
||||
static type = AUTHORITY_VALUE;
|
||||
|
||||
/**
|
||||
* The identifier of this authority
|
||||
@@ -36,6 +37,10 @@ export class AuthorityValue extends IntegrationModel implements MetadataValueInt
|
||||
*/
|
||||
language: string;
|
||||
|
||||
_links: {
|
||||
self: HALLink,
|
||||
};
|
||||
|
||||
/**
|
||||
* This method checks if authority has an identifier value
|
||||
*
|
||||
|
@@ -1,17 +1,18 @@
|
||||
import { ListableObject } from '../../shared/object-collection/shared/listable-object.model';
|
||||
import { isNotEmpty } from '../../shared/empty.util';
|
||||
import { ListableObject } from '../../shared/object-collection/shared/listable-object.model';
|
||||
import { link } from '../cache/builders/build-decorators';
|
||||
import { GenericConstructor } from '../shared/generic-constructor';
|
||||
import { HALLink } from '../shared/hal-link.model';
|
||||
import { HALResource } from '../shared/hal-resource.model';
|
||||
import { METADATA_FIELD } from './metadata-field.resource-type';
|
||||
import { MetadataSchema } from './metadata-schema.model';
|
||||
import { ResourceType } from '../shared/resource-type';
|
||||
import { GenericConstructor } from '../shared/generic-constructor';
|
||||
import { METADATA_SCHEMA } from './metadata-schema.resource-type';
|
||||
|
||||
/**
|
||||
* Class the represents a metadata field
|
||||
*/
|
||||
export class MetadataField extends ListableObject implements HALResource {
|
||||
static type = new ResourceType('metadatafield');
|
||||
static type = METADATA_FIELD;
|
||||
|
||||
/**
|
||||
* The identifier of this metadata field
|
||||
@@ -41,7 +42,7 @@ export class MetadataField extends ListableObject implements HALResource {
|
||||
/**
|
||||
* The metadata schema object of this metadata field
|
||||
*/
|
||||
@link(MetadataSchema.type)
|
||||
@link(METADATA_SCHEMA)
|
||||
// TODO the responseparsingservice assumes schemas are always embedded. This should be remotedata instead.
|
||||
schema?: MetadataSchema;
|
||||
|
||||
|
10
src/app/core/metadata/metadata-field.resource-type.ts
Normal file
10
src/app/core/metadata/metadata-field.resource-type.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
import { ResourceType } from '../shared/resource-type';
|
||||
|
||||
/**
|
||||
* The resource type for MetadataField
|
||||
*
|
||||
* Needs to be in a separate file to prevent circular
|
||||
* dependencies in webpack.
|
||||
*/
|
||||
|
||||
export const METADATA_FIELD = new ResourceType('metadatafield');
|
@@ -1,14 +1,14 @@
|
||||
import { ListableObject } from '../../shared/object-collection/shared/listable-object.model';
|
||||
import { GenericConstructor } from '../shared/generic-constructor';
|
||||
import { HALLink } from '../shared/hal-link.model';
|
||||
import { HALResource } from '../shared/hal-resource.model';
|
||||
import { ResourceType } from '../shared/resource-type';
|
||||
import { GenericConstructor } from '../shared/generic-constructor';
|
||||
import { METADATA_SCHEMA } from './metadata-schema.resource-type';
|
||||
|
||||
/**
|
||||
* Class that represents a metadata schema
|
||||
*/
|
||||
export class MetadataSchema extends ListableObject implements HALResource {
|
||||
static type = new ResourceType('metadataschema');
|
||||
static type = METADATA_SCHEMA;
|
||||
|
||||
/**
|
||||
* The unique identifier for this metadata schema
|
||||
|
10
src/app/core/metadata/metadata-schema.resource-type.ts
Normal file
10
src/app/core/metadata/metadata-schema.resource-type.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
import { ResourceType } from '../shared/resource-type';
|
||||
|
||||
/**
|
||||
* The resource type for MetadataSchema
|
||||
*
|
||||
* Needs to be in a separate file to prevent circular
|
||||
* dependencies in webpack.
|
||||
*/
|
||||
|
||||
export const METADATA_SCHEMA = new ResourceType('metadataschema');
|
@@ -1,15 +1,15 @@
|
||||
import { PageInfo } from '../shared/page-info.model';
|
||||
import { autoserialize, deserialize } from 'cerialize';
|
||||
import { ResourceType } from '../shared/resource-type';
|
||||
import { relationship } from '../cache/builders/build-decorators';
|
||||
import { NormalizedMetadataField } from '../metadata/normalized-metadata-field.model';
|
||||
import { MetadataField } from '../metadata/metadata-field.model';
|
||||
import { METADATA_FIELD } from '../metadata/metadata-field.resource-type';
|
||||
import { HALLink } from '../shared/hal-link.model';
|
||||
import { PageInfo } from '../shared/page-info.model';
|
||||
|
||||
/**
|
||||
* Class that represents a response with a registry's metadata fields
|
||||
*/
|
||||
export class RegistryMetadatafieldsResponse {
|
||||
static type = new ResourceType('metadatafield');
|
||||
static type = METADATA_FIELD;
|
||||
/**
|
||||
* List of metadata fields in the response
|
||||
*/
|
||||
@@ -28,4 +28,9 @@ export class RegistryMetadatafieldsResponse {
|
||||
*/
|
||||
@autoserialize
|
||||
self: string;
|
||||
|
||||
_links: {
|
||||
self: HALLink,
|
||||
schema: HALLink
|
||||
}
|
||||
}
|
||||
|
@@ -1,13 +1,13 @@
|
||||
import { CacheableObject, TypedObject } from '../cache/object-cache.reducer';
|
||||
import { HALLink } from './hal-link.model';
|
||||
import { ResourceType } from './resource-type';
|
||||
import { CacheableObject } from '../cache/object-cache.reducer';
|
||||
import { BitstreamFormatSupportLevel } from './bitstream-format-support-level';
|
||||
import { BITSTREAM_FORMAT } from './bitstream-format.resource-type';
|
||||
import { HALLink } from './hal-link.model';
|
||||
|
||||
/**
|
||||
* Model class for a Bitstream Format
|
||||
*/
|
||||
export class BitstreamFormat implements CacheableObject {
|
||||
static type = new ResourceType('bitstreamformat');
|
||||
static type = BITSTREAM_FORMAT;
|
||||
|
||||
bitstreamformat
|
||||
/**
|
||||
|
9
src/app/core/shared/bitstream-format.resource-type.ts
Normal file
9
src/app/core/shared/bitstream-format.resource-type.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
import { ResourceType } from './resource-type';
|
||||
|
||||
/**
|
||||
* The resource type for BitstreamFormat
|
||||
*
|
||||
* Needs to be in a separate file to prevent circular
|
||||
* dependencies in webpack.
|
||||
*/
|
||||
export const BITSTREAM_FORMAT = new ResourceType('bitstreamformat');
|
@@ -2,14 +2,14 @@ import { Observable } from 'rxjs';
|
||||
import { link } from '../cache/builders/build-decorators';
|
||||
import { RemoteData } from '../data/remote-data';
|
||||
import { BitstreamFormat } from './bitstream-format.model';
|
||||
import { Bundle } from './bundle.model';
|
||||
import { BITSTREAM_FORMAT } from './bitstream-format.resource-type';
|
||||
import { BITSTREAM } from './bitstream.resource-type';
|
||||
import { DSpaceObject } from './dspace-object.model';
|
||||
import { HALResource } from './hal-resource.model';
|
||||
import { HALLink } from './hal-link.model';
|
||||
import { ResourceType } from './resource-type';
|
||||
import { HALResource } from './hal-resource.model';
|
||||
|
||||
export class Bitstream extends DSpaceObject implements HALResource {
|
||||
static type = new ResourceType('bitstream');
|
||||
static type = BITSTREAM;
|
||||
|
||||
/**
|
||||
* The size of this bitstream in bytes
|
||||
@@ -34,19 +34,13 @@ export class Bitstream extends DSpaceObject implements HALResource {
|
||||
/**
|
||||
* The Bitstream Format for this Bitstream
|
||||
*/
|
||||
@link(BitstreamFormat.type)
|
||||
@link(BITSTREAM_FORMAT)
|
||||
format?: Observable<RemoteData<BitstreamFormat>>;
|
||||
|
||||
_links: {
|
||||
// @link(Bitstream.type)
|
||||
self: HALLink;
|
||||
|
||||
// @link(Bundle.type)
|
||||
bundle: HALLink;
|
||||
|
||||
// @link(BitstreamFormat.type)
|
||||
format: HALLink;
|
||||
|
||||
content: HALLink;
|
||||
}
|
||||
}
|
||||
|
9
src/app/core/shared/bitstream.resource-type.ts
Normal file
9
src/app/core/shared/bitstream.resource-type.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
import { ResourceType } from './resource-type';
|
||||
|
||||
/**
|
||||
* The resource type for Bitstream
|
||||
*
|
||||
* Needs to be in a separate file to prevent circular
|
||||
* dependencies in webpack.
|
||||
*/
|
||||
export const BITSTREAM = new ResourceType('bitstream');
|
@@ -1,10 +1,11 @@
|
||||
import { autoserialize, autoserializeAs } from 'cerialize';
|
||||
import { SortOption } from './sort-option.model';
|
||||
import { ResourceType } from './resource-type';
|
||||
import { TypedObject } from '../cache/object-cache.reducer';
|
||||
import { BROWSE_DEFINITION } from './browse-definition.resource-type';
|
||||
import { HALLink } from './hal-link.model';
|
||||
import { SortOption } from './sort-option.model';
|
||||
|
||||
export class BrowseDefinition implements TypedObject {
|
||||
static type = new ResourceType('browse');
|
||||
static type = BROWSE_DEFINITION;
|
||||
|
||||
@autoserialize
|
||||
id: string;
|
||||
@@ -21,8 +22,14 @@ export class BrowseDefinition implements TypedObject {
|
||||
@autoserializeAs('metadata')
|
||||
metadataKeys: string[];
|
||||
|
||||
get self(): string {
|
||||
return this._links.self.href;
|
||||
}
|
||||
|
||||
@autoserialize
|
||||
_links: {
|
||||
[name: string]: string
|
||||
}
|
||||
self: HALLink;
|
||||
entries: HALLink;
|
||||
items: HALLink;
|
||||
};
|
||||
}
|
||||
|
9
src/app/core/shared/browse-definition.resource-type.ts
Normal file
9
src/app/core/shared/browse-definition.resource-type.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
import { ResourceType } from './resource-type';
|
||||
|
||||
/**
|
||||
* The resource type for BrowseDefinition
|
||||
*
|
||||
* Needs to be in a separate file to prevent circular
|
||||
* dependencies in webpack.
|
||||
*/
|
||||
export const BROWSE_DEFINITION = new ResourceType('browse');
|
@@ -1,15 +1,16 @@
|
||||
import { ListableObject } from '../../shared/object-collection/shared/listable-object.model';
|
||||
import { TypedObject } from '../cache/object-cache.reducer';
|
||||
import { ResourceType } from './resource-type';
|
||||
import { GenericConstructor } from './generic-constructor';
|
||||
import { excludeFromEquals } from '../utilities/equals.decorators';
|
||||
import { BROWSE_ENTRY } from './browse-entry.resource-type';
|
||||
import { GenericConstructor } from './generic-constructor';
|
||||
import { HALLink } from './hal-link.model';
|
||||
|
||||
/**
|
||||
* Class object representing a browse entry
|
||||
* This class is not normalized because browse entries do not have self links
|
||||
*/
|
||||
export class BrowseEntry extends ListableObject implements TypedObject {
|
||||
static type = new ResourceType('browseEntry');
|
||||
static type = BROWSE_ENTRY;
|
||||
|
||||
/**
|
||||
* The authority string of this browse entry
|
||||
@@ -32,6 +33,11 @@ export class BrowseEntry extends ListableObject implements TypedObject {
|
||||
@excludeFromEquals
|
||||
count: number;
|
||||
|
||||
_links: {
|
||||
self: HALLink;
|
||||
entries: HALLink;
|
||||
};
|
||||
|
||||
/**
|
||||
* Method that returns as which type of object this object should be rendered
|
||||
*/
|
||||
|
9
src/app/core/shared/browse-entry.resource-type.ts
Normal file
9
src/app/core/shared/browse-entry.resource-type.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
import { ResourceType } from './resource-type';
|
||||
|
||||
/**
|
||||
* The resource type for BrowseEntry
|
||||
*
|
||||
* Needs to be in a separate file to prevent circular
|
||||
* dependencies in webpack.
|
||||
*/
|
||||
export const BROWSE_ENTRY = new ResourceType('browseEntry');
|
@@ -1,9 +1,9 @@
|
||||
import { BUNDLE } from './bundle.resource-type';
|
||||
import { DSpaceObject } from './dspace-object.model';
|
||||
import { HALLink } from './hal-link.model';
|
||||
import { ResourceType } from './resource-type';
|
||||
|
||||
export class Bundle extends DSpaceObject {
|
||||
static type = new ResourceType('bundle');
|
||||
static type = BUNDLE;
|
||||
|
||||
/**
|
||||
* The bundle's name
|
||||
@@ -13,8 +13,6 @@ export class Bundle extends DSpaceObject {
|
||||
_links: {
|
||||
self: HALLink;
|
||||
primaryBitstream: HALLink;
|
||||
parents: HALLink;
|
||||
owner: HALLink;
|
||||
bitstreams: HALLink;
|
||||
}
|
||||
}
|
||||
|
9
src/app/core/shared/bundle.resource-type.ts
Normal file
9
src/app/core/shared/bundle.resource-type.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
import { ResourceType } from './resource-type';
|
||||
|
||||
/**
|
||||
* The resource type for Bundle
|
||||
*
|
||||
* Needs to be in a separate file to prevent circular
|
||||
* dependencies in webpack.
|
||||
*/
|
||||
export const BUNDLE = new ResourceType('bundle');
|
@@ -1,17 +1,19 @@
|
||||
import { link } from '../cache/builders/build-decorators';
|
||||
import { DSpaceObject } from './dspace-object.model';
|
||||
import { Bitstream } from './bitstream.model';
|
||||
import { HALLink } from './hal-link.model';
|
||||
import { Item } from './item.model';
|
||||
import { RemoteData } from '../data/remote-data';
|
||||
import { Observable } from 'rxjs';
|
||||
import { License } from './license.model';
|
||||
import { ResourcePolicy } from './resource-policy.model';
|
||||
import { link } from '../cache/builders/build-decorators';
|
||||
import { PaginatedList } from '../data/paginated-list';
|
||||
import { ResourceType } from './resource-type';
|
||||
import { RemoteData } from '../data/remote-data';
|
||||
import { Bitstream } from './bitstream.model';
|
||||
import { BITSTREAM } from './bitstream.resource-type';
|
||||
import { COLLECTION } from './collection.resource-type';
|
||||
import { DSpaceObject } from './dspace-object.model';
|
||||
import { HALLink } from './hal-link.model';
|
||||
import { License } from './license.model';
|
||||
import { LICENSE } from './license.resource-type';
|
||||
import { ResourcePolicy } from './resource-policy.model';
|
||||
import { RESOURCE_POLICY } from './resource-policy.resource-type';
|
||||
|
||||
export class Collection extends DSpaceObject {
|
||||
static type = new ResourceType('collection');
|
||||
static type = COLLECTION;
|
||||
|
||||
/**
|
||||
* A string representing the unique handle of this Collection
|
||||
@@ -61,24 +63,26 @@ export class Collection extends DSpaceObject {
|
||||
/**
|
||||
* The deposit license of this Collection
|
||||
*/
|
||||
// license?: Observable<RemoteData<License>>;
|
||||
@link(LICENSE)
|
||||
license?: Observable<RemoteData<License>>;
|
||||
|
||||
/**
|
||||
* The Bitstream that represents the logo of this Collection
|
||||
*/
|
||||
@link(Bitstream.type)
|
||||
@link(BITSTREAM)
|
||||
logo?: Observable<RemoteData<Bitstream>>;
|
||||
|
||||
/**
|
||||
* The default access conditions of this Collection
|
||||
*/
|
||||
@link(ResourcePolicy.type, true)
|
||||
@link(RESOURCE_POLICY, true)
|
||||
defaultAccessConditions?: Observable<RemoteData<PaginatedList<ResourcePolicy>>>;
|
||||
|
||||
_links: {
|
||||
license: HALLink;
|
||||
harvester: HALLink;
|
||||
mappedItems: HALLink;
|
||||
itemtemplate: HALLink;
|
||||
defaultAccessConditions: HALLink;
|
||||
logo: HALLink;
|
||||
self: HALLink;
|
||||
|
9
src/app/core/shared/collection.resource-type.ts
Normal file
9
src/app/core/shared/collection.resource-type.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
import { ResourceType } from './resource-type';
|
||||
|
||||
/**
|
||||
* The resource type for Collection
|
||||
*
|
||||
* Needs to be in a separate file to prevent circular
|
||||
* dependencies in webpack.
|
||||
*/
|
||||
export const COLLECTION = new ResourceType('collection');
|
@@ -1,15 +1,17 @@
|
||||
import { link } from '../cache/builders/build-decorators';
|
||||
import { DSpaceObject } from './dspace-object.model';
|
||||
import { Bitstream } from './bitstream.model';
|
||||
import { Collection } from './collection.model';
|
||||
import { RemoteData } from '../data/remote-data';
|
||||
import { Observable } from 'rxjs';
|
||||
import { link } from '../cache/builders/build-decorators';
|
||||
import { PaginatedList } from '../data/paginated-list';
|
||||
import { RemoteData } from '../data/remote-data';
|
||||
import { Bitstream } from './bitstream.model';
|
||||
import { BITSTREAM } from './bitstream.resource-type';
|
||||
import { Collection } from './collection.model';
|
||||
import { COLLECTION } from './collection.resource-type';
|
||||
import { COMMUNITY } from './community.resource-type';
|
||||
import { DSpaceObject } from './dspace-object.model';
|
||||
import { HALLink } from './hal-link.model';
|
||||
import { ResourceType } from './resource-type';
|
||||
|
||||
export class Community extends DSpaceObject {
|
||||
static type = new ResourceType('community');
|
||||
static type = COMMUNITY;
|
||||
|
||||
/**
|
||||
* A string representing the unique handle of this Community
|
||||
@@ -51,13 +53,13 @@ export class Community extends DSpaceObject {
|
||||
/**
|
||||
* The Bitstream that represents the logo of this Community
|
||||
*/
|
||||
@link(Bitstream.type)
|
||||
@link(BITSTREAM)
|
||||
logo?: Observable<RemoteData<Bitstream>>;
|
||||
|
||||
@link(Collection.type, true)
|
||||
@link(COLLECTION, true)
|
||||
collections?: Observable<RemoteData<PaginatedList<Collection>>>;
|
||||
|
||||
@link(Community.type, true)
|
||||
@link(COMMUNITY, true)
|
||||
subcommunities?: Observable<RemoteData<PaginatedList<Community>>>;
|
||||
|
||||
_links: {
|
||||
|
9
src/app/core/shared/community.resource-type.ts
Normal file
9
src/app/core/shared/community.resource-type.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
import { ResourceType } from './resource-type';
|
||||
|
||||
/**
|
||||
* The resource type for Community
|
||||
*
|
||||
* Needs to be in a separate file to prevent circular
|
||||
* dependencies in webpack.
|
||||
*/
|
||||
export const COMMUNITY = new ResourceType('community');
|
@@ -1,16 +1,12 @@
|
||||
import { hasNoValue, isUndefined } from '../../shared/empty.util';
|
||||
import { ListableObject } from '../../shared/object-collection/shared/listable-object.model';
|
||||
import { CacheableObject } from '../cache/object-cache.reducer';
|
||||
import { excludeFromEquals } from '../utilities/equals.decorators';
|
||||
import { DSPACE_OBJECT } from './dspace-object.resource-type';
|
||||
import { GenericConstructor } from './generic-constructor';
|
||||
import { HALLink } from './hal-link.model';
|
||||
import {
|
||||
MetadataMap,
|
||||
MetadataValue,
|
||||
MetadataValueFilter,
|
||||
MetadatumViewModel
|
||||
} from './metadata.models';
|
||||
import { MetadataMap, MetadataValue, MetadataValueFilter, MetadatumViewModel } from './metadata.models';
|
||||
import { Metadata } from './metadata.utils';
|
||||
import { hasNoValue, isUndefined } from '../../shared/empty.util';
|
||||
import { CacheableObject } from '../cache/object-cache.reducer';
|
||||
import { ListableObject } from '../../shared/object-collection/shared/listable-object.model';
|
||||
import { excludeFromEquals } from '../utilities/equals.decorators';
|
||||
import { ResourceType } from './resource-type';
|
||||
|
||||
/**
|
||||
@@ -20,7 +16,7 @@ export class DSpaceObject extends ListableObject implements CacheableObject {
|
||||
/**
|
||||
* A string representing the kind of DSpaceObject, e.g. community, item, …
|
||||
*/
|
||||
static type = new ResourceType('dspaceobject');
|
||||
static type = DSPACE_OBJECT;
|
||||
|
||||
@excludeFromEquals
|
||||
private _name: string;
|
||||
|
9
src/app/core/shared/dspace-object.resource-type.ts
Normal file
9
src/app/core/shared/dspace-object.resource-type.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
import { ResourceType } from './resource-type';
|
||||
|
||||
/**
|
||||
* The resource type for DSpaceObject
|
||||
*
|
||||
* Needs to be in a separate file to prevent circular
|
||||
* dependencies in webpack.
|
||||
*/
|
||||
export const DSPACE_OBJECT = new ResourceType('dspaceobject');
|
@@ -1,14 +1,14 @@
|
||||
import { ListableObject } from '../../shared/object-collection/shared/listable-object.model';
|
||||
import { RESOURCE_TYPE } from './external-source-entry.resource-type';
|
||||
import { GenericConstructor } from './generic-constructor';
|
||||
import { HALLink } from './hal-link.model';
|
||||
import { MetadataMap } from './metadata.models';
|
||||
import { ResourceType } from './resource-type';
|
||||
import { ListableObject } from '../../shared/object-collection/shared/listable-object.model';
|
||||
import { GenericConstructor } from './generic-constructor';
|
||||
|
||||
/**
|
||||
* Model class for a single entry from an external source
|
||||
*/
|
||||
export class ExternalSourceEntry extends ListableObject {
|
||||
static type = new ResourceType('externalSourceEntry');
|
||||
static type = RESOURCE_TYPE;
|
||||
|
||||
/**
|
||||
* Unique identifier
|
||||
|
@@ -0,0 +1,9 @@
|
||||
import { ResourceType } from './resource-type';
|
||||
|
||||
/**
|
||||
* The resource type for ResourceType
|
||||
*
|
||||
* Needs to be in a separate file to prevent circular
|
||||
* dependencies in webpack.
|
||||
*/
|
||||
export const RESOURCE_TYPE = new ResourceType('externalSourceEntry');
|
@@ -1,12 +1,12 @@
|
||||
import { HALLink } from './hal-link.model';
|
||||
import { ResourceType } from './resource-type';
|
||||
import { CacheableObject } from '../cache/object-cache.reducer';
|
||||
import { EXTERNAL_SOURCE } from './external-source.resource-type';
|
||||
import { HALLink } from './hal-link.model';
|
||||
|
||||
/**
|
||||
* Model class for an external source
|
||||
*/
|
||||
export class ExternalSource extends CacheableObject {
|
||||
static type = new ResourceType('externalsource');
|
||||
static type = EXTERNAL_SOURCE;
|
||||
|
||||
/**
|
||||
* Unique identifier
|
||||
@@ -30,5 +30,6 @@ export class ExternalSource extends CacheableObject {
|
||||
|
||||
_links: {
|
||||
self: HALLink;
|
||||
entries: HALLink;
|
||||
}
|
||||
}
|
||||
|
9
src/app/core/shared/external-source.resource-type.ts
Normal file
9
src/app/core/shared/external-source.resource-type.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
import { ResourceType } from './resource-type';
|
||||
|
||||
/**
|
||||
* The resource type for ExternalSource
|
||||
*
|
||||
* Needs to be in a separate file to prevent circular
|
||||
* dependencies in webpack.
|
||||
*/
|
||||
export const EXTERNAL_SOURCE = new ResourceType('externalsource');
|
@@ -1,6 +1,11 @@
|
||||
import { HALLink } from './hal-link.model';
|
||||
|
||||
export class HALResource {
|
||||
|
||||
get self(): string {
|
||||
return this._links.self.href;
|
||||
}
|
||||
|
||||
_links: {
|
||||
self: HALLink
|
||||
[k: string]: HALLink;
|
||||
|
@@ -1,12 +1,12 @@
|
||||
import { CacheableObject } from '../../cache/object-cache.reducer';
|
||||
import { HALLink } from '../hal-link.model';
|
||||
import { ResourceType } from '../resource-type';
|
||||
import { ITEM_TYPE } from './item-type.resource-type';
|
||||
|
||||
/**
|
||||
* Describes a type of Item
|
||||
*/
|
||||
export class ItemType implements CacheableObject {
|
||||
static type = new ResourceType('entitytype');
|
||||
static type = ITEM_TYPE;
|
||||
|
||||
/**
|
||||
* The identifier of this ItemType
|
||||
|
@@ -0,0 +1,10 @@
|
||||
import { ResourceType } from '../resource-type';
|
||||
|
||||
/**
|
||||
* The resource type for ItemType
|
||||
*
|
||||
* Needs to be in a separate file to prevent circular
|
||||
* dependencies in webpack.
|
||||
*/
|
||||
|
||||
export const ITEM_TYPE = new ResourceType('entitytype');
|
@@ -3,14 +3,15 @@ import { link } from '../../cache/builders/build-decorators';
|
||||
import { CacheableObject } from '../../cache/object-cache.reducer';
|
||||
import { RemoteData } from '../../data/remote-data';
|
||||
import { HALLink } from '../hal-link.model';
|
||||
import { ResourceType } from '../resource-type';
|
||||
import { ItemType } from './item-type.model';
|
||||
import { ITEM_TYPE } from './item-type.resource-type';
|
||||
import { RELATIONSHIP_TYPE } from './relationship-type.resource-type';
|
||||
|
||||
/**
|
||||
* Describes a type of Relationship between multiple possible Items
|
||||
*/
|
||||
export class RelationshipType implements CacheableObject {
|
||||
static type = new ResourceType('relationshiptype');
|
||||
static type = RELATIONSHIP_TYPE;
|
||||
|
||||
/**
|
||||
* The link to the rest endpoint where this object can be found
|
||||
@@ -65,13 +66,13 @@ export class RelationshipType implements CacheableObject {
|
||||
/**
|
||||
* The type of Item found to the left of this RelationshipType
|
||||
*/
|
||||
@link(ItemType.type)
|
||||
@link(ITEM_TYPE)
|
||||
leftType?: Observable<RemoteData<ItemType>>;
|
||||
|
||||
/**
|
||||
* The type of Item found to the right of this RelationshipType
|
||||
*/
|
||||
@link(ItemType.type)
|
||||
@link(ITEM_TYPE)
|
||||
rightType?: Observable<RemoteData<ItemType>>;
|
||||
|
||||
_links: {
|
||||
|
@@ -0,0 +1,10 @@
|
||||
import { ResourceType } from '../resource-type';
|
||||
|
||||
/**
|
||||
* The resource type for RelationshipType
|
||||
*
|
||||
* Needs to be in a separate file to prevent circular
|
||||
* dependencies in webpack.
|
||||
*/
|
||||
|
||||
export const RELATIONSHIP_TYPE = new ResourceType('relationshiptype');
|
@@ -3,10 +3,11 @@ import { link } from '../../cache/builders/build-decorators';
|
||||
import { CacheableObject } from '../../cache/object-cache.reducer';
|
||||
import { RemoteData } from '../../data/remote-data';
|
||||
import { HALLink } from '../hal-link.model';
|
||||
import { RelationshipType } from './relationship-type.model';
|
||||
import { Item } from '../item.model';
|
||||
import { ITEM } from "../item.resource-type";
|
||||
import { RELATIONSHIP } from "../relationship.resource-type";
|
||||
import { ITEM } from '../item.resource-type';
|
||||
import { RelationshipType } from './relationship-type.model';
|
||||
import { RELATIONSHIP_TYPE } from './relationship-type.resource-type';
|
||||
import { RELATIONSHIP } from './relationship.resource-type';
|
||||
|
||||
/**
|
||||
* Describes a Relationship between two Items
|
||||
@@ -29,19 +30,6 @@ export class Relationship implements CacheableObject {
|
||||
*/
|
||||
id: string;
|
||||
|
||||
/**
|
||||
* The item to the left of this relationship
|
||||
*/
|
||||
|
||||
@link(ITEM)
|
||||
leftItem?: Observable<RemoteData<Item>>;
|
||||
|
||||
/**
|
||||
* The item to the right of this relationship
|
||||
*/
|
||||
@link(ITEM)
|
||||
rightItem?: Observable<RemoteData<Item>>;
|
||||
|
||||
/**
|
||||
* The place of the Item to the left side of this Relationship
|
||||
*/
|
||||
@@ -62,10 +50,23 @@ export class Relationship implements CacheableObject {
|
||||
*/
|
||||
rightwardValue: string;
|
||||
|
||||
/**
|
||||
* The item to the left of this relationship
|
||||
*/
|
||||
|
||||
@link(ITEM)
|
||||
leftItem?: Observable<RemoteData<Item>>;
|
||||
|
||||
/**
|
||||
* The item to the right of this relationship
|
||||
*/
|
||||
@link(ITEM)
|
||||
rightItem?: Observable<RemoteData<Item>>;
|
||||
|
||||
/**
|
||||
* The type of Relationship
|
||||
*/
|
||||
@link(RelationshipType.type)
|
||||
@link(RELATIONSHIP_TYPE)
|
||||
relationshipType?: Observable<RemoteData<RelationshipType>>;
|
||||
|
||||
_links: {
|
||||
|
@@ -1,4 +1,4 @@
|
||||
import { ResourceType } from "./resource-type";
|
||||
import { ResourceType } from '../resource-type';
|
||||
|
||||
/**
|
||||
* The resource type for Relationship.
|
@@ -6,14 +6,16 @@ import { link } from '../cache/builders/build-decorators';
|
||||
import { PaginatedList } from '../data/paginated-list';
|
||||
import { RemoteData } from '../data/remote-data';
|
||||
import { Bundle } from './bundle.model';
|
||||
import { BUNDLE } from './bundle.resource-type';
|
||||
import { Collection } from './collection.model';
|
||||
import { COLLECTION } from './collection.resource-type';
|
||||
|
||||
import { DSpaceObject } from './dspace-object.model';
|
||||
import { GenericConstructor } from './generic-constructor';
|
||||
import { HALLink } from './hal-link.model';
|
||||
import { Relationship } from './item-relationships/relationship.model';
|
||||
import { ITEM } from "./item.resource-type";
|
||||
import { RELATIONSHIP } from "./relationship.resource-type";
|
||||
import { RELATIONSHIP } from './item-relationships/relationship.resource-type';
|
||||
import { ITEM } from './item.resource-type';
|
||||
|
||||
/**
|
||||
* Class representing a DSpace Item
|
||||
@@ -49,11 +51,11 @@ export class Item extends DSpaceObject {
|
||||
/**
|
||||
* The Collection that owns this Item
|
||||
*/
|
||||
@link(Collection.type)
|
||||
owningCollection?: Observable<RemoteData<Collection>>;
|
||||
@link(COLLECTION)
|
||||
owningCollection: Observable<RemoteData<Collection>>;
|
||||
|
||||
@link(Bundle.type, true)
|
||||
bundles?: Observable<RemoteData<PaginatedList<Bundle>>>;
|
||||
@link(BUNDLE, true)
|
||||
bundles: Observable<RemoteData<PaginatedList<Bundle>>>;
|
||||
|
||||
@link(RELATIONSHIP)
|
||||
relationships?: Observable<RemoteData<PaginatedList<Relationship>>>;
|
||||
|
@@ -1,8 +1,8 @@
|
||||
import { DSpaceObject } from './dspace-object.model';
|
||||
import { ResourceType } from './resource-type';
|
||||
import { LICENSE } from './license.resource-type';
|
||||
|
||||
export class License extends DSpaceObject {
|
||||
static type = new ResourceType('license');
|
||||
static type = LICENSE;
|
||||
|
||||
/**
|
||||
* Is the license custom?
|
||||
|
9
src/app/core/shared/license.resource-type.ts
Normal file
9
src/app/core/shared/license.resource-type.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
import { ResourceType } from './resource-type';
|
||||
|
||||
/**
|
||||
* The resource type for License
|
||||
*
|
||||
* Needs to be in a separate file to prevent circular
|
||||
* dependencies in webpack.
|
||||
*/
|
||||
export const LICENSE = new ResourceType('license');
|
@@ -1,16 +1,16 @@
|
||||
import { Router } from '@angular/router';
|
||||
import { Observable } from 'rxjs';
|
||||
import { filter, find, flatMap, map, take, tap } from 'rxjs/operators';
|
||||
import { filter, find, flatMap, map, tap } from 'rxjs/operators';
|
||||
import { hasValue, hasValueOperator, isNotEmpty } from '../../shared/empty.util';
|
||||
import { SearchResult } from '../../shared/search/search-result.model';
|
||||
import { DSOSuccessResponse, RestResponse } from '../cache/response.models';
|
||||
import { PaginatedList } from '../data/paginated-list';
|
||||
import { RemoteData } from '../data/remote-data';
|
||||
import { RestRequest } from '../data/request.models';
|
||||
import { RequestEntry } from '../data/request.reducer';
|
||||
import { RequestService } from '../data/request.service';
|
||||
import { BrowseDefinition } from './browse-definition.model';
|
||||
import { DSpaceObject } from './dspace-object.model';
|
||||
import { PaginatedList } from '../data/paginated-list';
|
||||
import { SearchResult } from '../../shared/search/search-result.model';
|
||||
import { Router } from '@angular/router';
|
||||
|
||||
/**
|
||||
* This file contains custom RxJS operators that can be used in multiple places
|
||||
@@ -191,6 +191,7 @@ export const getBrowseDefinitionLinks = (definitionID: string) =>
|
||||
.find((def: BrowseDefinition) => def.id === definitionID)
|
||||
),
|
||||
map((def: BrowseDefinition) => {
|
||||
console.log('getBrowseDefinitionLinks def', def);
|
||||
if (isNotEmpty(def)) {
|
||||
return def._links;
|
||||
} else {
|
||||
|
@@ -1,13 +1,13 @@
|
||||
import { ActionType } from '../cache/models/action-type.model';
|
||||
import { CacheableObject } from '../cache/object-cache.reducer';
|
||||
import { HALLink } from './hal-link.model';
|
||||
import { ResourceType } from './resource-type';
|
||||
import { ActionType } from '../cache/models/action-type.model';
|
||||
import { RESOURCE_POLICY } from './resource-policy.resource-type';
|
||||
|
||||
/**
|
||||
* Model class for a Resource Policy
|
||||
*/
|
||||
export class ResourcePolicy implements CacheableObject {
|
||||
static type = new ResourceType('resourcePolicy');
|
||||
static type = RESOURCE_POLICY;
|
||||
|
||||
/**
|
||||
* The action that is allowed by this Resource Policy
|
||||
|
9
src/app/core/shared/resource-policy.resource-type.ts
Normal file
9
src/app/core/shared/resource-policy.resource-type.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
import { ResourceType } from './resource-type';
|
||||
|
||||
/**
|
||||
* The resource type for ResourcePolicy
|
||||
*
|
||||
* Needs to be in a separate file to prevent circular
|
||||
* dependencies in webpack.
|
||||
*/
|
||||
export const RESOURCE_POLICY = new ResourceType('resourcePolicy');
|
@@ -1,11 +1,11 @@
|
||||
import { DSpaceObject } from './dspace-object.model';
|
||||
import { ResourceType } from './resource-type';
|
||||
import { SITE } from './site.resource-type';
|
||||
|
||||
/**
|
||||
* Model class for the Site object
|
||||
*/
|
||||
export class Site extends DSpaceObject {
|
||||
|
||||
static type = new ResourceType('site');
|
||||
static type = SITE;
|
||||
|
||||
}
|
||||
|
9
src/app/core/shared/site.resource-type.ts
Normal file
9
src/app/core/shared/site.resource-type.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
import { ResourceType } from './resource-type';
|
||||
|
||||
/**
|
||||
* The resource type for Site
|
||||
*
|
||||
* Needs to be in a separate file to prevent circular
|
||||
* dependencies in webpack.
|
||||
*/
|
||||
export const SITE = new ResourceType('site');
|
@@ -2,13 +2,16 @@ import { Observable } from 'rxjs';
|
||||
import { link } from '../../cache/builders/build-decorators';
|
||||
|
||||
import { CacheableObject } from '../../cache/object-cache.reducer';
|
||||
import { DSpaceObject } from '../../shared/dspace-object.model';
|
||||
import { EPerson } from '../../eperson/models/eperson.model';
|
||||
import { SubmissionDefinitionsModel } from '../../config/models/config-submission-definitions.model';
|
||||
import { RemoteData } from '../../data/remote-data';
|
||||
import { EPerson } from '../../eperson/models/eperson.model';
|
||||
import { EPERSON } from '../../eperson/models/eperson.resource-type';
|
||||
import { Collection } from '../../shared/collection.model';
|
||||
import { COLLECTION } from '../../shared/collection.resource-type';
|
||||
import { DSpaceObject } from '../../shared/dspace-object.model';
|
||||
import { HALLink } from '../../shared/hal-link.model';
|
||||
import { Item } from '../../shared/item.model';
|
||||
import { SubmissionDefinitionsModel } from '../../config/models/config-submission-definitions.model';
|
||||
import { ITEM } from '../../shared/item.resource-type';
|
||||
import { WorkspaceitemSectionsObject } from './workspaceitem-sections.model';
|
||||
|
||||
export interface SubmissionObjectError {
|
||||
@@ -39,13 +42,13 @@ export abstract class SubmissionObject extends DSpaceObject implements Cacheable
|
||||
/**
|
||||
* The collection this submission applies to
|
||||
*/
|
||||
@link(Collection.type)
|
||||
@link(COLLECTION)
|
||||
collection?: Observable<RemoteData<Collection>> | Collection;
|
||||
|
||||
/**
|
||||
* The submission item
|
||||
*/
|
||||
@link(Item.type)
|
||||
@link(ITEM)
|
||||
item?: Observable<RemoteData<Item>> | Item;
|
||||
|
||||
/**
|
||||
@@ -62,7 +65,7 @@ export abstract class SubmissionObject extends DSpaceObject implements Cacheable
|
||||
/**
|
||||
* The workspaceitem submitter
|
||||
*/
|
||||
@link(EPerson.type)
|
||||
@link(EPERSON)
|
||||
submitter?: Observable<RemoteData<EPerson>> | EPerson;
|
||||
|
||||
/**
|
||||
|
@@ -1,27 +1,28 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { Injectable } from '@angular/core';
|
||||
|
||||
import { Store } from '@ngrx/store';
|
||||
import { Observable } from 'rxjs';
|
||||
import { NotificationsService } from '../../shared/notifications/notifications.service';
|
||||
import { dataService } from '../cache/builders/build-decorators';
|
||||
import { NormalizedObjectBuildService } from '../cache/builders/normalized-object-build.service';
|
||||
|
||||
import { RemoteDataBuildService } from '../cache/builders/remote-data-build.service';
|
||||
import { CoreState } from '../core.reducers';
|
||||
import { RequestService } from '../data/request.service';
|
||||
import { ClaimedTask } from './models/claimed-task-object.model';
|
||||
import { TasksService } from './tasks.service';
|
||||
import { HALEndpointService } from '../shared/hal-endpoint.service';
|
||||
import { NormalizedObjectBuildService } from '../cache/builders/normalized-object-build.service';
|
||||
import { ObjectCacheService } from '../cache/object-cache.service';
|
||||
import { NotificationsService } from '../../shared/notifications/notifications.service';
|
||||
import { CoreState } from '../core.reducers';
|
||||
import { DSOChangeAnalyzer } from '../data/dso-change-analyzer.service';
|
||||
import { RequestService } from '../data/request.service';
|
||||
import { HALEndpointService } from '../shared/hal-endpoint.service';
|
||||
import { ClaimedTask } from './models/claimed-task-object.model';
|
||||
import { CLAIMED_TASK } from './models/claimed-task-object.resource-type';
|
||||
import { ProcessTaskResponse } from './models/process-task-response';
|
||||
import { TasksService } from './tasks.service';
|
||||
|
||||
/**
|
||||
* The service handling all REST requests for ClaimedTask
|
||||
*/
|
||||
@Injectable()
|
||||
@dataService(ClaimedTask.type)
|
||||
@dataService(CLAIMED_TASK)
|
||||
export class ClaimedTaskDataService extends TasksService<ClaimedTask> {
|
||||
|
||||
protected responseMsToLive = 10 * 1000;
|
||||
|
@@ -1,9 +1,9 @@
|
||||
import { CLAIMED_TASK } from './claimed-task-object.resource-type';
|
||||
import { TaskObject } from './task-object.model';
|
||||
import { ResourceType } from '../../shared/resource-type';
|
||||
|
||||
/**
|
||||
* A model class for a ClaimedTask.
|
||||
*/
|
||||
export class ClaimedTask extends TaskObject {
|
||||
static type = new ResourceType('claimedtask');
|
||||
static type = CLAIMED_TASK;
|
||||
}
|
||||
|
@@ -0,0 +1,9 @@
|
||||
import { ResourceType } from '../../shared/resource-type';
|
||||
|
||||
/**
|
||||
* The resource type for ClaimedTask
|
||||
*
|
||||
* Needs to be in a separate file to prevent circular
|
||||
* dependencies in webpack.
|
||||
*/
|
||||
export const CLAIMED_TASK = new ResourceType('claimedtask');
|
@@ -1,9 +1,9 @@
|
||||
import { POOL_TASK } from './pool-task-object.resource-type';
|
||||
import { TaskObject } from './task-object.model';
|
||||
import { ResourceType } from '../../shared/resource-type';
|
||||
|
||||
/**
|
||||
* A model class for a PoolTask.
|
||||
*/
|
||||
export class PoolTask extends TaskObject {
|
||||
static type = new ResourceType('pooltask');
|
||||
static type = POOL_TASK;
|
||||
}
|
||||
|
@@ -0,0 +1,9 @@
|
||||
import { ResourceType } from '../../shared/resource-type';
|
||||
|
||||
/**
|
||||
* The resource type for PoolTask
|
||||
*
|
||||
* Needs to be in a separate file to prevent circular
|
||||
* dependencies in webpack.
|
||||
*/
|
||||
export const POOL_TASK = new ResourceType('pooltask');
|
@@ -2,19 +2,21 @@ import { Observable } from 'rxjs';
|
||||
import { link } from '../../cache/builders/build-decorators';
|
||||
|
||||
import { CacheableObject } from '../../cache/object-cache.reducer';
|
||||
import { DSpaceObject } from '../../shared/dspace-object.model';
|
||||
import { RemoteData } from '../../data/remote-data';
|
||||
import { EPerson } from '../../eperson/models/eperson.model';
|
||||
import { EPERSON } from '../../eperson/models/eperson.resource-type';
|
||||
import { Group } from '../../eperson/models/group.model';
|
||||
import { GROUP } from '../../eperson/models/group.resource-type';
|
||||
import { DSpaceObject } from '../../shared/dspace-object.model';
|
||||
import { HALLink } from '../../shared/hal-link.model';
|
||||
import { WorkflowItem } from '../../submission/models/workflowitem.model';
|
||||
import { ResourceType } from '../../shared/resource-type';
|
||||
import { EPerson } from '../../eperson/models/eperson.model';
|
||||
import { Group } from '../../eperson/models/group.model';
|
||||
import { TASK_OBJECT } from './task-object.resource-type';
|
||||
|
||||
/**
|
||||
* An abstract model class for a TaskObject.
|
||||
*/
|
||||
export class TaskObject extends DSpaceObject implements CacheableObject {
|
||||
static type = new ResourceType('taskobject');
|
||||
static type = TASK_OBJECT;
|
||||
|
||||
/**
|
||||
* The task identifier
|
||||
@@ -34,13 +36,13 @@ export class TaskObject extends DSpaceObject implements CacheableObject {
|
||||
/**
|
||||
* The group of this task
|
||||
*/
|
||||
@link(EPerson.type)
|
||||
@link(EPERSON)
|
||||
eperson?: Observable<RemoteData<EPerson>>;
|
||||
|
||||
/**
|
||||
* The group of this task
|
||||
*/
|
||||
@link(Group.type)
|
||||
@link(GROUP)
|
||||
group?: Observable<RemoteData<Group>>;
|
||||
|
||||
/**
|
||||
|
9
src/app/core/tasks/models/task-object.resource-type.ts
Normal file
9
src/app/core/tasks/models/task-object.resource-type.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
import { ResourceType } from '../../shared/resource-type';
|
||||
|
||||
/**
|
||||
* The resource type for TaskObject
|
||||
*
|
||||
* Needs to be in a separate file to prevent circular
|
||||
* dependencies in webpack.
|
||||
*/
|
||||
export const TASK_OBJECT = new ResourceType('taskobject');
|
@@ -1,27 +1,28 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Store } from '@ngrx/store';
|
||||
|
||||
import { Observable } from 'rxjs';
|
||||
import { Store } from '@ngrx/store';
|
||||
import { NotificationsService } from '../../shared/notifications/notifications.service';
|
||||
import { dataService } from '../cache/builders/build-decorators';
|
||||
import { NormalizedObjectBuildService } from '../cache/builders/normalized-object-build.service';
|
||||
|
||||
import { RemoteDataBuildService } from '../cache/builders/remote-data-build.service';
|
||||
import { CoreState } from '../core.reducers';
|
||||
import { RequestService } from '../data/request.service';
|
||||
import { PoolTask } from './models/pool-task-object.model';
|
||||
import { TasksService } from './tasks.service';
|
||||
import { HALEndpointService } from '../shared/hal-endpoint.service';
|
||||
import { NormalizedObjectBuildService } from '../cache/builders/normalized-object-build.service';
|
||||
import { ObjectCacheService } from '../cache/object-cache.service';
|
||||
import { NotificationsService } from '../../shared/notifications/notifications.service';
|
||||
import { CoreState } from '../core.reducers';
|
||||
import { DSOChangeAnalyzer } from '../data/dso-change-analyzer.service';
|
||||
import { RequestService } from '../data/request.service';
|
||||
import { HALEndpointService } from '../shared/hal-endpoint.service';
|
||||
import { PoolTask } from './models/pool-task-object.model';
|
||||
import { POOL_TASK } from './models/pool-task-object.resource-type';
|
||||
import { ProcessTaskResponse } from './models/process-task-response';
|
||||
import { TasksService } from './tasks.service';
|
||||
|
||||
/**
|
||||
* The service handling all REST requests for PoolTask
|
||||
*/
|
||||
@Injectable()
|
||||
@dataService(PoolTask.type)
|
||||
@dataService(POOL_TASK)
|
||||
export class PoolTaskDataService extends TasksService<PoolTask> {
|
||||
|
||||
/**
|
||||
|
@@ -1,13 +1,13 @@
|
||||
import { Observable, of as observableOf } from 'rxjs';
|
||||
import { Observable } from 'rxjs';
|
||||
import { map } from 'rxjs/operators';
|
||||
import { RemoteDataBuildService } from '../../core/cache/builders/remote-data-build.service';
|
||||
import { NormalizedObject } from '../../core/cache/models/normalized-object.model';
|
||||
import { PaginatedList } from '../../core/data/paginated-list';
|
||||
import { RemoteData } from '../../core/data/remote-data';
|
||||
import { RequestEntry } from '../../core/data/request.reducer';
|
||||
import { hasValue } from '../empty.util';
|
||||
import { NormalizedObject } from '../../core/cache/models/normalized-object.model';
|
||||
import { createSuccessfulRemoteDataObject$ } from '../testing/utils';
|
||||
import { PaginatedList } from '../../core/data/paginated-list';
|
||||
import { PageInfo } from '../../core/shared/page-info.model';
|
||||
import { hasValue } from '../empty.util';
|
||||
import { createSuccessfulRemoteDataObject$ } from '../testing/utils';
|
||||
|
||||
export function getMockRemoteDataBuildService(toRemoteDataObservable$?: Observable<RemoteData<any>>, buildList$?: Observable<RemoteData<PaginatedList<any>>>): RemoteDataBuildService {
|
||||
return {
|
||||
@@ -33,3 +33,39 @@ export function getMockRemoteDataBuildService(toRemoteDataObservable$?: Observab
|
||||
} as RemoteDataBuildService;
|
||||
|
||||
}
|
||||
|
||||
export function getMockRemoteDataBuildServiceHrefMap(toRemoteDataObservable$?: Observable<RemoteData<any>>, buildListHrefMap$?: { [href: string]: Observable<RemoteData<PaginatedList<any>>>; }): RemoteDataBuildService {
|
||||
return {
|
||||
toRemoteDataObservable: (requestEntry$: Observable<RequestEntry>, payload$: Observable<any>) => {
|
||||
|
||||
if (hasValue(toRemoteDataObservable$)) {
|
||||
return toRemoteDataObservable$;
|
||||
} else {
|
||||
return payload$.pipe(map((payload) => ({
|
||||
payload
|
||||
} as RemoteData<any>)))
|
||||
}
|
||||
},
|
||||
buildSingle: (href$: string | Observable<string>) => createSuccessfulRemoteDataObject$({}),
|
||||
build: (normalized: NormalizedObject<any>) => Object.create({}),
|
||||
buildList: (href$: string | Observable<string>) => {
|
||||
if (typeof href$ === 'string') {
|
||||
if (hasValue(buildListHrefMap$[href$])) {
|
||||
return buildListHrefMap$[href$];
|
||||
} else {
|
||||
return createSuccessfulRemoteDataObject$(new PaginatedList(new PageInfo(), []))
|
||||
}
|
||||
}
|
||||
href$.pipe(
|
||||
map((href: string) => {
|
||||
if (hasValue(buildListHrefMap$[href])) {
|
||||
return buildListHrefMap$[href];
|
||||
} else {
|
||||
return createSuccessfulRemoteDataObject$(new PaginatedList(new PageInfo(), []))
|
||||
}
|
||||
})
|
||||
);
|
||||
}
|
||||
} as RemoteDataBuildService;
|
||||
|
||||
}
|
||||
|
@@ -1,7 +1,4 @@
|
||||
import { ChangeDetectorRef, Component, Inject, ViewChild } from '@angular/core';
|
||||
|
||||
import { Observable, Subscription } from 'rxjs';
|
||||
import { distinctUntilChanged, filter, find, flatMap, map, startWith, take } from 'rxjs/operators';
|
||||
import {
|
||||
DynamicCheckboxModel,
|
||||
DynamicFormControlEvent,
|
||||
@@ -9,25 +6,29 @@ import {
|
||||
DynamicFormLayout
|
||||
} from '@ng-dynamic-forms/core';
|
||||
|
||||
import { SectionModelComponent } from '../models/section.model';
|
||||
import { JsonPatchOperationsBuilder } from '../../../core/json-patch/builder/json-patch-operations-builder';
|
||||
import { Observable, Subscription } from 'rxjs';
|
||||
import { distinctUntilChanged, filter, find, flatMap, map, startWith, take } from 'rxjs/operators';
|
||||
import { CollectionDataService } from '../../../core/data/collection-data.service';
|
||||
import { hasValue, isNotEmpty, isNotNull, isNotUndefined } from '../../../shared/empty.util';
|
||||
import { License } from '../../../core/shared/license.model';
|
||||
import { RemoteData } from '../../../core/data/remote-data';
|
||||
import { Collection } from '../../../core/shared/collection.model';
|
||||
import { SECTION_LICENSE_FORM_LAYOUT, SECTION_LICENSE_FORM_MODEL } from './section-license.model';
|
||||
import { FormBuilderService } from '../../../shared/form/builder/form-builder.service';
|
||||
import { FormService } from '../../../shared/form/form.service';
|
||||
import { JsonPatchOperationPathCombiner } from '../../../core/json-patch/builder/json-patch-operation-path-combiner';
|
||||
import { SectionsType } from '../sections-type';
|
||||
import { renderSectionFor } from '../sections-decorator';
|
||||
import { SectionDataObject } from '../models/section-data.model';
|
||||
import { JsonPatchOperationsBuilder } from '../../../core/json-patch/builder/json-patch-operations-builder';
|
||||
import { Collection } from '../../../core/shared/collection.model';
|
||||
import { License } from '../../../core/shared/license.model';
|
||||
import { WorkspaceitemSectionLicenseObject } from '../../../core/submission/models/workspaceitem-section-license.model';
|
||||
import { SubmissionService } from '../../submission.service';
|
||||
import { SectionsService } from '../sections.service';
|
||||
import { SectionFormOperationsService } from '../form/section-form-operations.service';
|
||||
import { hasValue, isNotEmpty, isNotNull, isNotUndefined } from '../../../shared/empty.util';
|
||||
import { FormBuilderService } from '../../../shared/form/builder/form-builder.service';
|
||||
import { FormComponent } from '../../../shared/form/form.component';
|
||||
import { FormService } from '../../../shared/form/form.service';
|
||||
import { followLink } from '../../../shared/utils/follow-link-config.model';
|
||||
import { SubmissionService } from '../../submission.service';
|
||||
import { SectionFormOperationsService } from '../form/section-form-operations.service';
|
||||
import { SectionDataObject } from '../models/section-data.model';
|
||||
|
||||
import { SectionModelComponent } from '../models/section.model';
|
||||
import { renderSectionFor } from '../sections-decorator';
|
||||
import { SectionsType } from '../sections-type';
|
||||
import { SectionsService } from '../sections.service';
|
||||
import { SECTION_LICENSE_FORM_LAYOUT, SECTION_LICENSE_FORM_MODEL } from './section-license.model';
|
||||
|
||||
/**
|
||||
* This component represents a section that contains the submission license form.
|
||||
@@ -132,7 +133,7 @@ export class SubmissionSectionLicenseComponent extends SectionModelComponent {
|
||||
(model as DynamicCheckboxModel).valueUpdates.next(false);
|
||||
}
|
||||
|
||||
this.licenseText$ = this.collectionDataService.findById(this.collectionId).pipe(
|
||||
this.licenseText$ = this.collectionDataService.findById(this.collectionId, followLink('license')).pipe(
|
||||
filter((collectionData: RemoteData<Collection>) => isNotUndefined((collectionData.payload))),
|
||||
flatMap((collectionData: RemoteData<Collection>) => (collectionData.payload as any).license),
|
||||
find((licenseData: RemoteData<License>) => isNotUndefined((licenseData.payload))),
|
||||
|
Reference in New Issue
Block a user