dw.object
Class ObjectTypeDefinition
dw.object.ObjectTypeDefinition
The class provides access to the meta data of a system object or custom
object. A short example should suffice to demonstrate how this metadata can
be used in a script:
var co : CustomObject = CustomObjectMgr.getCustomObject("sample", "MyCustomObject"); // get the object type definition var typeDef : ObjectTypeDefinition = co.describe(); // get the custom object attribute definition for name "enumIntValue" var attrDef : ObjectAttributeDefinition = typeDef.getCustomAttributeDefinition( "enumIntValue" ); // get the collection of object attribute value definitions var valueDefs : Collection = attrDef.getValues(); // return function if there are no object attribute value definitions if(valueDefs.isEmpty()) { return; } var displayValue : String; // loop over object attribute value definitions collection for each ( var valueDef : ObjectAttributeValueDefinition in valueDefs ) { if( valueDef.getValue() == co.custom.intValue ) { displayValue = valueDef.getDisplayValue(); break; } }
Properties
attributeDefinitions
:
Collection
(Read Only)
A collection of all declared attributes for the object.
The collection contains both system and custom attributes. There might
be system and custom attribute with identical names. So the name of the
attribute is not a uniqueness criteria. Additional the isCustom() flag
must be checked.
attributeGroups
:
Collection
(Read Only)
A collection of all declared attribute groups. A attribute group
is a collection of attribute, which are typically displayed together as
a visual group.
displayName
:
String
(Read Only)
The display name of the definition, which can be used in the
user interface.
ID
:
String
(Read Only)
The type id of the business objects.
Constructor Summary
This class does not have a constructor, so you cannot create it directly.
Method Summary
getAttributeDefinitions()
:
Collection
Returns a collection of all declared attributes for the object.
getAttributeGroup(name
:
String)
:
ObjectAttributeGroup
Returns the attribute group with the given name within this object type definition.
getAttributeGroups()
:
Collection
Returns a collection of all declared attribute groups.
getCustomAttributeDefinition(name
:
String)
:
ObjectAttributeDefinition
Returns the custom attribute definition with the given name.
getDisplayName()
:
String
Returns the display name of the definition, which can be used in the user interface.
getSystemAttributeDefinition(name
:
String)
:
ObjectAttributeDefinition
Returns the system attribute definition with the given name.
isSystem()
:
boolean
Identifies if this object definition is for a system type or a custom type.
Methods inherited from class
Object
assign, create, create, defineProperties, defineProperty, entries, freeze, fromEntries, getOwnPropertyDescriptor, getOwnPropertyNames, getOwnPropertySymbols, getPrototypeOf, hasOwnProperty, is, isExtensible, isFrozen, isPrototypeOf, isSealed, keys, preventExtensions, propertyIsEnumerable, seal, setPrototypeOf, toLocaleString, toString, valueOf, values
Method Detail
getAttributeDefinitions
getAttributeDefinitions()
:
Collection
Returns a collection of all declared attributes for the object.
The collection contains both system and custom attributes. There might
be system and custom attribute with identical names. So the name of the
attribute is not a uniqueness criteria. Additional the isCustom() flag
must be checked.
Returns:
a collection of all declared attributes for the object.
getAttributeGroup
Returns the attribute group with the given name within this object
type definition.
Parameters:
name
-
The name of the attribute scope to return.
Returns:
The matching attribute scope or
null
if no such scope exists.
getAttributeGroups
getAttributeGroups()
:
Collection
Returns a collection of all declared attribute groups. A attribute group
is a collection of attribute, which are typically displayed together as
a visual group.
Returns:
a collection of all declared attribute groups.
getCustomAttributeDefinition
Returns the custom attribute definition with the given name. The method
returns null if no custom attribute is defined with that name.
Parameters:
name
-
The unique name of the custom attribute definition within the object type.
Returns:
The matching attribute definition or
null
in case no such definition exists.
getDisplayName
getDisplayName()
:
String
Returns the display name of the definition, which can be used in the
user interface.
Returns:
the display name of the definition, which can be used in the user interface.
getID
getID()
:
String
Returns the type id of the business objects.
Returns:
the type id of the business objects.
getSystemAttributeDefinition
Returns the system attribute definition with the given name. The method
returns null if no system attribute is defined with that name. Only
system objects have system attributes. A CustomObject has no system attributes
and so the method will always return null for a CustomObject.
Parameters:
name
-
The unique name of the custom attribute definition within the object type.
Returns:
The matching attribute definition or
null
in case no such definition exists.