7.4.2. Defining Properties Using XML

This section describes how to define properties for a custom type and includes examples of property definitions.

Property definitions are used to define the metadata that are associated with a custom type. To define a property, you need to specify the name and type of the property. Property names cannot contain the following special characters: / \ : [ ] % * ' " |

You can also assign a label to a property. The label can contain any character and is used to display the property in the user interface. The type of the property must be defined as one of the following: Boolean, Date, Double, Long, Reference or String. The Boolean type is used for properties whose value can be either true or false. Date is used for dates. Double is used for real numbers and Long for integers. Reference can be used for properties whose values reference another object in EKM. For example, a simulation file can have a reference property called geomFile that is a reference to a geometry file used in a simulation. String can be used to define strings.

Properties have the following optional attributes:

Properties can also have the following child elements:

Examples - Property Definitions

This section contains five examples of property definitions in EKM.

Example 7.1: version Property defines a property named version of type String. Because the specifiedBy value is extractor, this property will be extracted from the file by the metadata extraction application. Because a label is specified, the property will appear in the user interface as Version.

Example 7.1:  version Property
<property name="version" type="String" specifiedBy="extractor" label="Version" />

Example 7.2: dimension Property defines a property named dimension of type Double. Because the specifiedBy attribute is not specified, it is assumed that the value will be specified by the user. Because the required attribute is set to true, users will be prompted to enter the value for this property when they create the object or upload a file containing this property. A default value of 15.0 is also specified. This property also has min and max constraints specified. This means that the value for this property should be between the specified range of 10.0 and 20.0.

Example 7.2:  dimension Property
<property name="dimension" type="Double" required="true">
       <defaultValue>15.0</defaultValue>
       <constraint name="min" value="10.0" />
       <constraint name="max" value="20.0" />
</property>

Example 7.3: revisionStatus Property defines a property named revisionStatus of type String that will appear in the user interface as Revision Status. It is a required property that will be specified by users. This property also has enumerations specified, so users can select only one of these values: Draft, Released or Obsolete. This property will appear in dialog boxes as a select menu (or drop-down list).

Example 7.3:  revisionStatus Property
<property name="revisionStatus" label="Revision Status" type="String" required="true">
        <enumeration>Draft</enumeration>
        <enumeration>Released</enumeration>
        <enumeration>Obsolete</enumeration>
</property>

Example 7.4: physicalModels Property defines a property named physicalModels of type String that will appear in the user interface as Physical Models. The property value will be automatically extracted. Because the multivalued attribute is set to true, the property can accept more than one value. Enumerations are specified, and the values must be equal to one of the enumerations.

Example 7.4:  physicalModels Property
<property name="physicalModels" label="Physical Models" type="String" 
specifiedBy="extractor" multivalued="true">
       <enumeration>Stress</enumeration>
       <enumeration>Thermal</enumeration>
       <enumeration>Vibration</enumeration>
       <enumeration>Magnetostatic</enumeration>
</property>

Example 7.5: inputFile Property defines a property named inputFile of type Reference. It is a required property that will be specified by the users. Because the baseType constraint is specified, the referenced object should be of the same type (or a subtype) of CaeModelFile.

Example 7.5:  inputFile Property
<property name="inputFile" type="Reference" required="true">
        <constraint name="baseType" value="CaeModelFile" />
</property>


Release 18.2 - © ANSYS, Inc. All rights reserved.