public interface IDataStructure
A sample data model is provided below:
<Application name="CRM" description="CRM Mobile App" version="1.0" dbversion="1.0" package="com.mycompany.crm" namespace="mycompany">
<BusinessEntity name="CUSTOMER" description="Customer">
<header className="com.unvired.template.saperp.so.be.CUSTOMER" description="" name="CUSTOMER_HEADER">
<Field name="CUSTOMER_NO" description="Customer No" sqlType="TEXT" isGid="true" length="10" mandatory="true" />
<Field name="CUSTOMER_NAME" description="Customer Name" sqlType="TEXT" length="12" mandatory="true" />
<Field name="STREET" description="Street" sqlType="TEXT" length="50" mandatory="false" />
<Field name="CITY" description="City" sqlType="TEXT" length="50" mandatory="false" />
<Field name="PIN_CODE" description="Pin Code" sqlType="TEXT" length="10" mandatory="false" />
</header>
<item className="com.unvired.template.saperp.so.be.CUSTOMER_CONTACT" description="" name="CUSTOMER_CONTACT">
<Field name="CUSTOMER_NO" description="Customer No" sqlType="TEXT" isGid="true" length="10" mandatory="true" />
<Field name="CONTACT_NO" description="Contact No" sqlType="TEXT" isGid="true" length="12" mandatory="true" />
<Field name="CONTACT_NAME" description="Contact Name" sqlType="TEXT" length="50" mandatory="false" />
<Field name="TEL_NO" description="Telephone No" sqlType="TEXT" length="10" mandatory="false" />
</item>
</BusinessEntity>
</Application>
DataStructure.
DataStructure is the default implementation of IDataStructure.
When headers and items are fetched from the database the objects are of type IDataStructure.
The following topics about the IDataStructure are covered here:
If required the Java objects can also be handwritten. All data model objects have to extend DataStructure.
FIELD_LID. Each data structure object contains a field
called LID and LID is like the primary key for the data structure.
Fields that form the GID can be obtained using getGidFieldNames(). GID fields' values can be obtained using
getGids().
FIELD_FID. FIELD_FID of the item should have the
FIELD_LID value of the header. FIELD_FID of the header is empty. While inserting business objects
to the database the FIELD_FID of the item has to be explicitly set with the FIELD_LID of the header.
FIELD_FID no other foreign key relationship is supported in
the data model. Other related data structures have to be logical relationships.
IDataManager.
OBJECT_STATUS: Object status indicates the state of the data. OBJECT_STATUS is available at both the header and item level.
i. GLOBAL � Data sent from the server
ii. ADD � Data added on the mobile device
iii.MODIFY � Data modified on the mobile device
iv. DELETE � Data marked for deletion on the mobile device
SYNC_STATUS: Sync status indicates the state of the data exchange. SYNC_STATUS is available at both the header and item level.
i. NONE � No status associated, by default there is no value for the SYNS_STATUS field
ii. QUEUED � Queued in the outbox to be sent to the server
iii.SENT � Sent to the server and waiting for a response
iv. ERROR � Response obtained from the server and has resulted in an error
InfoMessage. InfoMessages related to a data structure can be obtained using getInfoMessages().| Modifier and Type | Interface and Description |
|---|---|
static class |
IDataStructure.OBJECT_STATUS |
static class |
IDataStructure.SYNC_STATUS |
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
FIELD_FID |
static java.lang.String |
FIELD_HAS_CONFLICT |
static java.lang.String |
FIELD_LID |
static java.lang.String |
FIELD_OBJECT_STATUS |
static java.lang.String |
FIELD_SYNC_STATUS |
static java.lang.String |
FIELD_TIMESTAMP |
static java.lang.String |
FIELD_TYPE_FID |
static java.lang.String |
FIELD_TYPE_HAS_CONFLICT |
static java.lang.String |
FIELD_TYPE_LID |
static java.lang.String |
FIELD_TYPE_OBJECT_STATUS |
static java.lang.String |
FIELD_TYPE_SYNC_STATUS |
static java.lang.String |
FIELD_TYPE_TIMESTAMP |
| Modifier and Type | Method and Description |
|---|---|
java.lang.String |
getBEName()
Gets the business entity name to which the structure belongs to.
|
java.lang.String[] |
getChildrenTableNames()
Gets the names of all the children structures (items) of the header.
|
java.lang.String |
getFid()
Gets the FID of the data structure.
|
java.lang.Object |
getField(java.lang.String fieldName)
Gets the value associated with the field fieldName.
|
int |
getFieldCount()
Gets the number of fields in the data structure.
|
java.util.Enumeration<java.lang.String> |
getFieldNames()
Gets the names of the field that are part of the data structure.
|
java.lang.String |
getFieldType(java.lang.String fieldName)
Gets the data type of the field.
|
java.lang.String[] |
getGidFieldNames()
Gets the names of the fields that are designated as GID (global identifier) fields.
|
java.lang.Object[] |
getGids()
Gets the values associated with the GID (global identifier) fields.
|
boolean |
getHasConflict()
Get for the data structure has conflicted or not
|
InfoMessage[] |
getInfoMessages()
Gets the info messages associated with the data structure.
|
java.lang.String |
getLid()
Gets the lid of the data structure.
|
IDataStructure.OBJECT_STATUS |
getObjectStatus()
Gets the object status of the data structure.
|
IDataStructure.SYNC_STATUS |
getSyncStatus()
Gets the sync status of the data structure.
|
java.lang.String |
getTableName()
Gets the data structure name.
|
java.lang.Long |
getTimeStamp()
Gets the time stamp of the last modification of the data structure.
|
boolean |
isHeader()
Checks if the data structure is a header.
|
boolean |
isModified() |
void |
setFid(java.lang.String fid)
Sets the fid of the data structure.
|
boolean |
setField(java.lang.String fieldName,
java.lang.Object value)
Sets the value for the given field.
|
boolean |
setFieldBasedOnDataType(java.lang.String fieldName,
java.lang.Object value) |
void |
setHasConflict(boolean hasConflict)
Set for the data structure for conflict
|
void |
setLid(java.lang.String lid)
Sets the lid of the data structure
|
void |
setModifiedFlag(boolean modifiedFlag) |
void |
setObjectStatus(IDataStructure.OBJECT_STATUS objectStatus)
Sets the objectStatus of the data structure
|
void |
setSyncStatus(IDataStructure.SYNC_STATUS syncStatus)
Sets the syncStatus of the data structure
|
void |
setTimeStamp(java.lang.Long timeStamp)
Sets the time stamp of last modification of the data structure in milliseconds since January 1, 1970 00:00:00 UTC.
|
static final java.lang.String FIELD_LID
static final java.lang.String FIELD_FID
static final java.lang.String FIELD_TIMESTAMP
static final java.lang.String FIELD_OBJECT_STATUS
static final java.lang.String FIELD_SYNC_STATUS
static final java.lang.String FIELD_HAS_CONFLICT
static final java.lang.String FIELD_TYPE_LID
static final java.lang.String FIELD_TYPE_FID
static final java.lang.String FIELD_TYPE_TIMESTAMP
static final java.lang.String FIELD_TYPE_OBJECT_STATUS
static final java.lang.String FIELD_TYPE_SYNC_STATUS
static final java.lang.String FIELD_TYPE_HAS_CONFLICT
java.lang.String getBEName()
java.lang.String getTableName()
boolean isHeader()
java.lang.String getLid()
void setLid(java.lang.String lid)
lid - Lid value of the data structure.java.lang.String getFid()
void setFid(java.lang.String fid)
fid - Lid of the header has to be set as the fid in the item data structure. Fid should no be set
for headers.java.lang.Long getTimeStamp()
void setTimeStamp(java.lang.Long timeStamp)
timeStamp - Timestamp of last modification of the data structure in milliseconds since January 1, 1970 00:00:00 UTC.boolean setField(java.lang.String fieldName,
java.lang.Object value)
fieldName - Field name that has to be set with the given value.value - Value to be set to for the field.boolean setFieldBasedOnDataType(java.lang.String fieldName,
java.lang.Object value)
throws MissingFieldException,
MissingFieldTypeException
java.lang.Object getField(java.lang.String fieldName)
fieldName - Name of the field whose value is required.java.lang.String getFieldType(java.lang.String fieldName)
DataTypes.fieldName - Name of the field whose data type is required.int getFieldCount()
java.util.Enumeration<java.lang.String> getFieldNames()
java.lang.String[] getGidFieldNames()
java.lang.Object[] getGids()
throws DBException
DBException - Throws a DBException when the values cannot be fetched from the database.boolean isModified()
void setModifiedFlag(boolean modifiedFlag)
java.lang.String[] getChildrenTableNames()
throws DBException
DBException - Throws a DBException when the values cannot be fetched from the database.IDataStructure.OBJECT_STATUS getObjectStatus()
void setObjectStatus(IDataStructure.OBJECT_STATUS objectStatus)
objectStatus - Object status indicates the state of the data.IDataStructure.SYNC_STATUS getSyncStatus()
void setSyncStatus(IDataStructure.SYNC_STATUS syncStatus)
syncStatus - Sync status indicates the state of the data exchange.boolean getHasConflict()
void setHasConflict(boolean hasConflict)
hasConflict - mark data structure as conflictedInfoMessage[] getInfoMessages() throws DBException
InfoMessage.DBException - Throws a DBException when the values cannot be fetched from the database.Copyright © 2017 Unvired Inc. All Rights Reserved.