@Test public void testFindSegmentByMessageIdAndBoxAndTypeAndNos() throws Exception{ SFRMMessageSegmentDAO dao = this.getTestingTarget(); List segNums = new ArrayList(); segNums.add(new Integer(1)); segNums.add(new Integer(3)); List results = dao.findSegmentByMessageIdAndBoxAndTypeAndNos("a", SFRMConstant.MSGBOX_OUT, SFRMConstant.MSGT_PAYLOAD, segNums); Assert.assertEquals("Number of segment found should be 2", 2, results.size()); SFRMMessageSegmentDVO dvo = (SFRMMessageSegmentDVO) results.get(0); Assert.assertEquals("Message segment with num 1 not found", 1, dvo.getSegmentNo()); Assert.assertEquals("Message segment 1 should have status DL", "DL", dvo.getStatus()); Assert.assertEquals("Message box should be OUTBOX", SFRMConstant.MSGBOX_OUT, dvo.getMessageBox()); Assert.assertEquals("Message Id should be a", "a", dvo.getMessageId()); dvo = (SFRMMessageSegmentDVO) results.get(1); Assert.assertEquals("Message segment with num 3 not found", 3, dvo.getSegmentNo()); Assert.assertEquals("Message segment 3 should have status DF", "DF", dvo.getStatus()); Assert.assertEquals("Message box should be OUTBOX", SFRMConstant.MSGBOX_OUT, dvo.getMessageBox()); Assert.assertEquals("Message Id should be a", "a", dvo.getMessageId()); }
public List findSegmentByMessageIdAndBoxAndTypeAndNos( String messageId, String messageBox, String type, List<Integer> segmentNos ) throws DAOException{ ArrayList parameters = new ArrayList(); String sql = super.getFinder("find_message_segment_by_msgid_msg_box_type"); String segFilter = super.getFilter("find_message_segment_by_msgid_msg_box_type_filter"); String questionToken = ""; for(int i=0 ; segmentNos.size() > i ; i++){ questionToken += "?"; if(i != segmentNos.size() - 1){ questionToken += ","; } } segFilter = segFilter.replace("?", questionToken); sql += " AND " + segFilter; parameters.add(messageId); parameters.add(messageBox); parameters.add(type); parameters.addAll(segmentNos); return super.executeQuery(sql, parameters.toArray()); }
SFRMMessageSegmentDSDAO extends DataSourceDAO implements
		SFRMMessageSegmentDAO { public List findSegmentByMessageIdAndBoxAndTypeAndNos( String messageId, String messageBox, String type, List<Integer> segmentNos ) throws DAOException{ ArrayList parameters = new ArrayList(); String sql = super.getFinder("find_message_segment_by_msgid_msg_box_type"); String segFilter = super.getFilter("find_message_segment_by_msgid_msg_box_type_filter"); String questionToken = ""; for(int i=0 ; segmentNos.size() > i ; i++){ questionToken += "?"; if(i != segmentNos.size() - 1){ questionToken += ","; } } segFilter = segFilter.replace("?", questionToken); sql += " AND " + segFilter; parameters.add(messageId); parameters.add(messageBox); parameters.add(type); parameters.addAll(segmentNos); return super.executeQuery(sql, parameters.toArray()); } }
SFRMMessageSegmentDSDAO extends DataSourceDAO implements
		SFRMMessageSegmentDAO { public List findSegmentByMessageIdAndBoxAndTypeAndNos( String messageId, String messageBox, String type, List<Integer> segmentNos ) throws DAOException{ ArrayList parameters = new ArrayList(); String sql = super.getFinder("find_message_segment_by_msgid_msg_box_type"); String segFilter = super.getFilter("find_message_segment_by_msgid_msg_box_type_filter"); String questionToken = ""; for(int i=0 ; segmentNos.size() > i ; i++){ questionToken += "?"; if(i != segmentNos.size() - 1){ questionToken += ","; } } segFilter = segFilter.replace("?", questionToken); sql += " AND " + segFilter; parameters.add(messageId); parameters.add(messageBox); parameters.add(type); parameters.addAll(segmentNos); return super.executeQuery(sql, parameters.toArray()); }  }
