@Test public void testFindMessageByCpa() throws DAOException { MessageDVO dvo; List list; MessageDVO result; MessageDataSourceDAO dao = super.getTestingTarget(); dvo = (MessageDVO)dao.createDVO(); dvo.setCpaId("cecid4"); dvo.setService("cecid:cecid"); dvo.setAction("order"); list = dao.findMessageByCpa(dvo, 10); Assert.assertEquals(5, list.size()); result = (MessageDVO)list.get(0); Assert.assertEquals("convId3", result.getConvId()); result = (MessageDVO)list.get(1); Assert.assertEquals("convId4", result.getConvId()); result = (MessageDVO)list.get(2); Assert.assertEquals("convId2", result.getConvId()); result = (MessageDVO)list.get(3); Assert.assertEquals("convId5", result.getConvId()); result = (MessageDVO)list.get(4); Assert.assertEquals("convId1", result.getConvId()); list = dao.findMessageByCpa(dvo, 1); Assert.assertEquals(1, list.size()); dvo = (MessageDVO)dao.createDVO(); dvo.setCpaId("cecid4"); dvo.setService("cecid:cecid"); dvo.setAction("order"); dvo.setFromPartyId("fromPartyId1"); list = dao.findMessageByCpa(dvo, 10); result = (MessageDVO)list.get(0); Assert.assertEquals("fromPartyId1", result.getFromPartyId()); dvo = (MessageDVO)dao.createDVO(); dvo.setCpaId("cecid4"); dvo.setService("cecid:cecid"); dvo.setAction("order"); dvo.setFromPartyRole("fromPartyType2"); list = dao.findMessageByCpa(dvo, 10); result = (MessageDVO)list.get(0); Assert.assertEquals("fromPartyType2", result.getFromPartyRole()); dvo = (MessageDVO)dao.createDVO(); dvo.setCpaId("cecid4"); dvo.setService("cecid:cecid"); dvo.setAction("order"); dvo.setToPartyId("toPartyId3"); list = dao.findMessageByCpa(dvo, 10); result = (MessageDVO)list.get(0); Assert.assertEquals("toPartyId3", result.getToPartyId()); dvo = (MessageDVO)dao.createDVO(); dvo.setCpaId("cecid4"); dvo.setService("cecid:cecid"); dvo.setAction("order"); dvo.setToPartyRole("toPartyType4"); list = dao.findMessageByCpa(dvo, 10); result = (MessageDVO)list.get(0); Assert.assertEquals("toPartyType4", result.getToPartyRole()); dvo = (MessageDVO)dao.createDVO(); dvo.setCpaId("cecid4"); dvo.setService("cecid:cecid"); dvo.setAction("order"); dvo.setConvId("convId5"); list = dao.findMessageByCpa(dvo, 10); result = (MessageDVO)list.get(0); Assert.assertEquals("convId5", result.getConvId()); dvo = (MessageDVO)dao.createDVO(); dvo.setCpaId("cecid4"); dvo.setService("cecid:cecid"); dvo.setAction("order"); dvo.setConvId("convId5"); dvo.setFromPartyId("fromPartyId5"); dvo.setFromPartyRole("fromPartyType5"); dvo.setToPartyId("toPartyId5"); dvo.setToPartyRole("toPartyType5"); list = dao.findMessageByCpa(dvo, 10); Assert.assertEquals(1, list.size()); }
public List findMessageByCpa(MessageDVO data, int numberOfMessage) throws DAOException { List parameters = new ArrayList(); String sql = super.getFinder("find_message_by_cpa"); parameters.add(data.getCpaId()); parameters.add(data.getService()); parameters.add(data.getAction()); if (data.getConvId() != null) { sql += " AND " + getFilter("find_message_by_cpa_filter_conv_id"); parameters.add(data.getConvId()); } if (data.getFromPartyId() != null) { sql += " AND " + getFilter("find_message_by_cpa_filter_from_party_id"); parameters.add(data.getFromPartyId()); } if (data.getFromPartyRole() != null) { sql += " AND " + getFilter("find_message_by_cpa_filter_from_party_role"); parameters.add(data.getFromPartyRole()); } if (data.getToPartyId() != null) { sql += " AND " + getFilter("find_message_by_cpa_filter_to_party_id"); parameters.add(data.getToPartyId()); } if (data.getToPartyRole() != null) { sql += " AND " + getFilter("find_message_by_cpa_filter_to_party_role"); parameters.add(data.getToPartyRole()); } sql += " " + getOrder("find_message_by_cpa_order"); parameters.add(new Integer(numberOfMessage)); return executeQuery(sql, parameters.toArray()); }
MessageDataSourceDAO extends DataSourceDAO implements MessageDAO { public List findMessageByCpa(MessageDVO data, int numberOfMessage) throws DAOException { List parameters = new ArrayList(); String sql = super.getFinder("find_message_by_cpa"); parameters.add(data.getCpaId()); parameters.add(data.getService()); parameters.add(data.getAction()); if (data.getConvId() != null) { sql += " AND " + getFilter("find_message_by_cpa_filter_conv_id"); parameters.add(data.getConvId()); } if (data.getFromPartyId() != null) { sql += " AND " + getFilter("find_message_by_cpa_filter_from_party_id"); parameters.add(data.getFromPartyId()); } if (data.getFromPartyRole() != null) { sql += " AND " + getFilter("find_message_by_cpa_filter_from_party_role"); parameters.add(data.getFromPartyRole()); } if (data.getToPartyId() != null) { sql += " AND " + getFilter("find_message_by_cpa_filter_to_party_id"); parameters.add(data.getToPartyId()); } if (data.getToPartyRole() != null) { sql += " AND " + getFilter("find_message_by_cpa_filter_to_party_role"); parameters.add(data.getToPartyRole()); } sql += " " + getOrder("find_message_by_cpa_order"); parameters.add(new Integer(numberOfMessage)); return executeQuery(sql, parameters.toArray()); } }
MessageDataSourceDAO extends DataSourceDAO implements MessageDAO { public List findMessageByCpa(MessageDVO data, int numberOfMessage) throws DAOException { List parameters = new ArrayList(); String sql = super.getFinder("find_message_by_cpa"); parameters.add(data.getCpaId()); parameters.add(data.getService()); parameters.add(data.getAction()); if (data.getConvId() != null) { sql += " AND " + getFilter("find_message_by_cpa_filter_conv_id"); parameters.add(data.getConvId()); } if (data.getFromPartyId() != null) { sql += " AND " + getFilter("find_message_by_cpa_filter_from_party_id"); parameters.add(data.getFromPartyId()); } if (data.getFromPartyRole() != null) { sql += " AND " + getFilter("find_message_by_cpa_filter_from_party_role"); parameters.add(data.getFromPartyRole()); } if (data.getToPartyId() != null) { sql += " AND " + getFilter("find_message_by_cpa_filter_to_party_id"); parameters.add(data.getToPartyId()); } if (data.getToPartyRole() != null) { sql += " AND " + getFilter("find_message_by_cpa_filter_to_party_role"); parameters.add(data.getToPartyRole()); } sql += " " + getOrder("find_message_by_cpa_order"); parameters.add(new Integer(numberOfMessage)); return executeQuery(sql, parameters.toArray()); }  }
MessageDataSourceDAO extends DataSourceDAO implements MessageDAO { public List findMessageByCpa(MessageDVO data, int numberOfMessage) throws DAOException { List parameters = new ArrayList(); String sql = super.getFinder("find_message_by_cpa"); parameters.add(data.getCpaId()); parameters.add(data.getService()); parameters.add(data.getAction()); if (data.getConvId() != null) { sql += " AND " + getFilter("find_message_by_cpa_filter_conv_id"); parameters.add(data.getConvId()); } if (data.getFromPartyId() != null) { sql += " AND " + getFilter("find_message_by_cpa_filter_from_party_id"); parameters.add(data.getFromPartyId()); } if (data.getFromPartyRole() != null) { sql += " AND " + getFilter("find_message_by_cpa_filter_from_party_role"); parameters.add(data.getFromPartyRole()); } if (data.getToPartyId() != null) { sql += " AND " + getFilter("find_message_by_cpa_filter_to_party_id"); parameters.add(data.getToPartyId()); } if (data.getToPartyRole() != null) { sql += " AND " + getFilter("find_message_by_cpa_filter_to_party_role"); parameters.add(data.getToPartyRole()); } sql += " " + getOrder("find_message_by_cpa_order"); parameters.add(new Integer(numberOfMessage)); return executeQuery(sql, parameters.toArray()); }  DVO createDVO(); boolean findMessage(MessageDVO data); void addMessage(MessageDVO data); void deleteMessage(MessageDVO data); boolean updateMessage(MessageDVO data); boolean findRefToMessage(MessageDVO data); List findMessagesByTime(int time_period, MessageDVO data, int numberOfMessage, int offset); List findMessagesBeforeTime(int time_period); List findInboxPendingMessagesByTimestamp(MessageDVO data); List findOutboxPendingMessagesByTimestamp(MessageDVO data); List findOutboxProcessingMessagesByTimestamp(MessageDVO data); List findMessageByCpa(MessageDVO data, int numberOfMessage); int findInboxReadyMaxSequenceNoByCpa(MessageDVO data); int findMaxSequenceNoByMessageBoxAndCpa(MessageDVO data); int findMaxSequenceGroupByMessageBoxAndCpa(MessageDVO data); int findNumOfMessagesByMessageBoxAndCpaAndSequenceGroup(
            MessageDVO data); boolean findOrderedMessageByMessageBoxAndCpaAndSequenceGroupAndSequenceNo(
            MessageDVO data); List findOrderedMessagesByMessageBoxAndCpaAndStatus(MessageDVO data); List findMessagesByHistory(MessageDVO data, int numberOfMessage,
            int offset); int findNumberOfMessagesByHistory(MessageDVO data); int updateTimedOutMessageStatus(String status, Date currentTime); }
