src/lib/model/prepared-item.model.ts
Representation of a prepared item. A prepared item is an item that is supposed to create a new dms object. Adding a new object to yuuvis® RAD starts with a prepared item. If all the required properties are set up, the item will be used to create a new dms object.
Properties |
Methods |
constructor(json: any)
|
||||||||
Defined in src/lib/model/prepared-item.model.ts:182
|
||||||||
Creates a new instance
Parameters :
|
contentcount |
contentcount:
|
Type : number
|
Defined in src/lib/model/prepared-item.model.ts:111
|
Number of contents (files) attached to the item. |
contents |
contents:
|
Type : PreparedItemContent[]
|
Defined in src/lib/model/prepared-item.model.ts:172
|
Prepared items are able to perform bulk operations to create new dms objects. So you may add a bunch of files and decide to create one prepared item from it. When all the required properties are set up, the prepared item will create a dms object for each of those files. Contents property holds the list of content files attached to the prepared item |
created |
created:
|
Type : Date
|
Defined in src/lib/model/prepared-item.model.ts:107
|
The date (time) the item was created |
id |
id:
|
Type : string
|
Defined in src/lib/model/prepared-item.model.ts:103
|
unique identifier |
parent |
parent:
|
Type : literal type
|
Defined in src/lib/model/prepared-item.model.ts:124
|
Location (context folder) to add the item to. |
selectedtype |
selectedtype:
|
Type : literal type
|
Defined in src/lib/model/prepared-item.model.ts:153
|
The target object type selected for the prepared item. To be able to add new items to yuuvis® RAD an object type is required to be set up. |
state |
state:
|
Type : literal type
|
Defined in src/lib/model/prepared-item.model.ts:133
|
The state of the prepared item |
template |
template:
|
Type : literal type
|
Defined in src/lib/model/prepared-item.model.ts:161
|
New dms objects may be created from a template. This property stores information about the selected template. |
types |
types:
|
Type : PreparedItemType[]
|
Defined in src/lib/model/prepared-item.model.ts:176
|
Based on target location and attached files this property holds a collection of valid object types for the prepared item |
user |
user:
|
Type : literal type
|
Defined in src/lib/model/prepared-item.model.ts:116
|
Information about the user that created the item |
getSelectedTypeObject |
getSelectedTypeObject()
|
Defined in src/lib/model/prepared-item.model.ts:204
|
Retrieves the prepared items selected type object from the list of available types.
Returns :
any
The type object that is selected or NULL |
hasContent |
hasContent()
|
Defined in src/lib/model/prepared-item.model.ts:195
|
Returns true if the preparedItem contains content (template or actual file), false otherwise
Returns :
boolean
|
title |
gettitle()
|
Defined in src/lib/model/prepared-item.model.ts:180
|
Prepared items title |
export interface PreparedItemTemplate {
/**
* Templates ID
*/
id: string;
/**
* Templates Title
*/
title: string;
/**
* Templates description
*/
description: string;
types: string[];
content: {
path: string;
size: number;
mimegroup: string;
mimetype: string;
digest: string;
};
/**
* Tags describing the template
*/
tags: string[]
}
/**
* File (content) attached to a prepared item
*/
export interface PreparedItemContent {
/**
* The contents mime type group
*/
mimegroup: string;
/**
* The contents actual mime type
*/
mimetype: string;
/**
* Path to the content entry
*/
path: string;
/**
* Contents filesize in bytes
*/
size: number;
digest: string;
existscount: number;
}
/**
* Valid object type to be applied to a certain prepared item
*/
export interface PreparedItemType {
/**
* Object types internal name
*/
name: string;
/**
* Indicator whether or not the type is currently selected
*/
selected: boolean;
/**
* Object types label (title)
*/
label: string;
/**
* Object types description
*/
description: string;
/**
* Object types icon
*/
icon: {
id: string;
};
/**
* Input form for the object typed
*/
form: any;
/**
* Data to be pasted into the object types form. This data may come from default values or extraction services.
*/
data: any;
}
/**
* Representation of a prepared item. A prepared item is an item that is supposed to create a new dms object.
* Adding a new object to yuuvis<sup>®</sup> RAD starts with a prepared item. If all the required properties are set up, the item
* will be used to create a new dms object.
*/
export class PreparedItem {
/**
* unique identifier
*/
id: string;
/**
* The date (time) the item was created
*/
created: Date;
/**
* Number of contents (files) attached to the item.
*/
contentcount: number;
/**
* Information about the user that created the item
*/
user: {
id: string;
name: string;
title: string;
};
/**
* Location (context folder) to add the item to.
*/
parent: {
id: string;
title: string;
description: string;
type: string;
};
/**
* The state of the prepared item
*/
state: {
/**
* UNKNOWN: no object type selected yet, so we don't know which kind of content is supported
* NOCONTENTALLOWED: no content attachable
* REQUIRED: content required (e.g. for template types)
* OPTIONAL: one may or may not add content
*/
contentstate: 'UNKNOWN' | 'NOCONTENTALLOWED' | 'REQUIRED' | 'OPTIONAL',
typeselected: boolean,
typeselectedallowed: boolean,
hasallowedtypes: boolean,
contentset: boolean,
multicontent: boolean,
templateset: boolean,
parentisroot: boolean,
parentset: boolean
};
/**
* The target object type selected for the prepared item. To be able to add new items to yuuvis<sup>®</sup> RAD an object type is required to be set up.
*/
selectedtype: {
name: string,
label: string,
description: string,
};
/**
* New dms objects may be created from a template. This property stores information about the selected template.
*/
template: {
id: string,
description: string,
title: string,
};
/**
* Prepared items are able to perform bulk operations to create new dms objects. So you may add a bunch of files and decide to create one
* prepared item from it. When all the required properties are set up, the prepared item will create a dms object for each of those files.
*
* Contents property holds the list of content files attached to the prepared item
*/
contents: PreparedItemContent[];
/**
* Based on target location and attached files this property holds a collection of valid object types for the prepared item
*/
types: PreparedItemType[];
/**
* Prepared items title
*/
get title() {
return this.selectedtype ? this.selectedtype.label : '';
}
/**
* Creates a new instance
* @param json The JSON object received from the backend. This will be used to construct the new prepared item instance
*/
constructor(json: any) {
Object.assign(this, json);
}
/**
* Returns true if the preparedItem contains content (template or actual file), false otherwise
*/
hasContent(): boolean {
return !!this.template || this.contentcount > 0;
}
/**
* Retrieves the prepared items selected type object from the list
* of available types.
* @returns The type object that is selected or NULL
*/
getSelectedTypeObject() {
return this.types.find(t => t.selected);
}
}