/** * Guarda todos los mensajes en la BD * * @param from * @param to * @param body * @param direction * @throws Exception */ public static void push(String from, String to, String body, String direction) { IGenericDao dao = null; try { dao = Utility.getDbConnection(); Queue q = new Queue(); q.setDelivered(new Integer(0)); q.setMsgDirection(direction); q.setMsgBody(body); q.setMsgFrom(from); q.setMsgTime(new Timestamp(new Date().getTime())); q.setMsgTo(to); System.out.println("USUARIOS Q RECIBEN EL SMS Y SE VAN A INSERTAR EN LA BD ======> " + to); // de momento se deja a pelo hasta q este la muc q.setType("S"); log.debug("new message " + direction + " from: " + from + " to: " + to + " body: " + body); IObjectMappingKey myObj = Utility.persistMan .getObjectMappingFactory() .createInstance(Queue.class, new AutoGeneratedColumnsMapper(true)); dao.insert(myObj, q); } catch (Exception e) { log.error("mesage couldn't be written to db", e); } finally { try { JdbcUtil.close(dao); } catch (Exception e) { log.fatal("unable to close jdbc connection", e); } dao = null; } }