UnifaceEntity

This constructor is used to create an instance for an entity with specific types of fields.

import com.compuware.uniface.*;

UnifaceEntity (int[] fieldTypes)

Parameters

fieldTypes—an array containing the types of each of the fields required. The array is numbered starting with zero, which is an exception to the general Uniface convention.

Field Type Constants
Constant Meaning
UTYPE_STRING Uniface string
UTYPE_BOOLEAN Uniface boolean
UTYPE_NUMERIC Uniface numeric
UTYPE_FLOAT Uniface float
UTYPE_DATE Uniface date
UTYPE_TIME Uniface time
UTYPE_DATETIME Uniface date time
UTYPE_RAW Uniface raw
UTYPE_IMAGE Uniface image

Return Values

Returns an empty entity, that is, with no occurrences.

Description

Uniface entities are usually returned through parameters in Uniface operations, but they can also be created from Java using this class. Use the UnifaceEntity class to:

  • Get entity information, such as the number of fields and the current number of occurrences
  • Create new occurrences
  • Remove occurrences
  • Get data from and set data in fields of a specific occurrence

The UnifaceEntity class is used to specify entity parameters from Java. The Java UnifaceEntity object is passed to Uniface as a Java object (IN), and from Uniface to Java as a Java object (OUT). The Java UnifaceEntity object is a local copy only.

Note:   Occurrences are passed by value, not by reference. When entity data is passed as an IN (or INOUT) parameter, all occurrences are considered new data. A subsequent store from ProcScript, therefore, most likely leads to duplicate key errors.

To specify an entity named UE, with two fields, the first field of type String and the second of type Numeric, you would use the following code:

int fieldTypes [] = new int [2];
fieldTypes[0] = Values.UTYPE_STRING;
fieldTypes[1] = Values.UTYPE_NUMERIC;
UnifaceEntity UE = new UnifaceEntity(fieldTypes);

Note:  The fieldTypes array is numbered starting from zero. This is an exception to the general Uniface convention. In addition, non-database fields are not transported through the URB interface—if you need to access an entity that contains non-database fields, you should omit them from the fieldTypes array.