40416: normalized collection bug

This commit is contained in:
Lotte Hofstede
2017-05-05 10:21:33 +02:00
parent 25ef735366
commit 54cd529cc6
24 changed files with 148 additions and 38 deletions

View File

@@ -33,8 +33,7 @@ export class Item extends DSpaceObject {
/**
* An array of Collections that are direct parents of this Item
*/
@autoserializeAs(Collection)
parents: Array<Collection>;
parents: Array<RemoteData<Collection>>;
/**
* The Collection that owns this Item
@@ -50,14 +49,8 @@ export class Item extends DSpaceObject {
);
}
getFiles(): Array<Observable<Bitstream>> {
return this.getBundle("ORIGINAL").map(bundle => bundle.bitstreams.map(bitstream => bitstream.payload.flatMap(b => b))).;
// const bundle: Observable<Bundle> = this.getBundle("ORIGINAL");
// return bundle.map(
// bundle => bundle.bitstreams.flatMap(
// bitstream => bitstream.payload
// )
// );
getFiles(): Observable<Array<Observable<Bitstream>>> {
return this.getBundle("ORIGINAL").map(bundle => bundle.bitstreams.map(bitstream => bitstream.payload));
}
getBundle(name: String): Observable<Bundle> {
@@ -71,4 +64,8 @@ export class Item extends DSpaceObject {
});
}
getCollections(): Array<Observable<Collection>> {
return this.parents.map(c => c.payload.map(p => p));
}
}