File

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

Description

Representation of an object type. Object types are defined with the system definition and describe different kind of objects that allowed to be created.

Index

Properties
Methods

Constructor

constructor(json: IObjectType)

Creates a new instance

Parameters :
Name Type Optional Description
json IObjectType no

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

Properties

Optional actualLabel
actualLabel: string
Type : string
allowedcontexttypes
allowedcontexttypes: ContextType[]
Type : ContextType[]

List of context types this object type is allowed to be created in

description
description: string
Type : string

Object types description

elements
elements: any[]
Type : any[]

Elements are the properties defining the object type. Those elements are also used for defining a form model for the object types input form but (may) also contain hidden elements.

group
group: string
Type : string

Object types can be grouped. This property holds the name of the group the current type belongs to

iconId
iconId: string
Type : string

ID of the object types icon

id
id: string
Type : string

Object types ID

implements
implements: string[]
Type : string[]

List of all supertypes

isAbstract
isAbstract: boolean
Type : boolean

Flag indicating whether or not the object type is an abstract type other types can inherit from

isContextFolder
isContextFolder: boolean
Type : boolean

Flag indicating whether or not the object type is a context folder

label
label: string
Type : string

Object types label

maxFiles
maxFiles: number
Type : number

Maximum number of files to be attached to this type

minFiles
minFiles: number
Type : number

Minimum number of files to be attached to this type

name
name: string
Type : string

Object types internal name

Optional parenttypes
parenttypes: string[]
Type : string[]
qname
qname: string
Type : string

Object types full qualified internal name

shareable
shareable: boolean
Type : boolean

Flag indicating whether or not this object type can be shared

supertypes
supertypes: string[]
Type : string[]

List of parent types the current type inherits from

Methods

getParentTypes
getParentTypes(allowedlocations: )
Parameters :
Name Optional
allowedlocations no
Returns : string[]
export interface IObjectType {
  id: string;
  implements?: string[];
  folder: boolean;
  iscontextfolder: boolean;
  abstract: boolean;
  icon?: any;
  maxfiles: number;
  minfiles: number;
  name: string;
  qname: string;
  label: string;
  description: string;
  group?: any;
  elements: any[];
  allowedcontexttypes?: ContextType[];
  supertypes?: any[];
  shareable: boolean;
  allowedlocations?: {
    parenttypes: ParentTypes[];
  };
}

/**
 * @ignore
 */
export interface ParentTypes {
  name: string;
  count: string;
  uri: string;
}

/**
 * @ignore
 */
export interface ContextType {
  name: string;
  label: string;
  description?: string;
}

/**
 * Representation of an object type. Object types are defined with the system definition and describe
 * different kind of objects that allowed to be created.
 */
export class ObjectType {
  /**
   * Object types ID
   */
  id: string;
  /**
   * List of all supertypes
   */
  implements: string[];
  /**
   * @ignore
   * is basically the same as isContextFolder, because we do not allow other folders than context folder
   */
  isFolder: boolean;
  /**
   * Flag indicating whether or not the object type is a context folder
   */
  isContextFolder: boolean;
  /**
   * Flag indicating whether or not the object type is an abstract type other types can inherit from
   */
  isAbstract: boolean;
  /**
   * ID of the object types icon
   */
  iconId: string;
  /**
   * Minimum number of files to be attached to this type
   */
  minFiles: number;
  /**
   * Maximum number of files to be attached to this type
   */
  maxFiles: number;
  /**
   * Object types internal name
   */
  name: string;
  /**
   * Object types full qualified internal name
   */
  qname: string;
  /**
   * Object types label
   */
  label: string;
  /**
   * Object types description
   */
  description: string;
  /**
   * Object types can be grouped. This property holds the name of the group the current type belongs to
   */
  group: string;
  /**
   * Elements are the properties defining the object type. Those elements are also used for defining a form model
   * for the object types input form but (may) also contain hidden elements.
   */
  elements: any[];
  /**
   * List of context types this object type is allowed to be created in
   */
  allowedcontexttypes: ContextType[];
  /**
   * List of parent types the current type inherits from
   */
  supertypes: string[];
  /**
   * Flag indicating whether or not this object type can be shared
   */
  shareable: boolean;
  parenttypes?: string[];
  /*
   * Represents the original label of the object type. Utilized for obtaining translated labels for specific qnames, such as 'sysdmscontenttemplate'.
   */
  actualLabel?: string;
  /**
   * Creates a new instance
   * @param json The JSON object received from the backend. This will be used to construct the new object type instance
   */
  constructor(json: IObjectType) {
    this.id = json.id;
    this.implements = json.implements ? json.implements : [];
    this.isFolder = json.folder;
    this.isContextFolder = json.iscontextfolder;
    this.isAbstract = json.abstract;
    this.iconId = json.icon ? json.icon.id : null;
    this.maxFiles = json.maxfiles;
    this.minFiles = json.minfiles;
    this.name = json.name;
    this.qname = json.qname;
    this.label = json.label;
    this.description = json.description;
    this.group = json.group ? json.group.label : "";
    this.elements = json.elements;
    this.allowedcontexttypes = json.allowedcontexttypes
      ? json.allowedcontexttypes
      : [];
    this.supertypes = json.supertypes ? json.supertypes.map(t => t.name) : [];
    this.shareable = json.shareable;
    this.parenttypes = this.getParentTypes(json.allowedlocations);
    this.actualLabel = json.label;
  }

  getParentTypes(allowedlocations): string[] {
    if (allowedlocations) {
      return allowedlocations.parenttypes.map(types => types.name);
    }
    return [];
  }
}

results matching ""

    No results matching ""