Search in sources :

Example 6 with FastMap

use of javolution.util.FastMap in project smscgateway by RestComm.

the class DBOperations method c2_getArchiveTableList.

public Date[] c2_getArchiveTableList(String keyspace) {
    String[] ss = this.c2_getTableList(keyspace);
    FastMap<Date, Date> res = new FastMap<Date, Date>();
    for (String s : ss) {
        Date dt = null;
        // if (s.startsWith("MESSAGES_") && s.length() == 19) {
        if (s.startsWith(Schema.FAMILY_MESSAGES) && s.length() == 19) {
            String sYear = s.substring(9, 13);
            String sMon = s.substring(14, 16);
            String sDay = s.substring(17, 19);
            try {
                int year = Integer.parseInt(sYear);
                int mon = Integer.parseInt(sMon);
                int day = Integer.parseInt(sDay);
                dt = new Date(year - 1900, mon - 1, day);
            } catch (Exception e) {
            }
        }
        if (s.startsWith(Schema.FAMILY_MES_ID) && s.length() == 17) {
            String sYear = s.substring(7, 11);
            String sMon = s.substring(12, 14);
            String sDay = s.substring(15, 17);
            try {
                int year = Integer.parseInt(sYear);
                int mon = Integer.parseInt(sMon);
                int day = Integer.parseInt(sDay);
                dt = new Date(year - 1900, mon - 1, day);
            } catch (Exception e) {
            }
        }
        if (s.startsWith(Schema.FAMILY_DLV_MES_ID) && s.length() == 21) {
            String sYear = s.substring(11, 15);
            String sMon = s.substring(16, 18);
            String sDay = s.substring(19, 21);
            try {
                int year = Integer.parseInt(sYear);
                int mon = Integer.parseInt(sMon);
                int day = Integer.parseInt(sDay);
                dt = new Date(year - 1900, mon - 1, day);
            } catch (Exception e) {
            }
        }
        if (dt != null) {
            res.put(dt, dt);
        }
    }
    Date[] dd = new Date[res.size()];
    int i1 = 0;
    for (Date dt : res.keySet()) {
        dd[i1++] = dt;
    }
    Arrays.sort(dd);
    return dd;
}
Also used : FastMap(javolution.util.FastMap) Date(java.util.Date) XMLStreamException(javolution.xml.stream.XMLStreamException) InvalidQueryException(com.datastax.driver.core.exceptions.InvalidQueryException)

Aggregations

FastMap (javolution.util.FastMap)6 Date (java.util.Date)3 InvalidQueryException (com.datastax.driver.core.exceptions.InvalidQueryException)2 ArrayList (java.util.ArrayList)2 XMLStreamException (javolution.xml.stream.XMLStreamException)2 BufferedReader (java.io.BufferedReader)1 BufferedWriter (java.io.BufferedWriter)1 FileInputStream (java.io.FileInputStream)1 FileOutputStream (java.io.FileOutputStream)1 InputStreamReader (java.io.InputStreamReader)1 OutputStreamWriter (java.io.OutputStreamWriter)1 TreeMap (java.util.TreeMap)1 MAPApplicationContextVersion (org.mobicents.protocols.ss7.map.api.MAPApplicationContextVersion)1 CounterDefImpl (org.mobicents.protocols.ss7.oam.common.statistics.CounterDefImpl)1 CounterDefSetImpl (org.mobicents.protocols.ss7.oam.common.statistics.CounterDefSetImpl)1 CounterDef (org.mobicents.protocols.ss7.oam.common.statistics.api.CounterDef)1 CounterDefSet (org.mobicents.protocols.ss7.oam.common.statistics.api.CounterDefSet)1 SmsSet (org.mobicents.smsc.library.SmsSet)1 TargetAddress (org.mobicents.smsc.library.TargetAddress)1