File

src/lib/model/bpm.model.ts

Description

Entry of a work items file. A work items file is a container that holds objects (e.g. DMS Objects) attached to a work item. A work item for approving an invoice for example would have the related invoice document attached.

Index

Properties

Properties

addtime
addtime: number
Type : number

The time (date) this entry was added to the work item

creator
creator: string
Type : string

Name of the user that created this file entry

description
description: string
Type : string

Short description of the file entry

iconid
iconid: string
Type : string

ID of an icon (e.g. object type icon in case of dms objects)

id
id: string
Type : string

unique identifier

title
title: string
Type : string

Title of the file entry

type
type: string
Type : string

file entries type

import {OrgGroup, OrgRole, OrgUser} from './org.model';

/**
 * Process that could be executed/started. Starting an executable process will
 * create an instance of it (Process), which then can be fetched by its ID.
 */
export interface ExecutableProcess {
  id: string;
  qname: string;
  title: string;
  description?: string;
  iconid?: string;
  data?: any;
  data_meta?: any;
  form?: any;
  actions?: any;
}


/**
 * Instance of an executable process.
 */
export class Process {

  /**
   * processes unique identifier
   */
  processid: string;
  /**
   * The name of the process
   */
  procname: string;
  /**
   * ID of the user that created this process
   */
  creatorid: string;
  /**
   * ID of a process icon
   */
  iconid?: string;
  /**
   * URL of a process icon
   */
  iconurl?: string;
  /**
   * The localized title of the process
   */
  localizedsubject: string;
  /**
   * The ID of the underlying process model.
   * The process model is the definition of a process, so a process is basically an instance of a model.
   */
  modelid: string;
  /**
   * The name of the process model.
   */
  modelname: string;
  /**
   * Date (time) the process was started
   */
  starttime: number;
  /**
   * Date (time) the process ended
   */
  endtime: number;
  /**
   * Processes state
   *
   * NONE(-1),
   * CREATED(0),
   * RUNNING(20),
   * COMPLETED(30),
   * SUSPENDED(40),
   * TERMINATED(50),
   * ERRORSUSPENDED(60);
   */
  state: string;

  /**
   * A process file is a container that holds objects (e.g. DMS Objects) attached to the current work item. A work item for
   * approving an invoice for example would have the related invoice document attached.
   */
  file: FileEntry[];

  /**
   * Title of the process genarated from the localized subject
   */
  get title() {
    return this.localizedsubject || '';
  }

  /**
   * Process ID
   */
  get id() {
    return this.processid || '';
  }

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

    this.creatorid = json.creatorid;
    this.modelname = json.modelname;
    this.iconurl = json.iconurl;
    this.iconid = json.iconid;
    this.localizedsubject = json.subject;
    this.modelid = json.modelid;
    this.processid = json.id;
    this.procname = json.name;
    this.starttime = json.starttime;
    this.endtime = json.endtime;
    this.state = json.state;
  }

  setFile(fileEntries: FileEntry[]) {
    this.file = fileEntries || [];
  }
}


/**
 * WorkItems are the tasks of a process that require user interaction.
 */
export class WorkItem {

  /**
   * unique identifier
   */
  id: string;
  /**
   * work items title
   */
  title: string;
  /**
   * work items description
   */
  description: string;
  /**
   * the state the work item is in e.g. 'PERSON', 'CREATED', etc.
   */
  state: string;

  /**
   * ID of the parent process
   */
  processId: string;
  /**
   * title of the parent process
   */
  processTitle: string;
  /**
   * subject of the parent process
   */
  processSubject: string;

  /**
   * Form model for this work item. May be empty if the work item does not require user inputs
   */
  form: any;
  /**
   * Data for the form model. Form definition and the forms data are separated, and will be merged by the application.
   */
  data: any;
  /**
   * Meta data for data properties. Some form elements require additional information about the actual value.
   * Such values are for example form elements of type CODESYSTEM or ORGANIZATION.
   */
  data_meta: any;

  /**
   * Work items may define actions aside from the default `continue` action. This property holds a collection of all
   * actions provided by the current work item.
   */
  actions: WorkItemAction[];
  /**
   * A work items file is a container that holds objects (e.g. DMS Objects) attached to the current work item. A work item for
   * approving an invoice for example would have the related invoice document attached.
   */
  file: FileEntry[];
  /**
   * Permissions for the work items file entries, that allow or deny adding or removing entries from the work items file.
   */
  fileEntryPermissions: {
    add: boolean;
    remove: boolean

  };
  /**
   * Work items may be received by users in substitution for other users that are currently unavailable.
   * If this is the case this property holds the information about the user that should have retrieved the work item.
   */
  inSubstituteOf: OrgUser[];
  /**
   * When set to true, executing an action requires additional authorization.
   */
  authRequired: boolean;
  /**
   * The date the work item has been received
   */
  received: Date;
    /**
   * Work items are able to be set up with due time property that defines a time for the work item to have been processed
   */
  duetime: Date;
  /**
   * Performers are users, groups and/or roles that received the work item
   */
  performer: {
    groups: OrgGroup[],
    roles: OrgRole[],
    users: OrgUser[]
  };
  /**
   * The name of the used process model
   */
  qmodelname: string;

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

    this.fileEntryPermissions = {
      add: json.isFileElemAddable || false,
      remove: json.isFileElemRemovable || false
    };
    if (this.actions && this.actions.length) {
      this.actions = this.actions.sort((a, b) => {
        return a.code - b.code;
      });
    }
  }

  setFile(fileEntries: FileEntry[]) {
    if (fileEntries) {
      // Sort files by addtime
      this.file = fileEntries.sort((a, b) => {
        return (a.addtime < b.addtime) ? -1 : ((a.addtime > b.addtime) ? 1 : 0);
      });
    } else {
      this.file = [];
    }
  }
}


/**
 * A work items action. Actions are basically defining the next steps of a
 * process from the current work item.
 */
export interface WorkItemAction {
  /**
   * The actions title (label)
   */
  title: string;
  /**
   * Short description of the action
   */
  description?: string;
  /**
   * The actions type. Values may be `FORWARD` (forward to the next process step) or `LINK` (open an external link to e.g. process
   * or retrieve data required for the current work item)
   */
  type: string;
  /**
   * Code that identifies the action (kind of an ID in context of the current work item)
   */
  code: number;
  /**
   * If actions type is set to `LINK` this property holds the target URL to forward to
   */
  url?: string;
}


/**
 * Entry of a work items file. A work items file is a container that holds objects (e.g. DMS Objects) attached to a
 * work item. A work item for approving an invoice for example would have the related invoice document attached.
 */
export interface FileEntry {
  /**
   * unique identifier
   */
  id: string;
  /**
   * Title of the file entry
   */
  title: string;
  /**
   * Short description of the file entry
   */
  description: string;
  /**
   * ID of an icon (e.g. object type icon in case of dms objects)
   */
  iconid: string;
  /**
   * Name of the user that created this file entry
   */
  creator: string;
  /**
   * The time (date) this entry was added to the work item
   */
  addtime: number;
  /**
   * file entries type
   */
  type: string;
}

results matching ""

    No results matching ""