SFRMMessageSegmentHandler

public class SFRMMessageSegmentHandler extends DSHandler

The SFRM Message Segment handler is a proxy object of DAO layers. It wraps with some useful query like retrieve message segment and create message by the SFRM Message Header. Creation Date: 9/10/2006

Author:Twinsen Tsang

Methods

clearCache

public void clearCache(DVO dvo)

DOES NOT SUPPORT CACHING.

createMessageSegmentBySFRMMessage

public SFRMMessageSegmentDVO createMessageSegmentBySFRMMessage(SFRMMessage message, String messageBox, String status)

Create an Message Segment according to the SFRM message.

Parameters:
  • message – The message segmented used for generating the message segment record.
  • messageBox – The message box for the mesasge. It should either be “inbox” or “outbox”.
  • status – The status for the new message segment record. if this field is null, we conside the status is PENDING.
Throws:
Returns:

a message segment dvo if the operation runs succesfully.

getInstance

protected DAO getInstance()

Create / Get the instance of DAO.

retrieveDeliveredSegmentForMessage

public List retrieveDeliveredSegmentForMessage(String messageId)

retrieveIncompleteSegments

public List retrieveIncompleteSegments(String messageBox, String status, String type, int limit)

retrieveLastUpdatedMessageSegment

public SFRMMessageSegmentDVO retrieveLastUpdatedMessageSegment(String messageId, String messageBox, String type)

Select the last updated message segment with the specified parameter. The last updated message segment is defined as the message segment which has the latest proceedTimestamp value.

Parameters:
  • messageId – The message id of the message segment belong to.
  • messageBox – The message box of the message segment. It should either “inbox” or “outbox”.
  • type – The segment type (META, PAYLOAD, RECEIPT, RECOVERY)
Throws:
Returns:

A message segment dvo if the operation runs succesfully.

retrieveLastUpdatedTimestamp

public Timestamp retrieveLastUpdatedTimestamp(String messageId, String messageBox, String type)

Select the last updated timestamp with the specified parameter. The last updated message segment is defined as the message segment which has the latest proceedTimestamp value.

Parameters:
  • messageId – The message id of the message segment belong to.
  • messageBox – The message box of the message segment. It should either “inbox” or “outbox”.
  • type – The segment type (META, PAYLOAD, RECEIPT, RECOVERY)
Throws:
Returns:

A message segment dvo if the operation runs succesfully.

retrieveMaxMessageSegmentNumber

public int retrieveMaxMessageSegmentNumber(String messageId, String messageBox, String type)

Find the maximum segment number it has in the DB for the specified message.

Parameters:
  • messageId – The message id of the message segment belong to.
  • messageBox – The message box of the message segment.
  • type – The segment type (META, PAYLOAD, RECEIPT, RECOVERY)
Throws:

retrieveMessageSegment

public SFRMMessageSegmentDVO retrieveMessageSegment(String messageId, String messageBox, int segmentNo, String type)

Select a message segment with the specified parameter.

Parameters:
  • messageId – The message id of the message segment belong to.
  • messageBox – The message box of the message segment. It should either “inbox” or “outbox”.
  • segmentNo – The segment number of the segment
  • type – The segment type (META, PAYLOAD, RECEIPT, RECOVERY)
Throws:
Returns:

A message segment dvo if the operation runs succesfully.

retrieveMessageSegment

public SFRMMessageSegmentDVO retrieveMessageSegment(SFRMMessage message, String messageBox)

Select a message segment with the specified parameter. The segment type is omitted here is this query.

Parameters:
  • message – The message segmented used for get the message segment record.
  • messageBox – The message box for the mesasge. It should either be “inbox” or “outbox”.
Throws:
Returns:

A message segment dvo if the operation runs succesfully.

retrieveMessageSegmentCount

public int retrieveMessageSegmentCount(String messageId, String messageBox, String type, String status)

Find how many message for the partiucalur message id and message box are available in the database.

Parameters:
  • messageId – The message id of the message segment belong to.
  • messageBox – The message box of the message segment. Either inbox or outbox can be allowed.
  • type – The segment type of the message segment.
  • status – The status of the message segment
Throws:

retrieveMessages

public List retrieveMessages(String messageBox, String status, int limit)

Retrieve a set of messages from the specified parameters.

Parameters:
  • messageBox – The message box of the message segment. Either inbox or outbox can be allowed.
  • status – The status of the message segment.
  • limit – The maximum message that can be retrieved.
Throws:
Returns:

Return a list of message that fit the criteria.

retrieveMessages

public List retrieveMessages(String messageBox, String status, String messageStatus, int limit)

retrieveMessages

public List retrieveMessages(String messageBox, String status, String type, String messageStatus, int limit)

retrieveMessages

public List retrieveMessages(String messageId, String messageBox, String messageType, String[] status)

Find message segment by providing the message ID, message box, message type and a list of status

Parameters:
  • messageId – The message id of the mesage segment belong to
  • messageBox – The message box of the message segment
  • messageType – The segment type (META, PAYLOAD, ACK)
  • status – The status of message status
Throws:
Returns:

List of SFRMMessageSegmentDVO

retrieveMessages

public List retrieveMessages(String messageId, String messageBox, String type, List<Integer> segmentNums)