/**
  * Find max sequence no. of inbox message in PS or DL status by CPA Only for EbMS Inbox Collector
  * Service
  *
  * @param data The message data value object.
  * @return max sequence no. -1 will be returned if there is no matching data.
  * @throws DAOException if errors found when retrieving data from the data source.
  */
 public int findInboxReadyMaxSequenceNoByCpa(MessageDVO data) throws DAOException {
   List l =
       super.find(
           "find_inbox_ready_max_sequence_no_by_cpa",
           new Object[] {data.getCpaId(), data.getService(), data.getAction(), data.getConvId()});
   Iterator i = l.iterator();
   if (i.hasNext()) {
     MessageDataSourceDVO resultData = (MessageDataSourceDVO) i.next();
     return resultData.getSequenceNo();
   }
   return -1;
 }
 public int findMaxSequenceGroupByMessageBoxAndCpa(MessageDVO data) throws DAOException {
   List l =
       super.find(
           "find_max_sequence_group_by_message_box_and_cpa",
           new Object[] {
             data.getMessageBox(),
             data.getCpaId(),
             data.getService(),
             data.getAction(),
             data.getConvId()
           });
   Iterator i = l.iterator();
   if (i.hasNext()) {
     MessageDataSourceDVO resultData = (MessageDataSourceDVO) i.next();
     return resultData.getSequenceGroup();
   }
   return -1;
 }
 // find the ref to message
 public boolean findRefToMessage(MessageDVO data) throws DAOException {
   List l =
       super.find(
           "find_ref_to_message",
           new Object[] {data.getRefToMessageId(), data.getMessageBox(), data.getMessageType()});
   Iterator i = l.iterator();
   if (i.hasNext()) {
     ((MessageDataSourceDVO) data).setData(((MessageDataSourceDVO) i.next()).getData());
     return true;
   }
   return false;
 }
 public boolean findOrderedMessageByMessageBoxAndCpaAndSequenceGroupAndSequenceNo(MessageDVO data)
     throws DAOException {
   List l =
       super.find(
           "find_ordered_message_by_message_box_and_cpa_and_sequence_group_and_sequence_no",
           new Object[] {
             data.getMessageBox(),
             data.getCpaId(),
             data.getService(),
             data.getAction(),
             data.getConvId(),
             new Integer(data.getSequenceGroup()),
             new Integer(data.getSequenceNo())
           });
   Iterator i = l.iterator();
   if (i.hasNext()) {
     ((MessageDataSourceDVO) data).setData(((MessageDataSourceDVO) i.next()).getData());
     return true;
   }
   return false;
 }