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;
}
Aggregations