Class | ArsModels::Field |
In: |
lib/ars_models/field.rb
|
Parent: | Base |
Ruby wrapper class for the java com.kd.ars.models.structure.ArsField object. Instances of Field represent a single Ars field.
ars_field | [R] | Internal JAPI representation of the com.kd.ars.models.structure.ArsField object |
datatype | [RW] | The field datatype (such as ‘CHAR’, ‘DATE’, or ‘ATTACHMENT’). |
default_value | [RW] | The default value of the field. |
entrymode | [RW] | The field entrymode (such as ‘SYSTEM’, ‘REQUIRED’, or ‘OPTIONAL’) |
id | [RW] | The field identifier. |
label | [RW] | The label of the field on the default view. |
name | [RW] | The field database name. |
Creates a new Field object. This can be used to generate a Field manually or to build a Field from a JAPI ArsField object. name and datatype are required attributes.
Manual Generation:
Valid Options: +:datatype+, +:default_value+, +:entrymode+, +:id+, +:label+, +:name+
field = Field.new(:name => 'First Name', :datatype => 'CHAR')
JAPI Build:
field = Field.new(new com.kd.ars.models.structure.ArsField('First Name', 'CHAR'))
# File lib/ars_models/field.rb, line 35 35: def initialize(*args) 36: # Call the ArsModels::Base initializer and delegate to the build or generate method 37: super(*args) 38: end
Returns the xml representation of the field. For example, field 1 (Request ID) would be in the following format:
<field datatype="CHAR" entrymode="SYSTEM" id="1" label="Request ID" name="Request ID"/>
# File lib/ars_models/field.rb, line 86 86: def to_xml 87: # Defer xml generation to the com.kd.ars.models.structure.ArsField object 88: @ars_field.to_xml_string 89: end