@Test public void testUpdateBatchSegmentsStatus() throws Exception{ SFRMMessageSegmentDAO dao = this.getTestingTarget(); List segNums = new ArrayList(); segNums.add(new Integer(1)); segNums.add(new Integer(2)); segNums.add(new Integer(3)); int updated = dao.updateBatchSegmentsRecoveryStatus(SFRMConstant.MSGS_PROCESSED, "c", SFRMConstant.MSGBOX_OUT, SFRMConstant.MSGT_PAYLOAD, segNums); Assert.assertEquals("Number of updated segment should be 3", 3, updated); SFRMMessageSegmentDVO msDVO = (SFRMMessageSegmentDVO) dao.createDVO(); msDVO.setMessageId("c"); msDVO.setMessageBox(SFRMConstant.MSGBOX_OUT); msDVO.setSegmentType(SFRMConstant.MSGT_PAYLOAD); msDVO.setSegmentNo(1); dao.retrieve(msDVO); Assert.assertEquals("seg 1 should updated to " + SFRMConstant.MSGS_PROCESSED, SFRMConstant.MSGS_PROCESSED, msDVO.getStatus()); msDVO.setSegmentNo(2); dao.retrieve(msDVO); Assert.assertEquals("seg 2 should updated to " + SFRMConstant.MSGS_PROCESSED, SFRMConstant.MSGS_PROCESSED, msDVO.getStatus()); msDVO.setSegmentNo(3); dao.retrieve(msDVO); Assert.assertEquals("seg 3 should updated to " + SFRMConstant.MSGS_PROCESSED, SFRMConstant.MSGS_PROCESSED, msDVO.getStatus()); msDVO.setSegmentNo(4); dao.retrieve(msDVO); Assert.assertEquals("seg 4 should remain in " + SFRMConstant.MSGS_DELIVERED, SFRMConstant.MSGS_DELIVERED, msDVO.getStatus()); }
public int updateBatchSegmentsStatus( String status, Timestamp completeTime, String messageId, String messageBox, String segmentType, List<Integer> segNums) throws DAOException{ String sql = this.getSQL("update_batch_segments_status_complete_time"); String filter = super.getFilter("update_batch_segments_status_filter"); String questionToken = buildQuestionToken(segNums.size()); filter = filter.replace("?", questionToken); sql += " AND " + filter; ArrayList parameters = new ArrayList(); parameters.add(status); parameters.add(completeTime); parameters.add(messageId); parameters.add(messageBox); parameters.add(segmentType); parameters.addAll(segNums); return this.executeUpdate(sql, parameters.toArray()); }
SFRMMessageSegmentDSDAO extends DataSourceDAO implements
		SFRMMessageSegmentDAO { public int updateBatchSegmentsStatus( String status, Timestamp completeTime, String messageId, String messageBox, String segmentType, List<Integer> segNums) throws DAOException{ String sql = this.getSQL("update_batch_segments_status_complete_time"); String filter = super.getFilter("update_batch_segments_status_filter"); String questionToken = buildQuestionToken(segNums.size()); filter = filter.replace("?", questionToken); sql += " AND " + filter; ArrayList parameters = new ArrayList(); parameters.add(status); parameters.add(completeTime); parameters.add(messageId); parameters.add(messageBox); parameters.add(segmentType); parameters.addAll(segNums); return this.executeUpdate(sql, parameters.toArray()); } }
SFRMMessageSegmentDSDAO extends DataSourceDAO implements
		SFRMMessageSegmentDAO { public int updateBatchSegmentsStatus( String status, Timestamp completeTime, String messageId, String messageBox, String segmentType, List<Integer> segNums) throws DAOException{ String sql = this.getSQL("update_batch_segments_status_complete_time"); String filter = super.getFilter("update_batch_segments_status_filter"); String questionToken = buildQuestionToken(segNums.size()); filter = filter.replace("?", questionToken); sql += " AND " + filter; ArrayList parameters = new ArrayList(); parameters.add(status); parameters.add(completeTime); parameters.add(messageId); parameters.add(messageBox); parameters.add(segmentType); parameters.addAll(segNums); return this.executeUpdate(sql, parameters.toArray()); }  }
SFRMMessageSegmentDSDAO extends DataSourceDAO implements
		SFRMMessageSegmentDAO { public int updateBatchSegmentsStatus( String status, Timestamp completeTime, String messageId, String messageBox, String segmentType, List<Integer> segNums) throws DAOException{ String sql = this.getSQL("update_batch_segments_status_complete_time"); String filter = super.getFilter("update_batch_segments_status_filter"); String questionToken = buildQuestionToken(segNums.size()); filter = filter.replace("?", questionToken); sql += " AND " + filter; ArrayList parameters = new ArrayList(); parameters.add(status); parameters.add(completeTime); parameters.add(messageId); parameters.add(messageBox); parameters.add(segmentType); parameters.addAll(segNums); return this.executeUpdate(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 int updateBatchSegmentsStatus( String status, Timestamp completeTime, String messageId, String messageBox, String segmentType, List<Integer> segNums) throws DAOException{ String sql = this.getSQL("update_batch_segments_status_complete_time"); String filter = super.getFilter("update_batch_segments_status_filter"); String questionToken = buildQuestionToken(segNums.size()); filter = filter.replace("?", questionToken); sql += " AND " + filter; ArrayList parameters = new ArrayList(); parameters.add(status); parameters.add(completeTime); parameters.add(messageId); parameters.add(messageBox); parameters.add(segmentType); parameters.addAll(segNums); return this.executeUpdate(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);  }