mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 10:04:11 +00:00
refactored resource type and type mapping
This commit is contained in:
@@ -1,12 +1,9 @@
|
|||||||
import { Component, Input } from '@angular/core';
|
import { Component, Input } from '@angular/core';
|
||||||
import {
|
import { DynamicInputModel, DynamicTextAreaModel } from '@ng-dynamic-forms/core';
|
||||||
DynamicInputModel,
|
|
||||||
DynamicTextAreaModel
|
|
||||||
} from '@ng-dynamic-forms/core';
|
|
||||||
import { DynamicFormControlModel } from '@ng-dynamic-forms/core/src/model/dynamic-form-control.model';
|
import { DynamicFormControlModel } from '@ng-dynamic-forms/core/src/model/dynamic-form-control.model';
|
||||||
import { ResourceType } from '../../core/shared/resource-type';
|
|
||||||
import { Collection } from '../../core/shared/collection.model';
|
import { Collection } from '../../core/shared/collection.model';
|
||||||
import { ComColFormComponent } from '../../shared/comcol-forms/comcol-form/comcol-form.component';
|
import { ComColFormComponent } from '../../shared/comcol-forms/comcol-form/comcol-form.component';
|
||||||
|
import { NormalizedCollection } from '../../core/cache/models/normalized-collection.model';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Form used for creating and editing collections
|
* Form used for creating and editing collections
|
||||||
@@ -23,9 +20,9 @@ export class CollectionFormComponent extends ComColFormComponent<Collection> {
|
|||||||
@Input() dso: Collection = new Collection();
|
@Input() dso: Collection = new Collection();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @type {ResourceType.Collection} This is a collection-type form
|
* @type {Collection.type} This is a collection-type form
|
||||||
*/
|
*/
|
||||||
protected type = ResourceType.Collection;
|
protected type = Collection.type;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The dynamic form fields used for creating/editing a collection
|
* The dynamic form fields used for creating/editing a collection
|
||||||
|
@@ -20,9 +20,9 @@ export class CommunityFormComponent extends ComColFormComponent<Community> {
|
|||||||
@Input() dso: Community = new Community();
|
@Input() dso: Community = new Community();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @type {ResourceType.Community} This is a community-type form
|
* @type {Community.type} This is a community-type form
|
||||||
*/
|
*/
|
||||||
protected type = ResourceType.Community;
|
protected type = Community.type;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The dynamic form fields used for creating/editing a community
|
* The dynamic form fields used for creating/editing a community
|
||||||
|
@@ -114,7 +114,7 @@ export const objects = [
|
|||||||
self: 'https://dspace7.4science.it/dspace-spring-rest/api/core/communities/7669c72a-3f2a-451f-a3b9-9210e7a4c02f',
|
self: 'https://dspace7.4science.it/dspace-spring-rest/api/core/communities/7669c72a-3f2a-451f-a3b9-9210e7a4c02f',
|
||||||
id: '7669c72a-3f2a-451f-a3b9-9210e7a4c02f',
|
id: '7669c72a-3f2a-451f-a3b9-9210e7a4c02f',
|
||||||
uuid: '7669c72a-3f2a-451f-a3b9-9210e7a4c02f',
|
uuid: '7669c72a-3f2a-451f-a3b9-9210e7a4c02f',
|
||||||
type: ResourceType.Community,
|
type: Community.type,
|
||||||
metadata: {
|
metadata: {
|
||||||
'dc.description': [
|
'dc.description': [
|
||||||
{
|
{
|
||||||
@@ -168,7 +168,7 @@ export const objects = [
|
|||||||
self: 'https://dspace7.4science.it/dspace-spring-rest/api/core/communities/9076bd16-e69a-48d6-9e41-0238cb40d863',
|
self: 'https://dspace7.4science.it/dspace-spring-rest/api/core/communities/9076bd16-e69a-48d6-9e41-0238cb40d863',
|
||||||
id: '9076bd16-e69a-48d6-9e41-0238cb40d863',
|
id: '9076bd16-e69a-48d6-9e41-0238cb40d863',
|
||||||
uuid: '9076bd16-e69a-48d6-9e41-0238cb40d863',
|
uuid: '9076bd16-e69a-48d6-9e41-0238cb40d863',
|
||||||
type: ResourceType.Community,
|
type: Community.type,
|
||||||
metadata: {
|
metadata: {
|
||||||
'dc.description': [
|
'dc.description': [
|
||||||
{
|
{
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
import { combineLatest as observableCombineLatest, Observable, of as observableOf } from 'rxjs';
|
import { combineLatest as observableCombineLatest, Observable, of as observableOf } from 'rxjs';
|
||||||
import { Injectable, OnDestroy } from '@angular/core';
|
import { Injectable, OnDestroy } from '@angular/core';
|
||||||
import { NavigationExtras, PRIMARY_OUTLET, Router, UrlSegmentGroup } from '@angular/router';
|
import { NavigationExtras, Router } from '@angular/router';
|
||||||
import { first, map, switchMap } from 'rxjs/operators';
|
import { first, map, switchMap } from 'rxjs/operators';
|
||||||
import { RemoteDataBuildService } from '../../core/cache/builders/remote-data-build.service';
|
import { RemoteDataBuildService } from '../../core/cache/builders/remote-data-build.service';
|
||||||
import {
|
import {
|
||||||
@@ -40,7 +40,6 @@ import { PaginatedSearchOptions } from '../paginated-search-options.model';
|
|||||||
import { Community } from '../../core/shared/community.model';
|
import { Community } from '../../core/shared/community.model';
|
||||||
import { CommunityDataService } from '../../core/data/community-data.service';
|
import { CommunityDataService } from '../../core/data/community-data.service';
|
||||||
import { ViewMode } from '../../core/shared/view-mode.model';
|
import { ViewMode } from '../../core/shared/view-mode.model';
|
||||||
import { ResourceType } from '../../core/shared/resource-type';
|
|
||||||
import { DSpaceObjectDataService } from '../../core/data/dspace-object-data.service';
|
import { DSpaceObjectDataService } from '../../core/data/dspace-object-data.service';
|
||||||
import { RouteService } from '../../shared/services/route.service';
|
import { RouteService } from '../../shared/services/route.service';
|
||||||
|
|
||||||
@@ -296,7 +295,8 @@ export class SearchService implements OnDestroy {
|
|||||||
const scopeObject: Observable<RemoteData<DSpaceObject>> = this.dspaceObjectService.findById(scopeId).pipe(getSucceededRemoteData());
|
const scopeObject: Observable<RemoteData<DSpaceObject>> = this.dspaceObjectService.findById(scopeId).pipe(getSucceededRemoteData());
|
||||||
const scopeList: Observable<DSpaceObject[]> = scopeObject.pipe(
|
const scopeList: Observable<DSpaceObject[]> = scopeObject.pipe(
|
||||||
switchMap((dsoRD: RemoteData<DSpaceObject>) => {
|
switchMap((dsoRD: RemoteData<DSpaceObject>) => {
|
||||||
if (dsoRD.payload.type === ResourceType.Community) {
|
console.log((dsoRD.payload as any).type);
|
||||||
|
if ((dsoRD.payload as any).type === Community.type) {
|
||||||
const community: Community = dsoRD.payload as Community;
|
const community: Community = dsoRD.payload as Community;
|
||||||
return observableCombineLatest(community.subcommunities, community.collections).pipe(
|
return observableCombineLatest(community.subcommunities, community.collections).pipe(
|
||||||
map(([subCommunities, collections]) => {
|
map(([subCommunities, collections]) => {
|
||||||
|
@@ -10,6 +10,8 @@ import { ResourceType } from '../../shared/resource-type';
|
|||||||
* Object that represents the authenticated status of a user
|
* Object that represents the authenticated status of a user
|
||||||
*/
|
*/
|
||||||
export class AuthStatus implements CacheableObject {
|
export class AuthStatus implements CacheableObject {
|
||||||
|
static type = new ResourceType('status');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The unique identifier of this auth status
|
* The unique identifier of this auth status
|
||||||
*/
|
*/
|
||||||
@@ -49,10 +51,4 @@ export class AuthStatus implements CacheableObject {
|
|||||||
* The self link of this auth status' REST object
|
* The self link of this auth status' REST object
|
||||||
*/
|
*/
|
||||||
self: string;
|
self: string;
|
||||||
|
|
||||||
/**
|
|
||||||
* The resource object of this auth status
|
|
||||||
*/
|
|
||||||
type: ResourceType;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -4,11 +4,10 @@ import { mapsTo, relationship } from '../../cache/builders/build-decorators';
|
|||||||
import { ResourceType } from '../../shared/resource-type';
|
import { ResourceType } from '../../shared/resource-type';
|
||||||
import { NormalizedObject } from '../../cache/models/normalized-object.model';
|
import { NormalizedObject } from '../../cache/models/normalized-object.model';
|
||||||
import { IDToUUIDSerializer } from '../../cache/id-to-uuid-serializer';
|
import { IDToUUIDSerializer } from '../../cache/id-to-uuid-serializer';
|
||||||
import { resourceType } from '../../shared/resource-type.decorator';
|
import { EPerson } from '../../eperson/models/eperson.model';
|
||||||
|
|
||||||
@mapsTo(AuthStatus)
|
@mapsTo(AuthStatus)
|
||||||
@inheritSerialization(NormalizedObject)
|
@inheritSerialization(NormalizedObject)
|
||||||
@resourceType(ResourceType.AuthStatus)
|
|
||||||
export class NormalizedAuthStatus extends NormalizedObject<AuthStatus> {
|
export class NormalizedAuthStatus extends NormalizedObject<AuthStatus> {
|
||||||
/**
|
/**
|
||||||
* The unique identifier of this auth status
|
* The unique identifier of this auth status
|
||||||
@@ -37,7 +36,7 @@ export class NormalizedAuthStatus extends NormalizedObject<AuthStatus> {
|
|||||||
/**
|
/**
|
||||||
* The self link to the eperson of this auth status
|
* The self link to the eperson of this auth status
|
||||||
*/
|
*/
|
||||||
@relationship(ResourceType.EPerson, false)
|
@relationship(EPerson, false)
|
||||||
@autoserialize
|
@autoserialize
|
||||||
eperson: string;
|
eperson: string;
|
||||||
|
|
||||||
|
33
src/app/core/cache/builders/build-decorators.ts
vendored
33
src/app/core/cache/builders/build-decorators.ts
vendored
@@ -1,23 +1,42 @@
|
|||||||
import 'reflect-metadata';
|
import 'reflect-metadata';
|
||||||
|
|
||||||
import { GenericConstructor } from '../../shared/generic-constructor';
|
import { GenericConstructor } from '../../shared/generic-constructor';
|
||||||
import { CacheableObject } from '../object-cache.reducer';
|
import { CacheableObject, TypedObject } from '../object-cache.reducer';
|
||||||
import { ResourceType } from '../../shared/resource-type';
|
import { ResourceType } from '../../shared/resource-type';
|
||||||
|
|
||||||
const mapsToMetadataKey = Symbol('mapsTo');
|
const mapsToMetadataKey = Symbol('mapsTo');
|
||||||
const relationshipKey = Symbol('relationship');
|
const relationshipKey = Symbol('relationship');
|
||||||
|
|
||||||
const relationshipMap = new Map();
|
const relationshipMap = new Map();
|
||||||
|
const typeMap = new Map();
|
||||||
|
|
||||||
export function mapsTo(value: GenericConstructor<CacheableObject>) {
|
|
||||||
return Reflect.metadata(mapsToMetadataKey, value);
|
export function mapsTo(value: GenericConstructor<TypedObject>) {
|
||||||
|
return function decorator(objectConstructor: GenericConstructor<TypedObject>) {
|
||||||
|
Reflect.defineMetadata(mapsToMetadataKey, value, objectConstructor);
|
||||||
|
mapsToType((value as any).type, objectConstructor);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function mapsToType(value: ResourceType, objectConstructor: GenericConstructor<TypedObject>) {
|
||||||
|
if (!objectConstructor || !value) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
typeMap.set(value.value, objectConstructor);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getMapsTo(target: any) {
|
export function getMapsTo(target: any) {
|
||||||
return Reflect.getOwnMetadata(mapsToMetadataKey, target);
|
return Reflect.getOwnMetadata(mapsToMetadataKey, target);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function relationship(value: ResourceType, isList: boolean = false): any {
|
export function getMapsToType(type: string | ResourceType) {
|
||||||
|
if (typeof(type) === 'object') {
|
||||||
|
type = (type as ResourceType).value;
|
||||||
|
}
|
||||||
|
return typeMap.get(type);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function relationship<T extends CacheableObject>(value: GenericConstructor<T>, isList: boolean = false): any {
|
||||||
return function r(target: any, propertyKey: string, descriptor: PropertyDescriptor) {
|
return function r(target: any, propertyKey: string, descriptor: PropertyDescriptor) {
|
||||||
if (!target || !propertyKey) {
|
if (!target || !propertyKey) {
|
||||||
return;
|
return;
|
||||||
@@ -28,8 +47,10 @@ export function relationship(value: ResourceType, isList: boolean = false): any
|
|||||||
metaDataList.push(propertyKey);
|
metaDataList.push(propertyKey);
|
||||||
}
|
}
|
||||||
relationshipMap.set(target.constructor, metaDataList);
|
relationshipMap.set(target.constructor, metaDataList);
|
||||||
|
return Reflect.metadata(relationshipKey, {
|
||||||
return Reflect.metadata(relationshipKey, { resourceType: value, isList }).apply(this, arguments);
|
resourceType: (value as any).type.value,
|
||||||
|
isList
|
||||||
|
}).apply(this, arguments);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,9 +1,8 @@
|
|||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { NormalizedObject } from '../models/normalized-object.model';
|
import { NormalizedObject } from '../models/normalized-object.model';
|
||||||
import { getRelationships } from './build-decorators';
|
import { getMapsToType, getRelationships } from './build-decorators';
|
||||||
import { hasValue, isNotEmpty } from '../../../shared/empty.util';
|
import { hasValue, isNotEmpty } from '../../../shared/empty.util';
|
||||||
import { TypedObject } from '../object-cache.reducer';
|
import { TypedObject } from '../object-cache.reducer';
|
||||||
import { getNormalizedConstructorByType } from '../../shared/resource-type.decorator';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return true if halObj has a value for `_links.self`
|
* Return true if halObj has a value for `_links.self`
|
||||||
@@ -36,7 +35,7 @@ export class NormalizedObjectBuildService {
|
|||||||
* @param {TDomain} domainModel a domain model
|
* @param {TDomain} domainModel a domain model
|
||||||
*/
|
*/
|
||||||
normalize<T extends TypedObject>(domainModel: T): NormalizedObject<T> {
|
normalize<T extends TypedObject>(domainModel: T): NormalizedObject<T> {
|
||||||
const normalizedConstructor = getNormalizedConstructorByType(domainModel.type);
|
const normalizedConstructor = getMapsToType((domainModel as any).type);
|
||||||
const relationships = getRelationships(normalizedConstructor) || [];
|
const relationships = getRelationships(normalizedConstructor) || [];
|
||||||
|
|
||||||
const normalizedModel = Object.assign({}, domainModel) as any;
|
const normalizedModel = Object.assign({}, domainModel) as any;
|
||||||
|
@@ -1,19 +1,15 @@
|
|||||||
import { autoserialize, autoserializeAs, inheritSerialization } from 'cerialize';
|
import { autoserialize, autoserializeAs, inheritSerialization } from 'cerialize';
|
||||||
import { ItemType } from '../../../shared/item-relationships/item-type.model';
|
import { ItemType } from '../../../shared/item-relationships/item-type.model';
|
||||||
import { ResourceType } from '../../../shared/resource-type';
|
|
||||||
import { mapsTo } from '../../builders/build-decorators';
|
import { mapsTo } from '../../builders/build-decorators';
|
||||||
import { NormalizedObject } from '../normalized-object.model';
|
import { NormalizedObject } from '../normalized-object.model';
|
||||||
import { IDToUUIDSerializer } from '../../id-to-uuid-serializer';
|
import { IDToUUIDSerializer } from '../../id-to-uuid-serializer';
|
||||||
import { resourceType } from '../../../shared/resource-type.decorator';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Normalized model class for a DSpace ItemType
|
* Normalized model class for a DSpace ItemType
|
||||||
*/
|
*/
|
||||||
@mapsTo(ItemType)
|
@mapsTo(ItemType)
|
||||||
@resourceType(ResourceType.ItemType)
|
|
||||||
@inheritSerialization(NormalizedObject)
|
@inheritSerialization(NormalizedObject)
|
||||||
export class NormalizedItemType extends NormalizedObject<ItemType> {
|
export class NormalizedItemType extends NormalizedObject<ItemType> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The label that describes the ResourceType of the Item
|
* The label that describes the ResourceType of the Item
|
||||||
*/
|
*/
|
||||||
@@ -29,6 +25,6 @@ export class NormalizedItemType extends NormalizedObject<ItemType> {
|
|||||||
/**
|
/**
|
||||||
* The universally unique identifier of this ItemType
|
* The universally unique identifier of this ItemType
|
||||||
*/
|
*/
|
||||||
@autoserializeAs(new IDToUUIDSerializer(ResourceType.ItemType), 'id')
|
@autoserializeAs(new IDToUUIDSerializer(ItemType.type.value), 'id')
|
||||||
uuid: string;
|
uuid: string;
|
||||||
}
|
}
|
||||||
|
@@ -5,16 +5,15 @@ import { mapsTo, relationship } from '../../builders/build-decorators';
|
|||||||
import { NormalizedDSpaceObject } from '../normalized-dspace-object.model';
|
import { NormalizedDSpaceObject } from '../normalized-dspace-object.model';
|
||||||
import { NormalizedObject } from '../normalized-object.model';
|
import { NormalizedObject } from '../normalized-object.model';
|
||||||
import { IDToUUIDSerializer } from '../../id-to-uuid-serializer';
|
import { IDToUUIDSerializer } from '../../id-to-uuid-serializer';
|
||||||
import { resourceType } from '../../../shared/resource-type.decorator';
|
import { NormalizedItemType } from './normalized-item-type.model';
|
||||||
|
import { ItemType } from '../../../shared/item-relationships/item-type.model';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Normalized model class for a DSpace RelationshipType
|
* Normalized model class for a DSpace RelationshipType
|
||||||
*/
|
*/
|
||||||
@mapsTo(RelationshipType)
|
@mapsTo(RelationshipType)
|
||||||
@resourceType(ResourceType.RelationshipType)
|
|
||||||
@inheritSerialization(NormalizedDSpaceObject)
|
@inheritSerialization(NormalizedDSpaceObject)
|
||||||
export class NormalizedRelationshipType extends NormalizedObject<RelationshipType> {
|
export class NormalizedRelationshipType extends NormalizedObject<RelationshipType> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The identifier of this RelationshipType
|
* The identifier of this RelationshipType
|
||||||
*/
|
*/
|
||||||
@@ -61,19 +60,19 @@ export class NormalizedRelationshipType extends NormalizedObject<RelationshipTyp
|
|||||||
* The type of Item found to the left of this RelationshipType
|
* The type of Item found to the left of this RelationshipType
|
||||||
*/
|
*/
|
||||||
@autoserialize
|
@autoserialize
|
||||||
@relationship(ResourceType.ItemType, false)
|
@relationship(ItemType, false)
|
||||||
leftType: string;
|
leftType: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The type of Item found to the right of this RelationshipType
|
* The type of Item found to the right of this RelationshipType
|
||||||
*/
|
*/
|
||||||
@autoserialize
|
@autoserialize
|
||||||
@relationship(ResourceType.ItemType, false)
|
@relationship(ItemType, false)
|
||||||
rightType: string;
|
rightType: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The universally unique identifier of this RelationshipType
|
* The universally unique identifier of this RelationshipType
|
||||||
*/
|
*/
|
||||||
@autoserializeAs(new IDToUUIDSerializer(ResourceType.RelationshipType), 'id')
|
@autoserializeAs(new IDToUUIDSerializer(RelationshipType.type.value), 'id')
|
||||||
uuid: string;
|
uuid: string;
|
||||||
}
|
}
|
||||||
|
@@ -4,13 +4,13 @@ import { ResourceType } from '../../../shared/resource-type';
|
|||||||
import { mapsTo, relationship } from '../../builders/build-decorators';
|
import { mapsTo, relationship } from '../../builders/build-decorators';
|
||||||
import { NormalizedObject } from '../normalized-object.model';
|
import { NormalizedObject } from '../normalized-object.model';
|
||||||
import { IDToUUIDSerializer } from '../../id-to-uuid-serializer';
|
import { IDToUUIDSerializer } from '../../id-to-uuid-serializer';
|
||||||
import { resourceType } from '../../../shared/resource-type.decorator';
|
import { NormalizedRelationshipType } from './normalized-relationship-type.model';
|
||||||
|
import { RelationshipType } from '../../../shared/item-relationships/relationship-type.model';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Normalized model class for a DSpace Relationship
|
* Normalized model class for a DSpace Relationship
|
||||||
*/
|
*/
|
||||||
@mapsTo(Relationship)
|
@mapsTo(Relationship)
|
||||||
@resourceType(ResourceType.Relationship)
|
|
||||||
@inheritSerialization(NormalizedObject)
|
@inheritSerialization(NormalizedObject)
|
||||||
export class NormalizedRelationship extends NormalizedObject<Relationship> {
|
export class NormalizedRelationship extends NormalizedObject<Relationship> {
|
||||||
|
|
||||||
@@ -48,12 +48,12 @@ export class NormalizedRelationship extends NormalizedObject<Relationship> {
|
|||||||
* The type of Relationship
|
* The type of Relationship
|
||||||
*/
|
*/
|
||||||
@autoserialize
|
@autoserialize
|
||||||
@relationship(ResourceType.RelationshipType, false)
|
@relationship(RelationshipType, false)
|
||||||
relationshipType: string;
|
relationshipType: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The universally unique identifier of this Relationship
|
* The universally unique identifier of this Relationship
|
||||||
*/
|
*/
|
||||||
@autoserializeAs(new IDToUUIDSerializer(ResourceType.Relationship), 'id')
|
@autoserializeAs(new IDToUUIDSerializer(Relationship.type.value), 'id')
|
||||||
uuid: string;
|
uuid: string;
|
||||||
}
|
}
|
||||||
|
@@ -5,17 +5,13 @@ import { mapsTo } from '../builders/build-decorators';
|
|||||||
import { IDToUUIDSerializer } from '../id-to-uuid-serializer';
|
import { IDToUUIDSerializer } from '../id-to-uuid-serializer';
|
||||||
import { NormalizedObject } from './normalized-object.model';
|
import { NormalizedObject } from './normalized-object.model';
|
||||||
import { SupportLevel } from './support-level.model';
|
import { SupportLevel } from './support-level.model';
|
||||||
import { resourceType } from '../../shared/resource-type.decorator';
|
|
||||||
import { ResourceType } from '../../shared/resource-type';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Normalized model class for a Bitstream Format
|
* Normalized model class for a Bitstream Format
|
||||||
*/
|
*/
|
||||||
@mapsTo(BitstreamFormat)
|
@mapsTo(BitstreamFormat)
|
||||||
@inheritSerialization(NormalizedObject)
|
@inheritSerialization(NormalizedObject)
|
||||||
@resourceType(ResourceType.BitstreamFormat)
|
|
||||||
export class NormalizedBitstreamFormat extends NormalizedObject<BitstreamFormat> {
|
export class NormalizedBitstreamFormat extends NormalizedObject<BitstreamFormat> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Short description of this Bitstream Format
|
* Short description of this Bitstream Format
|
||||||
*/
|
*/
|
||||||
|
@@ -1,19 +1,17 @@
|
|||||||
import { inheritSerialization, autoserialize } from 'cerialize';
|
import { autoserialize, inheritSerialization } from 'cerialize';
|
||||||
|
|
||||||
import { NormalizedDSpaceObject } from './normalized-dspace-object.model';
|
import { NormalizedDSpaceObject } from './normalized-dspace-object.model';
|
||||||
import { Bitstream } from '../../shared/bitstream.model';
|
import { Bitstream } from '../../shared/bitstream.model';
|
||||||
import { mapsTo, relationship } from '../builders/build-decorators';
|
import { mapsTo, relationship } from '../builders/build-decorators';
|
||||||
import { ResourceType } from '../../shared/resource-type';
|
import { Item } from '../../shared/item.model';
|
||||||
import { resourceType } from '../../shared/resource-type.decorator';
|
import { BitstreamFormat } from '../../shared/bitstream-format.model';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Normalized model class for a DSpace Bitstream
|
* Normalized model class for a DSpace Bitstream
|
||||||
*/
|
*/
|
||||||
@mapsTo(Bitstream)
|
@mapsTo(Bitstream)
|
||||||
@inheritSerialization(NormalizedDSpaceObject)
|
@inheritSerialization(NormalizedDSpaceObject)
|
||||||
@resourceType(ResourceType.Bitstream)
|
|
||||||
export class NormalizedBitstream extends NormalizedDSpaceObject<Bitstream> {
|
export class NormalizedBitstream extends NormalizedDSpaceObject<Bitstream> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The size of this bitstream in bytes
|
* The size of this bitstream in bytes
|
||||||
*/
|
*/
|
||||||
@@ -30,7 +28,7 @@ export class NormalizedBitstream extends NormalizedDSpaceObject<Bitstream> {
|
|||||||
* The format of this Bitstream
|
* The format of this Bitstream
|
||||||
*/
|
*/
|
||||||
@autoserialize
|
@autoserialize
|
||||||
@relationship(ResourceType.BitstreamFormat, false)
|
@relationship(BitstreamFormat, false)
|
||||||
format: string;
|
format: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -43,14 +41,14 @@ export class NormalizedBitstream extends NormalizedDSpaceObject<Bitstream> {
|
|||||||
* An array of Bundles that are direct parents of this Bitstream
|
* An array of Bundles that are direct parents of this Bitstream
|
||||||
*/
|
*/
|
||||||
@autoserialize
|
@autoserialize
|
||||||
@relationship(ResourceType.Item, true)
|
@relationship(Item, true)
|
||||||
parents: string[];
|
parents: string[];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Bundle that owns this Bitstream
|
* The Bundle that owns this Bitstream
|
||||||
*/
|
*/
|
||||||
@autoserialize
|
@autoserialize
|
||||||
@relationship(ResourceType.Item, false)
|
@relationship(Item, false)
|
||||||
owner: string;
|
owner: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -3,21 +3,19 @@ import { autoserialize, inheritSerialization } from 'cerialize';
|
|||||||
import { NormalizedDSpaceObject } from './normalized-dspace-object.model';
|
import { NormalizedDSpaceObject } from './normalized-dspace-object.model';
|
||||||
import { Bundle } from '../../shared/bundle.model';
|
import { Bundle } from '../../shared/bundle.model';
|
||||||
import { mapsTo, relationship } from '../builders/build-decorators';
|
import { mapsTo, relationship } from '../builders/build-decorators';
|
||||||
import { ResourceType } from '../../shared/resource-type';
|
import { Bitstream } from '../../shared/bitstream.model';
|
||||||
import { resourceType } from '../../shared/resource-type.decorator';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Normalized model class for a DSpace Bundle
|
* Normalized model class for a DSpace Bundle
|
||||||
*/
|
*/
|
||||||
@mapsTo(Bundle)
|
@mapsTo(Bundle)
|
||||||
@inheritSerialization(NormalizedDSpaceObject)
|
@inheritSerialization(NormalizedDSpaceObject)
|
||||||
@resourceType(ResourceType.Bundle)
|
|
||||||
export class NormalizedBundle extends NormalizedDSpaceObject<Bundle> {
|
export class NormalizedBundle extends NormalizedDSpaceObject<Bundle> {
|
||||||
/**
|
/**
|
||||||
* The primary bitstream of this Bundle
|
* The primary bitstream of this Bundle
|
||||||
*/
|
*/
|
||||||
@autoserialize
|
@autoserialize
|
||||||
@relationship(ResourceType.Bitstream, false)
|
@relationship(Bitstream, false)
|
||||||
primaryBitstream: string;
|
primaryBitstream: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -34,7 +32,7 @@ export class NormalizedBundle extends NormalizedDSpaceObject<Bundle> {
|
|||||||
* List of Bitstreams that are part of this Bundle
|
* List of Bitstreams that are part of this Bundle
|
||||||
*/
|
*/
|
||||||
@autoserialize
|
@autoserialize
|
||||||
@relationship(ResourceType.Bitstream, true)
|
@relationship(Bitstream, true)
|
||||||
bitstreams: string[];
|
bitstreams: string[];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -3,15 +3,21 @@ import { autoserialize, deserialize, inheritSerialization } from 'cerialize';
|
|||||||
import { NormalizedDSpaceObject } from './normalized-dspace-object.model';
|
import { NormalizedDSpaceObject } from './normalized-dspace-object.model';
|
||||||
import { Collection } from '../../shared/collection.model';
|
import { Collection } from '../../shared/collection.model';
|
||||||
import { mapsTo, relationship } from '../builders/build-decorators';
|
import { mapsTo, relationship } from '../builders/build-decorators';
|
||||||
import { ResourceType } from '../../shared/resource-type';
|
import { NormalizedResourcePolicy } from './normalized-resource-policy.model';
|
||||||
import { resourceType } from '../../shared/resource-type.decorator';
|
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
|
* Normalized model class for a DSpace Collection
|
||||||
*/
|
*/
|
||||||
@mapsTo(Collection)
|
@mapsTo(Collection)
|
||||||
@inheritSerialization(NormalizedDSpaceObject)
|
@inheritSerialization(NormalizedDSpaceObject)
|
||||||
@resourceType(ResourceType.Collection)
|
|
||||||
export class NormalizedCollection extends NormalizedDSpaceObject<Collection> {
|
export class NormalizedCollection extends NormalizedDSpaceObject<Collection> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -24,42 +30,42 @@ export class NormalizedCollection extends NormalizedDSpaceObject<Collection> {
|
|||||||
* The Bitstream that represents the license of this Collection
|
* The Bitstream that represents the license of this Collection
|
||||||
*/
|
*/
|
||||||
@autoserialize
|
@autoserialize
|
||||||
@relationship(ResourceType.License, false)
|
@relationship(License, false)
|
||||||
license: string;
|
license: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Bitstream that represents the default Access Conditions of this Collection
|
* The Bitstream that represents the default Access Conditions of this Collection
|
||||||
*/
|
*/
|
||||||
@autoserialize
|
@autoserialize
|
||||||
@relationship(ResourceType.ResourcePolicy, false)
|
@relationship(ResourcePolicy, false)
|
||||||
defaultAccessConditions: string;
|
defaultAccessConditions: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Bitstream that represents the logo of this Collection
|
* The Bitstream that represents the logo of this Collection
|
||||||
*/
|
*/
|
||||||
@deserialize
|
@deserialize
|
||||||
@relationship(ResourceType.Bitstream, false)
|
@relationship(Bitstream, false)
|
||||||
logo: string;
|
logo: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An array of Communities that are direct parents of this Collection
|
* An array of Communities that are direct parents of this Collection
|
||||||
*/
|
*/
|
||||||
@deserialize
|
@deserialize
|
||||||
@relationship(ResourceType.Community, true)
|
@relationship(Community, true)
|
||||||
parents: string[];
|
parents: string[];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Community that owns this Collection
|
* The Community that owns this Collection
|
||||||
*/
|
*/
|
||||||
@deserialize
|
@deserialize
|
||||||
@relationship(ResourceType.Community, false)
|
@relationship(Community, false)
|
||||||
owner: string;
|
owner: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* List of Items that are part of (not necessarily owned by) this Collection
|
* List of Items that are part of (not necessarily owned by) this Collection
|
||||||
*/
|
*/
|
||||||
@deserialize
|
@deserialize
|
||||||
@relationship(ResourceType.Item, true)
|
@relationship(Item, true)
|
||||||
items: string[];
|
items: string[];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -1,19 +1,20 @@
|
|||||||
import { autoserialize, deserialize, inheritSerialization, serialize } from 'cerialize';
|
import { autoserialize, deserialize, inheritSerialization } from 'cerialize';
|
||||||
|
|
||||||
import { NormalizedDSpaceObject } from './normalized-dspace-object.model';
|
import { NormalizedDSpaceObject } from './normalized-dspace-object.model';
|
||||||
import { Community } from '../../shared/community.model';
|
import { Community } from '../../shared/community.model';
|
||||||
import { mapsTo, relationship } from '../builders/build-decorators';
|
import { mapsTo, relationship } from '../builders/build-decorators';
|
||||||
import { ResourceType } from '../../shared/resource-type';
|
import { ResourceType } from '../../shared/resource-type';
|
||||||
import { resourceType } from '../../shared/resource-type.decorator';
|
import { NormalizedBitstream } from './normalized-bitstream.model';
|
||||||
|
import { NormalizedCollection } from './normalized-collection.model';
|
||||||
|
import { Bitstream } from '../../shared/bitstream.model';
|
||||||
|
import { Collection } from '../../shared/collection.model';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Normalized model class for a DSpace Community
|
* Normalized model class for a DSpace Community
|
||||||
*/
|
*/
|
||||||
@mapsTo(Community)
|
@mapsTo(Community)
|
||||||
@inheritSerialization(NormalizedDSpaceObject)
|
@inheritSerialization(NormalizedDSpaceObject)
|
||||||
@resourceType(ResourceType.Community)
|
|
||||||
export class NormalizedCommunity extends NormalizedDSpaceObject<Community> {
|
export class NormalizedCommunity extends NormalizedDSpaceObject<Community> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A string representing the unique handle of this Community
|
* A string representing the unique handle of this Community
|
||||||
*/
|
*/
|
||||||
@@ -24,32 +25,32 @@ export class NormalizedCommunity extends NormalizedDSpaceObject<Community> {
|
|||||||
* The Bitstream that represents the logo of this Community
|
* The Bitstream that represents the logo of this Community
|
||||||
*/
|
*/
|
||||||
@deserialize
|
@deserialize
|
||||||
@relationship(ResourceType.Bitstream, false)
|
@relationship(Bitstream, false)
|
||||||
logo: string;
|
logo: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An array of Communities that are direct parents of this Community
|
* An array of Communities that are direct parents of this Community
|
||||||
*/
|
*/
|
||||||
@deserialize
|
@deserialize
|
||||||
@relationship(ResourceType.Community, true)
|
@relationship(Community, true)
|
||||||
parents: string[];
|
parents: string[];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Community that owns this Community
|
* The Community that owns this Community
|
||||||
*/
|
*/
|
||||||
@deserialize
|
@deserialize
|
||||||
@relationship(ResourceType.Community, false)
|
@relationship(Community, false)
|
||||||
owner: string;
|
owner: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* List of Collections that are owned by this Community
|
* List of Collections that are owned by this Community
|
||||||
*/
|
*/
|
||||||
@deserialize
|
@deserialize
|
||||||
@relationship(ResourceType.Collection, true)
|
@relationship(Collection, true)
|
||||||
collections: string[];
|
collections: string[];
|
||||||
|
|
||||||
@deserialize
|
@deserialize
|
||||||
@relationship(ResourceType.Community, true)
|
@relationship(Community, true)
|
||||||
subcommunities: string[];
|
subcommunities: string[];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -1,17 +1,14 @@
|
|||||||
import { autoserializeAs, deserializeAs } from 'cerialize';
|
import { autoserializeAs, deserializeAs, autoserialize } from 'cerialize';
|
||||||
import { DSpaceObject } from '../../shared/dspace-object.model';
|
import { DSpaceObject } from '../../shared/dspace-object.model';
|
||||||
import { MetadataMap, MetadataMapSerializer } from '../../shared/metadata.models';
|
import { MetadataMap, MetadataMapSerializer } from '../../shared/metadata.models';
|
||||||
import { ResourceType } from '../../shared/resource-type';
|
|
||||||
import { mapsTo } from '../builders/build-decorators';
|
import { mapsTo } from '../builders/build-decorators';
|
||||||
import { NormalizedObject } from './normalized-object.model';
|
import { NormalizedObject } from './normalized-object.model';
|
||||||
import { resourceType } from '../../shared/resource-type.decorator';
|
|
||||||
import { TypedObject } from '../object-cache.reducer';
|
import { TypedObject } from '../object-cache.reducer';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An model class for a DSpaceObject.
|
* An model class for a DSpaceObject.
|
||||||
*/
|
*/
|
||||||
@mapsTo(DSpaceObject)
|
@mapsTo(DSpaceObject)
|
||||||
@resourceType(ResourceType.DSpaceObject)
|
|
||||||
export class NormalizedDSpaceObject<T extends DSpaceObject> extends NormalizedObject<T> implements TypedObject {
|
export class NormalizedDSpaceObject<T extends DSpaceObject> extends NormalizedObject<T> implements TypedObject {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -41,8 +38,8 @@ export class NormalizedDSpaceObject<T extends DSpaceObject> extends NormalizedOb
|
|||||||
/**
|
/**
|
||||||
* A string representing the kind of DSpaceObject, e.g. community, item, …
|
* A string representing the kind of DSpaceObject, e.g. community, item, …
|
||||||
*/
|
*/
|
||||||
@autoserializeAs(ResourceType)
|
@autoserialize
|
||||||
type: ResourceType;
|
type: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* All metadata of this DSpaceObject
|
* All metadata of this DSpaceObject
|
||||||
|
@@ -4,14 +4,18 @@ import { NormalizedDSpaceObject } from './normalized-dspace-object.model';
|
|||||||
import { Item } from '../../shared/item.model';
|
import { Item } from '../../shared/item.model';
|
||||||
import { mapsTo, relationship } from '../builders/build-decorators';
|
import { mapsTo, relationship } from '../builders/build-decorators';
|
||||||
import { ResourceType } from '../../shared/resource-type';
|
import { ResourceType } from '../../shared/resource-type';
|
||||||
import { resourceType } from '../../shared/resource-type.decorator';
|
import { NormalizedCollection } from './normalized-collection.model';
|
||||||
|
import { NormalizedBitstream } from './normalized-bitstream.model';
|
||||||
|
import { NormalizedRelationship } from './items/normalized-relationship.model';
|
||||||
|
import { Collection } from '../../shared/collection.model';
|
||||||
|
import { Bitstream } from '../../shared/bitstream.model';
|
||||||
|
import { Relationship } from '../../shared/item-relationships/relationship.model';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Normalized model class for a DSpace Item
|
* Normalized model class for a DSpace Item
|
||||||
*/
|
*/
|
||||||
@mapsTo(Item)
|
@mapsTo(Item)
|
||||||
@inheritSerialization(NormalizedDSpaceObject)
|
@inheritSerialization(NormalizedDSpaceObject)
|
||||||
@resourceType(ResourceType.Item)
|
|
||||||
export class NormalizedItem extends NormalizedDSpaceObject<Item> {
|
export class NormalizedItem extends NormalizedDSpaceObject<Item> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -48,25 +52,25 @@ export class NormalizedItem extends NormalizedDSpaceObject<Item> {
|
|||||||
* An array of Collections that are direct parents of this Item
|
* An array of Collections that are direct parents of this Item
|
||||||
*/
|
*/
|
||||||
@deserialize
|
@deserialize
|
||||||
@relationship(ResourceType.Collection, true)
|
@relationship(Collection, true)
|
||||||
parents: string[];
|
parents: string[];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Collection that owns this Item
|
* The Collection that owns this Item
|
||||||
*/
|
*/
|
||||||
@deserialize
|
@deserialize
|
||||||
@relationship(ResourceType.Collection, false)
|
@relationship(Collection, false)
|
||||||
owningCollection: string;
|
owningCollection: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* List of Bitstreams that are owned by this Item
|
* List of Bitstreams that are owned by this Item
|
||||||
*/
|
*/
|
||||||
@deserialize
|
@deserialize
|
||||||
@relationship(ResourceType.Bitstream, true)
|
@relationship(Bitstream, true)
|
||||||
bitstreams: string[];
|
bitstreams: string[];
|
||||||
|
|
||||||
@autoserialize
|
@autoserialize
|
||||||
@relationship(ResourceType.Relationship, true)
|
@relationship(Relationship, true)
|
||||||
relationships: string[];
|
relationships: string[];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -2,7 +2,6 @@ import { autoserialize, inheritSerialization } from 'cerialize';
|
|||||||
import { mapsTo } from '../builders/build-decorators';
|
import { mapsTo } from '../builders/build-decorators';
|
||||||
import { NormalizedDSpaceObject } from './normalized-dspace-object.model';
|
import { NormalizedDSpaceObject } from './normalized-dspace-object.model';
|
||||||
import { License } from '../../shared/license.model';
|
import { License } from '../../shared/license.model';
|
||||||
import { resourceType } from '../../shared/resource-type.decorator';
|
|
||||||
import { ResourceType } from '../../shared/resource-type';
|
import { ResourceType } from '../../shared/resource-type';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -10,7 +9,6 @@ import { ResourceType } from '../../shared/resource-type';
|
|||||||
*/
|
*/
|
||||||
@mapsTo(License)
|
@mapsTo(License)
|
||||||
@inheritSerialization(NormalizedDSpaceObject)
|
@inheritSerialization(NormalizedDSpaceObject)
|
||||||
@resourceType(ResourceType.License)
|
|
||||||
export class NormalizedLicense extends NormalizedDSpaceObject<License> {
|
export class NormalizedLicense extends NormalizedDSpaceObject<License> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -5,19 +5,12 @@ import { ResourceType } from '../../shared/resource-type';
|
|||||||
* An abstract model class for a NormalizedObject.
|
* An abstract model class for a NormalizedObject.
|
||||||
*/
|
*/
|
||||||
export abstract class NormalizedObject<T extends TypedObject> implements CacheableObject {
|
export abstract class NormalizedObject<T extends TypedObject> implements CacheableObject {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The link to the rest endpoint where this object can be found
|
* The link to the rest endpoint where this object can be found
|
||||||
*/
|
*/
|
||||||
@autoserialize
|
@autoserialize
|
||||||
self: string;
|
self: string;
|
||||||
|
|
||||||
/**
|
|
||||||
* A string representing the kind of DSpaceObject, e.g. community, item, …
|
|
||||||
*/
|
|
||||||
@autoserialize
|
|
||||||
type: ResourceType;
|
|
||||||
|
|
||||||
@autoserialize
|
@autoserialize
|
||||||
_links: {
|
_links: {
|
||||||
[name: string]: string
|
[name: string]: string
|
||||||
|
@@ -5,7 +5,6 @@ import { mapsTo } from '../builders/build-decorators';
|
|||||||
import { NormalizedObject } from './normalized-object.model';
|
import { NormalizedObject } from './normalized-object.model';
|
||||||
import { IDToUUIDSerializer } from '../id-to-uuid-serializer';
|
import { IDToUUIDSerializer } from '../id-to-uuid-serializer';
|
||||||
import { ActionType } from './action-type.model';
|
import { ActionType } from './action-type.model';
|
||||||
import { resourceType } from '../../shared/resource-type.decorator';
|
|
||||||
import { ResourceType } from '../../shared/resource-type';
|
import { ResourceType } from '../../shared/resource-type';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -13,9 +12,7 @@ import { ResourceType } from '../../shared/resource-type';
|
|||||||
*/
|
*/
|
||||||
@mapsTo(ResourcePolicy)
|
@mapsTo(ResourcePolicy)
|
||||||
@inheritSerialization(NormalizedObject)
|
@inheritSerialization(NormalizedObject)
|
||||||
@resourceType(ResourceType.ResourcePolicy)
|
|
||||||
export class NormalizedResourcePolicy extends NormalizedObject<ResourcePolicy> {
|
export class NormalizedResourcePolicy extends NormalizedObject<ResourcePolicy> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The action that is allowed by this Resource Policy
|
* The action that is allowed by this Resource Policy
|
||||||
*/
|
*/
|
||||||
|
@@ -8,7 +8,7 @@ export enum SupportLevel {
|
|||||||
Unknown = 0,
|
Unknown = 0,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Unknown for Bitstream Formats that are known to the system, but not fully supported
|
* Known for Bitstream Formats that are known to the system, but not fully supported
|
||||||
*/
|
*/
|
||||||
Known = 1,
|
Known = 1,
|
||||||
|
|
||||||
|
12
src/app/core/cache/object-cache.reducer.spec.ts
vendored
12
src/app/core/cache/object-cache.reducer.spec.ts
vendored
@@ -9,7 +9,7 @@ import {
|
|||||||
ResetObjectCacheTimestampsAction
|
ResetObjectCacheTimestampsAction
|
||||||
} from './object-cache.actions';
|
} from './object-cache.actions';
|
||||||
import { Operation } from 'fast-json-patch';
|
import { Operation } from 'fast-json-patch';
|
||||||
import { ResourceType } from '../shared/resource-type';
|
import { Item } from '../shared/item.model';
|
||||||
|
|
||||||
class NullAction extends RemoveFromObjectCacheAction {
|
class NullAction extends RemoveFromObjectCacheAction {
|
||||||
type = null;
|
type = null;
|
||||||
@@ -29,7 +29,7 @@ describe('objectCacheReducer', () => {
|
|||||||
const testState = {
|
const testState = {
|
||||||
[selfLink1]: {
|
[selfLink1]: {
|
||||||
data: {
|
data: {
|
||||||
type: ResourceType.Item,
|
type: Item.type,
|
||||||
self: selfLink1,
|
self: selfLink1,
|
||||||
foo: 'bar'
|
foo: 'bar'
|
||||||
},
|
},
|
||||||
@@ -41,7 +41,7 @@ describe('objectCacheReducer', () => {
|
|||||||
},
|
},
|
||||||
[selfLink2]: {
|
[selfLink2]: {
|
||||||
data: {
|
data: {
|
||||||
type: ResourceType.Item,
|
type: Item.type,
|
||||||
self: requestUUID2,
|
self: requestUUID2,
|
||||||
foo: 'baz'
|
foo: 'baz'
|
||||||
},
|
},
|
||||||
@@ -70,7 +70,7 @@ describe('objectCacheReducer', () => {
|
|||||||
|
|
||||||
it('should add the payload to the cache in response to an ADD action', () => {
|
it('should add the payload to the cache in response to an ADD action', () => {
|
||||||
const state = Object.create(null);
|
const state = Object.create(null);
|
||||||
const objectToCache = { self: selfLink1, type: ResourceType.Item };
|
const objectToCache = { self: selfLink1, type: Item.type };
|
||||||
const timeAdded = new Date().getTime();
|
const timeAdded = new Date().getTime();
|
||||||
const msToLive = 900000;
|
const msToLive = 900000;
|
||||||
const requestUUID = requestUUID1;
|
const requestUUID = requestUUID1;
|
||||||
@@ -87,7 +87,7 @@ describe('objectCacheReducer', () => {
|
|||||||
self: selfLink1,
|
self: selfLink1,
|
||||||
foo: 'baz',
|
foo: 'baz',
|
||||||
somethingElse: true,
|
somethingElse: true,
|
||||||
type: ResourceType.Item
|
type: Item.type
|
||||||
};
|
};
|
||||||
const timeAdded = new Date().getTime();
|
const timeAdded = new Date().getTime();
|
||||||
const msToLive = 900000;
|
const msToLive = 900000;
|
||||||
@@ -103,7 +103,7 @@ describe('objectCacheReducer', () => {
|
|||||||
|
|
||||||
it('should perform the ADD action without affecting the previous state', () => {
|
it('should perform the ADD action without affecting the previous state', () => {
|
||||||
const state = Object.create(null);
|
const state = Object.create(null);
|
||||||
const objectToCache = { self: selfLink1, type: ResourceType.Item };
|
const objectToCache = { self: selfLink1, type: Item.type };
|
||||||
const timeAdded = new Date().getTime();
|
const timeAdded = new Date().getTime();
|
||||||
const msToLive = 900000;
|
const msToLive = 900000;
|
||||||
const requestUUID = requestUUID1;
|
const requestUUID = requestUUID1;
|
||||||
|
6
src/app/core/cache/object-cache.reducer.ts
vendored
6
src/app/core/cache/object-cache.reducer.ts
vendored
@@ -32,8 +32,8 @@ export interface Patch {
|
|||||||
operations: Operation[];
|
operations: Operation[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface TypedObject {
|
export abstract class TypedObject {
|
||||||
type: ResourceType;
|
static type: ResourceType;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -41,7 +41,7 @@ export interface TypedObject {
|
|||||||
*
|
*
|
||||||
* A cacheable object should have a self link
|
* A cacheable object should have a self link
|
||||||
*/
|
*/
|
||||||
export interface CacheableObject extends TypedObject {
|
export class CacheableObject extends TypedObject {
|
||||||
uuid?: string;
|
uuid?: string;
|
||||||
self: string;
|
self: string;
|
||||||
// isNew: boolean;
|
// isNew: boolean;
|
||||||
|
@@ -10,13 +10,13 @@ import {
|
|||||||
RemoveFromObjectCacheAction
|
RemoveFromObjectCacheAction
|
||||||
} from './object-cache.actions';
|
} from './object-cache.actions';
|
||||||
import { CoreState } from '../core.reducers';
|
import { CoreState } from '../core.reducers';
|
||||||
import { ResourceType } from '../shared/resource-type';
|
|
||||||
import { NormalizedItem } from './models/normalized-item.model';
|
import { NormalizedItem } from './models/normalized-item.model';
|
||||||
import { first } from 'rxjs/operators';
|
import { first } from 'rxjs/operators';
|
||||||
import { Operation } from 'fast-json-patch';
|
import { Operation } from 'fast-json-patch';
|
||||||
import { RestRequestMethod } from '../data/rest-request-method';
|
import { RestRequestMethod } from '../data/rest-request-method';
|
||||||
import { AddToSSBAction } from './server-sync-buffer.actions';
|
import { AddToSSBAction } from './server-sync-buffer.actions';
|
||||||
import { Patch } from './object-cache.reducer';
|
import { Patch } from './object-cache.reducer';
|
||||||
|
import { Item } from '../shared/item.model';
|
||||||
|
|
||||||
describe('ObjectCacheService', () => {
|
describe('ObjectCacheService', () => {
|
||||||
let service: ObjectCacheService;
|
let service: ObjectCacheService;
|
||||||
@@ -28,7 +28,7 @@ describe('ObjectCacheService', () => {
|
|||||||
const msToLive = 900000;
|
const msToLive = 900000;
|
||||||
let objectToCache = {
|
let objectToCache = {
|
||||||
self: selfLink,
|
self: selfLink,
|
||||||
type: ResourceType.Item
|
type: Item.type
|
||||||
};
|
};
|
||||||
let cacheEntry;
|
let cacheEntry;
|
||||||
let invalidCacheEntry;
|
let invalidCacheEntry;
|
||||||
@@ -37,7 +37,7 @@ describe('ObjectCacheService', () => {
|
|||||||
function init() {
|
function init() {
|
||||||
objectToCache = {
|
objectToCache = {
|
||||||
self: selfLink,
|
self: selfLink,
|
||||||
type: ResourceType.Item
|
type: Item.type
|
||||||
};
|
};
|
||||||
cacheEntry = {
|
cacheEntry = {
|
||||||
data: objectToCache,
|
data: objectToCache,
|
||||||
|
4
src/app/core/cache/object-cache.service.ts
vendored
4
src/app/core/cache/object-cache.service.ts
vendored
@@ -20,7 +20,7 @@ import {
|
|||||||
|
|
||||||
import { CacheableObject, ObjectCacheEntry, ObjectCacheState } from './object-cache.reducer';
|
import { CacheableObject, ObjectCacheEntry, ObjectCacheState } from './object-cache.reducer';
|
||||||
import { AddToSSBAction } from './server-sync-buffer.actions';
|
import { AddToSSBAction } from './server-sync-buffer.actions';
|
||||||
import { getNormalizedConstructorByType } from '../shared/resource-type.decorator';
|
import { getMapsToType } from './builders/build-decorators';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The base selector function to select the object cache in the store
|
* The base selector function to select the object cache in the store
|
||||||
@@ -109,7 +109,7 @@ export class ObjectCacheService {
|
|||||||
}
|
}
|
||||||
),
|
),
|
||||||
map((entry: ObjectCacheEntry) => {
|
map((entry: ObjectCacheEntry) => {
|
||||||
const type: GenericConstructor<NormalizedObject<T>> = getNormalizedConstructorByType(entry.data.type);
|
const type: GenericConstructor<NormalizedObject<T>> = getMapsToType((entry.data as any).type);
|
||||||
return Object.assign(new type(), entry.data) as NormalizedObject<T>
|
return Object.assign(new type(), entry.data) as NormalizedObject<T>
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
@@ -0,0 +1,19 @@
|
|||||||
|
import { ConfigObject } from './config.model';
|
||||||
|
import { SubmissionSectionModel } from './config-submission-section.model';
|
||||||
|
import { PaginatedList } from '../../data/paginated-list';
|
||||||
|
import { ResourceType } from '../../shared/resource-type';
|
||||||
|
|
||||||
|
export class SubmissionDefinitionModel extends ConfigObject {
|
||||||
|
static type = new ResourceType('submissiondefinition');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A boolean representing if this submission definition is the default or not
|
||||||
|
*/
|
||||||
|
isDefault: boolean;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A list of SubmissionSectionModel that are present in this submission definition
|
||||||
|
*/
|
||||||
|
sections: PaginatedList<SubmissionSectionModel>;
|
||||||
|
|
||||||
|
}
|
@@ -1,17 +1,7 @@
|
|||||||
import { ConfigObject } from './config.model';
|
import { SubmissionDefinitionModel } from './config-submission-definition.model';
|
||||||
import { SubmissionSectionModel } from './config-submission-section.model';
|
import { ResourceType } from '../../shared/resource-type';
|
||||||
import { PaginatedList } from '../../data/paginated-list';
|
|
||||||
|
|
||||||
export class SubmissionDefinitionsModel extends ConfigObject {
|
export class SubmissionDefinitionsModel extends SubmissionDefinitionModel {
|
||||||
|
static type = new ResourceType('submissiondefinitions');
|
||||||
/**
|
|
||||||
* A boolean representing if this submission definition is the default or not
|
|
||||||
*/
|
|
||||||
isDefault: boolean;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A list of SubmissionSectionModel that are present in this submission definition
|
|
||||||
*/
|
|
||||||
sections: PaginatedList<SubmissionSectionModel>;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
22
src/app/core/config/models/config-submission-form.model.ts
Normal file
22
src/app/core/config/models/config-submission-form.model.ts
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
import { ConfigObject } from './config.model';
|
||||||
|
import { FormFieldModel } from '../../../shared/form/builder/models/form-field.model';
|
||||||
|
import { ResourceType } from '../../shared/resource-type';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An interface that define a form row and its properties.
|
||||||
|
*/
|
||||||
|
export interface FormRowModel {
|
||||||
|
fields: FormFieldModel[];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A model class for a NormalizedObject.
|
||||||
|
*/
|
||||||
|
export class SubmissionFormModel extends ConfigObject {
|
||||||
|
static type = new ResourceType('submissionform');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An array of [FormRowModel] that are present in this form
|
||||||
|
*/
|
||||||
|
rows: FormRowModel[];
|
||||||
|
}
|
@@ -1,20 +1,9 @@
|
|||||||
import { ConfigObject } from './config.model';
|
import { SubmissionFormModel } from './config-submission-form.model';
|
||||||
import { FormFieldModel } from '../../../shared/form/builder/models/form-field.model';
|
import { ResourceType } from '../../shared/resource-type';
|
||||||
|
|
||||||
/**
|
|
||||||
* An interface that define a form row and its properties.
|
|
||||||
*/
|
|
||||||
export interface FormRowModel {
|
|
||||||
fields: FormFieldModel[];
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A model class for a NormalizedObject.
|
* A model class for a NormalizedObject.
|
||||||
*/
|
*/
|
||||||
export class SubmissionFormsModel extends ConfigObject {
|
export class SubmissionFormsModel extends SubmissionFormModel {
|
||||||
|
static type = new ResourceType('submissionforms');
|
||||||
/**
|
|
||||||
* An array of [FormRowModel] that are present in this form
|
|
||||||
*/
|
|
||||||
rows: FormRowModel[];
|
|
||||||
}
|
}
|
||||||
|
@@ -1,5 +1,6 @@
|
|||||||
import { ConfigObject } from './config.model';
|
import { ConfigObject } from './config.model';
|
||||||
import { SectionsType } from '../../../submission/sections/sections-type';
|
import { SectionsType } from '../../../submission/sections/sections-type';
|
||||||
|
import { ResourceType } from '../../shared/resource-type';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An interface that define section visibility and its properties.
|
* An interface that define section visibility and its properties.
|
||||||
@@ -10,6 +11,7 @@ export interface SubmissionSectionVisibility {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export class SubmissionSectionModel extends ConfigObject {
|
export class SubmissionSectionModel extends ConfigObject {
|
||||||
|
static type = new ResourceType('submissionsection');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The header for this section
|
* The header for this section
|
||||||
|
@@ -0,0 +1,6 @@
|
|||||||
|
import { SubmissionSectionModel } from './config-submission-section.model';
|
||||||
|
import { ResourceType } from '../../shared/resource-type';
|
||||||
|
|
||||||
|
export class SubmissionSectionsModel extends SubmissionSectionModel {
|
||||||
|
static type = new ResourceType('submissionsections');
|
||||||
|
}
|
@@ -0,0 +1,28 @@
|
|||||||
|
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 { SubmissionDefinitionModel } from './config-submission-definition.model';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Normalized class for the configuration describing the submission
|
||||||
|
*/
|
||||||
|
@mapsTo(SubmissionDefinitionModel)
|
||||||
|
@inheritSerialization(NormalizedConfigObject)
|
||||||
|
export class NormalizedSubmissionDefinitionModel extends NormalizedConfigObject<SubmissionDefinitionModel> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A boolean representing if this submission definition is the default or not
|
||||||
|
*/
|
||||||
|
@autoserialize
|
||||||
|
isDefault: boolean;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A list of SubmissionSectionModel that are present in this submission definition
|
||||||
|
*/
|
||||||
|
@autoserializeAs(SubmissionSectionModel)
|
||||||
|
sections: PaginatedList<SubmissionSectionModel>;
|
||||||
|
|
||||||
|
}
|
@@ -1,30 +1,13 @@
|
|||||||
import { autoserialize, autoserializeAs, inheritSerialization } from 'cerialize';
|
import { inheritSerialization } from 'cerialize';
|
||||||
import { SubmissionSectionModel } from './config-submission-section.model';
|
|
||||||
import { PaginatedList } from '../../data/paginated-list';
|
|
||||||
import { NormalizedConfigObject } from './normalized-config.model';
|
import { NormalizedConfigObject } from './normalized-config.model';
|
||||||
import { SubmissionDefinitionsModel } from './config-submission-definitions.model';
|
import { SubmissionDefinitionsModel } from './config-submission-definitions.model';
|
||||||
import { resourceType } from '../../shared/resource-type.decorator';
|
|
||||||
import { ResourceType } from '../../shared/resource-type';
|
|
||||||
import { mapsTo } from '../../cache/builders/build-decorators';
|
import { mapsTo } from '../../cache/builders/build-decorators';
|
||||||
|
import { NormalizedSubmissionDefinitionModel } from './normalized-config-submission-definition.model';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Normalized class for the configuration describing the submission
|
* Normalized class for the configuration describing the submission
|
||||||
*/
|
*/
|
||||||
@mapsTo(SubmissionDefinitionsModel)
|
@mapsTo(SubmissionDefinitionsModel)
|
||||||
@inheritSerialization(NormalizedConfigObject)
|
@inheritSerialization(NormalizedConfigObject)
|
||||||
@resourceType(ResourceType.SubmissionDefinitions, ResourceType.SubmissionDefinition)
|
export class NormalizedSubmissionDefinitionsModel extends NormalizedSubmissionDefinitionModel {
|
||||||
export class NormalizedSubmissionDefinitionsModel extends NormalizedConfigObject<SubmissionDefinitionsModel> {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A boolean representing if this submission definition is the default or not
|
|
||||||
*/
|
|
||||||
@autoserialize
|
|
||||||
isDefault: boolean;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A list of SubmissionSectionModel that are present in this submission definition
|
|
||||||
*/
|
|
||||||
@autoserializeAs(SubmissionSectionModel)
|
|
||||||
sections: PaginatedList<SubmissionSectionModel>;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -0,0 +1,18 @@
|
|||||||
|
import { autoserialize, inheritSerialization } from 'cerialize';
|
||||||
|
import { NormalizedConfigObject } from './normalized-config.model';
|
||||||
|
import { mapsTo } from '../../cache/builders/build-decorators';
|
||||||
|
import { FormRowModel, SubmissionFormModel } from './config-submission-form.model';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Normalized class for the configuration describing the submission form
|
||||||
|
*/
|
||||||
|
@mapsTo(SubmissionFormModel)
|
||||||
|
@inheritSerialization(NormalizedConfigObject)
|
||||||
|
export class NormalizedSubmissionFormModel extends NormalizedConfigObject<SubmissionFormModel> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An array of [FormRowModel] that are present in this form
|
||||||
|
*/
|
||||||
|
@autoserialize
|
||||||
|
rows: FormRowModel[];
|
||||||
|
}
|
@@ -1,21 +1,12 @@
|
|||||||
import { autoserialize, inheritSerialization } from 'cerialize';
|
import { inheritSerialization } from 'cerialize';
|
||||||
import { NormalizedConfigObject } from './normalized-config.model';
|
|
||||||
import { FormRowModel, SubmissionFormsModel } from './config-submission-forms.model';
|
|
||||||
import { resourceType } from '../../shared/resource-type.decorator';
|
|
||||||
import { ResourceType } from '../../shared/resource-type';
|
|
||||||
import { mapsTo } from '../../cache/builders/build-decorators';
|
import { mapsTo } from '../../cache/builders/build-decorators';
|
||||||
|
import { SubmissionFormsModel } from './config-submission-forms.model';
|
||||||
|
import { NormalizedSubmissionFormModel } from './normalized-config-submission-form.model';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Normalized class for the configuration describing the submission form
|
* Normalized class for the configuration describing the submission form
|
||||||
*/
|
*/
|
||||||
@mapsTo(SubmissionFormsModel)
|
@mapsTo(SubmissionFormsModel)
|
||||||
@inheritSerialization(NormalizedConfigObject)
|
@inheritSerialization(NormalizedSubmissionFormModel)
|
||||||
@resourceType(ResourceType.SubmissionForm, ResourceType.SubmissionForms)
|
export class NormalizedSubmissionFormsModel extends NormalizedSubmissionFormModel {
|
||||||
export class NormalizedSubmissionFormsModel extends NormalizedConfigObject<SubmissionFormsModel> {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* An array of [FormRowModel] that are present in this form
|
|
||||||
*/
|
|
||||||
@autoserialize
|
|
||||||
rows: FormRowModel[];
|
|
||||||
}
|
}
|
||||||
|
@@ -1,21 +1,17 @@
|
|||||||
import { autoserialize, inheritSerialization } from 'cerialize';
|
import { autoserialize, inheritSerialization } from 'cerialize';
|
||||||
import { SectionsType } from '../../../submission/sections/sections-type';
|
import { SectionsType } from '../../../submission/sections/sections-type';
|
||||||
import { NormalizedConfigObject } from './normalized-config.model';
|
import { NormalizedConfigObject } from './normalized-config.model';
|
||||||
import { SubmissionFormsModel } from './config-submission-forms.model';
|
|
||||||
import {
|
import {
|
||||||
SubmissionSectionModel,
|
SubmissionSectionModel,
|
||||||
SubmissionSectionVisibility
|
SubmissionSectionVisibility
|
||||||
} from './config-submission-section.model';
|
} from './config-submission-section.model';
|
||||||
import { mapsTo } from '../../cache/builders/build-decorators';
|
import { mapsTo } from '../../cache/builders/build-decorators';
|
||||||
import { resourceType } from '../../shared/resource-type.decorator';
|
|
||||||
import { ResourceType } from '../../shared/resource-type';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Normalized class for the configuration describing the submission section
|
* Normalized class for the configuration describing the submission section
|
||||||
*/
|
*/
|
||||||
@mapsTo(SubmissionSectionModel)
|
@mapsTo(SubmissionSectionModel)
|
||||||
@inheritSerialization(NormalizedConfigObject)
|
@inheritSerialization(NormalizedConfigObject)
|
||||||
@resourceType(ResourceType.SubmissionSection, ResourceType.SubmissionSections)
|
|
||||||
export class NormalizedSubmissionSectionModel extends NormalizedConfigObject<SubmissionSectionModel> {
|
export class NormalizedSubmissionSectionModel extends NormalizedConfigObject<SubmissionSectionModel> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -0,0 +1,18 @@
|
|||||||
|
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 { mapsTo } from '../../cache/builders/build-decorators';
|
||||||
|
import { SubmissionSectionsModel } from './config-submission-sections.model';
|
||||||
|
import { NormalizedSubmissionSectionModel } from './normalized-config-submission-section.model';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Normalized class for the configuration describing the submission section
|
||||||
|
*/
|
||||||
|
@mapsTo(SubmissionSectionsModel)
|
||||||
|
@inheritSerialization(NormalizedSubmissionSectionModel)
|
||||||
|
export class NormalizedSubmissionSectionsModel extends NormalizedSubmissionSectionModel {
|
||||||
|
}
|
@@ -7,8 +7,8 @@ import { GlobalConfig } from '../../../config/global-config.interface';
|
|||||||
import { GenericConstructor } from '../shared/generic-constructor';
|
import { GenericConstructor } from '../shared/generic-constructor';
|
||||||
import { PaginatedList } from './paginated-list';
|
import { PaginatedList } from './paginated-list';
|
||||||
import { isRestDataObject, isRestPaginatedList } from '../cache/builders/normalized-object-build.service';
|
import { isRestDataObject, isRestPaginatedList } from '../cache/builders/normalized-object-build.service';
|
||||||
import { getNormalizedConstructorByType } from '../shared/resource-type.decorator';
|
|
||||||
import { ResourceType } from '../shared/resource-type';
|
import { ResourceType } from '../shared/resource-type';
|
||||||
|
import { getMapsToType } from '../cache/builders/build-decorators';
|
||||||
/* tslint:disable:max-classes-per-file */
|
/* tslint:disable:max-classes-per-file */
|
||||||
|
|
||||||
export abstract class BaseResponseParsingService {
|
export abstract class BaseResponseParsingService {
|
||||||
@@ -84,9 +84,9 @@ export abstract class BaseResponseParsingService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected deserialize<ObjectDomain>(obj): any {
|
protected deserialize<ObjectDomain>(obj): any {
|
||||||
const type: ResourceType = obj.type;
|
const type: string = obj.type;
|
||||||
if (hasValue(type)) {
|
if (hasValue(type)) {
|
||||||
const normObjConstructor = getNormalizedConstructorByType(type) as GenericConstructor<ObjectDomain>;
|
const normObjConstructor = getMapsToType(type) as GenericConstructor<ObjectDomain>;
|
||||||
|
|
||||||
if (hasValue(normObjConstructor)) {
|
if (hasValue(normObjConstructor)) {
|
||||||
const serializer = new DSpaceRESTv2Serializer(normObjConstructor);
|
const serializer = new DSpaceRESTv2Serializer(normObjConstructor);
|
||||||
|
@@ -36,7 +36,7 @@ import { RequestEntry } from './request.reducer';
|
|||||||
import { NormalizedObjectBuildService } from '../cache/builders/normalized-object-build.service';
|
import { NormalizedObjectBuildService } from '../cache/builders/normalized-object-build.service';
|
||||||
import { ChangeAnalyzer } from './change-analyzer';
|
import { ChangeAnalyzer } from './change-analyzer';
|
||||||
import { RestRequestMethod } from './rest-request-method';
|
import { RestRequestMethod } from './rest-request-method';
|
||||||
import { getNormalizedConstructorByType } from '../shared/resource-type.decorator';
|
import { getMapsToType } from '../cache/builders/build-decorators';
|
||||||
|
|
||||||
export abstract class DataService<T extends CacheableObject> {
|
export abstract class DataService<T extends CacheableObject> {
|
||||||
protected abstract requestService: RequestService;
|
protected abstract requestService: RequestService;
|
||||||
@@ -243,7 +243,7 @@ export abstract class DataService<T extends CacheableObject> {
|
|||||||
);
|
);
|
||||||
|
|
||||||
const normalizedObject: NormalizedObject<T> = this.dataBuildService.normalize<T>(dso);
|
const normalizedObject: NormalizedObject<T> = this.dataBuildService.normalize<T>(dso);
|
||||||
const serializedDso = new DSpaceRESTv2Serializer(getNormalizedConstructorByType(dso.type)).serialize(normalizedObject);
|
const serializedDso = new DSpaceRESTv2Serializer(getMapsToType((dso as any).type)).serialize(normalizedObject);
|
||||||
|
|
||||||
const request$ = endpoint$.pipe(
|
const request$ = endpoint$.pipe(
|
||||||
take(1),
|
take(1),
|
||||||
|
@@ -20,7 +20,7 @@ import { DSpaceRESTv2Serializer } from '../dspace-rest-v2/dspace-rest-v2.seriali
|
|||||||
import { catchError, filter, flatMap, map, take, tap } from 'rxjs/operators';
|
import { catchError, filter, flatMap, map, take, tap } from 'rxjs/operators';
|
||||||
import { ErrorResponse, RestResponse } from '../cache/response.models';
|
import { ErrorResponse, RestResponse } from '../cache/response.models';
|
||||||
import { StoreActionTypes } from '../../store.actions';
|
import { StoreActionTypes } from '../../store.actions';
|
||||||
import { getNormalizedConstructorByType } from '../shared/resource-type.decorator';
|
import { getMapsToType } from '../cache/builders/build-decorators';
|
||||||
|
|
||||||
export const addToResponseCacheAndCompleteAction = (request: RestRequest, envConfig: GlobalConfig) =>
|
export const addToResponseCacheAndCompleteAction = (request: RestRequest, envConfig: GlobalConfig) =>
|
||||||
(source: Observable<RestResponse>): Observable<RequestCompleteAction> =>
|
(source: Observable<RestResponse>): Observable<RequestCompleteAction> =>
|
||||||
@@ -45,7 +45,7 @@ export class RequestEffects {
|
|||||||
flatMap((request: RestRequest) => {
|
flatMap((request: RestRequest) => {
|
||||||
let body;
|
let body;
|
||||||
if (isNotEmpty(request.body)) {
|
if (isNotEmpty(request.body)) {
|
||||||
const serializer = new DSpaceRESTv2Serializer(getNormalizedConstructorByType(request.body.type));
|
const serializer = new DSpaceRESTv2Serializer(getMapsToType(request.body.type));
|
||||||
body = serializer.serialize(request.body);
|
body = serializer.serialize(request.body);
|
||||||
}
|
}
|
||||||
return this.restApi.request(request.method, request.href, body, request.options).pipe(
|
return this.restApi.request(request.method, request.href, body, request.options).pipe(
|
||||||
|
@@ -4,8 +4,10 @@ import { DSpaceObject } from '../../shared/dspace-object.model';
|
|||||||
import { Group } from './group.model';
|
import { Group } from './group.model';
|
||||||
import { RemoteData } from '../../data/remote-data';
|
import { RemoteData } from '../../data/remote-data';
|
||||||
import { PaginatedList } from '../../data/paginated-list';
|
import { PaginatedList } from '../../data/paginated-list';
|
||||||
|
import { ResourceType } from '../../shared/resource-type';
|
||||||
|
|
||||||
export class EPerson extends DSpaceObject {
|
export class EPerson extends DSpaceObject {
|
||||||
|
static type = new ResourceType('eperson');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A string representing the unique handle of this Collection
|
* A string representing the unique handle of this Collection
|
||||||
|
@@ -3,8 +3,10 @@ import { Observable } from 'rxjs';
|
|||||||
import { DSpaceObject } from '../../shared/dspace-object.model';
|
import { DSpaceObject } from '../../shared/dspace-object.model';
|
||||||
import { PaginatedList } from '../../data/paginated-list';
|
import { PaginatedList } from '../../data/paginated-list';
|
||||||
import { RemoteData } from '../../data/remote-data';
|
import { RemoteData } from '../../data/remote-data';
|
||||||
|
import { ResourceType } from '../../shared/resource-type';
|
||||||
|
|
||||||
export class Group extends DSpaceObject {
|
export class Group extends DSpaceObject {
|
||||||
|
static type = new ResourceType('group');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* List of Groups that this Group belong to
|
* List of Groups that this Group belong to
|
||||||
|
@@ -5,14 +5,11 @@ import { ListableObject } from '../../../shared/object-collection/shared/listabl
|
|||||||
import { NormalizedDSpaceObject } from '../../cache/models/normalized-dspace-object.model';
|
import { NormalizedDSpaceObject } from '../../cache/models/normalized-dspace-object.model';
|
||||||
import { EPerson } from './eperson.model';
|
import { EPerson } from './eperson.model';
|
||||||
import { mapsTo, relationship } from '../../cache/builders/build-decorators';
|
import { mapsTo, relationship } from '../../cache/builders/build-decorators';
|
||||||
import { ResourceType } from '../../shared/resource-type';
|
import { Group } from './group.model';
|
||||||
import { resourceType } from '../../shared/resource-type.decorator';
|
|
||||||
|
|
||||||
@mapsTo(EPerson)
|
@mapsTo(EPerson)
|
||||||
@inheritSerialization(NormalizedDSpaceObject)
|
@inheritSerialization(NormalizedDSpaceObject)
|
||||||
@resourceType(ResourceType.EPerson)
|
|
||||||
export class NormalizedEPerson extends NormalizedDSpaceObject<EPerson> implements CacheableObject, ListableObject {
|
export class NormalizedEPerson extends NormalizedDSpaceObject<EPerson> implements CacheableObject, ListableObject {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A string representing the unique handle of this EPerson
|
* A string representing the unique handle of this EPerson
|
||||||
*/
|
*/
|
||||||
@@ -23,7 +20,7 @@ export class NormalizedEPerson extends NormalizedDSpaceObject<EPerson> implement
|
|||||||
* List of Groups that this EPerson belong to
|
* List of Groups that this EPerson belong to
|
||||||
*/
|
*/
|
||||||
@deserialize
|
@deserialize
|
||||||
@relationship(ResourceType.Group, true)
|
@relationship(Group, true)
|
||||||
groups: string[];
|
groups: string[];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -5,19 +5,16 @@ import { ListableObject } from '../../../shared/object-collection/shared/listabl
|
|||||||
import { NormalizedDSpaceObject } from '../../cache/models/normalized-dspace-object.model';
|
import { NormalizedDSpaceObject } from '../../cache/models/normalized-dspace-object.model';
|
||||||
import { mapsTo, relationship } from '../../cache/builders/build-decorators';
|
import { mapsTo, relationship } from '../../cache/builders/build-decorators';
|
||||||
import { Group } from './group.model';
|
import { Group } from './group.model';
|
||||||
import { ResourceType } from '../../shared/resource-type';
|
|
||||||
import { resourceType } from '../../shared/resource-type.decorator';
|
|
||||||
|
|
||||||
@mapsTo(Group)
|
@mapsTo(Group)
|
||||||
@inheritSerialization(NormalizedDSpaceObject)
|
@inheritSerialization(NormalizedDSpaceObject)
|
||||||
@resourceType(ResourceType.Group)
|
|
||||||
export class NormalizedGroup extends NormalizedDSpaceObject<Group> implements CacheableObject, ListableObject {
|
export class NormalizedGroup extends NormalizedDSpaceObject<Group> implements CacheableObject, ListableObject {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* List of Groups that this Group belong to
|
* List of Groups that this Group belong to
|
||||||
*/
|
*/
|
||||||
@deserialize
|
@deserialize
|
||||||
@relationship(ResourceType.Group, true)
|
@relationship(Group, true)
|
||||||
groups: string[];
|
groups: string[];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -2,11 +2,7 @@ import { Inject, Injectable } from '@angular/core';
|
|||||||
import { RestRequest } from '../data/request.models';
|
import { RestRequest } from '../data/request.models';
|
||||||
import { ResponseParsingService } from '../data/parsing.service';
|
import { ResponseParsingService } from '../data/parsing.service';
|
||||||
import { DSpaceRESTV2Response } from '../dspace-rest-v2/dspace-rest-v2-response.model';
|
import { DSpaceRESTV2Response } from '../dspace-rest-v2/dspace-rest-v2-response.model';
|
||||||
import {
|
import { ErrorResponse, IntegrationSuccessResponse, RestResponse } from '../cache/response.models';
|
||||||
ErrorResponse,
|
|
||||||
IntegrationSuccessResponse,
|
|
||||||
RestResponse
|
|
||||||
} from '../cache/response.models';
|
|
||||||
import { isNotEmpty } from '../../shared/empty.util';
|
import { isNotEmpty } from '../../shared/empty.util';
|
||||||
|
|
||||||
import { BaseResponseParsingService } from '../data/base-response-parsing.service';
|
import { BaseResponseParsingService } from '../data/base-response-parsing.service';
|
||||||
@@ -16,7 +12,6 @@ import { ObjectCacheService } from '../cache/object-cache.service';
|
|||||||
import { IntegrationModel } from './models/integration.model';
|
import { IntegrationModel } from './models/integration.model';
|
||||||
import { AuthorityValue } from './models/authority.value';
|
import { AuthorityValue } from './models/authority.value';
|
||||||
import { PaginatedList } from '../data/paginated-list';
|
import { PaginatedList } from '../data/paginated-list';
|
||||||
import { ResourceType } from '../shared/resource-type';
|
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class IntegrationResponseParsingService extends BaseResponseParsingService implements ResponseParsingService {
|
export class IntegrationResponseParsingService extends BaseResponseParsingService implements ResponseParsingService {
|
||||||
@@ -47,7 +42,7 @@ export class IntegrationResponseParsingService extends BaseResponseParsingServic
|
|||||||
protected processResponse(data: PaginatedList<IntegrationModel>): any {
|
protected processResponse(data: PaginatedList<IntegrationModel>): any {
|
||||||
const returnList = Array.of();
|
const returnList = Array.of();
|
||||||
data.page.forEach((item, index) => {
|
data.page.forEach((item, index) => {
|
||||||
if (item.type === ResourceType.Authority) {
|
if (item.type === AuthorityValue.type) {
|
||||||
data.page[index] = Object.assign(new AuthorityValue(), item);
|
data.page[index] = Object.assign(new AuthorityValue(), item);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@@ -3,11 +3,13 @@ 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 { 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 { OtherInformation } from '../../../shared/form/builder/models/form-field-metadata-value.model';
|
||||||
import { MetadataValueInterface } from '../../shared/metadata.models';
|
import { MetadataValueInterface } from '../../shared/metadata.models';
|
||||||
|
import { ResourceType } from '../../shared/resource-type';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class representing an authority object
|
* Class representing an authority object
|
||||||
*/
|
*/
|
||||||
export class AuthorityValue extends IntegrationModel implements MetadataValueInterface {
|
export class AuthorityValue extends IntegrationModel implements MetadataValueInterface {
|
||||||
|
static type = new ResourceType('authority');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The identifier of this authority
|
* The identifier of this authority
|
||||||
|
@@ -2,15 +2,12 @@ import { autoserialize, inheritSerialization } from 'cerialize';
|
|||||||
import { IntegrationModel } from './integration.model';
|
import { IntegrationModel } from './integration.model';
|
||||||
import { mapsTo } from '../../cache/builders/build-decorators';
|
import { mapsTo } from '../../cache/builders/build-decorators';
|
||||||
import { AuthorityValue } from './authority.value';
|
import { AuthorityValue } from './authority.value';
|
||||||
import { resourceType } from '../../shared/resource-type.decorator';
|
|
||||||
import { ResourceType } from '../../shared/resource-type';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Normalized model class for an Authority Value
|
* Normalized model class for an Authority Value
|
||||||
*/
|
*/
|
||||||
@mapsTo(AuthorityValue)
|
@mapsTo(AuthorityValue)
|
||||||
@inheritSerialization(IntegrationModel)
|
@inheritSerialization(IntegrationModel)
|
||||||
@resourceType(ResourceType.Authority)
|
|
||||||
export class NormalizedAuthorityValue extends IntegrationModel {
|
export class NormalizedAuthorityValue extends IntegrationModel {
|
||||||
|
|
||||||
@autoserialize
|
@autoserialize
|
||||||
|
@@ -7,6 +7,7 @@ import { ResourceType } from '../shared/resource-type';
|
|||||||
* Class the represents a metadata field
|
* Class the represents a metadata field
|
||||||
*/
|
*/
|
||||||
export class MetadataField implements ListableObject {
|
export class MetadataField implements ListableObject {
|
||||||
|
static type = new ResourceType('metadatafield');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The identifier of this metadata field
|
* The identifier of this metadata field
|
||||||
|
@@ -5,6 +5,8 @@ import { ResourceType } from '../shared/resource-type';
|
|||||||
* Class that represents a metadata schema
|
* Class that represents a metadata schema
|
||||||
*/
|
*/
|
||||||
export class MetadataSchema implements ListableObject {
|
export class MetadataSchema implements ListableObject {
|
||||||
|
static type = new ResourceType('metadataschema');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The unique identifier for this metadata schema
|
* The unique identifier for this metadata schema
|
||||||
*/
|
*/
|
||||||
|
@@ -1,16 +1,15 @@
|
|||||||
import { autoserialize, deserialize } from 'cerialize';
|
import { autoserialize, deserialize } from 'cerialize';
|
||||||
import { mapsTo, relationship } from '../cache/builders/build-decorators';
|
import { mapsTo, relationship } from '../cache/builders/build-decorators';
|
||||||
import { ResourceType } from '../shared/resource-type';
|
import { ResourceType } from '../shared/resource-type';
|
||||||
import { resourceType } from '../shared/resource-type.decorator';
|
|
||||||
import { MetadataField } from './metadata-field.model';
|
import { MetadataField } from './metadata-field.model';
|
||||||
import { NormalizedObject } from '../cache/models/normalized-object.model';
|
import { NormalizedObject } from '../cache/models/normalized-object.model';
|
||||||
import { ListableObject } from '../../shared/object-collection/shared/listable-object.model';
|
import { ListableObject } from '../../shared/object-collection/shared/listable-object.model';
|
||||||
|
import { MetadataSchema } from './metadata-schema.model';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class the represents a normalized metadata field
|
* Class the represents a normalized metadata field
|
||||||
*/
|
*/
|
||||||
@mapsTo(MetadataField)
|
@mapsTo(MetadataField)
|
||||||
@resourceType(ResourceType.MetadataField)
|
|
||||||
export class NormalizedMetadataField extends NormalizedObject<MetadataField> implements ListableObject {
|
export class NormalizedMetadataField extends NormalizedObject<MetadataField> implements ListableObject {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -47,7 +46,7 @@ export class NormalizedMetadataField extends NormalizedObject<MetadataField> imp
|
|||||||
* The link to the metadata schema of this normalized metadata field
|
* The link to the metadata schema of this normalized metadata field
|
||||||
*/
|
*/
|
||||||
@deserialize
|
@deserialize
|
||||||
@relationship(ResourceType.MetadataSchema)
|
@relationship(MetadataSchema)
|
||||||
schema: string;
|
schema: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -2,7 +2,6 @@ import { autoserialize } from 'cerialize';
|
|||||||
import { NormalizedObject } from '../cache/models/normalized-object.model';
|
import { NormalizedObject } from '../cache/models/normalized-object.model';
|
||||||
import { mapsTo } from '../cache/builders/build-decorators';
|
import { mapsTo } from '../cache/builders/build-decorators';
|
||||||
import { ListableObject } from '../../shared/object-collection/shared/listable-object.model';
|
import { ListableObject } from '../../shared/object-collection/shared/listable-object.model';
|
||||||
import { resourceType } from '../shared/resource-type.decorator';
|
|
||||||
import { ResourceType } from '../shared/resource-type';
|
import { ResourceType } from '../shared/resource-type';
|
||||||
import { MetadataSchema } from './metadata-schema.model';
|
import { MetadataSchema } from './metadata-schema.model';
|
||||||
|
|
||||||
@@ -10,7 +9,6 @@ import { MetadataSchema } from './metadata-schema.model';
|
|||||||
* Normalized class for a DSpace MetadataSchema
|
* Normalized class for a DSpace MetadataSchema
|
||||||
*/
|
*/
|
||||||
@mapsTo(MetadataSchema)
|
@mapsTo(MetadataSchema)
|
||||||
@resourceType(ResourceType.MetadataSchema)
|
|
||||||
export class NormalizedMetadataSchema extends NormalizedObject<MetadataSchema> implements ListableObject {
|
export class NormalizedMetadataSchema extends NormalizedObject<MetadataSchema> implements ListableObject {
|
||||||
/**
|
/**
|
||||||
* The unique identifier for this schema
|
* The unique identifier for this schema
|
||||||
|
@@ -1,18 +1,20 @@
|
|||||||
import { PageInfo } from '../shared/page-info.model';
|
import { PageInfo } from '../shared/page-info.model';
|
||||||
import { autoserialize, deserialize } from 'cerialize';
|
import { autoserialize, deserialize } from 'cerialize';
|
||||||
import { MetadataField } from '../metadata/metadata-field.model';
|
|
||||||
import { relationship } from '../cache/builders/build-decorators';
|
|
||||||
import { ResourceType } from '../shared/resource-type';
|
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';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class that represents a response with a registry's metadata fields
|
* Class that represents a response with a registry's metadata fields
|
||||||
*/
|
*/
|
||||||
export class RegistryMetadatafieldsResponse {
|
export class RegistryMetadatafieldsResponse {
|
||||||
|
static type = new ResourceType('metadatafield');
|
||||||
/**
|
/**
|
||||||
* List of metadata fields in the response
|
* List of metadata fields in the response
|
||||||
*/
|
*/
|
||||||
@deserialize
|
@deserialize
|
||||||
@relationship(ResourceType.MetadataField, true)
|
@relationship(MetadataField, true)
|
||||||
metadatafields: MetadataField[];
|
metadatafields: MetadataField[];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -62,14 +62,14 @@ describe('RegistryService', () => {
|
|||||||
self: 'https://dspace7.4science.it/dspace-spring-rest/api/core/metadataschemas/1',
|
self: 'https://dspace7.4science.it/dspace-spring-rest/api/core/metadataschemas/1',
|
||||||
prefix: 'dc',
|
prefix: 'dc',
|
||||||
namespace: 'http://dublincore.org/documents/dcmi-terms/',
|
namespace: 'http://dublincore.org/documents/dcmi-terms/',
|
||||||
type: ResourceType.MetadataSchema
|
type: MetadataSchema.type
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 2,
|
id: 2,
|
||||||
self: 'https://dspace7.4science.it/dspace-spring-rest/api/core/metadataschemas/2',
|
self: 'https://dspace7.4science.it/dspace-spring-rest/api/core/metadataschemas/2',
|
||||||
prefix: 'mock',
|
prefix: 'mock',
|
||||||
namespace: 'http://dspace.org/mockschema',
|
namespace: 'http://dspace.org/mockschema',
|
||||||
type: ResourceType.MetadataSchema
|
type: MetadataSchema.type
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
const mockFieldsList = [
|
const mockFieldsList = [
|
||||||
@@ -80,7 +80,7 @@ describe('RegistryService', () => {
|
|||||||
qualifier: 'advisor',
|
qualifier: 'advisor',
|
||||||
scopeNote: null,
|
scopeNote: null,
|
||||||
schema: mockSchemasList[0],
|
schema: mockSchemasList[0],
|
||||||
type: ResourceType.MetadataField
|
type: MetadataField.type
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 2,
|
id: 2,
|
||||||
@@ -89,7 +89,7 @@ describe('RegistryService', () => {
|
|||||||
qualifier: 'author',
|
qualifier: 'author',
|
||||||
scopeNote: null,
|
scopeNote: null,
|
||||||
schema: mockSchemasList[0],
|
schema: mockSchemasList[0],
|
||||||
type: ResourceType.MetadataField
|
type: MetadataField.type
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 3,
|
id: 3,
|
||||||
@@ -98,7 +98,7 @@ describe('RegistryService', () => {
|
|||||||
qualifier: 'editor',
|
qualifier: 'editor',
|
||||||
scopeNote: 'test scope note',
|
scopeNote: 'test scope note',
|
||||||
schema: mockSchemasList[1],
|
schema: mockSchemasList[1],
|
||||||
type: ResourceType.MetadataField
|
type: MetadataField.type
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 4,
|
id: 4,
|
||||||
@@ -107,7 +107,7 @@ describe('RegistryService', () => {
|
|||||||
qualifier: 'illustrator',
|
qualifier: 'illustrator',
|
||||||
scopeNote: null,
|
scopeNote: null,
|
||||||
schema: mockSchemasList[1],
|
schema: mockSchemasList[1],
|
||||||
type: ResourceType.MetadataField
|
type: MetadataField.type
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
|
@@ -63,7 +63,7 @@ import { HttpHeaders } from '@angular/common/http';
|
|||||||
import { TranslateService } from '@ngx-translate/core';
|
import { TranslateService } from '@ngx-translate/core';
|
||||||
import { MetadataSchema } from '../metadata/metadata-schema.model';
|
import { MetadataSchema } from '../metadata/metadata-schema.model';
|
||||||
import { MetadataField } from '../metadata/metadata-field.model';
|
import { MetadataField } from '../metadata/metadata-field.model';
|
||||||
import { getNormalizedConstructorByType } from '../shared/resource-type.decorator';
|
import { getMapsToType } from '../cache/builders/build-decorators';
|
||||||
|
|
||||||
const metadataRegistryStateSelector = (state: AppState) => state.metadataRegistry;
|
const metadataRegistryStateSelector = (state: AppState) => state.metadataRegistry;
|
||||||
const editMetadataSchemaSelector = createSelector(metadataRegistryStateSelector, (metadataState: MetadataRegistryState) => metadataState.editSchema);
|
const editMetadataSchemaSelector = createSelector(metadataRegistryStateSelector, (metadataState: MetadataRegistryState) => metadataState.editSchema);
|
||||||
@@ -463,7 +463,7 @@ export class RegistryService {
|
|||||||
distinctUntilChanged()
|
distinctUntilChanged()
|
||||||
);
|
);
|
||||||
|
|
||||||
const serializedSchema = new DSpaceRESTv2Serializer(getNormalizedConstructorByType(ResourceType.MetadataSchema)).serialize(schema as NormalizedMetadataSchema);
|
const serializedSchema = new DSpaceRESTv2Serializer(getMapsToType(MetadataSchema.type)).serialize(schema as NormalizedMetadataSchema);
|
||||||
|
|
||||||
const request$ = endpoint$.pipe(
|
const request$ = endpoint$.pipe(
|
||||||
take(1),
|
take(1),
|
||||||
|
@@ -6,7 +6,9 @@ import { ResourceType } from './resource-type';
|
|||||||
* Model class for a Bitstream Format
|
* Model class for a Bitstream Format
|
||||||
*/
|
*/
|
||||||
export class BitstreamFormat implements CacheableObject {
|
export class BitstreamFormat implements CacheableObject {
|
||||||
|
static type = new ResourceType('bitstreamformat');
|
||||||
|
|
||||||
|
bitstreamformat
|
||||||
/**
|
/**
|
||||||
* Short description of this Bitstream Format
|
* Short description of this Bitstream Format
|
||||||
*/
|
*/
|
||||||
|
@@ -3,8 +3,10 @@ import { RemoteData } from '../data/remote-data';
|
|||||||
import { Item } from './item.model';
|
import { Item } from './item.model';
|
||||||
import { BitstreamFormat } from './bitstream-format.model';
|
import { BitstreamFormat } from './bitstream-format.model';
|
||||||
import { Observable } from 'rxjs';
|
import { Observable } from 'rxjs';
|
||||||
|
import { ResourceType } from './resource-type';
|
||||||
|
|
||||||
export class Bitstream extends DSpaceObject {
|
export class Bitstream extends DSpaceObject {
|
||||||
|
static type = new ResourceType('bitstream');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The size of this bitstream in bytes
|
* The size of this bitstream in bytes
|
||||||
@@ -40,5 +42,4 @@ export class Bitstream extends DSpaceObject {
|
|||||||
* The URL to retrieve this Bitstream's file
|
* The URL to retrieve this Bitstream's file
|
||||||
*/
|
*/
|
||||||
content: string;
|
content: string;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -1,42 +1,31 @@
|
|||||||
import { autoserialize, autoserializeAs } from 'cerialize';
|
|
||||||
import { ListableObject } from '../../shared/object-collection/shared/listable-object.model';
|
import { ListableObject } from '../../shared/object-collection/shared/listable-object.model';
|
||||||
import { ResourceType } from './resource-type';
|
|
||||||
import { resourceType } from './resource-type.decorator';
|
|
||||||
import { TypedObject } from '../cache/object-cache.reducer';
|
import { TypedObject } from '../cache/object-cache.reducer';
|
||||||
|
import { ResourceType } from './resource-type';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class object representing a browse entry
|
* Class object representing a browse entry
|
||||||
* This class is not normalized because browse entries do not have self links
|
* This class is not normalized because browse entries do not have self links
|
||||||
*/
|
*/
|
||||||
@resourceType(ResourceType.BrowseEntry)
|
|
||||||
export class BrowseEntry implements ListableObject, TypedObject {
|
export class BrowseEntry implements ListableObject, TypedObject {
|
||||||
/**
|
static type = new ResourceType('browseEntry');
|
||||||
* The resource type of this browse entry
|
|
||||||
*/
|
|
||||||
@autoserialize
|
|
||||||
type: ResourceType;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The authority string of this browse entry
|
* The authority string of this browse entry
|
||||||
*/
|
*/
|
||||||
@autoserialize
|
|
||||||
authority: string;
|
authority: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The value of this browse entry
|
* The value of this browse entry
|
||||||
*/
|
*/
|
||||||
@autoserialize
|
|
||||||
value: string;
|
value: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The language of the value of this browse entry
|
* The language of the value of this browse entry
|
||||||
*/
|
*/
|
||||||
@autoserializeAs('valueLang')
|
|
||||||
language: string;
|
language: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The count of this browse entry
|
* The count of this browse entry
|
||||||
*/
|
*/
|
||||||
@autoserialize
|
|
||||||
count: number;
|
count: number;
|
||||||
}
|
}
|
||||||
|
@@ -3,8 +3,11 @@ import { Bitstream } from './bitstream.model';
|
|||||||
import { Item } from './item.model';
|
import { Item } from './item.model';
|
||||||
import { RemoteData } from '../data/remote-data';
|
import { RemoteData } from '../data/remote-data';
|
||||||
import { Observable } from 'rxjs';
|
import { Observable } from 'rxjs';
|
||||||
|
import { ResourceType } from './resource-type';
|
||||||
|
|
||||||
export class Bundle extends DSpaceObject {
|
export class Bundle extends DSpaceObject {
|
||||||
|
static type = new ResourceType('bundle');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The primary bitstream of this Bundle
|
* The primary bitstream of this Bundle
|
||||||
*/
|
*/
|
||||||
|
@@ -6,8 +6,10 @@ import { Observable } from 'rxjs';
|
|||||||
import { License } from './license.model';
|
import { License } from './license.model';
|
||||||
import { ResourcePolicy } from './resource-policy.model';
|
import { ResourcePolicy } from './resource-policy.model';
|
||||||
import { PaginatedList } from '../data/paginated-list';
|
import { PaginatedList } from '../data/paginated-list';
|
||||||
|
import { ResourceType } from './resource-type';
|
||||||
|
|
||||||
export class Collection extends DSpaceObject {
|
export class Collection extends DSpaceObject {
|
||||||
|
static type = new ResourceType('collection');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A string representing the unique handle of this Collection
|
* A string representing the unique handle of this Collection
|
||||||
@@ -80,5 +82,4 @@ export class Collection extends DSpaceObject {
|
|||||||
owner: Observable<RemoteData<Collection>>;
|
owner: Observable<RemoteData<Collection>>;
|
||||||
|
|
||||||
items: Observable<RemoteData<Item[]>>;
|
items: Observable<RemoteData<Item[]>>;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -4,8 +4,10 @@ import { Collection } from './collection.model';
|
|||||||
import { RemoteData } from '../data/remote-data';
|
import { RemoteData } from '../data/remote-data';
|
||||||
import { Observable } from 'rxjs';
|
import { Observable } from 'rxjs';
|
||||||
import { PaginatedList } from '../data/paginated-list';
|
import { PaginatedList } from '../data/paginated-list';
|
||||||
|
import { ResourceType } from './resource-type';
|
||||||
|
|
||||||
export class Community extends DSpaceObject {
|
export class Community extends DSpaceObject {
|
||||||
|
static type = new ResourceType('community');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A string representing the unique handle of this Community
|
* A string representing the unique handle of this Community
|
||||||
|
@@ -1,18 +1,26 @@
|
|||||||
import { Observable } from 'rxjs';
|
import { Observable } from 'rxjs';
|
||||||
|
|
||||||
import { MetadataMap, MetadataValue, MetadataValueFilter, MetadatumViewModel } from './metadata.models';
|
import {
|
||||||
|
MetadataMap,
|
||||||
|
MetadataValue,
|
||||||
|
MetadataValueFilter,
|
||||||
|
MetadatumViewModel
|
||||||
|
} from './metadata.models';
|
||||||
import { Metadata } from './metadata.utils';
|
import { Metadata } from './metadata.utils';
|
||||||
import { isUndefined } from '../../shared/empty.util';
|
import { hasNoValue, isUndefined } from '../../shared/empty.util';
|
||||||
import { CacheableObject, TypedObject } from '../cache/object-cache.reducer';
|
import { CacheableObject } from '../cache/object-cache.reducer';
|
||||||
import { RemoteData } from '../data/remote-data';
|
import { RemoteData } from '../data/remote-data';
|
||||||
import { ResourceType } from './resource-type';
|
|
||||||
import { ListableObject } from '../../shared/object-collection/shared/listable-object.model';
|
import { ListableObject } from '../../shared/object-collection/shared/listable-object.model';
|
||||||
import { hasNoValue } from '../../shared/empty.util';
|
import { ResourceType } from './resource-type';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An abstract model class for a DSpaceObject.
|
* An abstract model class for a DSpaceObject.
|
||||||
*/
|
*/
|
||||||
export class DSpaceObject implements CacheableObject, ListableObject {
|
export class DSpaceObject implements CacheableObject, ListableObject {
|
||||||
|
/**
|
||||||
|
* A string representing the kind of DSpaceObject, e.g. community, item, …
|
||||||
|
*/
|
||||||
|
static type = new ResourceType('dspaceobject');
|
||||||
|
|
||||||
private _name: string;
|
private _name: string;
|
||||||
|
|
||||||
@@ -28,11 +36,6 @@ export class DSpaceObject implements CacheableObject, ListableObject {
|
|||||||
*/
|
*/
|
||||||
uuid: string;
|
uuid: string;
|
||||||
|
|
||||||
/**
|
|
||||||
* A string representing the kind of DSpaceObject, e.g. community, item, …
|
|
||||||
*/
|
|
||||||
type: ResourceType;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The name for this DSpaceObject
|
* The name for this DSpaceObject
|
||||||
*/
|
*/
|
||||||
|
@@ -5,6 +5,8 @@ import { ResourceType } from '../resource-type';
|
|||||||
* Describes a type of Item
|
* Describes a type of Item
|
||||||
*/
|
*/
|
||||||
export class ItemType implements CacheableObject {
|
export class ItemType implements CacheableObject {
|
||||||
|
static type = new ResourceType('entitytype');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The identifier of this ItemType
|
* The identifier of this ItemType
|
||||||
*/
|
*/
|
||||||
|
@@ -8,6 +8,8 @@ import { ItemType } from './item-type.model';
|
|||||||
* Describes a type of Relationship between multiple possible Items
|
* Describes a type of Relationship between multiple possible Items
|
||||||
*/
|
*/
|
||||||
export class RelationshipType implements CacheableObject {
|
export class RelationshipType implements CacheableObject {
|
||||||
|
static type = new ResourceType('relationshiptype');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The link to the rest endpoint where this object can be found
|
* The link to the rest endpoint where this object can be found
|
||||||
*/
|
*/
|
||||||
|
@@ -8,6 +8,8 @@ import { RelationshipType } from './relationship-type.model';
|
|||||||
* Describes a Relationship between two Items
|
* Describes a Relationship between two Items
|
||||||
*/
|
*/
|
||||||
export class Relationship implements CacheableObject {
|
export class Relationship implements CacheableObject {
|
||||||
|
static type = new ResourceType('relationship');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The link to the rest endpoint where this object can be found
|
* The link to the rest endpoint where this object can be found
|
||||||
*/
|
*/
|
||||||
|
@@ -8,8 +8,10 @@ import { Bitstream } from './bitstream.model';
|
|||||||
import { hasValue, isNotEmpty, isNotUndefined } from '../../shared/empty.util';
|
import { hasValue, isNotEmpty, isNotUndefined } from '../../shared/empty.util';
|
||||||
import { PaginatedList } from '../data/paginated-list';
|
import { PaginatedList } from '../data/paginated-list';
|
||||||
import { Relationship } from './item-relationships/relationship.model';
|
import { Relationship } from './item-relationships/relationship.model';
|
||||||
|
import { ResourceType } from './resource-type';
|
||||||
|
|
||||||
export class Item extends DSpaceObject {
|
export class Item extends DSpaceObject {
|
||||||
|
static type = new ResourceType('item');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A string representing the unique handle of this Item
|
* A string representing the unique handle of this Item
|
||||||
|
@@ -1,6 +1,8 @@
|
|||||||
import { DSpaceObject } from './dspace-object.model';
|
import { DSpaceObject } from './dspace-object.model';
|
||||||
|
import { ResourceType } from './resource-type';
|
||||||
|
|
||||||
export class License extends DSpaceObject {
|
export class License extends DSpaceObject {
|
||||||
|
static type = new ResourceType('license');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Is the license custom?
|
* Is the license custom?
|
||||||
|
42
src/app/core/shared/normalized-browse-entry.model.ts
Normal file
42
src/app/core/shared/normalized-browse-entry.model.ts
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
import { autoserialize, autoserializeAs } from 'cerialize';
|
||||||
|
import { ResourceType } from './resource-type';
|
||||||
|
import { BrowseEntry } from './browse-entry.model';
|
||||||
|
import { NormalizedObject } from '../cache/models/normalized-object.model';
|
||||||
|
import { mapsTo } from '../cache/builders/build-decorators';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class object representing a browse entry
|
||||||
|
* This class is not normalized because browse entries do not have self links
|
||||||
|
*/
|
||||||
|
@mapsTo(BrowseEntry)
|
||||||
|
export class NormalizedBrowseEntry extends NormalizedObject<BrowseEntry> {
|
||||||
|
/**
|
||||||
|
* The resource type of this browse entry
|
||||||
|
*/
|
||||||
|
@autoserialize
|
||||||
|
type: ResourceType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The authority string of this browse entry
|
||||||
|
*/
|
||||||
|
@autoserialize
|
||||||
|
authority: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The value of this browse entry
|
||||||
|
*/
|
||||||
|
@autoserialize
|
||||||
|
value: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The language of the value of this browse entry
|
||||||
|
*/
|
||||||
|
@autoserializeAs('valueLang')
|
||||||
|
language: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The count of this browse entry
|
||||||
|
*/
|
||||||
|
@autoserialize
|
||||||
|
count: number;
|
||||||
|
}
|
@@ -6,6 +6,8 @@ import { ActionType } from '../cache/models/action-type.model';
|
|||||||
* Model class for a Resource Policy
|
* Model class for a Resource Policy
|
||||||
*/
|
*/
|
||||||
export class ResourcePolicy implements CacheableObject {
|
export class ResourcePolicy implements CacheableObject {
|
||||||
|
static type = new ResourceType('resourcePolicy');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The action that is allowed by this Resource Policy
|
* The action that is allowed by this Resource Policy
|
||||||
*/
|
*/
|
||||||
|
@@ -1,27 +0,0 @@
|
|||||||
import { TypedObject } from '../cache/object-cache.reducer';
|
|
||||||
import { GenericConstructor } from './generic-constructor';
|
|
||||||
import { ResourceType } from './resource-type';
|
|
||||||
|
|
||||||
const resourceTypeForObjectMap = new Map();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Decorator function to map resource types to their matching normalized model class constructor
|
|
||||||
* @param type The resource type used as a key in the map
|
|
||||||
*/
|
|
||||||
export function resourceType(...type: ResourceType[]) {
|
|
||||||
return function decorator(objectConstructor: GenericConstructor<TypedObject>) {
|
|
||||||
if (!objectConstructor) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
type.forEach((rt: string) => resourceTypeForObjectMap.set(rt, objectConstructor)
|
|
||||||
)
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Method to retrieve the normalized model class constructor based on a resource type
|
|
||||||
* @param type The resource type to look for
|
|
||||||
*/
|
|
||||||
export function getNormalizedConstructorByType(type: ResourceType) {
|
|
||||||
return resourceTypeForObjectMap.get(type);
|
|
||||||
}
|
|
@@ -1,31 +1,10 @@
|
|||||||
export enum ResourceType {
|
export class ResourceType {
|
||||||
DSpaceObject = 'dspaceobject',
|
constructor(public value: string) {
|
||||||
Bundle = 'bundle',
|
}
|
||||||
Bitstream = 'bitstream',
|
// SubmissionDefinitions = 'submissiondefinitions',
|
||||||
BitstreamFormat = 'bitstreamformat',
|
// SubmissionDefinition = 'submissiondefinition',
|
||||||
Item = 'item',
|
// SubmissionForm = 'submissionform',
|
||||||
Collection = 'collection',
|
// SubmissionForms = 'submissionforms',
|
||||||
Community = 'community',
|
// SubmissionSections = 'submissionsections',
|
||||||
EPerson = 'eperson',
|
// SubmissionSection = 'submissionsection',
|
||||||
Group = 'group',
|
|
||||||
ResourcePolicy = 'resourcePolicy',
|
|
||||||
MetadataSchema = 'metadataschema',
|
|
||||||
MetadataField = 'metadatafield',
|
|
||||||
Relationship = 'relationship',
|
|
||||||
RelationshipType = 'relationshiptype',
|
|
||||||
ItemType = 'entitytype',
|
|
||||||
License = 'license',
|
|
||||||
WorkflowItem = 'workflowitem',
|
|
||||||
WorkspaceItem = 'workspaceitem',
|
|
||||||
SubmissionDefinitions = 'submissiondefinitions',
|
|
||||||
SubmissionDefinition = 'submissiondefinition',
|
|
||||||
SubmissionForm = 'submissionform',
|
|
||||||
SubmissionForms = 'submissionforms',
|
|
||||||
SubmissionSections = 'submissionsections',
|
|
||||||
SubmissionSection = 'submissionsection',
|
|
||||||
AuthStatus = 'status',
|
|
||||||
Authority = 'authority',
|
|
||||||
BrowseEntry = 'browseEntry',
|
|
||||||
ClaimedTask = 'claimedtask',
|
|
||||||
PoolTask = 'pooltask'
|
|
||||||
}
|
}
|
||||||
|
@@ -4,42 +4,49 @@ import { mapsTo, relationship } from '../../cache/builders/build-decorators';
|
|||||||
import { WorkflowItem } from './workflowitem.model';
|
import { WorkflowItem } from './workflowitem.model';
|
||||||
import { NormalizedSubmissionObject } from './normalized-submission-object.model';
|
import { NormalizedSubmissionObject } from './normalized-submission-object.model';
|
||||||
import { ResourceType } from '../../shared/resource-type';
|
import { ResourceType } from '../../shared/resource-type';
|
||||||
import { resourceType } from '../../shared/resource-type.decorator';
|
import { NormalizedItem } from '../../cache/models/normalized-item.model';
|
||||||
|
import { NormalizedCollection } from '../../cache/models/normalized-collection.model';
|
||||||
|
import { NormalizedEPerson } from '../../eperson/models/normalized-eperson.model';
|
||||||
|
import { NormalizedSubmissionDefinitionsModel } from '../../config/models/normalized-config-submission-definitions.model';
|
||||||
|
import { Collection } from '../../shared/collection.model';
|
||||||
|
import { Item } from '../../shared/item.model';
|
||||||
|
import { SubmissionDefinitionsModel } from '../../config/models/config-submission-definitions.model';
|
||||||
|
import { EPerson } from '../../eperson/models/eperson.model';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An model class for a NormalizedWorkflowItem.
|
* An model class for a NormalizedWorkflowItem.
|
||||||
*/
|
*/
|
||||||
@mapsTo(WorkflowItem)
|
@mapsTo(WorkflowItem)
|
||||||
@inheritSerialization(NormalizedSubmissionObject)
|
@inheritSerialization(NormalizedSubmissionObject)
|
||||||
@resourceType(ResourceType.WorkflowItem)
|
|
||||||
export class NormalizedWorkflowItem extends NormalizedSubmissionObject<WorkflowItem> {
|
export class NormalizedWorkflowItem extends NormalizedSubmissionObject<WorkflowItem> {
|
||||||
|
static type = new ResourceType('workflowitem');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The collection this workflowitem belonging to
|
* The collection this workflowitem belonging to
|
||||||
*/
|
*/
|
||||||
@autoserialize
|
@autoserialize
|
||||||
@relationship(ResourceType.Collection, false)
|
@relationship(Collection, false)
|
||||||
collection: string;
|
collection: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The item created with this workflowitem
|
* The item created with this workflowitem
|
||||||
*/
|
*/
|
||||||
@autoserialize
|
@autoserialize
|
||||||
@relationship(ResourceType.Item, false)
|
@relationship(Item, false)
|
||||||
item: string;
|
item: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The configuration object that define this workflowitem
|
* The configuration object that define this workflowitem
|
||||||
*/
|
*/
|
||||||
@autoserialize
|
@autoserialize
|
||||||
@relationship(ResourceType.SubmissionDefinition, false)
|
@relationship(SubmissionDefinitionsModel, false)
|
||||||
submissionDefinition: string;
|
submissionDefinition: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The EPerson who submit this workflowitem
|
* The EPerson who submit this workflowitem
|
||||||
*/
|
*/
|
||||||
@autoserialize
|
@autoserialize
|
||||||
@relationship(ResourceType.EPerson, false)
|
@relationship(EPerson, false)
|
||||||
submitter: string;
|
submitter: string;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -4,9 +4,11 @@ import { WorkspaceItem } from './workspaceitem.model';
|
|||||||
import { NormalizedSubmissionObject } from './normalized-submission-object.model';
|
import { NormalizedSubmissionObject } from './normalized-submission-object.model';
|
||||||
import { mapsTo, relationship } from '../../cache/builders/build-decorators';
|
import { mapsTo, relationship } from '../../cache/builders/build-decorators';
|
||||||
import { NormalizedDSpaceObject } from '../../cache/models/normalized-dspace-object.model';
|
import { NormalizedDSpaceObject } from '../../cache/models/normalized-dspace-object.model';
|
||||||
import { ResourceType } from '../../shared/resource-type';
|
|
||||||
import { WorkflowItem } from './workflowitem.model';
|
import { WorkflowItem } from './workflowitem.model';
|
||||||
import { resourceType } from '../../shared/resource-type.decorator';
|
import { Item } from '../../shared/item.model';
|
||||||
|
import { Collection } from '../../shared/collection.model';
|
||||||
|
import { SubmissionDefinitionModel } from '../../config/models/config-submission-definition.model';
|
||||||
|
import { EPerson } from '../../eperson/models/eperson.model';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An model class for a NormalizedWorkspaceItem.
|
* An model class for a NormalizedWorkspaceItem.
|
||||||
@@ -14,34 +16,33 @@ import { resourceType } from '../../shared/resource-type.decorator';
|
|||||||
@mapsTo(WorkspaceItem)
|
@mapsTo(WorkspaceItem)
|
||||||
@inheritSerialization(NormalizedDSpaceObject)
|
@inheritSerialization(NormalizedDSpaceObject)
|
||||||
@inheritSerialization(NormalizedSubmissionObject)
|
@inheritSerialization(NormalizedSubmissionObject)
|
||||||
@resourceType(ResourceType.WorkspaceItem)
|
|
||||||
export class NormalizedWorkspaceItem extends NormalizedSubmissionObject<WorkflowItem> {
|
export class NormalizedWorkspaceItem extends NormalizedSubmissionObject<WorkflowItem> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The collection this workspaceitem belonging to
|
* The collection this workspaceitem belonging to
|
||||||
*/
|
*/
|
||||||
@autoserialize
|
@autoserialize
|
||||||
@relationship(ResourceType.Collection, false)
|
@relationship(Collection, false)
|
||||||
collection: string;
|
collection: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The item created with this workspaceitem
|
* The item created with this workspaceitem
|
||||||
*/
|
*/
|
||||||
@autoserialize
|
@autoserialize
|
||||||
@relationship(ResourceType.Item, false)
|
@relationship(Item, false)
|
||||||
item: string;
|
item: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The configuration object that define this workspaceitem
|
* The configuration object that define this workspaceitem
|
||||||
*/
|
*/
|
||||||
@autoserialize
|
@autoserialize
|
||||||
@relationship(ResourceType.SubmissionDefinition, false)
|
@relationship(SubmissionDefinitionModel, false)
|
||||||
submissionDefinition: string;
|
submissionDefinition: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The EPerson who submit this workspaceitem
|
* The EPerson who submit this workspaceitem
|
||||||
*/
|
*/
|
||||||
@autoserialize
|
@autoserialize
|
||||||
@relationship(ResourceType.EPerson, false)
|
@relationship(EPerson, false)
|
||||||
submitter: string;
|
submitter: string;
|
||||||
}
|
}
|
||||||
|
@@ -1,7 +1,9 @@
|
|||||||
import { WorkspaceItem } from './workspaceitem.model';
|
import { WorkspaceItem } from './workspaceitem.model';
|
||||||
|
import { ResourceType } from '../../shared/resource-type';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A model class for a WorkflowItem.
|
* A model class for a WorkflowItem.
|
||||||
*/
|
*/
|
||||||
export class WorkflowItem extends WorkspaceItem {
|
export class WorkflowItem extends WorkspaceItem {
|
||||||
|
static type = new ResourceType('workflowitem');
|
||||||
}
|
}
|
||||||
|
@@ -1,8 +1,10 @@
|
|||||||
import { SubmissionObject } from './submission-object.model';
|
import { SubmissionObject } from './submission-object.model';
|
||||||
|
import { ResourceType } from '../../shared/resource-type';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A model class for a WorkspaceItem.
|
* A model class for a WorkspaceItem.
|
||||||
*/
|
*/
|
||||||
export class WorkspaceItem extends SubmissionObject {
|
export class WorkspaceItem extends SubmissionObject {
|
||||||
|
static type = new ResourceType('workspaceitem');
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -1,21 +0,0 @@
|
|||||||
export enum SubmissionResourceType {
|
|
||||||
Bundle = 'bundle',
|
|
||||||
Bitstream = 'bitstream',
|
|
||||||
BitstreamFormat = 'bitstreamformat',
|
|
||||||
Item = 'item',
|
|
||||||
Collection = 'collection',
|
|
||||||
Community = 'community',
|
|
||||||
ResourcePolicy = 'resourcePolicy',
|
|
||||||
License = 'license',
|
|
||||||
EPerson = 'eperson',
|
|
||||||
Group = 'group',
|
|
||||||
WorkspaceItem = 'workspaceitem',
|
|
||||||
WorkflowItem = 'workflowitem',
|
|
||||||
SubmissionDefinitions = 'submissiondefinitions',
|
|
||||||
SubmissionDefinition = 'submissiondefinition',
|
|
||||||
SubmissionForm = 'submissionform',
|
|
||||||
SubmissionForms = 'submissionforms',
|
|
||||||
SubmissionSections = 'submissionsections',
|
|
||||||
SubmissionSection = 'submissionsection',
|
|
||||||
Authority = 'authority'
|
|
||||||
}
|
|
@@ -1,8 +1,9 @@
|
|||||||
import { TaskObject } from './task-object.model';
|
import { TaskObject } from './task-object.model';
|
||||||
|
import { ResourceType } from '../../shared/resource-type';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A model class for a ClaimedTask.
|
* A model class for a ClaimedTask.
|
||||||
*/
|
*/
|
||||||
export class ClaimedTask extends TaskObject {
|
export class ClaimedTask extends TaskObject {
|
||||||
|
static type = new ResourceType('claimedtask');
|
||||||
}
|
}
|
||||||
|
@@ -2,17 +2,16 @@ import { NormalizedTaskObject } from './normalized-task-object.model';
|
|||||||
import { mapsTo, relationship } from '../../cache/builders/build-decorators';
|
import { mapsTo, relationship } from '../../cache/builders/build-decorators';
|
||||||
import { autoserialize, inheritSerialization } from 'cerialize';
|
import { autoserialize, inheritSerialization } from 'cerialize';
|
||||||
import { ClaimedTask } from './claimed-task-object.model';
|
import { ClaimedTask } from './claimed-task-object.model';
|
||||||
import { ResourceType } from '../../shared/resource-type';
|
import { EPerson } from '../../eperson/models/eperson.model';
|
||||||
import { resourceType } from '../../shared/resource-type.decorator';
|
import { Group } from '../../eperson/models/group.model';
|
||||||
|
import { WorkflowItem } from '../../submission/models/workflowitem.model';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A normalized model class for a ClaimedTask.
|
* A normalized model class for a ClaimedTask.
|
||||||
*/
|
*/
|
||||||
@mapsTo(ClaimedTask)
|
@mapsTo(ClaimedTask)
|
||||||
@resourceType(ResourceType.ClaimedTask)
|
|
||||||
@inheritSerialization(NormalizedTaskObject)
|
@inheritSerialization(NormalizedTaskObject)
|
||||||
export class NormalizedClaimedTask extends NormalizedTaskObject<ClaimedTask> {
|
export class NormalizedClaimedTask extends NormalizedTaskObject<ClaimedTask> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The task identifier
|
* The task identifier
|
||||||
*/
|
*/
|
||||||
@@ -35,21 +34,21 @@ export class NormalizedClaimedTask extends NormalizedTaskObject<ClaimedTask> {
|
|||||||
* The eperson object for this task
|
* The eperson object for this task
|
||||||
*/
|
*/
|
||||||
@autoserialize
|
@autoserialize
|
||||||
@relationship(ResourceType.EPerson, false)
|
@relationship(EPerson, false)
|
||||||
eperson: string;
|
eperson: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The group object for this task
|
* The group object for this task
|
||||||
*/
|
*/
|
||||||
@autoserialize
|
@autoserialize
|
||||||
@relationship(ResourceType.Group, false)
|
@relationship(Group, false)
|
||||||
group: string;
|
group: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The workflowitem object whom this task is related
|
* The workflowitem object whom this task is related
|
||||||
*/
|
*/
|
||||||
@autoserialize
|
@autoserialize
|
||||||
@relationship(ResourceType.WorkflowItem, false)
|
@relationship(WorkflowItem, false)
|
||||||
workflowitem: string;
|
workflowitem: string;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -2,17 +2,15 @@ import { NormalizedTaskObject } from './normalized-task-object.model';
|
|||||||
import { PoolTask } from './pool-task-object.model';
|
import { PoolTask } from './pool-task-object.model';
|
||||||
import { autoserialize, inheritSerialization } from 'cerialize';
|
import { autoserialize, inheritSerialization } from 'cerialize';
|
||||||
import { mapsTo, relationship } from '../../cache/builders/build-decorators';
|
import { mapsTo, relationship } from '../../cache/builders/build-decorators';
|
||||||
import { ResourceType } from '../../shared/resource-type';
|
import { Group } from '../../eperson/models/group.model';
|
||||||
import { resourceType } from '../../shared/resource-type.decorator';
|
import { WorkflowItem } from '../../submission/models/workflowitem.model';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A normalized model class for a PoolTask.
|
* A normalized model class for a PoolTask.
|
||||||
*/
|
*/
|
||||||
@mapsTo(PoolTask)
|
@mapsTo(PoolTask)
|
||||||
@resourceType(ResourceType.PoolTask)
|
|
||||||
@inheritSerialization(NormalizedTaskObject)
|
@inheritSerialization(NormalizedTaskObject)
|
||||||
export class NormalizedPoolTask extends NormalizedTaskObject<PoolTask> {
|
export class NormalizedPoolTask extends NormalizedTaskObject<PoolTask> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The task identifier
|
* The task identifier
|
||||||
*/
|
*/
|
||||||
@@ -35,13 +33,13 @@ export class NormalizedPoolTask extends NormalizedTaskObject<PoolTask> {
|
|||||||
* The group object for this task
|
* The group object for this task
|
||||||
*/
|
*/
|
||||||
@autoserialize
|
@autoserialize
|
||||||
@relationship(ResourceType.Group, false)
|
@relationship(Group, false)
|
||||||
group: string;
|
group: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The workflowitem object whom this task is related
|
* The workflowitem object whom this task is related
|
||||||
*/
|
*/
|
||||||
@autoserialize
|
@autoserialize
|
||||||
@relationship(ResourceType.WorkflowItem, false)
|
@relationship(WorkflowItem, false)
|
||||||
workflowitem: string;
|
workflowitem: string;
|
||||||
}
|
}
|
||||||
|
@@ -1,16 +1,18 @@
|
|||||||
import { autoserialize, inheritSerialization } from 'cerialize';
|
import { autoserialize, inheritSerialization } from 'cerialize';
|
||||||
import { mapsTo, relationship } from '../../cache/builders/build-decorators';
|
import { mapsTo, relationship } from '../../cache/builders/build-decorators';
|
||||||
import { ResourceType } from '../../shared/resource-type';
|
|
||||||
import { NormalizedDSpaceObject } from '../../cache/models/normalized-dspace-object.model';
|
import { NormalizedDSpaceObject } from '../../cache/models/normalized-dspace-object.model';
|
||||||
import { TaskObject } from './task-object.model';
|
import { TaskObject } from './task-object.model';
|
||||||
import { DSpaceObject } from '../../shared/dspace-object.model';
|
import { DSpaceObject } from '../../shared/dspace-object.model';
|
||||||
|
import { Group } from '../../eperson/models/group.model';
|
||||||
|
import { EPerson } from '../../eperson/models/eperson.model';
|
||||||
|
import { WorkflowItem } from '../../submission/models/workflowitem.model';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An abstract normalized model class for a TaskObject.
|
* An abstract normalized model class for a TaskObject.
|
||||||
*/
|
*/
|
||||||
@mapsTo(TaskObject)
|
@mapsTo(TaskObject)
|
||||||
@inheritSerialization(NormalizedDSpaceObject)
|
@inheritSerialization(NormalizedDSpaceObject)
|
||||||
export abstract class NormalizedTaskObject<T extends DSpaceObject> extends NormalizedDSpaceObject<T> {
|
export class NormalizedTaskObject<T extends DSpaceObject> extends NormalizedDSpaceObject<T> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The task identifier
|
* The task identifier
|
||||||
@@ -34,20 +36,20 @@ export abstract class NormalizedTaskObject<T extends DSpaceObject> extends Norma
|
|||||||
* The eperson object for this task
|
* The eperson object for this task
|
||||||
*/
|
*/
|
||||||
@autoserialize
|
@autoserialize
|
||||||
@relationship(ResourceType.EPerson, false)
|
@relationship(EPerson, false)
|
||||||
eperson: string;
|
eperson: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The group object for this task
|
* The group object for this task
|
||||||
*/
|
*/
|
||||||
@autoserialize
|
@autoserialize
|
||||||
@relationship(ResourceType.Group, false)
|
@relationship(Group, false)
|
||||||
group: string;
|
group: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The workflowitem object whom this task is related
|
* The workflowitem object whom this task is related
|
||||||
*/
|
*/
|
||||||
@autoserialize
|
@autoserialize
|
||||||
@relationship(ResourceType.WorkflowItem, false)
|
@relationship(WorkflowItem, false)
|
||||||
workflowitem: string;
|
workflowitem: string;
|
||||||
}
|
}
|
||||||
|
@@ -1,8 +1,9 @@
|
|||||||
import { TaskObject } from './task-object.model';
|
import { TaskObject } from './task-object.model';
|
||||||
|
import { ResourceType } from '../../shared/resource-type';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A model class for a PoolTask.
|
* A model class for a PoolTask.
|
||||||
*/
|
*/
|
||||||
export class PoolTask extends TaskObject {
|
export class PoolTask extends TaskObject {
|
||||||
|
static type = new ResourceType('pooltask');
|
||||||
}
|
}
|
||||||
|
@@ -7,11 +7,13 @@ import { RemoteData } from '../../data/remote-data';
|
|||||||
import { WorkflowItem } from '../../submission/models/workflowitem.model';
|
import { WorkflowItem } from '../../submission/models/workflowitem.model';
|
||||||
import { Group } from '../../eperson/models/group.model';
|
import { Group } from '../../eperson/models/group.model';
|
||||||
import { EPerson } from '../../eperson/models/eperson.model';
|
import { EPerson } from '../../eperson/models/eperson.model';
|
||||||
|
import { ResourceType } from '../../shared/resource-type';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An abstract model class for a TaskObject.
|
* An abstract model class for a TaskObject.
|
||||||
*/
|
*/
|
||||||
export class TaskObject extends DSpaceObject implements CacheableObject, ListableObject {
|
export class TaskObject extends DSpaceObject implements CacheableObject, ListableObject {
|
||||||
|
static type = new ResourceType('taskobject');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The task identifier
|
* The task identifier
|
||||||
|
@@ -66,7 +66,7 @@ describe('AlertComponent test suite', () => {
|
|||||||
compAsAny = comp;
|
compAsAny = comp;
|
||||||
comp.content = 'test alert';
|
comp.content = 'test alert';
|
||||||
comp.dismissible = true;
|
comp.dismissible = true;
|
||||||
comp.type = AlertType.Info;
|
comp.value = AlertType.Info;
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@@ -103,7 +103,7 @@ describe('ComColFormComponent', () => {
|
|||||||
...randomMD,
|
...randomMD,
|
||||||
...abstractMD
|
...abstractMD
|
||||||
},
|
},
|
||||||
type: ResourceType.Community
|
type: Community.type
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
@@ -10,7 +10,7 @@ import { TranslateService } from '@ngx-translate/core';
|
|||||||
import { DSpaceObject } from '../../../core/shared/dspace-object.model';
|
import { DSpaceObject } from '../../../core/shared/dspace-object.model';
|
||||||
import { MetadataMap, MetadataValue } from '../../../core/shared/metadata.models';
|
import { MetadataMap, MetadataValue } from '../../../core/shared/metadata.models';
|
||||||
import { isNotEmpty } from '../../empty.util';
|
import { isNotEmpty } from '../../empty.util';
|
||||||
import { ResourceType } from '../../../core/shared/resource-type';
|
import { Community } from '../../../core/shared/community.model';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A form for creating and editing Communities or Collections
|
* A form for creating and editing Communities or Collections
|
||||||
@@ -99,7 +99,7 @@ export class ComColFormComponent<T extends DSpaceObject> implements OnInit {
|
|||||||
...this.dso.metadata,
|
...this.dso.metadata,
|
||||||
...formMetadata
|
...formMetadata
|
||||||
},
|
},
|
||||||
type: ResourceType.Community
|
type: Community.type
|
||||||
});
|
});
|
||||||
this.submitForm.emit(updatedDSO);
|
this.submitForm.emit(updatedDSO);
|
||||||
}
|
}
|
||||||
|
@@ -47,10 +47,10 @@ export class DeleteComColPageComponent<TDomain extends DSpaceObject> implements
|
|||||||
.pipe(first())
|
.pipe(first())
|
||||||
.subscribe((success: boolean) => {
|
.subscribe((success: boolean) => {
|
||||||
if (success) {
|
if (success) {
|
||||||
const successMessage = this.translate.instant(dso.type + '.delete.notification.success');
|
const successMessage = this.translate.instant((dso as any).type + '.delete.notification.success');
|
||||||
this.notifications.success(successMessage)
|
this.notifications.success(successMessage)
|
||||||
} else {
|
} else {
|
||||||
const errorMessage = this.translate.instant(dso.type + '.delete.notification.fail');
|
const errorMessage = this.translate.instant((dso as any).type + '.delete.notification.fail');
|
||||||
this.notifications.error(errorMessage)
|
this.notifications.error(errorMessage)
|
||||||
}
|
}
|
||||||
this.router.navigate(['/']);
|
this.router.navigate(['/']);
|
||||||
|
@@ -51,7 +51,7 @@ describe('DSOSelectorComponent', () => {
|
|||||||
component = fixture.componentInstance;
|
component = fixture.componentInstance;
|
||||||
debugElement = fixture.debugElement;
|
debugElement = fixture.debugElement;
|
||||||
component.currentDSOId = currentDSOId;
|
component.currentDSOId = currentDSOId;
|
||||||
component.type = type;
|
component.value = type;
|
||||||
|
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
});
|
});
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
import { DynamicFormControlLayout, serializable } from '@ng-dynamic-forms/core';
|
import { DynamicFormControlLayout, serializable } from '@ng-dynamic-forms/core';
|
||||||
import { FormRowModel } from '../../../../../../core/config/models/config-submission-forms.model';
|
|
||||||
import { DsDynamicInputModel, DsDynamicInputModelConfig } from '../ds-dynamic-input.model';
|
import { DsDynamicInputModel, DsDynamicInputModelConfig } from '../ds-dynamic-input.model';
|
||||||
import { isEmpty, isNull } from '../../../../../empty.util';
|
import { isEmpty, isNull } from '../../../../../empty.util';
|
||||||
|
import { FormRowModel } from '../../../../../../core/config/models/config-submission-form.model';
|
||||||
|
|
||||||
export const DYNAMIC_FORM_CONTROL_TYPE_RELATION_GROUP = 'RELATION';
|
export const DYNAMIC_FORM_CONTROL_TYPE_RELATION_GROUP = 'RELATION';
|
||||||
export const PLACEHOLDER_PARENT_METADATA = '#PLACEHOLDER_PARENT_METADATA_VALUE#';
|
export const PLACEHOLDER_PARENT_METADATA = '#PLACEHOLDER_PARENT_METADATA_VALUE#';
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
import { autoserialize } from 'cerialize';
|
import { autoserialize } from 'cerialize';
|
||||||
import { FormRowModel } from '../../../../core/config/models/config-submission-forms.model';
|
|
||||||
import { LanguageCode } from './form-field-language-value.model';
|
import { LanguageCode } from './form-field-language-value.model';
|
||||||
import { FormFieldMetadataValueObject } from './form-field-metadata-value.model';
|
import { FormFieldMetadataValueObject } from './form-field-metadata-value.model';
|
||||||
|
import { FormRowModel } from '../../../../core/config/models/config-submission-form.model';
|
||||||
|
|
||||||
export class FormFieldModel {
|
export class FormFieldModel {
|
||||||
|
|
||||||
|
@@ -3,12 +3,12 @@ import { FormFieldMetadataValueObject } from '../models/form-field-metadata-valu
|
|||||||
import { FormFieldModel } from '../models/form-field.model';
|
import { FormFieldModel } from '../models/form-field.model';
|
||||||
|
|
||||||
import { isNotEmpty } from '../../../empty.util';
|
import { isNotEmpty } from '../../../empty.util';
|
||||||
import { FormRowModel } from '../../../../core/config/models/config-submission-forms.model';
|
|
||||||
import {
|
import {
|
||||||
DynamicRelationGroupModel,
|
DynamicRelationGroupModel,
|
||||||
DynamicRelationGroupModelConfig,
|
DynamicRelationGroupModelConfig,
|
||||||
PLACEHOLDER_PARENT_METADATA
|
PLACEHOLDER_PARENT_METADATA
|
||||||
} from '../ds-dynamic-form-ui/models/relation-group/dynamic-relation-group.model';
|
} from '../ds-dynamic-form-ui/models/relation-group/dynamic-relation-group.model';
|
||||||
|
import { FormRowModel } from '../../../../core/config/models/config-submission-form.model';
|
||||||
|
|
||||||
export class RelationGroupFieldParser extends FieldParser {
|
export class RelationGroupFieldParser extends FieldParser {
|
||||||
|
|
||||||
|
@@ -5,7 +5,6 @@ import {
|
|||||||
DynamicRowArrayModelConfig
|
DynamicRowArrayModelConfig
|
||||||
} from '../form/builder/ds-dynamic-form-ui/models/ds-dynamic-row-array-model';
|
} from '../form/builder/ds-dynamic-form-ui/models/ds-dynamic-row-array-model';
|
||||||
import { DynamicSelectModel } from '@ng-dynamic-forms/core';
|
import { DynamicSelectModel } from '@ng-dynamic-forms/core';
|
||||||
import { FormRowModel } from '../../core/config/models/config-submission-forms.model';
|
|
||||||
import { SubmissionScopeType } from '../../core/submission/submission-scope-type';
|
import { SubmissionScopeType } from '../../core/submission/submission-scope-type';
|
||||||
import { DynamicRelationGroupModel } from '../form/builder/ds-dynamic-form-ui/models/relation-group/dynamic-relation-group.model';
|
import { DynamicRelationGroupModel } from '../form/builder/ds-dynamic-form-ui/models/relation-group/dynamic-relation-group.model';
|
||||||
import { FormFieldModel } from '../form/builder/models/form-field.model';
|
import { FormFieldModel } from '../form/builder/models/form-field.model';
|
||||||
@@ -13,6 +12,7 @@ import { AuthorityOptions } from '../../core/integration/models/authority-option
|
|||||||
import { AuthorityValue } from '../../core/integration/models/authority.value';
|
import { AuthorityValue } from '../../core/integration/models/authority.value';
|
||||||
import { FormFieldMetadataValueObject } from '../form/builder/models/form-field-metadata-value.model';
|
import { FormFieldMetadataValueObject } from '../form/builder/models/form-field-metadata-value.model';
|
||||||
import { DynamicRowGroupModel } from '../form/builder/ds-dynamic-form-ui/models/ds-dynamic-row-group-model';
|
import { DynamicRowGroupModel } from '../form/builder/ds-dynamic-form-ui/models/ds-dynamic-row-group-model';
|
||||||
|
import { FormRowModel } from '../../core/config/models/config-submission-form.model';
|
||||||
|
|
||||||
export const qualdropSelectConfig = {
|
export const qualdropSelectConfig = {
|
||||||
name: 'dc.identifier_QUALDROP_METADATA',
|
name: 'dc.identifier_QUALDROP_METADATA',
|
||||||
|
@@ -66,7 +66,7 @@ const workflowitem = Object.assign(new WorkflowItem(), { item: observableOf(rdIt
|
|||||||
const rdWorkflowitem = createSuccessfulRemoteDataObject(workflowitem);
|
const rdWorkflowitem = createSuccessfulRemoteDataObject(workflowitem);
|
||||||
mockObject = Object.assign(new ClaimedTask(), { workflowitem: observableOf(rdWorkflowitem), id: '1234' });
|
mockObject = Object.assign(new ClaimedTask(), { workflowitem: observableOf(rdWorkflowitem), id: '1234' });
|
||||||
|
|
||||||
describe('ClaimedTaskActionsComponent', () => {
|
fdescribe('ClaimedTaskActionsComponent', () => {
|
||||||
beforeEach(async(() => {
|
beforeEach(async(() => {
|
||||||
TestBed.configureTestingModule({
|
TestBed.configureTestingModule({
|
||||||
imports: [
|
imports: [
|
||||||
|
@@ -62,7 +62,7 @@ export class ClaimedTaskActionsComponent extends MyDSpaceActionsComponent<Claime
|
|||||||
protected router: Router,
|
protected router: Router,
|
||||||
protected notificationsService: NotificationsService,
|
protected notificationsService: NotificationsService,
|
||||||
protected translate: TranslateService) {
|
protected translate: TranslateService) {
|
||||||
super(ResourceType.ClaimedTask, injector, router, notificationsService, translate);
|
super(ClaimedTask.type, injector, router, notificationsService, translate);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -6,7 +6,6 @@ import { TranslateService } from '@ngx-translate/core';
|
|||||||
import { MyDSpaceActionsComponent } from '../mydspace-actions';
|
import { MyDSpaceActionsComponent } from '../mydspace-actions';
|
||||||
import { ItemDataService } from '../../../core/data/item-data.service';
|
import { ItemDataService } from '../../../core/data/item-data.service';
|
||||||
import { Item } from '../../../core/shared/item.model';
|
import { Item } from '../../../core/shared/item.model';
|
||||||
import { ResourceType } from '../../../core/shared/resource-type';
|
|
||||||
import { NotificationsService } from '../../notifications/notifications.service';
|
import { NotificationsService } from '../../notifications/notifications.service';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -37,7 +36,7 @@ export class ItemActionsComponent extends MyDSpaceActionsComponent<Item, ItemDat
|
|||||||
protected router: Router,
|
protected router: Router,
|
||||||
protected notificationsService: NotificationsService,
|
protected notificationsService: NotificationsService,
|
||||||
protected translate: TranslateService) {
|
protected translate: TranslateService) {
|
||||||
super(ResourceType.Item, injector, router, notificationsService, translate);
|
super(Item.type, injector, router, notificationsService, translate);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -1,36 +0,0 @@
|
|||||||
import { DataService } from '../../core/data/data.service';
|
|
||||||
import { ResourceType } from '../../core/shared/resource-type';
|
|
||||||
import { WorkspaceitemDataService } from '../../core/submission/workspaceitem-data.service';
|
|
||||||
import { ClaimedTaskDataService } from '../../core/tasks/claimed-task-data.service';
|
|
||||||
import { PoolTaskDataService } from '../../core/tasks/pool-task-data.service';
|
|
||||||
import { WorkflowItemDataService } from '../../core/submission/workflowitem-data.service';
|
|
||||||
import { CacheableObject } from '../../core/cache/object-cache.reducer';
|
|
||||||
import { ItemDataService } from '../../core/data/item-data.service';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Class to return DataService for given ResourceType
|
|
||||||
*/
|
|
||||||
export class MydspaceActionsServiceFactory<T extends CacheableObject, TService extends DataService<T>> {
|
|
||||||
public getConstructor(type: ResourceType): TService {
|
|
||||||
switch (type) {
|
|
||||||
case ResourceType.Item: {
|
|
||||||
return ItemDataService as any;
|
|
||||||
}
|
|
||||||
case ResourceType.WorkspaceItem: {
|
|
||||||
return WorkspaceitemDataService as any;
|
|
||||||
}
|
|
||||||
case ResourceType.WorkflowItem: {
|
|
||||||
return WorkflowItemDataService as any;
|
|
||||||
}
|
|
||||||
case ResourceType.ClaimedTask: {
|
|
||||||
return ClaimedTaskDataService as any;
|
|
||||||
}
|
|
||||||
case ResourceType.PoolTask: {
|
|
||||||
return PoolTaskDataService as any;
|
|
||||||
}
|
|
||||||
default: {
|
|
||||||
return undefined;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@@ -3,7 +3,6 @@ import { Injector, Input } from '@angular/core';
|
|||||||
|
|
||||||
import { find } from 'rxjs/operators';
|
import { find } from 'rxjs/operators';
|
||||||
|
|
||||||
import { MydspaceActionsServiceFactory } from './mydspace-actions-service.factory';
|
|
||||||
import { RemoteData } from '../../core/data/remote-data';
|
import { RemoteData } from '../../core/data/remote-data';
|
||||||
import { DataService } from '../../core/data/data.service';
|
import { DataService } from '../../core/data/data.service';
|
||||||
import { DSpaceObject } from '../../core/shared/dspace-object.model';
|
import { DSpaceObject } from '../../core/shared/dspace-object.model';
|
||||||
@@ -11,6 +10,7 @@ import { ResourceType } from '../../core/shared/resource-type';
|
|||||||
import { NotificationOptions } from '../notifications/models/notification-options.model';
|
import { NotificationOptions } from '../notifications/models/notification-options.model';
|
||||||
import { NotificationsService } from '../notifications/notifications.service';
|
import { NotificationsService } from '../notifications/notifications.service';
|
||||||
import { TranslateService } from '@ngx-translate/core';
|
import { TranslateService } from '@ngx-translate/core';
|
||||||
|
import { getMapsToType } from '../../core/cache/builders/build-decorators';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Abstract class for all different representations of mydspace actions
|
* Abstract class for all different representations of mydspace actions
|
||||||
@@ -42,8 +42,7 @@ export abstract class MyDSpaceActionsComponent<T extends DSpaceObject, TService
|
|||||||
protected router: Router,
|
protected router: Router,
|
||||||
protected notificationsService: NotificationsService,
|
protected notificationsService: NotificationsService,
|
||||||
protected translate: TranslateService) {
|
protected translate: TranslateService) {
|
||||||
const factory = new MydspaceActionsServiceFactory<T, TService>();
|
this.objectDataService = injector.get(getMapsToType(objectType));
|
||||||
this.objectDataService = injector.get(factory.getConstructor(objectType));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -53,7 +53,7 @@ export class PoolTaskActionsComponent extends MyDSpaceActionsComponent<PoolTask,
|
|||||||
protected router: Router,
|
protected router: Router,
|
||||||
protected notificationsService: NotificationsService,
|
protected notificationsService: NotificationsService,
|
||||||
protected translate: TranslateService) {
|
protected translate: TranslateService) {
|
||||||
super(ResourceType.PoolTask, injector, router, notificationsService, translate);
|
super(PoolTask.type, injector, router, notificationsService, translate);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -6,7 +6,6 @@ import { TranslateService } from '@ngx-translate/core';
|
|||||||
import { MyDSpaceActionsComponent } from '../mydspace-actions';
|
import { MyDSpaceActionsComponent } from '../mydspace-actions';
|
||||||
import { WorkflowItem } from '../../../core/submission/models/workflowitem.model';
|
import { WorkflowItem } from '../../../core/submission/models/workflowitem.model';
|
||||||
import { WorkflowItemDataService } from '../../../core/submission/workflowitem-data.service';
|
import { WorkflowItemDataService } from '../../../core/submission/workflowitem-data.service';
|
||||||
import { ResourceType } from '../../../core/shared/resource-type';
|
|
||||||
import { NotificationsService } from '../../notifications/notifications.service';
|
import { NotificationsService } from '../../notifications/notifications.service';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -36,7 +35,7 @@ export class WorkflowitemActionsComponent extends MyDSpaceActionsComponent<Workf
|
|||||||
protected router: Router,
|
protected router: Router,
|
||||||
protected notificationsService: NotificationsService,
|
protected notificationsService: NotificationsService,
|
||||||
protected translate: TranslateService) {
|
protected translate: TranslateService) {
|
||||||
super(ResourceType.WorkflowItem, injector, router, notificationsService, translate);
|
super(WorkflowItem.type, injector, router, notificationsService, translate);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -46,7 +46,7 @@ export class WorkspaceitemActionsComponent extends MyDSpaceActionsComponent<Work
|
|||||||
protected modalService: NgbModal,
|
protected modalService: NgbModal,
|
||||||
protected notificationsService: NotificationsService,
|
protected notificationsService: NotificationsService,
|
||||||
protected translate: TranslateService) {
|
protected translate: TranslateService) {
|
||||||
super(ResourceType.WorkspaceItem, injector, router, notificationsService, translate);
|
super(WorkspaceItem.type, injector, router, notificationsService, translate);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -123,7 +123,7 @@ describe('Notifications reducer', () => {
|
|||||||
cdr.detectChanges();
|
cdr.detectChanges();
|
||||||
|
|
||||||
const action = new NewNotificationAction(notification);
|
const action = new NewNotificationAction(notification);
|
||||||
action.type = 'NothingToDo, return only the state';
|
action.value = 'NothingToDo, return only the state';
|
||||||
|
|
||||||
const lastState = notificationsReducer(stateBis, action);
|
const lastState = notificationsReducer(stateBis, action);
|
||||||
expect(lastState.length).toEqual(1);
|
expect(lastState.length).toEqual(1);
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user