public int readCDRinQueueEx() throws DBException { int numOfCdrs = 0; Collection collection = dbTools.getAllCDRsInQueueEx(); // System.out.println("truoc khi chay collection"+collection.size()); if ((collection != null) && (collection.size() > 0)) { numOfCdrs = collection.size(); CDR cdr = null; BigDecimal cdrId = null; // System.out.println("truoc khi chay Iterator"); for (Iterator it = collection.iterator(); it.hasNext(); ) { cdr = (CDR) it.next(); cdrId = cdr.getId(); // System.out.println("cdrId"+cdrId); if (cdr == null) { // removed by other processes // System.out.println("CDR is null (queueId=" + cdrId + // ")"); Logger.info("CDR:", "CDR is null (queueId=" + cdrId + ")"); continue; } // ////////////////////////////////// cdr = dbTools.moveCDRFromQueueToLogEx(cdr); if (cdr != null) { CDRTool.add2CDRFileEx(cdr); System.out.print( cdr.getUserId() + "-->" + cdr.getServiceId() + ":" + cdr.getCommandCode() + "\t\t"); if (col >= maxcols - 1) { System.out.println(); col = 0; } else { col++; } } else { // System.out.println("CDR is null (queueId=" + cdrId + // ")"); Logger.info("CDR:", "CDR is null (queueId=" + cdrId + ")"); } // ////////////////////////////////// } // end for } return numOfCdrs; }
/** Them phat day ra file */ public static int pushCDRinQueueEx8x99(String fromNum, String toNum) throws DBException { int numOfCdrs = 0; int maxcols = 2; int col = 0; DBTools dbTools = new DBTools(); Collection collection = dbTools.getAllCDRsInLogEx8x99(fromNum, toNum); if ((collection != null) && (collection.size() > 0)) { numOfCdrs = collection.size(); CDR cdr = null; BigDecimal cdrId = null; for (Iterator it = collection.iterator(); it.hasNext(); ) { cdr = (CDR) it.next(); cdrId = cdr.getId(); if (cdr == null) { // removed by other processes // System.out.println("CDR is null (queueId=" + cdrId + // ")"); Logger.info("CDR:", "CDR is null (queueId=" + cdrId + ")"); continue; } // ////////////////////////////////// // cdr = dbTools.moveCDRFromQueueToLogEx(cdr); if (cdr != null) { CDRTool.add2CDRFile8x99ForPushVMS(cdr); System.out.print( cdr.getUserId() + "-->" + cdr.getServiceId() + ":" + cdr.getCommandCode() + "\t\t"); if (col >= maxcols - 1) { System.out.println(); col = 0; } else { col++; } } else { // System.out.println("CDR is null (queueId=" + cdrId + // ")"); Logger.info("CDR:", "CDR is null (queueId=" + cdrId + ")"); } // ////////////////////////////////// } // end for } return numOfCdrs; }