MessageDataSourceDAO extends DataSourceDAO implements MessageDAO { public List findMessageByCpa(MessageDVO data, int numberOfMessage) throws DAOException { List parameters = new ArrayList(); String sql = super.getFinder("find_message_by_cpa"); parameters.add(data.getCpaId()); parameters.add(data.getService()); parameters.add(data.getAction()); if (data.getConvId() != null) { sql += " AND " + getFilter("find_message_by_cpa_filter_conv_id"); parameters.add(data.getConvId()); } if (data.getFromPartyId() != null) { sql += " AND " + getFilter("find_message_by_cpa_filter_from_party_id"); parameters.add(data.getFromPartyId()); } if (data.getFromPartyRole() != null) { sql += " AND " + getFilter("find_message_by_cpa_filter_from_party_role"); parameters.add(data.getFromPartyRole()); } if (data.getToPartyId() != null) { sql += " AND " + getFilter("find_message_by_cpa_filter_to_party_id"); parameters.add(data.getToPartyId()); } if (data.getToPartyRole() != null) { sql += " AND " + getFilter("find_message_by_cpa_filter_to_party_role"); parameters.add(data.getToPartyRole()); } sql += " " + getOrder("find_message_by_cpa_order"); parameters.add(new Integer(numberOfMessage)); return executeQuery(sql, parameters.toArray()); }  DVO createDVO(); boolean findMessage(MessageDVO data); void addMessage(MessageDVO data); void deleteMessage(MessageDVO data); boolean updateMessage(MessageDVO data); boolean findRefToMessage(MessageDVO data); List findMessagesByTime(int time_period, MessageDVO data, int numberOfMessage, int offset); List findMessagesBeforeTime(int time_period); List findInboxPendingMessagesByTimestamp(MessageDVO data); List findOutboxPendingMessagesByTimestamp(MessageDVO data); List findOutboxProcessingMessagesByTimestamp(MessageDVO data); List findMessageByCpa(MessageDVO data, int numberOfMessage); int findInboxReadyMaxSequenceNoByCpa(MessageDVO data); int findMaxSequenceNoByMessageBoxAndCpa(MessageDVO data); int findMaxSequenceGroupByMessageBoxAndCpa(MessageDVO data); int findNumOfMessagesByMessageBoxAndCpaAndSequenceGroup(
            MessageDVO data); boolean findOrderedMessageByMessageBoxAndCpaAndSequenceGroupAndSequenceNo(
            MessageDVO data); List findOrderedMessagesByMessageBoxAndCpaAndStatus(MessageDVO data); List findMessagesByHistory(MessageDVO data, int numberOfMessage,
            int offset); int findNumberOfMessagesByHistory(MessageDVO data); int updateTimedOutMessageStatus(String status, Date currentTime);  }