File

src/lib/model/dms-object.model.ts

Description

Representation of a dms object.

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 dms object instance

Properties

content
content: any
Type : any

The objects content (file). May be empty as dms objects can be created without contents

contentFileName
contentFileName: string
Type : string

The contents filename

contentFileSize
contentFileSize: string
Type : string

The contents filesize

contextFolder
contextFolder: literal type
Type : literal type

Information about the objects context folder

created
created: any
Type : any

Information about the objects creation. Includes the date it was created and the user that created the object

data
data: any
Type : any

Indexdata of the object

description
description: string
Type : string

objects description

id
id: string
Type : string

objects ID

isActiveVersion
isActiveVersion: boolean
Type : boolean

Flag indicating whether or not this is the active version of the object

isContextFolder
isContextFolder: boolean
Type : boolean

Flag indicating whether or not the object is a context folder

isFavorite
isFavorite: boolean
Type : boolean

Flag indicating whether or not the object has been marked as favorite

isFinalized
isFinalized: boolean
Type : boolean

Flag indicating whether or not has been finalized

lock
lock: any
Type : any

Flag indicating whether or not the object is locked. Locked objects are not allowed to be changed

modified
modified: any
Type : any

Information about the objects last modification. Includes the date it was modified and the user that modified the object

processcount
processcount: any
Type : any

Information about the number of active process.

resubmissions
resubmissions: any[]
Type : any[]
Default value : []

List of resubmissions for the object

rights
rights: any
Type : any

special right/permissions set up for the object

shares
shares: any
Type : any

Information about the sharing status of the object

storageInfo
storageInfo: any[]
Type : any[]
Default value : []

Storage info of the object

subscriptions
subscriptions: any[]
Type : any[]
Default value : []

List of subscriptions for the object

title
title: string
Type : string

objects title

Optional type
type: ObjectType
Type : ObjectType

objects type

typeName
typeName: string
Type : string

object type name

version
version: number
Type : number

objects version number

import {ObjectType} from './object-type.model';

/**
 * @ignore
 */
export class DmsObjectAttachment {
  id: number;
  name: string;
  size: number;
  type: string;
  previewUri: string;

  /**
   * @param json - server sent JSON for a dms object
   */
  constructor(json: any) {
    Object.assign(this, json);
  }
}

/**
 * Representation of a dms object.
 */
export class DmsObject {
  /**
   * objects ID
   */
  id: string;
  /**
   * objects title
   */
  title: string;
  /**
   * objects description
   */
  description: string;
  /**
   * objects version number
   */
  version: number;
  /**
   * @ignore
   */
  versions: any[];
  /**
   * object type name
   */
  typeName: string;
  /**
   * objects type
   */
  type?: ObjectType;
  /**
   * Flag indicating whether or not this is the active version of the object
   */
  isActiveVersion: boolean;
  /**
   * Flag indicating whether or not has been finalized
   */
  isFinalized: boolean;
  /**
   * Flag indicating whether or not the object has been marked as favorite
   */
  isFavorite: boolean;
  /**
   * @ignore
   * same as isContextFolder because we do not allow other folders than context folders
   */
  isFolder: boolean;
  /**
   * Flag indicating whether or not the object is a context folder
   */
  isContextFolder: boolean;
  /**
   * Information about the objects context folder
   */
  contextFolder: { id: string, typeName: string, type?: ObjectType, title: string, description: string, data: Object };
  /**
   * Indexdata of the object
   */
  data: any;
  /**
   * special right/permissions set up for the object
   */
  rights: any;
  /**
   * Information about the sharing status of the object
   */
  shares: any;
  /**
   * Information about the objects creation. Includes the date it was created and the user that created the object
   */
  created: any;
  /**
   * Information about the objects last modification. Includes the date it was modified and the user that modified the object
   */
  modified: any;
  /**
   * Information about the number of active process.
   */
  processcount: any;
  /**
   * Flag indicating whether or not the object is locked. Locked objects are not allowed to be changed
   */
  lock: any;
  /**
   * The objects content (file). May be empty as dms objects can be created without contents
   */
  content: any;
  /**
   * The contents filename
   */
  contentFileName: string;
  /**
   * The contents filesize
   */
  contentFileSize: string;
  /**
   * List of subscriptions for the object
   */
  subscriptions: any[] = [];
  /**
   * List of resubmissions for the object
   */
  resubmissions: any[] = [];
  /**
   * Storage info of the object
   */
  storageInfo: any[] = [];
  /**
   * @ignore
   */
  additionalvisibility: any[] = [];


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

    // create a DmsObject based on the server JSON
    this.id = json.id;
    this.title = json.title;
    this.description = json.description;
    this.version = json.version;
    this.versions = json.versions;
    this.data = json.data;
    this.typeName = json.type;

    this.isActiveVersion = json.activeversion;
    this.isFinalized = json.finalized;
    this.isFavorite = json.favorite;
    this.isFolder = json.folder;
    this.isContextFolder = !!json.iscontextfolder;
    this.processcount = json.processcount;
    this.storageInfo = json.storageinfo;

    if (json.contents && json.contents[0]) {
      this.contentFileName = json.contents[0].path;
      this.contentFileSize = json.contents[0].size;
    }

    if (json.contextfolder) {
      this.contextFolder = {
        id: json.contextfolder.id,
        typeName: json.contextfolder.type,
        title: json.contextfolder.title,
        description: json.contextfolder.description,
        data: json.contextfolder.data
      };
    }

    if (json.created) {
      this.created = {
        on: json.created.on,
        by: {
          id: json.created.by.id,
          title: json.created.by.title,
          name: json.created.by.name
        }
      };
    }

    if (json.modified) {
      this.modified = {
        on: json.modified.on,
        by: {
          id: json.modified.by.id,
          title: json.modified.by.title,
          name: json.modified.by.name
        }
      };
    }

    // lock informations
    if (json.lock !== 'NOT_LOCKED' && json.lockinfo) {
      this.lock = {
        on: json.lockinfo.time,
        by: {
          me: json.lock === 'LOCKED_BY_SESSION_USER',
          other: json.lock === 'LOCKED_BY_OTHER_USER',
          name: json.lockinfo.username,
          label: json.lockinfo.usertitle
        }
      };
    }

    // rights section
    if (json.rights && json.rights.length > 0) {
      this.rights = {
        select: json.rights[0].privileges.select,
        edit: json.rights[0].privileges.edit && !(this.lock && this.lock.by.other),
        delete: json.rights[0].privileges.delete && !(this.lock && this.lock.by.other),
        finalize: json.rights[0].privileges.finalize && !(this.lock && this.lock.by.other),
        recycle: json.rights[0].privileges.recycle && !(this.lock && this.lock.by.other),
        share: json.rights[0].privileges.share && !(this.lock && this.lock.by.other),
      };
    } else {
      this.rights = {
        select: false,
        edit: false,
        delete: false,
        finalize: false,
        recycle: false,
        share: false
      };
    }

    if (json.shares) {
      this.shares = json.shares;
    }

    // content section
    if (json.contentid) {
      this.content = {
        id: json.contentid,
        type: json.contenttype,
        count: json.contentcount || 0,
        linked: json.contentid !== json.id,
        contents: json.contents
      };
    }

    if (json.subscriptions) {
      this.subscriptions = json.subscriptions;
    }

    if (json.resubmissions) {
      this.resubmissions = json.resubmissions;
    }

    if (json.additionalvisibility) {
      this.additionalvisibility = json.additionalvisibility;
    }
  }
}

results matching ""

    No results matching ""