diff --git a/src/app/core/auth/models/auth-status.model.ts b/src/app/core/auth/models/auth-status.model.ts index 86ae9f3a49..df6cc5490f 100644 --- a/src/app/core/auth/models/auth-status.model.ts +++ b/src/app/core/auth/models/auth-status.model.ts @@ -1,6 +1,6 @@ import { autoserialize, deserialize, deserializeAs } from 'cerialize'; import { Observable } from 'rxjs'; -import { link, resourceType } from '../../cache/builders/build-decorators'; +import { link, typedObject } from '../../cache/builders/build-decorators'; import { IDToUUIDSerializer } from '../../cache/id-to-uuid-serializer'; import { CacheableObject } from '../../cache/object-cache.reducer'; import { RemoteData } from '../../data/remote-data'; @@ -16,7 +16,7 @@ import { AuthTokenInfo } from './auth-token-info.model'; /** * Object that represents the authenticated status of a user */ -@resourceType(AuthStatus.type) +@typedObject export class AuthStatus implements CacheableObject { static type = AUTH_STATUS; diff --git a/src/app/core/cache/builders/build-decorators.ts b/src/app/core/cache/builders/build-decorators.ts index 17bbc4a8b4..3c1415b9a4 100644 --- a/src/app/core/cache/builders/build-decorators.ts +++ b/src/app/core/cache/builders/build-decorators.ts @@ -1,12 +1,11 @@ import 'reflect-metadata'; import { hasNoValue, hasValue } from '../../../shared/empty.util'; import { DataService } from '../../data/data.service'; -import { PaginatedList } from '../../data/paginated-list'; import { GenericConstructor } from '../../shared/generic-constructor'; import { HALResource } from '../../shared/hal-resource.model'; -import { CacheableObject, TypedObject } from '../object-cache.reducer'; import { ResourceType } from '../../shared/resource-type'; +import { CacheableObject, TypedObject } from '../object-cache.reducer'; const resolvedLinkKey = Symbol('resolvedLink'); @@ -17,12 +16,10 @@ const linkMap = new Map(); /** * Decorator function to map a ResourceType to its class - * @param value The ResourceType to map + * @param target The contructor of the typed class to map */ -export function resourceType(value: ResourceType) { - return function decorator(objectConstructor: GenericConstructor) { - typeMap.set(value.value, objectConstructor); - } +export function typedObject(target: typeof TypedObject) { + typeMap.set(target.type.value, target); } /** @@ -74,14 +71,6 @@ export function resolvedLink, K extends keyof T>(prov }; } -export function getResolvedLinkMetadata(target: any, propertyKey: string) { - return Reflect.getMetadata(resolvedLinkKey, target, propertyKey); -} - -export function getResolvedLinks(target: any) { - return resolvedLinkMap.get(target); -} - export class LinkDefinition { resourceType: ResourceType; isList = false; diff --git a/src/app/core/config/models/config-submission-definition.model.ts b/src/app/core/config/models/config-submission-definition.model.ts index 54ca948e62..1437ae32b1 100644 --- a/src/app/core/config/models/config-submission-definition.model.ts +++ b/src/app/core/config/models/config-submission-definition.model.ts @@ -1,5 +1,5 @@ import { autoserialize, deserialize } from 'cerialize'; -import { resourceType } from '../../cache/builders/build-decorators'; +import { typedObject } from '../../cache/builders/build-decorators'; import { PaginatedList } from '../../data/paginated-list'; import { HALLink } from '../../shared/hal-link.model'; import { ResourceType } from '../../shared/resource-type'; @@ -9,7 +9,7 @@ import { ConfigObject } from './config.model'; /** * Class for the configuration describing the submission */ -@resourceType(SubmissionDefinitionModel.type) +@typedObject export class SubmissionDefinitionModel extends ConfigObject { static type = new ResourceType('submissiondefinition'); diff --git a/src/app/core/config/models/config-submission-definitions.model.ts b/src/app/core/config/models/config-submission-definitions.model.ts index 534f044b08..1fdf571806 100644 --- a/src/app/core/config/models/config-submission-definitions.model.ts +++ b/src/app/core/config/models/config-submission-definitions.model.ts @@ -1,9 +1,9 @@ import { inheritSerialization } from 'cerialize'; -import { resourceType } from '../../cache/builders/build-decorators'; +import { typedObject } from '../../cache/builders/build-decorators'; import { SubmissionDefinitionModel } from './config-submission-definition.model'; import { ResourceType } from '../../shared/resource-type'; -@resourceType(SubmissionDefinitionsModel.type) +@typedObject @inheritSerialization(SubmissionDefinitionModel) export class SubmissionDefinitionsModel extends SubmissionDefinitionModel { static type = new ResourceType('submissiondefinitions'); diff --git a/src/app/core/config/models/config-submission-form.model.ts b/src/app/core/config/models/config-submission-form.model.ts index 3fac904d45..d3fcfa9738 100644 --- a/src/app/core/config/models/config-submission-form.model.ts +++ b/src/app/core/config/models/config-submission-form.model.ts @@ -1,5 +1,5 @@ import { autoserialize, inheritSerialization } from 'cerialize'; -import { resourceType } from '../../cache/builders/build-decorators'; +import { typedObject } from '../../cache/builders/build-decorators'; import { ConfigObject } from './config.model'; import { FormFieldModel } from '../../../shared/form/builder/models/form-field.model'; import { ResourceType } from '../../shared/resource-type'; @@ -14,7 +14,7 @@ export interface FormRowModel { /** * A model class for a NormalizedObject. */ -@resourceType(SubmissionFormModel.type) +@typedObject @inheritSerialization(ConfigObject) export class SubmissionFormModel extends ConfigObject { static type = new ResourceType('submissionform'); diff --git a/src/app/core/config/models/config-submission-forms.model.ts b/src/app/core/config/models/config-submission-forms.model.ts index aabce33ea5..8130bf3264 100644 --- a/src/app/core/config/models/config-submission-forms.model.ts +++ b/src/app/core/config/models/config-submission-forms.model.ts @@ -1,12 +1,12 @@ import { inheritSerialization } from 'cerialize'; -import { resourceType } from '../../cache/builders/build-decorators'; +import { typedObject } from '../../cache/builders/build-decorators'; import { SubmissionFormModel } from './config-submission-form.model'; import { ResourceType } from '../../shared/resource-type'; /** * A model class for a NormalizedObject. */ -@resourceType(SubmissionFormsModel.type) +@typedObject @inheritSerialization(SubmissionFormModel) export class SubmissionFormsModel extends SubmissionFormModel { static type = new ResourceType('submissionforms'); diff --git a/src/app/core/config/models/config-submission-section.model.ts b/src/app/core/config/models/config-submission-section.model.ts index 3c657c3d2a..d589e6a648 100644 --- a/src/app/core/config/models/config-submission-section.model.ts +++ b/src/app/core/config/models/config-submission-section.model.ts @@ -1,6 +1,6 @@ import { autoserialize, deserialize } from 'cerialize'; import { SectionsType } from '../../../submission/sections/sections-type'; -import { resourceType } from '../../cache/builders/build-decorators'; +import { typedObject } from '../../cache/builders/build-decorators'; import { HALLink } from '../../shared/hal-link.model'; import { ResourceType } from '../../shared/resource-type'; import { ConfigObject } from './config.model'; @@ -13,7 +13,7 @@ export interface SubmissionSectionVisibility { other: any } -@resourceType(SubmissionSectionModel.type) +@typedObject export class SubmissionSectionModel extends ConfigObject { static type = new ResourceType('submissionsection'); diff --git a/src/app/core/config/models/config-submission-sections.model.ts b/src/app/core/config/models/config-submission-sections.model.ts index a87e0cb3d6..7f78712273 100644 --- a/src/app/core/config/models/config-submission-sections.model.ts +++ b/src/app/core/config/models/config-submission-sections.model.ts @@ -1,9 +1,9 @@ import { inheritSerialization } from 'cerialize'; -import { resourceType } from '../../cache/builders/build-decorators'; +import { typedObject } from '../../cache/builders/build-decorators'; import { SubmissionSectionModel } from './config-submission-section.model'; import { ResourceType } from '../../shared/resource-type'; -@resourceType(SubmissionSectionsModel.type) +@typedObject @inheritSerialization(SubmissionSectionModel) export class SubmissionSectionsModel extends SubmissionSectionModel { static type = new ResourceType('submissionsections'); diff --git a/src/app/core/config/models/config-submission-uploads.model.ts b/src/app/core/config/models/config-submission-uploads.model.ts index 6a9aace270..b88ce4e0f8 100644 --- a/src/app/core/config/models/config-submission-uploads.model.ts +++ b/src/app/core/config/models/config-submission-uploads.model.ts @@ -1,11 +1,11 @@ import { autoserialize } from 'cerialize'; -import { resourceType } from '../../cache/builders/build-decorators'; +import { typedObject } from '../../cache/builders/build-decorators'; import { ConfigObject } from './config.model'; import { AccessConditionOption } from './config-access-condition-option.model'; import { SubmissionFormsModel } from './config-submission-forms.model'; import { ResourceType } from '../../shared/resource-type'; -@resourceType(SubmissionUploadsModel.type) +@typedObject export class SubmissionUploadsModel extends ConfigObject { static type = new ResourceType('submissionupload'); /** diff --git a/src/app/core/data/base-response-parsing.service.ts b/src/app/core/data/base-response-parsing.service.ts index a1aea3ee38..3615ab4023 100644 --- a/src/app/core/data/base-response-parsing.service.ts +++ b/src/app/core/data/base-response-parsing.service.ts @@ -111,10 +111,10 @@ export abstract class BaseResponseParsingService { protected deserialize(obj): any { const type: string = obj.type; if (hasValue(type)) { - const normObjConstructor = getClassForType(type) as GenericConstructor; + const objConstructor = getClassForType(type) as GenericConstructor; - if (hasValue(normObjConstructor)) { - const serializer = new this.serializerConstructor(normObjConstructor); + if (hasValue(objConstructor)) { + const serializer = new this.serializerConstructor(objConstructor); return serializer.deserialize(obj); } else { return null; diff --git a/src/app/core/eperson/models/eperson.model.ts b/src/app/core/eperson/models/eperson.model.ts index d7048eb6ba..a0e6266311 100644 --- a/src/app/core/eperson/models/eperson.model.ts +++ b/src/app/core/eperson/models/eperson.model.ts @@ -1,6 +1,6 @@ import { autoserialize, deserialize, inheritSerialization } from 'cerialize'; import { Observable } from 'rxjs'; -import { link, resourceType } from '../../cache/builders/build-decorators'; +import { link, typedObject } from '../../cache/builders/build-decorators'; import { PaginatedList } from '../../data/paginated-list'; import { RemoteData } from '../../data/remote-data'; @@ -10,7 +10,7 @@ import { EPERSON } from './eperson.resource-type'; import { Group } from './group.model'; import { GROUP } from './group.resource-type'; -@resourceType(EPerson.type) +@typedObject @inheritSerialization(DSpaceObject) export class EPerson extends DSpaceObject { static type = EPERSON; diff --git a/src/app/core/eperson/models/group.model.ts b/src/app/core/eperson/models/group.model.ts index 28a121d410..3dae9bf864 100644 --- a/src/app/core/eperson/models/group.model.ts +++ b/src/app/core/eperson/models/group.model.ts @@ -1,6 +1,6 @@ import { autoserialize, deserialize, inheritSerialization } from 'cerialize'; import { Observable } from 'rxjs'; -import { link, resourceType } from '../../cache/builders/build-decorators'; +import { link, typedObject } from '../../cache/builders/build-decorators'; import { PaginatedList } from '../../data/paginated-list'; import { RemoteData } from '../../data/remote-data'; @@ -8,7 +8,7 @@ import { DSpaceObject } from '../../shared/dspace-object.model'; import { HALLink } from '../../shared/hal-link.model'; import { GROUP } from './group.resource-type'; -@resourceType(Group.type) +@typedObject @inheritSerialization(DSpaceObject) export class Group extends DSpaceObject { static type = GROUP; diff --git a/src/app/core/integration/models/authority.value.ts b/src/app/core/integration/models/authority.value.ts index 55e0fba99d..9fb64a2555 100644 --- a/src/app/core/integration/models/authority.value.ts +++ b/src/app/core/integration/models/authority.value.ts @@ -2,7 +2,7 @@ import { autoserialize, deserialize, inheritSerialization } from 'cerialize'; import { isNotEmpty } from '../../../shared/empty.util'; import { PLACEHOLDER_PARENT_METADATA } from '../../../shared/form/builder/ds-dynamic-form-ui/models/relation-group/dynamic-relation-group.model'; import { OtherInformation } from '../../../shared/form/builder/models/form-field-metadata-value.model'; -import { resourceType } from '../../cache/builders/build-decorators'; +import { typedObject } from '../../cache/builders/build-decorators'; import { HALLink } from '../../shared/hal-link.model'; import { MetadataValueInterface } from '../../shared/metadata.models'; import { AUTHORITY_VALUE } from './authority.resource-type'; @@ -11,7 +11,7 @@ import { IntegrationModel } from './integration.model'; /** * Class representing an authority object */ -@resourceType(AuthorityValue.type) +@typedObject @inheritSerialization(IntegrationModel) export class AuthorityValue extends IntegrationModel implements MetadataValueInterface { static type = AUTHORITY_VALUE; diff --git a/src/app/core/metadata/metadata-field.model.ts b/src/app/core/metadata/metadata-field.model.ts index d4931a127d..44a0f14e82 100644 --- a/src/app/core/metadata/metadata-field.model.ts +++ b/src/app/core/metadata/metadata-field.model.ts @@ -1,7 +1,7 @@ import { autoserialize, deserialize } from 'cerialize'; import { isNotEmpty } from '../../shared/empty.util'; import { ListableObject } from '../../shared/object-collection/shared/listable-object.model'; -import { link, resourceType } from '../cache/builders/build-decorators'; +import { link, typedObject } from '../cache/builders/build-decorators'; import { GenericConstructor } from '../shared/generic-constructor'; import { HALLink } from '../shared/hal-link.model'; import { HALResource } from '../shared/hal-resource.model'; @@ -13,7 +13,7 @@ import { MetadataSchema } from './metadata-schema.model'; /** * Class the represents a metadata field */ -@resourceType(MetadataField.type) +@typedObject export class MetadataField extends ListableObject implements HALResource { static type = METADATA_FIELD; diff --git a/src/app/core/metadata/metadata-schema.model.ts b/src/app/core/metadata/metadata-schema.model.ts index 9adfcc2479..d4d94b8780 100644 --- a/src/app/core/metadata/metadata-schema.model.ts +++ b/src/app/core/metadata/metadata-schema.model.ts @@ -1,6 +1,6 @@ import { autoserialize, deserialize } from 'cerialize'; import { ListableObject } from '../../shared/object-collection/shared/listable-object.model'; -import { resourceType } from '../cache/builders/build-decorators'; +import { typedObject } from '../cache/builders/build-decorators'; import { GenericConstructor } from '../shared/generic-constructor'; import { HALLink } from '../shared/hal-link.model'; import { HALResource } from '../shared/hal-resource.model'; @@ -11,7 +11,7 @@ import { METADATA_SCHEMA } from './metadata-schema.resource-type'; /** * Class that represents a metadata schema */ -@resourceType(MetadataSchema.type) +@typedObject export class MetadataSchema extends ListableObject implements HALResource { static type = METADATA_SCHEMA; diff --git a/src/app/core/registry/registry-metadatafields-response.model.ts b/src/app/core/registry/registry-metadatafields-response.model.ts index 2bdaade0b7..5dc492ab0f 100644 --- a/src/app/core/registry/registry-metadatafields-response.model.ts +++ b/src/app/core/registry/registry-metadatafields-response.model.ts @@ -1,5 +1,5 @@ import { autoserialize, deserialize } from 'cerialize'; -import { resourceType } from '../cache/builders/build-decorators'; +import { typedObject } from '../cache/builders/build-decorators'; import { MetadataField } from '../metadata/metadata-field.model'; import { METADATA_FIELD } from '../metadata/metadata-field.resource-type'; import { HALLink } from '../shared/hal-link.model'; @@ -10,7 +10,7 @@ import { excludeFromEquals } from '../utilities/equals.decorators'; /** * Class that represents a response with a registry's metadata fields */ -@resourceType(RegistryMetadatafieldsResponse.type) +@typedObject export class RegistryMetadatafieldsResponse { static type = METADATA_FIELD; diff --git a/src/app/core/shared/bitstream-format.model.ts b/src/app/core/shared/bitstream-format.model.ts index 0ba284fcc5..1fdb707aaf 100644 --- a/src/app/core/shared/bitstream-format.model.ts +++ b/src/app/core/shared/bitstream-format.model.ts @@ -1,5 +1,5 @@ import { autoserialize, deserialize, deserializeAs } from 'cerialize'; -import { resourceType } from '../cache/builders/build-decorators'; +import { typedObject } from '../cache/builders/build-decorators'; import { IDToUUIDSerializer } from '../cache/id-to-uuid-serializer'; import { CacheableObject } from '../cache/object-cache.reducer'; import { excludeFromEquals } from '../utilities/equals.decorators'; @@ -11,7 +11,7 @@ import { ResourceType } from './resource-type'; /** * Model class for a Bitstream Format */ -@resourceType(BitstreamFormat.type) +@typedObject export class BitstreamFormat implements CacheableObject { static type = BITSTREAM_FORMAT; diff --git a/src/app/core/shared/bitstream.model.ts b/src/app/core/shared/bitstream.model.ts index da8c39cd8b..d4060f96a6 100644 --- a/src/app/core/shared/bitstream.model.ts +++ b/src/app/core/shared/bitstream.model.ts @@ -1,6 +1,6 @@ import { autoserialize, deserialize, inheritSerialization } from 'cerialize'; import { Observable } from 'rxjs'; -import { link, resourceType } from '../cache/builders/build-decorators'; +import { link, typedObject } from '../cache/builders/build-decorators'; import { RemoteData } from '../data/remote-data'; import { BitstreamFormat } from './bitstream-format.model'; import { BITSTREAM_FORMAT } from './bitstream-format.resource-type'; @@ -9,7 +9,7 @@ import { DSpaceObject } from './dspace-object.model'; import { HALLink } from './hal-link.model'; import { HALResource } from './hal-resource.model'; -@resourceType(Bitstream.type) +@typedObject @inheritSerialization(DSpaceObject) export class Bitstream extends DSpaceObject implements HALResource { static type = BITSTREAM; diff --git a/src/app/core/shared/browse-definition.model.ts b/src/app/core/shared/browse-definition.model.ts index 73badd4729..e1d0e0bf01 100644 --- a/src/app/core/shared/browse-definition.model.ts +++ b/src/app/core/shared/browse-definition.model.ts @@ -1,5 +1,5 @@ import { autoserialize, autoserializeAs, deserialize } from 'cerialize'; -import { resourceType } from '../cache/builders/build-decorators'; +import { typedObject } from '../cache/builders/build-decorators'; import { TypedObject } from '../cache/object-cache.reducer'; import { excludeFromEquals } from '../utilities/equals.decorators'; import { BROWSE_DEFINITION } from './browse-definition.resource-type'; @@ -7,7 +7,7 @@ import { HALLink } from './hal-link.model'; import { ResourceType } from './resource-type'; import { SortOption } from './sort-option.model'; -@resourceType(BrowseDefinition.type) +@typedObject export class BrowseDefinition implements TypedObject { static type = BROWSE_DEFINITION; diff --git a/src/app/core/shared/browse-entry.model.ts b/src/app/core/shared/browse-entry.model.ts index a5e444ae5a..b5e971d069 100644 --- a/src/app/core/shared/browse-entry.model.ts +++ b/src/app/core/shared/browse-entry.model.ts @@ -1,6 +1,6 @@ import { autoserialize, autoserializeAs, deserialize } from 'cerialize'; import { ListableObject } from '../../shared/object-collection/shared/listable-object.model'; -import { resourceType } from '../cache/builders/build-decorators'; +import { typedObject } from '../cache/builders/build-decorators'; import { TypedObject } from '../cache/object-cache.reducer'; import { excludeFromEquals } from '../utilities/equals.decorators'; import { BROWSE_ENTRY } from './browse-entry.resource-type'; @@ -11,7 +11,7 @@ import { ResourceType } from './resource-type'; /** * Class object representing a browse entry */ -@resourceType(BrowseEntry.type) +@typedObject export class BrowseEntry extends ListableObject implements TypedObject { static type = BROWSE_ENTRY; diff --git a/src/app/core/shared/bundle.model.ts b/src/app/core/shared/bundle.model.ts index a5d1818a0d..c2fb25f5b7 100644 --- a/src/app/core/shared/bundle.model.ts +++ b/src/app/core/shared/bundle.model.ts @@ -1,10 +1,10 @@ import { deserialize, inheritSerialization } from 'cerialize'; -import { resourceType } from '../cache/builders/build-decorators'; +import { typedObject } from '../cache/builders/build-decorators'; import { BUNDLE } from './bundle.resource-type'; import { DSpaceObject } from './dspace-object.model'; import { HALLink } from './hal-link.model'; -@resourceType(Bundle.type) +@typedObject @inheritSerialization(DSpaceObject) export class Bundle extends DSpaceObject { static type = BUNDLE; diff --git a/src/app/core/shared/collection.model.ts b/src/app/core/shared/collection.model.ts index d7508c27cb..33a8fd444e 100644 --- a/src/app/core/shared/collection.model.ts +++ b/src/app/core/shared/collection.model.ts @@ -1,6 +1,6 @@ import { autoserialize, deserialize, inheritSerialization } from 'cerialize'; import { Observable } from 'rxjs'; -import { link, resourceType } from '../cache/builders/build-decorators'; +import { link, typedObject } from '../cache/builders/build-decorators'; import { PaginatedList } from '../data/paginated-list'; import { RemoteData } from '../data/remote-data'; import { Bitstream } from './bitstream.model'; @@ -13,7 +13,7 @@ import { LICENSE } from './license.resource-type'; import { ResourcePolicy } from './resource-policy.model'; import { RESOURCE_POLICY } from './resource-policy.resource-type'; -@resourceType(Collection.type) +@typedObject @inheritSerialization(DSpaceObject) export class Collection extends DSpaceObject { static type = COLLECTION; diff --git a/src/app/core/shared/community.model.ts b/src/app/core/shared/community.model.ts index b1b91a8207..66e71176f3 100644 --- a/src/app/core/shared/community.model.ts +++ b/src/app/core/shared/community.model.ts @@ -1,6 +1,6 @@ import { autoserialize, deserialize, inheritSerialization } from 'cerialize'; import { Observable } from 'rxjs'; -import { link, resourceType } from '../cache/builders/build-decorators'; +import { link, typedObject } from '../cache/builders/build-decorators'; import { PaginatedList } from '../data/paginated-list'; import { RemoteData } from '../data/remote-data'; import { Bitstream } from './bitstream.model'; @@ -11,7 +11,7 @@ import { COMMUNITY } from './community.resource-type'; import { DSpaceObject } from './dspace-object.model'; import { HALLink } from './hal-link.model'; -@resourceType(Community.type) +@typedObject @inheritSerialization(DSpaceObject) export class Community extends DSpaceObject { static type = COMMUNITY; diff --git a/src/app/core/shared/dspace-object.model.ts b/src/app/core/shared/dspace-object.model.ts index ff9981079a..7276926b50 100644 --- a/src/app/core/shared/dspace-object.model.ts +++ b/src/app/core/shared/dspace-object.model.ts @@ -1,7 +1,7 @@ import { autoserialize, autoserializeAs, deserialize, deserializeAs } from 'cerialize'; import { hasNoValue, isUndefined } from '../../shared/empty.util'; import { ListableObject } from '../../shared/object-collection/shared/listable-object.model'; -import { resourceType } from '../cache/builders/build-decorators'; +import { typedObject } from '../cache/builders/build-decorators'; import { CacheableObject } from '../cache/object-cache.reducer'; import { excludeFromEquals } from '../utilities/equals.decorators'; import { DSPACE_OBJECT } from './dspace-object.resource-type'; @@ -20,7 +20,7 @@ import { ResourceType } from './resource-type'; /** * An abstract model class for a DSpaceObject. */ -@resourceType(DSpaceObject.type) +@typedObject export class DSpaceObject extends ListableObject implements CacheableObject { /** * A string representing the kind of DSpaceObject, e.g. community, item, … diff --git a/src/app/core/shared/external-source-entry.model.ts b/src/app/core/shared/external-source-entry.model.ts index cfab5f93d6..876ca12f83 100644 --- a/src/app/core/shared/external-source-entry.model.ts +++ b/src/app/core/shared/external-source-entry.model.ts @@ -1,6 +1,6 @@ import { autoserialize, autoserializeAs, deserialize } from 'cerialize'; import { ListableObject } from '../../shared/object-collection/shared/listable-object.model'; -import { resourceType } from '../cache/builders/build-decorators'; +import { typedObject } from '../cache/builders/build-decorators'; import { excludeFromEquals } from '../utilities/equals.decorators'; import { EXTERNAL_SOURCE_ENTRY } from './external-source-entry.resource-type'; import { GenericConstructor } from './generic-constructor'; @@ -11,7 +11,7 @@ import { ResourceType } from './resource-type'; /** * Model class for a single entry from an external source */ -@resourceType(ExternalSourceEntry.type) +@typedObject export class ExternalSourceEntry extends ListableObject { static type = EXTERNAL_SOURCE_ENTRY; diff --git a/src/app/core/shared/external-source.model.ts b/src/app/core/shared/external-source.model.ts index f83d7a82db..718ac4ff49 100644 --- a/src/app/core/shared/external-source.model.ts +++ b/src/app/core/shared/external-source.model.ts @@ -1,5 +1,5 @@ import { autoserialize, deserialize, inheritSerialization } from 'cerialize'; -import { resourceType } from '../cache/builders/build-decorators'; +import { typedObject } from '../cache/builders/build-decorators'; import { CacheableObject } from '../cache/object-cache.reducer'; import { excludeFromEquals } from '../utilities/equals.decorators'; import { EXTERNAL_SOURCE } from './external-source.resource-type'; @@ -9,7 +9,7 @@ import { ResourceType } from './resource-type'; /** * Model class for an external source */ -@resourceType(ExternalSource.type) +@typedObject export class ExternalSource extends CacheableObject { static type = EXTERNAL_SOURCE; diff --git a/src/app/core/shared/item-relationships/item-type.model.ts b/src/app/core/shared/item-relationships/item-type.model.ts index e63c01ea8e..7ff7ba9e74 100644 --- a/src/app/core/shared/item-relationships/item-type.model.ts +++ b/src/app/core/shared/item-relationships/item-type.model.ts @@ -1,5 +1,5 @@ import { autoserialize, deserialize, deserializeAs } from 'cerialize'; -import { resourceType } from '../../cache/builders/build-decorators'; +import { typedObject } from '../../cache/builders/build-decorators'; import { IDToUUIDSerializer } from '../../cache/id-to-uuid-serializer'; import { CacheableObject } from '../../cache/object-cache.reducer'; import { excludeFromEquals } from '../../utilities/equals.decorators'; @@ -10,7 +10,7 @@ import { ITEM_TYPE } from './item-type.resource-type'; /** * Describes a type of Item */ -@resourceType(ItemType.type) +@typedObject export class ItemType implements CacheableObject { static type = ITEM_TYPE; diff --git a/src/app/core/shared/item-relationships/relationship-type.model.ts b/src/app/core/shared/item-relationships/relationship-type.model.ts index 087b984c41..437203bd51 100644 --- a/src/app/core/shared/item-relationships/relationship-type.model.ts +++ b/src/app/core/shared/item-relationships/relationship-type.model.ts @@ -1,6 +1,6 @@ import { autoserialize, deserialize, deserializeAs } from 'cerialize'; import { Observable } from 'rxjs'; -import { link, resourceType } from '../../cache/builders/build-decorators'; +import { link, typedObject } from '../../cache/builders/build-decorators'; import { IDToUUIDSerializer } from '../../cache/id-to-uuid-serializer'; import { CacheableObject } from '../../cache/object-cache.reducer'; import { RemoteData } from '../../data/remote-data'; @@ -14,7 +14,7 @@ import { RELATIONSHIP_TYPE } from './relationship-type.resource-type'; /** * Describes a type of Relationship between multiple possible Items */ -@resourceType(RelationshipType.type) +@typedObject export class RelationshipType implements CacheableObject { static type = RELATIONSHIP_TYPE; diff --git a/src/app/core/shared/item-relationships/relationship.model.ts b/src/app/core/shared/item-relationships/relationship.model.ts index 5d9251c0a4..4103208d89 100644 --- a/src/app/core/shared/item-relationships/relationship.model.ts +++ b/src/app/core/shared/item-relationships/relationship.model.ts @@ -1,6 +1,6 @@ import { autoserialize, deserialize, serialize, deserializeAs } from 'cerialize'; import { Observable } from 'rxjs'; -import { link, resourceType } from '../../cache/builders/build-decorators'; +import { link, typedObject } from '../../cache/builders/build-decorators'; import { IDToUUIDSerializer } from '../../cache/id-to-uuid-serializer'; import { CacheableObject } from '../../cache/object-cache.reducer'; import { RemoteData } from '../../data/remote-data'; @@ -16,7 +16,7 @@ import { RELATIONSHIP } from './relationship.resource-type'; /** * Describes a Relationship between two Items */ -@resourceType(Relationship.type) +@typedObject export class Relationship implements CacheableObject { static type = RELATIONSHIP; diff --git a/src/app/core/shared/item.model.ts b/src/app/core/shared/item.model.ts index 5221176ad5..e20cc1dbac 100644 --- a/src/app/core/shared/item.model.ts +++ b/src/app/core/shared/item.model.ts @@ -3,7 +3,7 @@ import { Observable } from 'rxjs/internal/Observable'; import { isEmpty } from '../../shared/empty.util'; import { DEFAULT_ENTITY_TYPE } from '../../shared/metadata-representation/metadata-representation.decorator'; import { ListableObject } from '../../shared/object-collection/shared/listable-object.model'; -import { link, resourceType } from '../cache/builders/build-decorators'; +import { link, typedObject } from '../cache/builders/build-decorators'; import { PaginatedList } from '../data/paginated-list'; import { RemoteData } from '../data/remote-data'; import { Bundle } from './bundle.model'; @@ -21,7 +21,7 @@ import { ITEM } from './item.resource-type'; /** * Class representing a DSpace Item */ -@resourceType(Item.type) +@typedObject @inheritSerialization(DSpaceObject) export class Item extends DSpaceObject { static type = ITEM; diff --git a/src/app/core/shared/license.model.ts b/src/app/core/shared/license.model.ts index 45a5f9f314..2b2477c1f8 100644 --- a/src/app/core/shared/license.model.ts +++ b/src/app/core/shared/license.model.ts @@ -1,9 +1,9 @@ import { autoserialize, inheritSerialization } from 'cerialize'; -import { resourceType } from '../cache/builders/build-decorators'; +import { typedObject } from '../cache/builders/build-decorators'; import { DSpaceObject } from './dspace-object.model'; import { LICENSE } from './license.resource-type'; -@resourceType(License.type) +@typedObject @inheritSerialization(DSpaceObject) export class License extends DSpaceObject { static type = LICENSE; diff --git a/src/app/core/shared/resource-policy.model.ts b/src/app/core/shared/resource-policy.model.ts index 29dc90d6a5..29f901c35b 100644 --- a/src/app/core/shared/resource-policy.model.ts +++ b/src/app/core/shared/resource-policy.model.ts @@ -1,5 +1,5 @@ import { autoserialize, deserialize, deserializeAs } from 'cerialize'; -import { resourceType } from '../cache/builders/build-decorators'; +import { typedObject } from '../cache/builders/build-decorators'; import { IDToUUIDSerializer } from '../cache/id-to-uuid-serializer'; import { ActionType } from '../cache/models/action-type.model'; import { CacheableObject } from '../cache/object-cache.reducer'; @@ -11,7 +11,7 @@ import { ResourceType } from './resource-type'; /** * Model class for a Resource Policy */ -@resourceType(ResourcePolicy.type) +@typedObject export class ResourcePolicy implements CacheableObject { static type = RESOURCE_POLICY; diff --git a/src/app/core/shared/site.model.ts b/src/app/core/shared/site.model.ts index 204c33f17a..befd4c1ae3 100644 --- a/src/app/core/shared/site.model.ts +++ b/src/app/core/shared/site.model.ts @@ -1,12 +1,12 @@ import { inheritSerialization } from 'cerialize'; -import { resourceType } from '../cache/builders/build-decorators'; +import { typedObject } from '../cache/builders/build-decorators'; import { DSpaceObject } from './dspace-object.model'; import { SITE } from './site.resource-type'; /** * Model class for the Site object */ -@resourceType(Site.type) +@typedObject @inheritSerialization(DSpaceObject) export class Site extends DSpaceObject { ​ diff --git a/src/app/core/submission/models/workflowitem.model.ts b/src/app/core/submission/models/workflowitem.model.ts index 5d53300b81..b8054a66d0 100644 --- a/src/app/core/submission/models/workflowitem.model.ts +++ b/src/app/core/submission/models/workflowitem.model.ts @@ -1,5 +1,5 @@ import { deserializeAs, inheritSerialization } from 'cerialize'; -import { inheritLinkAnnotations, resourceType } from '../../cache/builders/build-decorators'; +import { inheritLinkAnnotations, typedObject } from '../../cache/builders/build-decorators'; import { IDToUUIDSerializer } from '../../cache/id-to-uuid-serializer'; import { WORKFLOWITEM } from '../../eperson/models/workflowitem.resource-type'; import { SubmissionObject } from './submission-object.model'; @@ -7,7 +7,7 @@ import { SubmissionObject } from './submission-object.model'; /** * A model class for a WorkflowItem. */ -@resourceType(WorkflowItem.type) +@typedObject @inheritSerialization(SubmissionObject) @inheritLinkAnnotations(SubmissionObject) export class WorkflowItem extends SubmissionObject { diff --git a/src/app/core/submission/models/workspaceitem.model.ts b/src/app/core/submission/models/workspaceitem.model.ts index f25115ab52..b29d8c0efa 100644 --- a/src/app/core/submission/models/workspaceitem.model.ts +++ b/src/app/core/submission/models/workspaceitem.model.ts @@ -1,5 +1,5 @@ import { deserializeAs, inheritSerialization } from 'cerialize'; -import { inheritLinkAnnotations, resourceType } from '../../cache/builders/build-decorators'; +import { inheritLinkAnnotations, typedObject } from '../../cache/builders/build-decorators'; import { IDToUUIDSerializer } from '../../cache/id-to-uuid-serializer'; import { DSpaceObject } from '../../shared/dspace-object.model'; import { SubmissionObject } from './submission-object.model'; @@ -8,7 +8,7 @@ import { ResourceType } from '../../shared/resource-type'; /** * A model class for a WorkspaceItem. */ -@resourceType(WorkspaceItem.type) +@typedObject @inheritSerialization(SubmissionObject) @inheritLinkAnnotations(SubmissionObject) export class WorkspaceItem extends SubmissionObject { diff --git a/src/app/core/tasks/models/claimed-task-object.model.ts b/src/app/core/tasks/models/claimed-task-object.model.ts index 314bc3a1fa..9ec28bc2e0 100644 --- a/src/app/core/tasks/models/claimed-task-object.model.ts +++ b/src/app/core/tasks/models/claimed-task-object.model.ts @@ -1,5 +1,5 @@ import { inheritSerialization } from 'cerialize'; -import { resourceType } from '../../cache/builders/build-decorators'; +import { typedObject } from '../../cache/builders/build-decorators'; import { DSpaceObject } from '../../shared/dspace-object.model'; import { CLAIMED_TASK } from './claimed-task-object.resource-type'; import { TaskObject } from './task-object.model'; @@ -7,7 +7,7 @@ import { TaskObject } from './task-object.model'; /** * A model class for a ClaimedTask. */ -@resourceType(ClaimedTask.type) +@typedObject @inheritSerialization(DSpaceObject) export class ClaimedTask extends TaskObject { static type = CLAIMED_TASK; diff --git a/src/app/core/tasks/models/pool-task-object.model.ts b/src/app/core/tasks/models/pool-task-object.model.ts index 9938435f12..04fe572502 100644 --- a/src/app/core/tasks/models/pool-task-object.model.ts +++ b/src/app/core/tasks/models/pool-task-object.model.ts @@ -1,12 +1,12 @@ import { inheritSerialization } from 'cerialize'; -import { resourceType } from '../../cache/builders/build-decorators'; +import { typedObject } from '../../cache/builders/build-decorators'; import { POOL_TASK } from './pool-task-object.resource-type'; import { TaskObject } from './task-object.model'; /** * A model class for a PoolTask. */ -@resourceType(PoolTask.type) +@typedObject @inheritSerialization(TaskObject) export class PoolTask extends TaskObject { static type = POOL_TASK; diff --git a/src/app/core/tasks/models/task-object.model.ts b/src/app/core/tasks/models/task-object.model.ts index bab1b3b62b..2e035f134e 100644 --- a/src/app/core/tasks/models/task-object.model.ts +++ b/src/app/core/tasks/models/task-object.model.ts @@ -1,6 +1,6 @@ import { autoserialize, deserialize, inheritSerialization } from 'cerialize'; import { Observable } from 'rxjs'; -import { link, resourceType } from '../../cache/builders/build-decorators'; +import { link, typedObject } from '../../cache/builders/build-decorators'; import { CacheableObject } from '../../cache/object-cache.reducer'; import { RemoteData } from '../../data/remote-data'; @@ -16,7 +16,7 @@ import { TASK_OBJECT } from './task-object.resource-type'; /** * An abstract model class for a TaskObject. */ -@resourceType(TaskObject.type) +@typedObject @inheritSerialization(DSpaceObject) export class TaskObject extends DSpaceObject implements CacheableObject { static type = TASK_OBJECT;