IP Classification Methods

IP Classification methods provide elements that help you navigate through the classification model. You can use the following methods on the existing pre-commit triggers.

This page discusses:

getConnectedDefinitionClasses

This method allows you to retrieve a list of definition classes connected to a classified item.

Signature

getConnectedDefinitionClasses() : List

ReturnType

List

Example

let ToObject (BusinessType)
let classes (List)
let class (`General Class`)
let gls (List)
let glTitles (List)
let gl (`General Library`)
let i (Integer)

// Classified Item
Set ToObject = ThisObject.GetTo()

// Class
Set FromObject = ThisObject.GetFrom()
if (NULL <> ToObject) {
	// List of classes where ToObject i.e. IP Asset is classified
	Set classes = ToObject.getConnectedDefinitionClasses()	
} else {
	ReportUXMessage("ToObject is null")
	Validation = false
}

getConnectedCategorizationClasses

This method allows you to retrieve a list of categorization classes connected to a classified item.

Signature

getConnectedCategorizationClasses() : List

ReturnType

List

Example

let ToObject (BusinessType)
let classes (List)
let class (`General Class`)
let gls (List)
let glTitles (List)
let gl (`General Library`)
let i (Integer)

// Classified Item
Set ToObject = ThisObject.GetTo()

// Class
Set FromObject = ThisObject.GetFrom()

if (NULL <> ToObject) {
	// List of classes where ToObject i.e. IP Asset is classified
	Set classes = ToObject.getConnectedCategorizationClasses()	
} else {
	ReportUXMessage("ToObject is null")
	Validation = false
}

getParentLibrary

This method allows you to retrieve the parent library of the corresponding class.

Signature

getParentLibrary() : General Library

ReturnType

General Library

Example

let ToObject (BusinessType)
let classes (List)
let class (`General Class`)
let gls (List)
let glTitles (List)
let gl (`General Library`)
let i (Integer)

// Classified Item
Set ToObject = ThisObject.GetTo()

// Class
Set FromObject = ThisObject.GetFrom()

if (NULL <> ToObject) {
	// List of classes where ToObject i.e. IP Asset is classified
	Set classes = ToObject.getConnectedDefinitionClasses()
	// List of libraries which are associated with classes
	i = 1
	for i while i <= classes.Size() {
		Set class = classes.GetItem(i)
		// Get the library associated with the class and add to list
		Set gl = class.getParentLibrary()
		gls.AddItem(gl, i)
	}
} else {
	ReportUXMessage("ToObject is null")
	Validation = false
}

getParentClass

This method allows you to retrieve the parent class of the corresponding class.

Signature

getParentClass() : General Class

ReturnType

General Class

Example

let ToObject (BusinessType)
let classes (List)
let class (`General Class`)
let gls (List)
let glTitles (List)
let gl (`General Library`)
let i (Integer)

// Classified Item
Set ToObject = ThisObject.GetTo()

// Class
Set FromObject = ThisObject.GetFrom()

if (NULL <> ToObject) {
    // Get the Parent class
    Set parentClass = FromObject.getParentClass()
    if (parentClass <> NULL) {
        ReportUXMessage("Parent Class: " + parentClass.Title)
    } else {
        ReportUXMessage("Class is directly under a library")
    }
} else {
	ReportUXMessage("ToObject is null")
Validation = false
}

getSubclasses

This method allows you to retrieve a list of first-level subclasses of the corresponding class.

Signature

getSubClasses() : List

ReturnType

List

Example

let ToObject (BusinessType)
let classes (List)
let class (`General Class`)
let gls (List)
let glTitles (List)
let gl (`General Library`)
let i (Integer)

// Classified Item
Set ToObject = ThisObject.GetTo()

// Class
Set FromObject = ThisObject.GetFrom()

if (NULL <> ToObject) {
    // Get subclasses
    Set subclasses = FromObject.getSubclasses()
    if (subclasses.Size() == 0) {
        ReportUXMessage("Class is a leaf node")
}
} else {
	ReportUXMessage("ToObject is null")
	Validation = false
}

getClassificationAttributeValue

This method allows you to retrieve the value of a classification attribute.

Signature

getClassificationAttributeValue(attributeName:String, classId: String) : ObjectType

Arguments

Name Input or Output Required Type Comment
attributeName Input String Name of the attribute
classId Input String Physical ID of the class associated with the classified item

ReturnType

ObjectType

Example

let ToObject (BusinessType)
let FromObject (`General Class`)
let classes (List)
let class (`General Class`)
let gls (List)
let glTitles (List)
let gl (`General Library`)
let i (Integer)
let newRealAttributeValue (String)
let newStringAttributeValue (String)
let newIntegerAttributeValue (Integer)
let newDateAttributeValue (Date)
let newBooleanAttributeValue (Boolean)
let classId (String)
let inputs (Number_inputs)

let attributeName (String)

// Classified Item
Set ToObject = ThisObject.GetTo()

// Class
Set FromObject = ThisObject.GetFrom()
Set classId = FromObject.GetAttributeString("physicalid")

