com.sybase.uep.bobclient.data
Class SPMBOModel

java.lang.Object
  extended by com.sybase.uep.bobclient.data.CommonMBOModel
      extended by com.sybase.uep.bobclient.data.MBOModel
          extended by com.sybase.uep.bobclient.data.SPMBOModel
Direct Known Subclasses:
InvisibleSPMBOModel

public class SPMBOModel
extends MBOModel

Structured parameter MBO model

Author:
haowang

Field Summary
static java.lang.String CREATE_OP
          name of create operation
static java.lang.String DELETE_OP
          name of delete operation
static java.lang.String UPDATE_OP
          name of update operation
 
Fields inherited from class com.sybase.uep.bobclient.data.CommonMBOModel
_databaseMetaData, _log, _mboApp, _metaData, KEY, PENDING_OP_SCOPE_MBO, PENDING_OP_SCOPE_PACKAGE, PENDING_OP_SCOPE_SYNCGROUP, SYNCHRONIZATION_NORMAL, SYNCHRONIZATION_NOTIFICATION
 
Constructor Summary
protected SPMBOModel()
           
  SPMBOModel(java.lang.String id)
          Constructor
 
Method Summary
 void cancelPending(java.lang.Object mbo)
          Restores the original state of the MBO instance.The caller takes the responsibility to make sure the metaData of mbo equals to _metaData.
 void cancelPendingObjects()
          Cancel all the pending operations for this MBO object
protected  void doPersist(java.lang.Object mbo, java.lang.String operationName)
          Designed to be overridden.
 java.util.Vector find(Query q)
          Queries the MBOModel with Query q and returns the result
 java.util.Vector findAll()
          Returns all data.
 java.util.Vector findNamedQuery(java.lang.String namedQuery, java.util.Hashtable parameters)
          Queries the MBOModel by the named query name and returns the result
 java.lang.String getPackageName()
          Gets the package name of the MBO
 int getParameterMaxLength(java.lang.String parameterName, java.lang.String namedQuery)
           
 ObjectList getPendingObjects()
          Retrieve the list of pending operations for this MBO object
 java.lang.String getProfileRefID()
          Get the mobile application reference ID
 java.util.Vector getRelationshipDataFilterBy(java.lang.Object mbo, java.lang.String relation, Query q)
          Gets the data through relationship, and the Query q is used to filter the result data.
 int getSize(Query query)
          Queries the size of the total records in the MBOModel with Query q
 java.lang.Object getSK(java.lang.Object mbo)
          Gets the surrogate key of a given mbo instance
 java.lang.String getSynchronizationGroup()
          Obtains the synchronization group registered by this MBO; Returns null if no synchronization group found
 MBOModelSyncParameters getSyncParameter()
          Get the synchronization parameters for this MBO
 java.lang.Object invoke(java.lang.Object mbo, java.lang.String operationName, ObjectList paramValueList)
          Wrapper the invoke method of reflection manager.
 boolean isDeleted(java.lang.Object mbo)
          Checks if the MBO object has been deleted since last synchronization.The caller takes the responsibility to make sure the metaData of mbo equals to _metaData.
 boolean isDirty(java.lang.Object mbo)
          Checks if the MBO object has been updated since last synchronization.The caller takes the responsibility to make sure the metaData of mbo equals to _metaData.
 boolean isNew(java.lang.Object mbo)
          Checks if the MBO object is a new created one since last synchronization.The caller takes the responsibility to make sure the metaData of mbo equals to _metaData.
 boolean isOtherCalled(java.lang.Object mbo)
           
 boolean isSynchronized()
          Gets whether this MBO application has been synchronized.
 void namedQueryChanged()
          Fires NAMED_QUERY_TYPE event.
 void namedQueryInitialized()
          Fires NAMED_QUERY_INITIALIZED_TYPE event.
protected  java.util.Vector readPersistentData()
          Designed to be overridden.
 void refresh(java.lang.Object mbo)
          Refresh the given mbo.
 void saveUpdate(java.lang.Object mbo)
          Saves the changes to MBO application.
 void setData(java.util.Vector data)
          set data to this model
 void setData(java.util.Vector data, boolean notifyListener)
          Set the data to this model
 void submitPendingObjects()
          Submits all the pending operations for this MBO object.
 void synchronize(SyncStatusListener syncStatusListener, int pendingOpScope)
          Synchronizes the MBO application with a sync status listener.
 
Methods inherited from class com.sybase.uep.bobclient.data.MBOModel
clearSyncParameter, currentSelectChanged, deleteFromModel, getLastOperation, getLogs, getOtherOperationModel, getOtherOperationModelTable, getReflectionManager, getRelationshipData, getValue, newMBOInstance, parentSelectChanged, relationshipChanged, setValue, size, submitPending
 
