diff --git a/src/app/core/data-services/collection/collection-data.effects.ts b/src/app/core/data-services/collection/collection-data.effects.ts index 2b2d468a5c..9a8651944e 100644 --- a/src/app/core/data-services/collection/collection-data.effects.ts +++ b/src/app/core/data-services/collection/collection-data.effects.ts @@ -48,19 +48,13 @@ export class CollectionDataEffects { @Effect() findById$ = this.actions$ .ofType(CollectionFindSingleActionTypes.FIND_BY_ID_REQUEST) .switchMap(action => { - if (this.cache.has(action.payload)) { - return this.cache.get(action.payload) - .map(collection => new CollectionFindByIdSuccessAction(collection.uuid)); - } - else { - return this.restApi.get(`/collections/${action.payload}`) - .map((data: DSpaceRESTV2Response) => new DSpaceRESTv2Serializer(Collection).deserialize(data)) - .do((collection: Collection) => { - this.cache.add(collection, GlobalConfig.cache.msToLive); - }) - .map((collection: Collection) => new CollectionFindByIdSuccessAction(collection.uuid)) - .catch((errorMsg: string) => Observable.of(new CollectionFindByIdErrorAction(errorMsg))); - } + return this.restApi.get(`/collections/${action.payload}`) + .map((data: DSpaceRESTV2Response) => new DSpaceRESTv2Serializer(Collection).deserialize(data)) + .do((collection: Collection) => { + this.cache.add(collection, GlobalConfig.cache.msToLive); + }) + .map((collection: Collection) => new CollectionFindByIdSuccessAction(collection.uuid)) + .catch((errorMsg: string) => Observable.of(new CollectionFindByIdErrorAction(errorMsg))); }); } diff --git a/src/app/core/data-services/item/item-data.effects.ts b/src/app/core/data-services/item/item-data.effects.ts index 63336df3e9..a8ccf9f223 100644 --- a/src/app/core/data-services/item/item-data.effects.ts +++ b/src/app/core/data-services/item/item-data.effects.ts @@ -48,19 +48,13 @@ export class ItemDataEffects { @Effect() findById$ = this.actions$ .ofType(ItemFindSingleActionTypes.FIND_BY_ID_REQUEST) .switchMap(action => { - if (this.cache.has(action.payload)) { - return this.cache.get(action.payload) - .map(item => new ItemFindByIdSuccessAction(item.uuid)); - } - else { - return this.restApi.get(`/items/${action.payload}`) - .map((data: DSpaceRESTV2Response) => new DSpaceRESTv2Serializer(Item).deserialize(data)) - .do((item: Item) => { - this.cache.add(item, GlobalConfig.cache.msToLive); - }) - .map((item: Item) => new ItemFindByIdSuccessAction(item.uuid)) - .catch((errorMsg: string) => Observable.of(new ItemFindByIdErrorAction(errorMsg))); - } + return this.restApi.get(`/items/${action.payload}`) + .map((data: DSpaceRESTV2Response) => new DSpaceRESTv2Serializer(Item).deserialize(data)) + .do((item: Item) => { + this.cache.add(item, GlobalConfig.cache.msToLive); + }) + .map((item: Item) => new ItemFindByIdSuccessAction(item.uuid)) + .catch((errorMsg: string) => Observable.of(new ItemFindByIdErrorAction(errorMsg))); }); } diff --git a/src/app/core/shared/dspace-object.model.ts b/src/app/core/shared/dspace-object.model.ts index 9f48b7ca45..d9197db2b4 100644 --- a/src/app/core/shared/dspace-object.model.ts +++ b/src/app/core/shared/dspace-object.model.ts @@ -9,11 +9,17 @@ import { CacheableObject } from "../data-services/cache/cache.reducer"; export abstract class DSpaceObject implements CacheableObject { /** - * The identifier of this DSpaceObject + * The human-readable identifier of this DSpaceObject */ @autoserialize id: string; + /** + * The universally unique identifier of this DSpaceObject + */ + @autoserialize + uuid: string; + /** * A string representing the kind of DSpaceObject, e.g. community, item, … */ @@ -65,12 +71,4 @@ export abstract class DSpaceObject implements CacheableObject { return undefined; } } - - get uuid(): string { - return this.id; - } - - set uuid(val: string) { - this.id = val; - } } diff --git a/src/backend/bitstreams.ts b/src/backend/bitstreams.ts index b6a0076b7f..480a0b4b55 100644 --- a/src/backend/bitstreams.ts +++ b/src/backend/bitstreams.ts @@ -5,7 +5,8 @@ export const BITSTREAMS = [ "bundle": { "href": "/bundles/35e0606d-5e18-4f9c-aa61-74fc751cc3f9" }, "retrieve": { "href": "/bitstreams/43c57c2b-206f-4645-8c8f-5f10c84b09fa/retrieve" } }, - "id": "43c57c2b-206f-4645-8c8f-5f10c84b09fa", + "id": "3678", + "uuid": "43c57c2b-206f-4645-8c8f-5f10c84b09fa", "name": "do_open_access_CRL.pdf", "size": 636626, "checksum": { @@ -25,7 +26,8 @@ export const BITSTREAMS = [ "bundle": { "href": "/bundles/a469c57a-abcf-45c3-83e4-b187ebd708fd" }, "retrieve": { "href": "/rest/bitstreams/1a013ecc-fb25-4689-a44f-f1383ad26632/retrieve" } }, - "id": "1a013ecc-fb25-4689-a44f-f1383ad26632", + "id": "8842", + "uuid": "1a013ecc-fb25-4689-a44f-f1383ad26632", "name": "do_open_access_CRL.pdf.jpg", "size": 41183, "checksum": { diff --git a/src/backend/bundles.ts b/src/backend/bundles.ts index 1b06110e61..01e8f07002 100644 --- a/src/backend/bundles.ts +++ b/src/backend/bundles.ts @@ -3,14 +3,15 @@ export const BUNDLES = [ "_links": { "self": { "href": "/bundles/35e0606d-5e18-4f9c-aa61-74fc751cc3f9" }, "items": [ - { "href": "/items/21539b1d-9ef1-4eda-9c77-49565b5bfb78" } + { "href": "/items/8871" } ], "bitstreams": [ { "href": "/bitstreams/43c57c2b-206f-4645-8c8f-5f10c84b09fa" }, ], "primaryBitstream": { "href": "/bitstreams/43c57c2b-206f-4645-8c8f-5f10c84b09fa" } }, - "id": "35e0606d-5e18-4f9c-aa61-74fc751cc3f9", + "id": "2355", + "uuid": "35e0606d-5e18-4f9c-aa61-74fc751cc3f9", "name": "ORIGINAL", "metadata": [ { "key": "dc.title", "value": "ORIGINAL", "language": "en" } @@ -20,14 +21,15 @@ export const BUNDLES = [ "_links": { "self": { "href": "/bundles/a469c57a-abcf-45c3-83e4-b187ebd708fd" }, "items": [ - { "href": "/items/21539b1d-9ef1-4eda-9c77-49565b5bfb78" } + { "href": "/items/8871" } ], "bitstreams": [ { "href": "/bitstreams/1a013ecc-fb25-4689-a44f-f1383ad26632" }, ], "primaryBitstream": { "href": "/bitstreams/1a013ecc-fb25-4689-a44f-f1383ad26632" } }, - "id": "a469c57a-abcf-45c3-83e4-b187ebd708fd", + "id": "5687", + "uuid": "a469c57a-abcf-45c3-83e4-b187ebd708fd", "name": "THUMBNAIL", "metadata": [ { "key": "dc.title", "value": "THUMBNAIL", "language": "en" } diff --git a/src/backend/collections.ts b/src/backend/collections.ts index b29fa07e16..1149d244f8 100644 --- a/src/backend/collections.ts +++ b/src/backend/collections.ts @@ -1,13 +1,14 @@ export const COLLECTIONS = [ { "_links": { - "self": { "href": "/collections/9e32a2e2-6b91-4236-a361-995ccdc14c60" }, + "self": { "href": "/collections/5179" }, "items": [ - { "href": "/items/21539b1d-9ef1-4eda-9c77-49565b5bfb78" }, - { "href": "/items/be8325f7-243b-49f4-8a4b-df2b793ff3b5" } + { "href": "/items/8871" }, + { "href": "/items/9978" } ] }, - "id": "9e32a2e2-6b91-4236-a361-995ccdc14c60", + "id": "5179", + "uuid": "9e32a2e2-6b91-4236-a361-995ccdc14c60", "name": "A Test Collection", "handle": "123456789/5179", "metadata": [ @@ -35,13 +36,14 @@ export const COLLECTIONS = [ }, { "_links": { - "self": { "href": "/collections/598ce822-c357-46f3-ab70-63724d02d6ad" }, + "self": { "href": "/collections/6547" }, "items": [ - { "href": "/items/21539b1d-9ef1-4eda-9c77-49565b5bfb78" }, - { "href": "/items/be8325f7-243b-49f4-8a4b-df2b793ff3b5" } + { "href": "/items/8871" }, + { "href": "/items/9978" } ] }, - "id": "598ce822-c357-46f3-ab70-63724d02d6ad", + "id": "6547", + "uuid": "598ce822-c357-46f3-ab70-63724d02d6ad", "name": "Another Test Collection", "handle": "123456789/6547", "metadata": [ diff --git a/src/backend/items.ts b/src/backend/items.ts index 46698c3bc0..290e2b96aa 100644 --- a/src/backend/items.ts +++ b/src/backend/items.ts @@ -2,14 +2,14 @@ export const ITEMS = [ { "_links": { "self": { - "href": "/items/21539b1d-9ef1-4eda-9c77-49565b5bfb78" + "href": "/items/8871" }, "collections": [ { - "href": "/collections/9e32a2e2-6b91-4236-a361-995ccdc14c60" + "href": "/collections/5179" }, { - "href": "/collections/598ce822-c357-46f3-ab70-63724d02d6ad" + "href": "/collections/6547" } ], "bundles": [ @@ -21,7 +21,8 @@ export const ITEMS = [ } ] }, - "id": "21539b1d-9ef1-4eda-9c77-49565b5bfb78", + "id": "8871", + "uuid": "21539b1d-9ef1-4eda-9c77-49565b5bfb78", "name": "Do Open-Access Articles Have a Greater Research Impact?", "handle": "123456789/8871", "lastModified": "2016-10-14 10:41:12.886", @@ -93,14 +94,14 @@ export const ITEMS = [ { "_links": { "self": { - "href": "/items/be8325f7-243b-49f4-8a4b-df2b793ff3b5" + "href": "/items/9978" }, "collections": [ { - "href": "/collections/9e32a2e2-6b91-4236-a361-995ccdc14c60" + "href": "/collections/5179" }, { - "href": "/collections/598ce822-c357-46f3-ab70-63724d02d6ad" + "href": "/collections/6547" } ], "bundles": [ @@ -112,7 +113,8 @@ export const ITEMS = [ } ] }, - "id": "be8325f7-243b-49f4-8a4b-df2b793ff3b5", + "id": "9978", + "uuid": "be8325f7-243b-49f4-8a4b-df2b793ff3b5", "name": "Another Test Item", "handle": "123456789/9978", "lastModified": "2016-05-27 03:00:20.063",