Sun Java System Mobile Enterprise Platform 1.0 Developer's Guide for Enterprise Connectors

The BusinessObject Class

Table 3–1 lists the constructor and methods belonging to the BusinessObject class, the base class for all business objects. Business objects are the entities synchronized with client applications. Each business object instance is identified by a name, which is also used to name the file that holds the object on the mobile client. Business objects are created by business object providers; see The BusinessObjectProvider Class for details.

Table 3–1 Class com.sun.mep.connector.api.BusinessObject

Method 

Description 

BusinessObject(T bobjectProvider)

Constructor that takes the BusinessObjectProvider for the business object as its argument.

public abstract void deserialize(byte[] data)

Deserializes a business object from a byte array. 

public T getBusinessObjectProvider()

Returns a reference to the business object provider associated with this object. 

public abstract <T extends BusinessObject> DeleteCommand<T> getDeleteCommand()

Returns a command that when executed can delete this business object from a back end. 

public abstract java.lang.String getExtension()

Returns the default extension for business objects of this type. Extensions are used by the files holding these objects and must be part of the contract with clients. That is, clients and connectors must use the same extension for the same type of business object. Concrete subclasses should redefine this method. 

public abstract <T extends BusinessObject> InsertCommand<T> getInsertCommand()

Returns a command that when executed can insert this business object into a back end. 

public long getLastModified()

Returns a timestamp indicating the last time this business object was modified. The timestamp represents the number of milliseconds since “the epoch,” namely January 1, 1970, 00:00:00 GMT. 

public java.lang.String getName()

Returns the name of this business object. Names must be unique identifiers. 

public abstract <T extends BusinessObject> UpdateCommand<T> getUpdateCommand()

Returns a command that when executed can update this business object in a back end. 

public abstract byte[] serialize()

Serializes a business object into a byte array. 

public void setLastModified(long millis)

Sets a timestamp indicating the last time this business object was modified. The timestamp must represent the number of milliseconds since “the epoch,” namely January 1, 1970, 00:00:00 GMT. 

public void setName(java.lang.String name)

Sets the name of this business object. Names must be unique identifiers.