Methods inherited from class com.sybase.uep.bobclient.data.CommonMBOModel
addModelChangeListener, deleteDatabase, fireModelChanged, fireSyncEvent, fireSyncEvent, getDataType, getID, getLastSynchronized, getLogger, getLogs, getMetaData, getName, getSynchronizationGroup, getSynchronizationProfile, getSynchronizationProfile, getType, invoke, loginToSync, registerCallbackHandler, removeModelChangeListener, startBackgroundSynchronization, startBackgroundSynchronization, submitPendingOperations, submitPendingOperations, synchronize, synchronize, syncSyncGroup, syncSyncGroupNoSubmit, uploadLogs
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CREATE_OP

public static final java.lang.String CREATE_OP
name of create operation

See Also:
Constant Field Values

DELETE_OP

public static final java.lang.String DELETE_OP
name of delete operation

See Also:
Constant Field Values

UPDATE_OP

public static final java.lang.String UPDATE_OP
name of update operation

See Also:
Constant Field Values
Constructor Detail

SPMBOModel

public SPMBOModel(java.lang.String id)
Constructor

Parameters:
id - This implementation call readPersistentData(), if the returned data is not null, it will be used as the initial contained data of this model. Otherwise, the initial value is an empty Vector

SPMBOModel

protected SPMBOModel()
Method Detail

readPersistentData

protected java.util.Vector readPersistentData()
Designed to be overridden. Subclass should override this to read data from file system. The returned data will be used as the initial data of this structure mbo model. Since this method will be called by the constructor, it's overriding method should avoid to access any class fields that are initialized by the subclass's constructor.

Returns:

getSynchronizationGroup

public java.lang.String getSynchronizationGroup()
Description copied from class: CommonMBOModel
Obtains the synchronization group registered by this MBO; Returns null if no synchronization group found

Overrides:
getSynchronizationGroup in class MBOModel
Returns:
the synchronization group name

isSynchronized

public boolean isSynchronized()
Description copied from class: MBOModel
Gets whether this MBO application has been synchronized.

Overrides:
isSynchronized in class MBOModel
Returns:

synchronize

public void synchronize(SyncStatusListener syncStatusListener,
                        int pendingOpScope)
                 throws java.lang.Exception
Description copied from class: MBOModel
Synchronizes the MBO application with a sync status listener.

Overrides:
synchronize in class MBOModel
Parameters:
syncStatusListener - - Sync status listener
pendingOpScope - - @see CommonMBOModel.PENDING_OP_SCOPE_SYNCGROUP, CommonMBOModel.PENDING_OP_SCOPE_MBO, CommonMBOModel.PENDING_OP_SCOPE_PACKAGE
Throws:
NoSuchOperationException - if synchronize( SyncStatusListener ) is not defined in corresponding database class.
java.lang.Exception

invoke

public java.lang.Object invoke(java.lang.Object mbo,
                               java.lang.String operationName,
                               ObjectList paramValueList)
Description copied from class: CommonMBOModel
Wrapper the invoke method of reflection manager. The difference with invoke(Object mbo, String operationName, String[] paramTypeList, ObjectList paramValueList)is that it doesn't require the data types. Object API can do this because there will be an restriction that there won't duplicate operation name in one MBO

Overrides:
invoke in class CommonMBOModel
Returns:

isDeleted

public boolean isDeleted(java.lang.Object mbo)
Description copied from class: MBOModel
Checks if the MBO object has been deleted since last synchronization.The caller takes the responsibility to make sure the metaData of mbo equals to _metaData. For example, caller should not try to use a Customer MBOModel to check the status of a SalesOrder instance

Overrides:
isDeleted in class MBOModel
Returns:

isDirty

public boolean isDirty(java.lang.Object mbo)
Description copied from class: MBOModel
Checks if the MBO object has been updated since last synchronization.The caller takes the responsibility to make sure the metaData of mbo equals to _metaData. For example, caller should not try to use a Customer MBOModel to check the status of a SalesOrder instance

Overrides:
isDirty in class MBOModel
Returns:

isNew

public boolean isNew(java.lang.Object mbo)
Description copied from class: MBOModel
Checks if the MBO object is a new created one since last synchronization.The caller takes the responsibility to make sure the metaData of mbo equals to _metaData. For example, caller should not try to use a Customer MBOModel to check the status of a SalesOrder instance

Overrides:
isNew in class MBOModel
Returns:

cancelPending

public void cancelPending(java.lang.Object mbo)
Description copied from class: MBOModel
Restores the original state of the MBO instance.The caller takes the responsibility to make sure the metaData of mbo equals to _metaData. For example, caller should not try to use a Customer MBOModel to restore the state of a SalesOrder instance

