File

src/lib/model/work-item-history.model.ts

Description

History entry of a work item.

Index

Properties

Constructor

constructor(json: any)

Creates a new instance

Parameters :
Name Type Optional Description
json any no

The JSON object received from the backend. This will be used to construct the new work item history instance

Properties

data
data: any
Type : any

Additional data for special kinds of entries like errors, personalization, periods

description
description: string
Type : string

Short description of the history entry

editor
editor: OrgUser
Type : OrgUser

User that was responsible for creating this entry (e.g. by executing an action)

number
number: number
Type : number

Index of the history entry (may be used for ordering)

performer
performer: WorkItemHistoryPerformer[]
Type : WorkItemHistoryPerformer[]

Collection of performers. Performers are users, groups or roles that received a work item that let to the creation of a history entry. If for example a work item was forwarded, the history entry created for that action will contain the recipients of the forwarded action.

time
time: Date
Type : Date

The date (time) this entry was created

title
title: string
Type : string

Title of the history entry

type
type: string
Type : string

History entries type

import {OrgUser} from './org.model';

/**
 * @ignore
 */
export interface WorkItemHistoryPerformer {
  type: string;
  label: string;
}

/**
 * History entry of a work item.
 */
export class WorkItemHistoryEntry {

  /**
   * Title of the history entry
   */
  title: string;
  /**
   * Short description of the history entry
   */
  description: string;
  /**
   * The date (time) this entry was created
   */
  time: Date;
  /**
   * Index of the history entry (may be used for ordering)
   */
  number: number;
  /**
   * History entries type
   */
  type: string;
  /**
   * User that was responsible for creating this entry (e.g. by executing an action)
   */
  editor: OrgUser;
  /**
   * Collection of performers. Performers are users, groups or roles that received a work item that let to the creation of a history entry.
   * If for example a work item was forwarded, the history entry created for that action will contain the recipients of the forwarded action.
   */
  performer: WorkItemHistoryPerformer[];
  /**
   * Additional data for special kinds of entries like errors, personalization, periods
   */
  data: any;

  /**
   * Creates a new instance
   * @param json The JSON object received from the backend. This will be used to construct the new work item history instance
   */
  constructor(json: any) {

    this.title = json.activityName;
    this.description = json.description;
    this.number = json.number;
    this.time = json.time;
    this.type = json.type;
    this.data = {};

    // overrides for special types of history entries
    switch (json.type) {
      // deadline started
      case 'DEADLINE_START': {
        this.title = `${json.periodName}`;
        // description will be generated in template
        this.description = null;
        this.data = {
          periodFireTime: json.periodFireTime
        };
        this.type = json.type;
        break;
      }
      // deadline reached
      case 'DEADLINE_FIRE': {
        this.title = `${json.periodName}`;
        // description will be generated in template
        this.description = null;
        this.data = {
          periodFireTime: json.periodFireTime
        };
        this.type = json.type;
        break;
      }
    }

    // are there additional information about the performer
    // that caused the history entry
    if (json.performer) {
      this.performer = [];
      json.performer.groups.forEach(g => this.performer.push({type: 'group', label: g.name}));
      json.performer.roles.forEach(r => this.performer.push({type: 'role', label: r.name}));
      json.performer.users.forEach(u => this.performer.push({type: 'user', label: `${u.lastname}, ${u.firstname} (${u.name})`}));
    }

    if (json.user) {
      this.editor = json.user;
    }
  }
}

results matching ""

    No results matching ""