use of org.mobicents.smsc.library.DbSmsRoutingRule in project smscgateway by RestComm.
the class DBOperations method c2_getSmppSmsRoutingRulesRange.
/**
* Returns 100 rows of SMPP_SMS_ROUTING_RULE starting from passed lastAdress. If lastAdress, first 100 rows are returned
*
* @param lastAdress
* @return
* @throws PersistenceException
*/
public List<DbSmsRoutingRule> c2_getSmppSmsRoutingRulesRange(String lastAdress) throws PersistenceException {
List<DbSmsRoutingRule> ress = new FastList<DbSmsRoutingRule>();
try {
PreparedStatement ps = lastAdress != null ? getSmppSmsRoutingRulesRange : getSmppSmsRoutingRulesRange2;
BoundStatement boundStatement = new BoundStatement(ps);
if (lastAdress != null) {
boundStatement.bind(lastAdress);
}
ResultSet result = session.execute(boundStatement);
int i1 = 0;
for (Row row : result) {
String address = row.getString(Schema.COLUMN_ADDRESS);
String name = row.getString(Schema.COLUMN_CLUSTER_NAME);
int networkId = row.getInt(Schema.COLUMN_NETWORK_ID);
DbSmsRoutingRule res = new DbSmsRoutingRule(SmsRoutingRuleType.SMPP, address, networkId, name);
if (i1 == 0) {
i1 = 1;
if (lastAdress == null)
ress.add(res);
} else {
ress.add(res);
}
}
return ress;
} catch (Exception e) {
String msg = "Failed to getSmsRoutingRule DbSmsRoutingRule for all records: " + e;
throw new PersistenceException(msg, e);
}
}
Aggregations