src/lib/model/inbox-item.model.ts
Items emitted by the inbox service
Properties |
|
Methods |
constructor(json: any)
|
||||||||
Defined in src/lib/model/inbox-item.model.ts:54
|
||||||||
Creates a new instance
Parameters :
|
accepted |
accepted:
|
Type : boolean
|
Defined in src/lib/model/inbox-item.model.ts:41
|
Flag indicating whether or not the entry has been accepted |
description |
description:
|
Type : string
|
Defined in src/lib/model/inbox-item.model.ts:23
|
Items description |
duetime |
duetime:
|
Type : Date
|
Defined in src/lib/model/inbox-item.model.ts:49
|
The date the item is due. |
iconId |
iconId:
|
Type : string
|
Defined in src/lib/model/inbox-item.model.ts:37
|
Items icon ID |
id |
id:
|
Type : string
|
Defined in src/lib/model/inbox-item.model.ts:15
|
Items ID |
isdeputy |
isdeputy:
|
Type : boolean
|
Defined in src/lib/model/inbox-item.model.ts:45
|
Flag indicating that the current user got this task in substitute |
received |
received:
|
Type : Date
|
Defined in src/lib/model/inbox-item.model.ts:53
|
The date the item was received |
sourceId |
sourceId:
|
Type : string
|
Defined in src/lib/model/inbox-item.model.ts:33
|
ID of the object that caused the inbox entry. In case of type SUBSCRIPTION and RESUBMISSION this is the id of the dms object, for type BPM it is a process id |
target |
target:
|
Type : any
|
Defined in src/lib/model/inbox-item.model.ts:54
|
title |
title:
|
Type : string
|
Defined in src/lib/model/inbox-item.model.ts:19
|
Items title |
type |
type:
|
Type : string
|
Defined in src/lib/model/inbox-item.model.ts:27
|
Items type ('BPM', 'RESUBMISSION', 'SUBSCRIPTION') |
Static TYPE_BPM |
TYPE_BPM:
|
Type : string
|
Default value : 'BPM'
|
Defined in src/lib/model/inbox-item.model.ts:8
|
Static TYPE_RESUBMISSION |
TYPE_RESUBMISSION:
|
Type : string
|
Default value : 'RESUBMISSION'
|
Defined in src/lib/model/inbox-item.model.ts:9
|
Static TYPE_SUBSCRIPTION |
TYPE_SUBSCRIPTION:
|
Type : string
|
Default value : 'SUBSCRIPTION'
|
Defined in src/lib/model/inbox-item.model.ts:10
|
isOverdue |
isOverdue()
|
Defined in src/lib/model/inbox-item.model.ts:81
|
Determines whether or not the inbox item is overdue
Returns :
any
True when inbox item is overdue, false otherwise |
import moment from 'moment';
/**
* Items emitted by the inbox service
*/
export class InboxItem {
public static TYPE_BPM = 'BPM';
public static TYPE_RESUBMISSION = 'RESUBMISSION';
public static TYPE_SUBSCRIPTION = 'SUBSCRIPTION';
/**
* Items ID
*/
id: string;
/**
* Items title
*/
title: string;
/**
* Items description
*/
description: string;
/**
* Items type ('BPM', 'RESUBMISSION', 'SUBSCRIPTION')
*/
type: string;
/**
* ID of the object that caused the inbox entry.
* In case of type SUBSCRIPTION and RESUBMISSION this is the id of the dms object,
* for type BPM it is a process id
*/
sourceId: string;
/**
* Items icon ID
*/
iconId: string;
/**
* Flag indicating whether or not the entry has been accepted
*/
accepted: boolean;
/**
* Flag indicating that the current user got this task in substitute
*/
isdeputy: boolean;
/**
* The date the item is due.
*/
duetime: Date;
/**
* The date the item was received
*/
received: Date;
target: any;
/**
* Creates a new instance
* @param json The JSON object received from the backend. This will be used to construct the new inbox item instance
*/
constructor(json: any) {
// todo: jsut use Object assign when backend changes are done
// Object.assign(this, json);
this.id = json.inboxentryid;
this.title = json.title;
this.description = json.description;
this.type = json.type;
this.sourceId = json.source ? json.source.id : null;
this.iconId = json.target && json.target.icon ? json.target.icon.id : null;
this.accepted = json.accepted;
this.isdeputy = json.isdeputy;
this.duetime = json.duetime;
this.received = json.receivetime;
this.target = json.target;
}
/**
* Determines whether or not the inbox item is overdue
* @returns True when inbox item is overdue, false otherwise
*/
isOverdue() {
return this.duetime && moment(this.duetime).isBefore(moment());
}
}
/**
* InboxState
*/
export interface InboxState {
totalmessages: number;
overduemessages: number;
unreadmessages: number;
calculationtime: Date;
}