Overrides:
cancelPending in class MBOModel

cancelPendingObjects

public void cancelPendingObjects()
Description copied from class: MBOModel
Cancel all the pending operations for this MBO object

Overrides:
cancelPendingObjects in class MBOModel

getPendingObjects

public ObjectList getPendingObjects()
Description copied from class: MBOModel
Retrieve the list of pending operations for this MBO object

Overrides:
getPendingObjects in class MBOModel
Returns:
ObjectList list of MBO objects
See Also:
ObjectList

getSyncParameter

public MBOModelSyncParameters getSyncParameter()
Description copied from class: MBOModel
Get the synchronization parameters for this MBO

Overrides:
getSyncParameter in class MBOModel
Returns:
MBOModelSyncParameters object

find

public java.util.Vector find(Query q)
Description copied from class: MBOModel
Queries the MBOModel with Query q and returns the result

Overrides:
find in class MBOModel
Returns:
a Vector that contains MBO instances. Return an empty vector if no data is found.

findAll

public java.util.Vector findAll()
Returns all data.

Returns:
all data.

setData

public void setData(java.util.Vector data)
set data to this model

Parameters:
data -

setData

public void setData(java.util.Vector data,
                    boolean notifyListener)
Set the data to this model

Parameters:
data -
notifyListener - whether to fire an event.

findNamedQuery

public java.util.Vector findNamedQuery(java.lang.String namedQuery,
                                       java.util.Hashtable parameters)
Description copied from class: MBOModel
Queries the MBOModel by the named query name and returns the result

Overrides:
findNamedQuery in class MBOModel
Parameters:
namedQuery - String value for the named query method name
parameters - Hashtable value for the list of parameters
Returns:
Vector value for the result set.

getPackageName

public java.lang.String getPackageName()
Description copied from class: CommonMBOModel
Gets the package name of the MBO

Overrides:
getPackageName in class CommonMBOModel
Returns:

getParameterMaxLength

public int getParameterMaxLength(java.lang.String parameterName,
                                 java.lang.String namedQuery)

getProfileRefID

public java.lang.String getProfileRefID()
Description copied from class: MBOModel
Get the mobile application reference ID

Overrides:
getProfileRefID in class MBOModel
Returns:
string value of ID

getRelationshipDataFilterBy

public java.util.Vector getRelationshipDataFilterBy(java.lang.Object mbo,
                                                    java.lang.String relation,
                                                    Query q)
Description copied from class: MBOModel
Gets the data through relationship, and the Query q is used to filter the result data.

Overrides:
getRelationshipDataFilterBy in class MBOModel
Parameters:
mbo - the parent mbo to retrieve the child data
relation - relationship name
q - query
Returns:
the data matches the query

getSize

public int getSize(Query query)
Description copied from class: MBOModel
Queries the size of the total records in the MBOModel with Query q

Overrides:
getSize in class MBOModel
Returns:
the count of the records

getSK

public java.lang.Object getSK(java.lang.Object mbo)
Description copied from class: MBOModel
Gets the surrogate key of a given mbo instance

Overrides:
getSK in class MBOModel
Parameters:
mbo -
Returns:

isOtherCalled

public boolean isOtherCalled(java.lang.Object mbo)

namedQueryChanged

public void namedQueryChanged()
Description copied from class: MBOModel
Fires NAMED_QUERY_TYPE event.

Overrides:
namedQueryChanged in class MBOModel

namedQueryInitialized

public void namedQueryInitialized()
Description copied from class: MBOModel
Fires NAMED_QUERY_INITIALIZED_TYPE event.

Overrides:
namedQueryInitialized in class MBOModel

refresh

public void refresh(java.lang.Object mbo)
Description copied from class: MBOModel
Refresh the given mbo.

Overrides:
refresh in class MBOModel
Parameters:
mbo -

saveUpdate

public void saveUpdate(java.lang.Object mbo)
Description copied from class: MBOModel
Saves the changes to MBO application. The caller takes the responsibility to make sure the metaData of mbo equals to _metaData. For example, caller should not try to use a Customer MBOModel to save the update on a SalesOrder instance

Overrides:
saveUpdate in class MBOModel
Parameters:
mbo - the changed MBO instance

submitPendingObjects

public void submitPendingObjects()
Description copied from class: MBOModel
Submits all the pending operations for this MBO object. During MBO sync, synchronization group level pending operations should be submitted, so this API is only intended to be called in pending operations screen, when user selects a MBO model.

Overrides:
submitPendingObjects in class MBOModel

doPersist

protected void doPersist(java.lang.Object mbo,
                         java.lang.String operationName)
Designed to be overridden. It will be called after each CUD operation

Parameters:
mbo - the raw object to be persisted