SFRMMessageHandler

public class SFRMMessageHandler extends DSHandler

THe SFRM Message handler is a proxy object of DAO layers. It wraps with some useful query like retrieve message and create message by the SFRM Meta Header. Creation Date: 3/10/2006 V1.0.1 - supports DVO caching.

Author:Twinsen Tsang

Methods

clearCache

public void clearCache(DVO dvo)

Clear the cache ONLY by a particular dvo object;

createMessageBySFRMMetaMessage

public SFRMMessageDVO createMessageBySFRMMetaMessage(SFRMMessage msg, SFRMPartnershipDVO pDVO, String messageBox, String status, String statusDesc)

Create a new message record by a SFRM Mesasge which is meta type.

Parameters:
  • msg – The SFRM message.
  • pDVO – The partnership associated with this message.
  • messageBox – The message box of the new message record.
  • status – The status of the new message record.
  • statusDesc – The status description of the new message record.
Throws:
  • DAOException – If the sfrm message is null or with segment no not equal to zero , or other database error.
  • SFRMException
  • IOException
  • FileNotFoundException
Returns:

return null if database error, otherwise a new message record.

getInstance

protected DAO getInstance()

Create / Get the instance of DAO.

removeMessage

public boolean removeMessage(SFRMMessageDVO msgDVO)

Remove the msgDVO to the pesistence DB. Developer SHOULD use this method instead of hk.hku.cecid.piazza.commons.dao.DAO.remove(hk.hku.cecid.piazza.commons.dao.DVO) because this invocation also manage the DVO cache.

Parameters:
  • msgDVO – The message DVO to be update.
Throws:
Returns:

true if operation success, fail vice versa.

retrieveAcknowledgmentMessages

public List retrieveAcknowledgmentMessages(int numOfMessage, int offset)

Retrieve a set of messages that is required to ack the acknowledgement from receiver

Parameters:
  • numOfMessage – number of messages for acknowledgement request
  • offset – offset in the message records
Throws:
Returns:

a list of message that is required to ack the acknowledgement

retrieveMessage

public SFRMMessageDVO retrieveMessage(String messageId, String messageBox)

Retrieve a message from the specified parameters. This method support caching. If the particular DVO is already in the cache, it returned immediately without JDBC calls.

Parameters:
  • messageId – The message id of the message.
  • messageBox – The message box of the message. either inbox or outbox.
Throws:
Returns:

return null if not found by the specified parameter, otherwise a message record.

retrieveMessages

public List retrieveMessages(String messageBox, String status)

Retrieve a set of messages from the specified parameters.

Parameters:
  • messageBox – The message box of the message. either inbox or outbox.
  • status – The status of the message.
Throws:
Returns:

return a list of message that fit the criteria.

updateMessage

public boolean updateMessage(SFRMMessageDVO msgDVO)

Update the msgDVO to the pesistence DB. Developer SHOULD use this method instead of hk.hku.cecid.piazza.commons.dao.DAO.persist(hk.hku.cecid.piazza.commons.dao.DVO) because this invocation also manage the DVO cache.

Parameters:
  • msgDVO – The message DVO to be update.
Returns:

true if operation success, fail vice versa.