From d3f478ef0f9843ea44f82201ca4af850d71cfd1a Mon Sep 17 00:00:00 2001 From: Art Lowel Date: Thu, 4 May 2017 13:44:14 +0200 Subject: [PATCH] refactoring --- .../core/cache/builders/bitstream-builder.ts | 21 ------ .../core/cache/builders/build-decorators.ts | 39 +++++++++++ src/app/core/cache/builders/bundle-builder.ts | 34 ---------- .../core/cache/builders/collection-builder.ts | 34 ---------- .../cache/builders/domain-model-builder.ts | 21 ------ src/app/core/cache/builders/item-builder.ts | 34 ---------- .../builders/remote-data-build.service.ts | 67 ++++++++++++++----- .../models/normalized-bitstream.model.ts | 3 + .../cache/models/normalized-bundle.model.ts | 6 ++ .../models/normalized-collection.model.ts | 5 ++ .../cache/models/normalized-item.model.ts | 5 ++ .../core/cache/object-cache.service.spec.ts | 10 +-- src/app/core/cache/object-cache.service.ts | 34 ++-------- src/app/core/data/collection-data.service.ts | 5 -- src/app/core/data/data.service.ts | 14 ++-- src/app/core/data/item-data.service.ts | 5 -- src/app/core/data/request.service.ts | 2 +- src/app/core/shared/bitstream.model.ts | 2 - src/backend/bundles.ts | 4 +- 19 files changed, 129 insertions(+), 216 deletions(-) delete mode 100644 src/app/core/cache/builders/bitstream-builder.ts create mode 100644 src/app/core/cache/builders/build-decorators.ts delete mode 100644 src/app/core/cache/builders/bundle-builder.ts delete mode 100644 src/app/core/cache/builders/collection-builder.ts delete mode 100644 src/app/core/cache/builders/domain-model-builder.ts delete mode 100644 src/app/core/cache/builders/item-builder.ts diff --git a/src/app/core/cache/builders/bitstream-builder.ts b/src/app/core/cache/builders/bitstream-builder.ts deleted file mode 100644 index ce862d2ef2..0000000000 --- a/src/app/core/cache/builders/bitstream-builder.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { Bitstream } from "../../shared/bitstream.model"; -import { RequestService } from "../../data/request.service"; -import { hasValue } from "../../../shared/empty.util"; -import { NormalizedBitstream } from "../models/normalized-bitstream.model"; -import { RemoteDataBuildService } from "./remote-data-build.service"; -import { DomainModelBuilder } from "./domain-model-builder"; - -export class BitstreamBuilder extends DomainModelBuilder { - constructor( - private requestService: RequestService, - private rdbService: RemoteDataBuildService, - ) { - super(); - } - - build(): Bitstream { - let links: any = {}; - //TODO - return Object.assign(new Bitstream(), this.normalized, links); - } -} diff --git a/src/app/core/cache/builders/build-decorators.ts b/src/app/core/cache/builders/build-decorators.ts new file mode 100644 index 0000000000..bb86ad4ae1 --- /dev/null +++ b/src/app/core/cache/builders/build-decorators.ts @@ -0,0 +1,39 @@ +import { GenericConstructor } from "../../shared/generic-constructor"; +import { CacheableObject } from "../object-cache.reducer"; + +const mapsToMetadataKey = Symbol("mapsTo"); +const relationshipKey = Symbol("relationship"); + +const relationshipMap = new Map(); + +export const mapsTo = function(value: GenericConstructor) { + return Reflect.metadata(mapsToMetadataKey, value); +}; + +export const getMapsTo = function(target: any) { + return Reflect.getOwnMetadata(mapsToMetadataKey, target); +}; + +export const relationship = function(value: any): any { + return function (target: any, propertyKey: string, descriptor: PropertyDescriptor) { + if (!target || !propertyKey) { + return; + } + + let metaDataList : Array = relationshipMap.get(target.constructor) || []; + if (metaDataList.indexOf(propertyKey) === -1) { + metaDataList.push(propertyKey); + } + relationshipMap.set(target.constructor, metaDataList); + + return Reflect.metadata(relationshipKey, value).apply(this, arguments); + }; +}; + +export const getResourceType = function(target: any, propertyKey: string) { + return Reflect.getMetadata(relationshipKey, target, propertyKey); +}; + +export const getRelationships = function(target: any) { + return relationshipMap.get(target); +}; diff --git a/src/app/core/cache/builders/bundle-builder.ts b/src/app/core/cache/builders/bundle-builder.ts deleted file mode 100644 index 1639163d4f..0000000000 --- a/src/app/core/cache/builders/bundle-builder.ts +++ /dev/null @@ -1,34 +0,0 @@ -import { Bundle } from "../../shared/bundle.model"; -import { RequestService } from "../../data/request.service"; -import { NormalizedBundle } from "../models/normalized-bundle.model"; -import { hasValue } from "../../../shared/empty.util"; -import { NormalizedBitstream } from "../models/normalized-bitstream.model"; -import { RemoteDataBuildService } from "./remote-data-build.service"; -import { DomainModelBuilder } from "./domain-model-builder"; -import { BitstreamBuilder } from "./bitstream-builder"; - -export class BundleBuilder extends DomainModelBuilder { - constructor( - private requestService: RequestService, - private rdbService: RemoteDataBuildService, - ) { - super(); - } - - build(): Bundle { - let links: any = {}; - - if (hasValue(this.normalized.bitstreams)) { - this.normalized.bitstreams.forEach((href: string) => { - setTimeout(() => { - this.requestService.configure(href, NormalizedBitstream); - },0); - }); - - links.bitstreams = this.normalized.bitstreams.map((href: string) => { - return this.rdbService.buildSingle(href, NormalizedBitstream, new BitstreamBuilder(this.requestService, this.rdbService)); - }); - } - return Object.assign(new Bundle(), this.normalized, links); - } -} diff --git a/src/app/core/cache/builders/collection-builder.ts b/src/app/core/cache/builders/collection-builder.ts deleted file mode 100644 index b142136175..0000000000 --- a/src/app/core/cache/builders/collection-builder.ts +++ /dev/null @@ -1,34 +0,0 @@ -import { Collection } from "../../shared/collection.model"; -import { RequestService } from "../../data/request.service"; -import { NormalizedCollection } from "../models/normalized-collection.model"; -import { hasValue } from "../../../shared/empty.util"; -import { NormalizedItem } from "../models/normalized-item.model"; -import { RemoteDataBuildService } from "./remote-data-build.service"; -import { DomainModelBuilder } from "./domain-model-builder"; -import { ItemBuilder } from "./item-builder"; - -export class CollectionBuilder extends DomainModelBuilder { - constructor( - private requestService: RequestService, - private rdbService: RemoteDataBuildService, - ) { - super(); - } - - build(): Collection { - let links: any = {}; - - if (hasValue(this.normalized.items)) { - this.normalized.items.forEach((href: string) => { - setTimeout(() => { - this.requestService.configure(href, NormalizedItem) - },0); - }); - - links.items = this.normalized.items.map((href: string) => { - return this.rdbService.buildSingle(href, NormalizedItem, new ItemBuilder(this.requestService, this.rdbService)); - }); - } - return Object.assign(new Collection(), this.normalized, links); - } -} diff --git a/src/app/core/cache/builders/domain-model-builder.ts b/src/app/core/cache/builders/domain-model-builder.ts deleted file mode 100644 index 788ac2a24e..0000000000 --- a/src/app/core/cache/builders/domain-model-builder.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { CacheableObject } from "../object-cache.reducer"; - -export abstract class DomainModelBuilder { - protected href: string; - protected normalized: TNormalized; - - constructor() { - } - - setHref(href: string): DomainModelBuilder { - this.href = href; - return this; - } - - setNormalized(normalized: TNormalized): DomainModelBuilder { - this.normalized = normalized; - return this; - } - - abstract build(): TDomain; -} diff --git a/src/app/core/cache/builders/item-builder.ts b/src/app/core/cache/builders/item-builder.ts deleted file mode 100644 index d8778a0229..0000000000 --- a/src/app/core/cache/builders/item-builder.ts +++ /dev/null @@ -1,34 +0,0 @@ -import { Item } from "../../shared/item.model"; -import { RequestService } from "../../data/request.service"; -import { NormalizedItem } from "../models/normalized-item.model"; -import { hasValue } from "../../../shared/empty.util"; -import { NormalizedBundle } from "../models/normalized-bundle.model"; -import { RemoteDataBuildService } from "./remote-data-build.service"; -import { DomainModelBuilder } from "./domain-model-builder"; -import { BundleBuilder } from "./bundle-builder"; - -export class ItemBuilder extends DomainModelBuilder { - constructor( - private requestService: RequestService, - private rdbService: RemoteDataBuildService, - ) { - super(); - } - - build(): Item { - let links: any = {}; - - if (hasValue(this.normalized.bundles)) { - this.normalized.bundles.forEach((href: string) => { - setTimeout(() => { - this.requestService.configure(href, NormalizedBundle) - },0); - }); - - links.bundles = this.normalized.bundles.map((href: string) => { - return this.rdbService.buildSingle(href, NormalizedBundle, new BundleBuilder(this.requestService, this.rdbService)); - }); - } - return Object.assign(new Item(), this.normalized, links); - } -} diff --git a/src/app/core/cache/builders/remote-data-build.service.ts b/src/app/core/cache/builders/remote-data-build.service.ts index 3bfa49c144..511c5d594a 100644 --- a/src/app/core/cache/builders/remote-data-build.service.ts +++ b/src/app/core/cache/builders/remote-data-build.service.ts @@ -1,5 +1,4 @@ import { Injectable } from "@angular/core"; -import { GenericConstructor } from "../../shared/generic-constructor"; import { CacheableObject } from "../object-cache.reducer"; import { ObjectCacheService } from "../object-cache.service"; import { RequestService } from "../../data/request.service"; @@ -12,7 +11,8 @@ import { ResponseCacheEntry } from "../response-cache.reducer"; import { ErrorResponse, SuccessResponse } from "../response-cache.models"; import { Observable } from "rxjs/Observable"; import { RemoteData } from "../../data/remote-data"; -import { DomainModelBuilder } from "./domain-model-builder"; +import { GenericConstructor } from "../../shared/generic-constructor"; +import { getMapsTo, getResourceType, getRelationships } from "./build-decorators"; @Injectable() export class RemoteDataBuildService { @@ -26,8 +26,7 @@ export class RemoteDataBuildService { buildSingle( href: string, - normalizedType: GenericConstructor, - builder: DomainModelBuilder + normalizedType: GenericConstructor ): RemoteData { const requestObs = this.store.select('core', 'data', 'request', href); const responseCacheObs = this.responseCache.get(href); @@ -46,24 +45,22 @@ export class RemoteDataBuildService { const payload = Observable.race( - this.objectCache.getBySelfLink(href, normalizedType), + this.objectCache.getBySelfLink(href), responseCacheObs .filter((entry: ResponseCacheEntry) => hasValue(entry) && entry.response.isSuccessful) .map((entry: ResponseCacheEntry) => ( entry.response).resourceUUIDs) .flatMap((resourceUUIDs: Array) => { if (isNotEmpty(resourceUUIDs)) { - return this.objectCache.get(resourceUUIDs[0], normalizedType); + return this.objectCache.get(resourceUUIDs[0]); } else { return Observable.of(undefined); } }) .distinctUntilChanged() - ).map((normalized: TNormalized) => builder - .setHref(href) - .setNormalized(normalized) - .build() - ); + ).map((normalized: TNormalized) => { + return this.build(normalized); + }); return new RemoteData( href, @@ -77,8 +74,7 @@ export class RemoteDataBuildService { buildList( href: string, - normalizedType: GenericConstructor, - builder: DomainModelBuilder + normalizedType: GenericConstructor ): RemoteData { const requestObs = this.store.select('core', 'data', 'request', href); const responseCacheObs = this.responseCache.get(href); @@ -99,13 +95,10 @@ export class RemoteDataBuildService { .filter((entry: ResponseCacheEntry) => hasValue(entry) && entry.response.isSuccessful) .map((entry: ResponseCacheEntry) => ( entry.response).resourceUUIDs) .flatMap((resourceUUIDs: Array) => { - return this.objectCache.getList(resourceUUIDs, normalizedType) + return this.objectCache.getList(resourceUUIDs) .map((normList: TNormalized[]) => { return normList.map((normalized: TNormalized) => { - return builder - .setHref(href) - .setNormalized(normalized) - .build(); + return this.build(normalized); }); }); }) @@ -120,4 +113,42 @@ export class RemoteDataBuildService { payload ); } + + + build(normalized: TNormalized): TDomain { + let links: any = {}; + + const relationships = getRelationships(normalized.constructor) || []; + + relationships.forEach((relationship: string) => { + if (hasValue(normalized[relationship])) { + const resourceType = getResourceType(normalized, relationship); + if (Array.isArray(normalized[relationship])) { + // without the setTimeout, the actions inside requestService.configure + // are dispatched, but sometimes don't arrive. I'm unsure why atm. + setTimeout(() => { + normalized[relationship].forEach((href: string) => { + this.requestService.configure(href, resourceType) + }); + }, 0); + + links[relationship] = normalized[relationship].map((href: string) => { + return this.buildSingle(href, resourceType); + }); + } + else { + // without the setTimeout, the actions inside requestService.configure + // are dispatched, but sometimes don't arrive. I'm unsure why atm. + setTimeout(() => { + this.requestService.configure(normalized[relationship], resourceType); + },0); + + links[relationship] = this.buildSingle(normalized[relationship], resourceType); + } + } + }); + + const constructor = getMapsTo(normalized.constructor); + return Object.assign(new constructor(), normalized, links); + } } diff --git a/src/app/core/cache/models/normalized-bitstream.model.ts b/src/app/core/cache/models/normalized-bitstream.model.ts index b6b1302f79..6ef6996b6e 100644 --- a/src/app/core/cache/models/normalized-bitstream.model.ts +++ b/src/app/core/cache/models/normalized-bitstream.model.ts @@ -1,6 +1,9 @@ import { inheritSerialization } from "cerialize"; import { NormalizedDSpaceObject } from "./normalized-dspace-object.model"; +import { Bitstream } from "../../shared/bitstream.model"; +import { mapsTo } from "../builders/build-decorators"; +@mapsTo(Bitstream) @inheritSerialization(NormalizedDSpaceObject) export class NormalizedBitstream extends NormalizedDSpaceObject { diff --git a/src/app/core/cache/models/normalized-bundle.model.ts b/src/app/core/cache/models/normalized-bundle.model.ts index 9eed7cf033..834fd770f6 100644 --- a/src/app/core/cache/models/normalized-bundle.model.ts +++ b/src/app/core/cache/models/normalized-bundle.model.ts @@ -1,12 +1,17 @@ import { autoserialize, inheritSerialization } from "cerialize"; import { NormalizedDSpaceObject } from "./normalized-dspace-object.model"; +import { Bundle } from "../../shared/bundle.model"; +import { mapsTo, relationship } from "../builders/build-decorators"; +import { NormalizedBitstream } from "./normalized-bitstream.model"; +@mapsTo(Bundle) @inheritSerialization(NormalizedDSpaceObject) export class NormalizedBundle extends NormalizedDSpaceObject { /** * The primary bitstream of this Bundle */ @autoserialize + @relationship(NormalizedBitstream) primaryBitstream: string; /** @@ -20,5 +25,6 @@ export class NormalizedBundle extends NormalizedDSpaceObject { owner: string; @autoserialize + @relationship(NormalizedBitstream) bitstreams: Array; } diff --git a/src/app/core/cache/models/normalized-collection.model.ts b/src/app/core/cache/models/normalized-collection.model.ts index 74f29150b2..0584646ccb 100644 --- a/src/app/core/cache/models/normalized-collection.model.ts +++ b/src/app/core/cache/models/normalized-collection.model.ts @@ -1,6 +1,10 @@ import { autoserialize, inheritSerialization, autoserializeAs } from "cerialize"; import { NormalizedDSpaceObject } from "./normalized-dspace-object.model"; +import { Collection } from "../../shared/collection.model"; +import { mapsTo, relationship } from "../builders/build-decorators"; +import { NormalizedItem } from "./normalized-item.model"; +@mapsTo(Collection) @inheritSerialization(NormalizedDSpaceObject) export class NormalizedCollection extends NormalizedDSpaceObject { @@ -26,6 +30,7 @@ export class NormalizedCollection extends NormalizedDSpaceObject { owner: string; @autoserialize + @relationship(NormalizedItem) items: Array; } diff --git a/src/app/core/cache/models/normalized-item.model.ts b/src/app/core/cache/models/normalized-item.model.ts index 53f44e2eb3..9e1dca1a12 100644 --- a/src/app/core/cache/models/normalized-item.model.ts +++ b/src/app/core/cache/models/normalized-item.model.ts @@ -1,6 +1,10 @@ import { inheritSerialization, autoserialize } from "cerialize"; import { NormalizedDSpaceObject } from "./normalized-dspace-object.model"; +import { Item } from "../../shared/item.model"; +import { mapsTo, relationship } from "../builders/build-decorators"; +import { NormalizedBundle } from "./normalized-bundle.model"; +@mapsTo(Item) @inheritSerialization(NormalizedDSpaceObject) export class NormalizedItem extends NormalizedDSpaceObject { @@ -36,5 +40,6 @@ export class NormalizedItem extends NormalizedDSpaceObject { owner: string; @autoserialize + @relationship(NormalizedBundle) bundles: Array; } diff --git a/src/app/core/cache/object-cache.service.spec.ts b/src/app/core/cache/object-cache.service.spec.ts index 827e39ab7e..d380829452 100644 --- a/src/app/core/cache/object-cache.service.spec.ts +++ b/src/app/core/cache/object-cache.service.spec.ts @@ -57,12 +57,12 @@ describe("ObjectCacheService", () => { }); describe("get", () => { - it("should return an observable of the cached object with the specified UUID and type", () => { + it("should return an observable of the cached object with the specified UUID", () => { spyOn(store, 'select').and.returnValue(Observable.of(cacheEntry)); let testObj: any; //due to the implementation of spyOn above, this subscribe will be synchronous - service.get(uuid, TestClass).take(1).subscribe(o => testObj = o); + service.get(uuid).take(1).subscribe(o => testObj = o); expect(testObj.uuid).toBe(uuid); expect(testObj.foo).toBe("bar"); // this only works if testObj is an instance of TestClass @@ -73,18 +73,18 @@ describe("ObjectCacheService", () => { spyOn(store, 'select').and.returnValue(Observable.of(invalidCacheEntry)); let getObsHasFired = false; - const subscription = service.get(uuid, TestClass).subscribe(o => getObsHasFired = true); + const subscription = service.get(uuid).subscribe(o => getObsHasFired = true); expect(getObsHasFired).toBe(false); subscription.unsubscribe(); }); }); describe("getList", () => { - it("should return an observable of the array of cached objects with the specified UUID and type", () => { + it("should return an observable of the array of cached objects with the specified UUID", () => { spyOn(service, 'get').and.returnValue(Observable.of(new TestClass(uuid, "bar"))); let testObjs: Array; - service.getList([uuid, uuid], TestClass).take(1).subscribe(arr => testObjs = arr); + service.getList([uuid, uuid]).take(1).subscribe(arr => testObjs = arr); expect(testObjs[0].uuid).toBe(uuid); expect(testObjs[0].foo).toBe("bar"); expect(testObjs[0].test()).toBe("bar" + uuid); diff --git a/src/app/core/cache/object-cache.service.ts b/src/app/core/cache/object-cache.service.ts index ec0bea4a97..b801421ce3 100644 --- a/src/app/core/cache/object-cache.service.ts +++ b/src/app/core/cache/object-cache.service.ts @@ -4,7 +4,6 @@ import { ObjectCacheState, ObjectCacheEntry, CacheableObject } from "./object-ca import { AddToObjectCacheAction, RemoveFromObjectCacheAction } from "./object-cache.actions"; import { Observable } from "rxjs"; import { hasNoValue } from "../../shared/empty.util"; -import { GenericConstructor } from "../shared/generic-constructor"; /** * A service to interact with the object cache @@ -40,53 +39,34 @@ export class ObjectCacheService { /** * Get an observable of the object with the specified UUID * - * The type needs to be specified as well, in order to turn - * the cached plain javascript object in to an instance of - * a class. - * - * e.g. get('c96588c6-72d3-425d-9d47-fa896255a695', Item) - * * @param uuid * The UUID of the object to get - * @param type - * The type of the object to get * @return Observable * An observable of the requested object */ - get(uuid: string, type: GenericConstructor): Observable { + get(uuid: string): Observable { return this.store.select('core', 'cache', 'object', uuid) .filter(entry => this.isValid(entry)) .distinctUntilChanged() - .map((entry: ObjectCacheEntry) => Object.assign(new type(), entry.data)); + .map((entry: ObjectCacheEntry) => entry.data); } - getBySelfLink(href: string, type: GenericConstructor): Observable { + getBySelfLink(href: string): Observable { return this.store.select('core', 'index', 'href', href) - .flatMap((uuid: string) => this.get(uuid, type)) + .flatMap((uuid: string) => this.get(uuid)) } /** - * Get an observable for an array of objects of the same type + * Get an observable for an array of objects * with the specified UUIDs * - * The type needs to be specified as well, in order to turn - * the cached plain javascript object in to an instance of - * a class. - * - * e.g. getList([ - * 'c96588c6-72d3-425d-9d47-fa896255a695', - * 'cff860da-cf5f-4fda-b8c9-afb7ec0b2d9e' - * ], Collection) - * * @param uuids * An array of UUIDs of the objects to get - * @param type - * The type of the objects to get * @return Observable> */ - getList(uuids: Array, type: GenericConstructor): Observable> { + getList(uuids: Array): Observable> { return Observable.combineLatest( - uuids.map((id: string) => this.get(id, type)) + uuids.map((id: string) => this.get(id)) ); } diff --git a/src/app/core/data/collection-data.service.ts b/src/app/core/data/collection-data.service.ts index 882f7db5a5..232345d2be 100644 --- a/src/app/core/data/collection-data.service.ts +++ b/src/app/core/data/collection-data.service.ts @@ -8,8 +8,6 @@ import { NormalizedCollection } from "../cache/models/normalized-collection.mode import { CoreState } from "../core.reducers"; import { RequestService } from "./request.service"; import { RemoteDataBuildService } from "../cache/builders/remote-data-build.service"; -import { DomainModelBuilder } from "../cache/builders/domain-model-builder"; -import { CollectionBuilder } from "../cache/builders/collection-builder"; @Injectable() export class CollectionDataService extends DataService { @@ -25,7 +23,4 @@ export class CollectionDataService extends DataService { protected abstract objectCache: ObjectCacheService; @@ -24,8 +23,6 @@ export abstract class DataService } - protected abstract getDomainModelBuilder(): DomainModelBuilder; - protected getFindAllHref(scopeID?): string { let result = this.endpoint; if (hasValue(scopeID)) { @@ -41,7 +38,8 @@ export abstract class DataService this.store.dispatch(new RequestConfigureAction(request)); this.store.dispatch(new RequestExecuteAction(href)); } - return this.rdbService.buildList(href, this.normalizedResourceType, this.getDomainModelBuilder()) + return this.rdbService.buildList(href, this.normalizedResourceType); + // return this.rdbService.buildList(href); } protected getFindByIDHref(resourceID): string { @@ -55,7 +53,8 @@ export abstract class DataService this.store.dispatch(new RequestConfigureAction(request)); this.store.dispatch(new RequestExecuteAction(href)); } - return this.rdbService.buildSingle(href, this.normalizedResourceType, this.getDomainModelBuilder()) + return this.rdbService.buildSingle(href, this.normalizedResourceType); + // return this.rdbService.buildSingle(href); } findByHref(href: string): RemoteData { @@ -64,7 +63,8 @@ export abstract class DataService this.store.dispatch(new RequestConfigureAction(request)); this.store.dispatch(new RequestExecuteAction(href)); } - return this.rdbService.buildSingle(href, this.normalizedResourceType, this.getDomainModelBuilder()) + return this.rdbService.buildSingle(href, this.normalizedResourceType); + // return this.rdbService.buildSingle(href)); } } diff --git a/src/app/core/data/item-data.service.ts b/src/app/core/data/item-data.service.ts index 1e764f5bb4..fc13999f37 100644 --- a/src/app/core/data/item-data.service.ts +++ b/src/app/core/data/item-data.service.ts @@ -8,7 +8,6 @@ import { CoreState } from "../core.reducers"; import { NormalizedItem } from "../cache/models/normalized-item.model"; import { RequestService } from "./request.service"; import { RemoteDataBuildService } from "../cache/builders/remote-data-build.service"; -import { ItemBuilder } from "../cache/builders/item-builder"; @Injectable() export class ItemDataService extends DataService { @@ -23,8 +22,4 @@ export class ItemDataService extends DataService { ) { super(NormalizedItem); } - - protected getDomainModelBuilder(): ItemBuilder { - return new ItemBuilder(this.requestService, this.rdbService); - } } diff --git a/src/app/core/data/request.service.ts b/src/app/core/data/request.service.ts index 03b7f1ffd8..b3b28af2c2 100644 --- a/src/app/core/data/request.service.ts +++ b/src/app/core/data/request.service.ts @@ -5,10 +5,10 @@ import { Request } from "./request.models"; import { hasValue } from "../../shared/empty.util"; import { Observable } from "rxjs/Observable"; import { RequestConfigureAction, RequestExecuteAction } from "./request.actions"; -import { GenericConstructor } from "../shared/generic-constructor"; import { ResponseCacheService } from "../cache/response-cache.service"; import { ObjectCacheService } from "../cache/object-cache.service"; import { CacheableObject } from "../cache/object-cache.reducer"; +import { GenericConstructor } from "../shared/generic-constructor"; @Injectable() export class RequestService { diff --git a/src/app/core/shared/bitstream.model.ts b/src/app/core/shared/bitstream.model.ts index 43217a1292..acceaa38f0 100644 --- a/src/app/core/shared/bitstream.model.ts +++ b/src/app/core/shared/bitstream.model.ts @@ -1,8 +1,6 @@ -import { inheritSerialization } from "cerialize"; import { DSpaceObject } from "./dspace-object.model"; import { Bundle } from "./bundle.model"; -@inheritSerialization(DSpaceObject) export class Bitstream extends DSpaceObject { /** diff --git a/src/backend/bundles.ts b/src/backend/bundles.ts index fde6409635..9ec0630dbd 100644 --- a/src/backend/bundles.ts +++ b/src/backend/bundles.ts @@ -8,7 +8,7 @@ export const BUNDLES = [ "bitstreams": [ { "href": "/bitstreams/3678" }, ], - "primaryBitstream": { "href": "/bitstreams/43c57c2b-206f-4645-8c8f-5f10c84b09fa" } + "primaryBitstream": { "href": "/bitstreams/3678" } }, "id": "2355", "uuid": "35e0606d-5e18-4f9c-aa61-74fc751cc3f9", @@ -26,7 +26,7 @@ export const BUNDLES = [ "bitstreams": [ { "href": "/bitstreams/8842" }, ], - "primaryBitstream": { "href": "/bitstreams/1a013ecc-fb25-4689-a44f-f1383ad26632" } + "primaryBitstream": { "href": "/bitstreams/8842" } }, "id": "5687", "uuid": "a469c57a-abcf-45c3-83e4-b187ebd708fd",