SFRMMessageSegmentDSDAO extends DataSourceDAO implements
		SFRMMessageSegmentDAO { public List findSegmentByMessageIdAndBoxAndTypeAndNos( String messageId, String messageBox, String type, List<Integer> segmentNos ) throws DAOException{ ArrayList parameters = new ArrayList(); String sql = super.getFinder("find_message_segment_by_msgid_msg_box_type"); String segFilter = super.getFilter("find_message_segment_by_msgid_msg_box_type_filter"); String questionToken = ""; for(int i=0 ; segmentNos.size() > i ; i++){ questionToken += "?"; if(i != segmentNos.size() - 1){ questionToken += ","; } } segFilter = segFilter.replace("?", questionToken); sql += " AND " + segFilter; parameters.add(messageId); parameters.add(messageBox); parameters.add(type); parameters.addAll(segmentNos); return super.executeQuery(sql, parameters.toArray()); }  DVO createDVO(); SFRMMessageSegmentDVO findMessageSegmentByMessageIdAndBoxAndType(
			String messageId, String messageBox, int segmentNo, String type); SFRMMessageSegmentDVO findLastUpdatedMessageSegmentByMessageIdAndBoxAndType(
			String 	messageId,
			String 	messageBox,
			String	type); List findMessageSegmentsByMessageBoxAndStatus(
			String messageBox, String status, int limit); List findMessageSegmentsByMessageBoxAndStatusAndMessageStatusNotEqualTo(
			String messageBox, String status, String messageStatus, int limit); List findMessageSegmentByMessageBoxAndStatusAndTypeAndMessageStatusNotEqualTo(
			String 	messageBox, 
			String 	status, 
			String  type,
			String 	messageStatus, 
			int 	limit); List findIncompleteSegments(
			String messageBox,
			String status,
			String type,
			int    limit); int findNumOfSegmentByMessageIdAndBoxAndTypeAndStatus(
			String messageId, 
			String messageBox, 
			String type, 
			String status); List findSegmentsByMessageIdAndBoxAndTypeAndStatus(
			String messageId, 
			String messageBox,
			String type, 
			String status); int findMaxSegmentNoByMessageIdAndBoxAndType(
			String messageId,
			String messageBox,
			String type); List findSegmentByMessageIdAndBoxAndTypeAndNos(
			String messageId,
			String messageBox,
			String type,
			List<Integer> segmentNos
			); int updateBatchSegmentsRecoveryStatus(
			String status, 
			String messageId,
			String messageBox,
			String segmentType,
			List<Integer> segNums); int updateBatchSegmentsStatus(
			String status,
			Timestamp completeTime,
			String messageId,
			String messageBox,
			String segmentType,
			List<Integer> segNums); long findNumOfBytesSentByMessageIdAndBoxAndTypeAndStatues(
			String messageId, 
			String messageBox,
			String type, 
			long proceedTime,
			List<String> statues); }
SFRMMessageSegmentDSDAO extends DataSourceDAO implements
		SFRMMessageSegmentDAO { public List findSegmentByMessageIdAndBoxAndTypeAndNos( String messageId, String messageBox, String type, List<Integer> segmentNos ) throws DAOException{ ArrayList parameters = new ArrayList(); String sql = super.getFinder("find_message_segment_by_msgid_msg_box_type"); String segFilter = super.getFilter("find_message_segment_by_msgid_msg_box_type_filter"); String questionToken = ""; for(int i=0 ; segmentNos.size() > i ; i++){ questionToken += "?"; if(i != segmentNos.size() - 1){ questionToken += ","; } } segFilter = segFilter.replace("?", questionToken); sql += " AND " + segFilter; parameters.add(messageId); parameters.add(messageBox); parameters.add(type); parameters.addAll(segmentNos); return super.executeQuery(sql, parameters.toArray()); }  DVO createDVO(); SFRMMessageSegmentDVO findMessageSegmentByMessageIdAndBoxAndType(
			String messageId, String messageBox, int segmentNo, String type); SFRMMessageSegmentDVO findLastUpdatedMessageSegmentByMessageIdAndBoxAndType(
			String 	messageId,
			String 	messageBox,
			String	type); List findMessageSegmentsByMessageBoxAndStatus(
			String messageBox, String status, int limit); List findMessageSegmentsByMessageBoxAndStatusAndMessageStatusNotEqualTo(
			String messageBox, String status, String messageStatus, int limit); List findMessageSegmentByMessageBoxAndStatusAndTypeAndMessageStatusNotEqualTo(
			String 	messageBox, 
			String 	status, 
			String  type,
			String 	messageStatus, 
			int 	limit); List findIncompleteSegments(
			String messageBox,
			String status,
			String type,
			int    limit); int findNumOfSegmentByMessageIdAndBoxAndTypeAndStatus(
			String messageId, 
			String messageBox, 
			String type, 
			String status); List findSegmentsByMessageIdAndBoxAndTypeAndStatus(
			String messageId, 
			String messageBox,
			String type, 
			String status); int findMaxSegmentNoByMessageIdAndBoxAndType(
			String messageId,
			String messageBox,
			String type); List findSegmentByMessageIdAndBoxAndTypeAndNos(
			String messageId,
			String messageBox,
			String type,
			List<Integer> segmentNos
			); int updateBatchSegmentsRecoveryStatus(
			String status, 
			String messageId,
			String messageBox,
			String segmentType,
			List<Integer> segNums); int updateBatchSegmentsStatus(
			String status,
			Timestamp completeTime,
			String messageId,
			String messageBox,
			String segmentType,
			List<Integer> segNums); long findNumOfBytesSentByMessageIdAndBoxAndTypeAndStatues(
			String messageId, 
			String messageBox,
			String type, 
			long proceedTime,
			List<String> statues);  }