mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-17 23:13:04 +00:00
40416: small fixes and thumbnails
This commit is contained in:
@@ -3,42 +3,62 @@ import { DSpaceObject } from "./dspace-object.model";
|
||||
import { Collection } from "./collection.model";
|
||||
import { RemoteData } from "../data/remote-data";
|
||||
import { Bundle } from "./bundle.model";
|
||||
import { Bitstream } from "./bitstream.model";
|
||||
import { Observable } from "rxjs";
|
||||
|
||||
@inheritSerialization(DSpaceObject)
|
||||
export class Item extends DSpaceObject {
|
||||
|
||||
/**
|
||||
* A string representing the unique handle of this Item
|
||||
*/
|
||||
@autoserialize
|
||||
handle: string;
|
||||
/**
|
||||
* A string representing the unique handle of this Item
|
||||
*/
|
||||
@autoserialize
|
||||
handle: string;
|
||||
|
||||
/**
|
||||
* The Date of the last modification of this Item
|
||||
*/
|
||||
lastModified: Date;
|
||||
/**
|
||||
* The Date of the last modification of this Item
|
||||
*/
|
||||
lastModified: Date;
|
||||
|
||||
/**
|
||||
* A boolean representing if this Item is currently archived or not
|
||||
*/
|
||||
isArchived: boolean;
|
||||
/**
|
||||
* A boolean representing if this Item is currently archived or not
|
||||
*/
|
||||
isArchived: boolean;
|
||||
|
||||
/**
|
||||
* A boolean representing if this Item is currently withdrawn or not
|
||||
*/
|
||||
isWithdrawn: boolean;
|
||||
/**
|
||||
* A boolean representing if this Item is currently withdrawn or not
|
||||
*/
|
||||
isWithdrawn: boolean;
|
||||
|
||||
/**
|
||||
* An array of Collections that are direct parents of this Item
|
||||
*/
|
||||
@autoserializeAs(Collection)
|
||||
parents: Array<Collection>;
|
||||
/**
|
||||
* An array of Collections that are direct parents of this Item
|
||||
*/
|
||||
@autoserializeAs(Collection)
|
||||
parents: Array<Collection>;
|
||||
|
||||
/**
|
||||
* The Collection that owns this Item
|
||||
*/
|
||||
owner: Collection;
|
||||
/**
|
||||
* The Collection that owns this Item
|
||||
*/
|
||||
owner: Collection;
|
||||
|
||||
bundles: Array<RemoteData<Bundle>>
|
||||
bundles: Array<RemoteData<Bundle>>;
|
||||
|
||||
getThumbnail(): Observable<Bitstream> {
|
||||
const bundle: Observable<Bundle> = this.getBundle("THUMBNAIL");
|
||||
return bundle.flatMap(
|
||||
b => b.primaryBitstream.payload
|
||||
);
|
||||
}
|
||||
|
||||
getBundle(name: String): Observable<Bundle> {
|
||||
return Observable.combineLatest(
|
||||
...this.bundles.map(b => b.payload),
|
||||
(...bundles: Array<Bundle>) => bundles)
|
||||
.map(bundles => {
|
||||
return bundles.find((bundle: Bundle) => {
|
||||
return bundle.name === name
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user