@doc alias="fld" hierarchy="GMLDOM">
The Field class is an abstract class from which all %GML% field types are derived.
(c) SAP AG 2003-2006. All rights reserved.
///////////////////////////////////////////////////////////////////////
// CLASS HEADER
Class Field inherit ConfigurationItem;
implement dev:IField;
metadata title = '#TEXT[XTIT_FIELD]';
metadata descr = '#TEXT[XTOL_FIELD]';
metadata icon16 = '#URL[~res:skins.neutral.symbols.field16.gif]';
///////////////////////////////////////////////////////////////////////
// PROPERTIES
<@doc>Gets or sets wheter this field is required to have a value or not.
property required = false;
<@doc>Gets the owner infoshape
virtual readonly property infoshape = ^Infoshape;
<@doc type="string" >Gets or sets the backend-system data type
property type = '';
<@doc type="@FIELD_TYPES" default="FLD_STRING">Gets or sets the field's type
property primitive = #[FLD_STRING];
///////////////////////////////////////////////////////////////////////
// METHODS
override method onCreate()
if (!this.name) this.name = this.id;
this.supercall();
end
override method onInsertMe(parent, trans)
if (parent.isa('core.gml:Infoshape'))
this.infoshape = parent;
this.supercall();
end
<@doc>
Get a collection of values that are allowed as an a value of this field.
return null if no such collection is defined (e.g. in case of an integer field)
method getAllowedValues()
return null; //TODO: return an enum, if such an enum is defined
end
method getPrimitiveAsString()
switch (this.primitive)
{
case #[FLD_STRING]:
return #[STRING];
break;
case #[FLD_BOOLEAN]:
return #[BOOLEAN];
break;
case #[FLD_INTEGER]:
return #[NUMBER];
break;
case #[FLD_FLOAT]:
return #[NUMBER];
break;
case #[FLD_DATE]:
return #[DATE];
break;
case #[FLD_TIME]:
return #[TIME];
case #[FLD_QUANTITY]:
return #[QUANTITY];
break;
}
throw new Error(-1, '#TEXT[XMSG_PRIMITIVE_TYPE_INVALID]');
end
///////////////////////////////////////////////////////////////////////
// ENUMERATIONS
<@enum name="FIELD_TYPES">
An enumeration of the available field data types
The available field data types are listed below:
Type | Description
FLD_STRING | Text (string) field
FLD_INTEGER | Numeric integer field
FLD_FLOAT | Numeric float field
FLD_DATE | Date field
FLD_TIME | Time field
FLD_BOOLEAN | Boolean (true/false) field
FLD_QUANTITY | Quantity
/////////////////////////////////
// Implementing IField prototype:
<@doc>
Gets the field's id
The field's id
override method getId()
return this.id;
end
<@doc>
DEPRECATED - use getName() or getLabel() instead
Gets the field's friendly name (alias)
The fields's friendly name
override method getAlias()
return this.name;
end
<@doc>
NOTE - for GML fields, the Name does not abide to the name definitions in the interface, and is merely a display name.
override method getName()
return this.name;
end
<@doc>
Gets the field's control label, retrieved from the backend
The fields's control label.
override method getLabel()
return "";
end
<@doc>
Gets the field's description, as retrieved from the backend
The fields's description.
override method getDescription()
return "";
end
<@doc>
Gets the owner infoshape
The infoshape object
method getInfoshape()
return this.infoshape;
end
<@doc>
Gets the field's type
The field's type
override method getType()
return this.getPrimitiveAsString();
end
<@doc>
Gets the string representation of the application-specific technical field name
The application-specific technical field name
override method getAppName()
return this.name;
end
<@doc>
Gets the string representation of the application-specific technical field type
The application-specific technical field type
override method getAppType()
return this.type;
end
<@doc>
return the value of the property in this field, if not exist return null
method getPropertyValue(property)
return this.getProperty(property);
end