if (NULL <> ToObject) {
    // set and get real attribute
    Set attributeName = "ClsAttributeCreate000"
    Set newRealAttributeValue =  "44.44 INCH"
    ToObject.setClassificationAttributeValue(attributeName, newRealAttributeValue, classId)
    Set inputs = ToObject.getClassificationAttributeValue(attributeName, classId)
    ReportUXMessage("inputvalue = " + inputs.inputvalue() + ", inputunit = " + inputs.inputunit())
    
    // set and get string attribute
    Set attributeName = "ClsAttributeCreate001"
    Set newStringAttributeValue =  "hello"
    ToObject.setClassificationAttributeValue(attributeName, newStringAttributeValue, classId)
    ReportUXMessage("attributeName = " + attributeName + ", attributeValue = " + ToObject.getClassificationAttributeValue(attributeName, classId))
    
    // set and get integer attribute
    Set attributeName = "ClsAttributeCreate002"
    Set newIntegerAttributeValue =  "hello"
    ToObject.setClassificationAttributeValue(attributeName, newIntegerAttributeValue, classId)
    ReportUXMessage("attributeName = " + attributeName + ", attributeValue = " + ToObject.getClassificationAttributeValue(attributeName, classId))
    
    // set and get date attribute
    Set attributeName = "ClsAttributeCreate003"
    Set newDateAttributeValue = BuildDate()
    ToObject.setClassificationAttributeValue(attributeName, newDateAttributeValue, classId)
    ReportUXMessage("attributeName = " + attributeName + ", attributeValue = " + ToObject.getClassificationAttributeValue(attributeName, classId))
    
    // set and get boolean attribute
    Set attributeName = "ClsAttributeCreate004"
    Set newBooleanAttributeValue =  true
    ToObject.setClassificationAttributeValue(attributeName, newBooleanAttributeValue, classId)
    ReportUXMessage("attributeName = " + attributeName + ", attributeValue = " + ToObject.getClassificationAttributeValue(attributeName, classId))
} else {
    ReportUXMessage("ToObject is null")
    Validation = false
}

setClassificationAttributeValue

This method allows you to set the value of a classification attribute.

Note: For multi value attributes, you can provide EKL list as an argument.

Signature

setClassificationAttributeValue(attributeName:String, attributeValue:ObjectType, classId: String) : VoidType

Arguments

Name Input or Output Required Type Comment
attributeName Input String Name of the attribute
attributeValue Input String Attribute value
classId Input String Physical ID of the class associated with the classified item

ReturnType

VoidType

Example

let ToObject (BusinessType)
let FromObject (`General Class`)
let classes (List)
let class (`General Class`)
let gls (List)
let glTitles (List)
let gl (`General Library`)
let i (Integer)
let newRealAttributeValue (String)
let newStringAttributeValue (String)
let newIntegerAttributeValue (Integer)
let newDateAttributeValue (Date)
let newBooleanAttributeValue (Boolean)
let classId (String)
let inputs (Number_inputs)

let attributeName (String)

// Classified Item
Set ToObject = ThisObject.GetTo()

// Class
Set FromObject = ThisObject.GetFrom()
Set classId = FromObject.GetAttributeString("physicalid")

if (NULL <> ToObject) {
    // set and get real attribute
    Set attributeName = "ClsAttributeCreate000"
    Set newRealAttributeValue =  "44.44 INCH"
    ToObject.setClassificationAttributeValue(attributeName, newRealAttributeValue, classId)
    Set inputs = ToObject.getClassificationAttributeValue(attributeName, classId)
    ReportUXMessage("inputvalue = " + inputs.inputvalue() + ", inputunit = " + inputs.inputunit())
    
    // set and get string attribute
    Set attributeName = "ClsAttributeCreate001"
    Set newStringAttributeValue =  "hello"
    ToObject.setClassificationAttributeValue(attributeName, newStringAttributeValue, classId)
    ReportUXMessage("attributeName = " + attributeName + ", attributeValue = " + ToObject.getClassificationAttributeValue(attributeName, classId))
    
    // set and get integer attribute
    Set attributeName = "ClsAttributeCreate002"
    Set newIntegerAttributeValue =  "hello"
    ToObject.setClassificationAttributeValue(attributeName, newIntegerAttributeValue, classId)
    ReportUXMessage("attributeName = " + attributeName + ", attributeValue = " + ToObject.getClassificationAttributeValue(attributeName, classId))
    
    // set and get date attribute
    Set attributeName = "ClsAttributeCreate003"
    Set newDateAttributeValue = BuildDate()
    ToObject.setClassificationAttributeValue(attributeName, newDateAttributeValue, classId)
    ReportUXMessage("attributeName = " + attributeName + ", attributeValue = " + ToObject.getClassificationAttributeValue(attributeName, classId))
    
    // set and get boolean attribute
    Set attributeName = "ClsAttributeCreate004"
    Set newBooleanAttributeValue =  true
    ToObject.setClassificationAttributeValue(attributeName, newBooleanAttributeValue, classId)
    ReportUXMessage("attributeName = " + attributeName + ", attributeValue = " + ToObject.getClassificationAttributeValue(attributeName, classId))
} else {
    ReportUXMessage("ToObject is null")
    Validation = false
}