List of usage examples for org.apache.ibatis.session SqlSession selectList
<E> List<E> selectList(String statement, Object parameter);
From source file:org.mobicents.servlet.restcomm.dao.mybatis.MybatisHttpCookiesDao.java
License:Open Source License
@Override public List<Cookie> getCookies(final Sid sid) { final SqlSession session = sessions.openSession(); try {/* w ww .ja va 2s . c o m*/ final List<Map<String, Object>> results = session.selectList(namespace + "getCookies", sid.toString()); final List<Cookie> cookies = new ArrayList<Cookie>(); if (results != null && !results.isEmpty()) { for (final Map<String, Object> result : results) { cookies.add(toCookie(result)); } } return cookies; } finally { session.close(); } }
From source file:org.mobicents.servlet.restcomm.dao.mybatis.MybatisIncomingPhoneNumbersDao.java
License:Open Source License
@Override public List<IncomingPhoneNumber> getIncomingPhoneNumbers(final Sid accountSid) { final SqlSession session = sessions.openSession(); try {/*from www.j av a 2s. c o m*/ final List<Map<String, Object>> results = session.selectList(namespace + "getIncomingPhoneNumbers", accountSid.toString()); final List<IncomingPhoneNumber> incomingPhoneNumbers = new ArrayList<IncomingPhoneNumber>(); if (results != null && !results.isEmpty()) { for (final Map<String, Object> result : results) { incomingPhoneNumbers.add(toIncomingPhoneNumber(result)); } } return incomingPhoneNumbers; } finally { session.close(); } }
From source file:org.mobicents.servlet.restcomm.dao.mybatis.MybatisIncomingPhoneNumbersDao.java
License:Open Source License
@Override public List<IncomingPhoneNumber> getIncomingPhoneNumbersByFilter(IncomingPhoneNumberFilter filter) { final SqlSession session = sessions.openSession(); try {/* ww w . j ava 2 s.c o m*/ final List<Map<String, Object>> results = session .selectList(namespace + "getIncomingPhoneNumbersByFriendlyName", filter); final List<IncomingPhoneNumber> incomingPhoneNumbers = new ArrayList<IncomingPhoneNumber>(); if (results != null && !results.isEmpty()) { for (final Map<String, Object> result : results) { incomingPhoneNumbers.add(toIncomingPhoneNumber(result)); } } return incomingPhoneNumbers; } finally { session.close(); } }
From source file:org.mobicents.servlet.restcomm.dao.mybatis.MybatisNotificationsDao.java
License:Open Source License
private List<Notification> getNotifications(final String selector, final Object input) { final SqlSession session = sessions.openSession(); try {//from ww w. j a v a 2 s . c om final List<Map<String, Object>> results = session.selectList(selector, input); final List<Notification> notifications = new ArrayList<Notification>(); if (results != null && !results.isEmpty()) { for (final Map<String, Object> result : results) { notifications.add(toNotification(result)); } } return notifications; } finally { session.close(); } }
From source file:org.mobicents.servlet.restcomm.dao.mybatis.MybatisOutgoingCallerIdsDao.java
License:Open Source License
@Override public List<OutgoingCallerId> getOutgoingCallerIds(final Sid accountSid) { final SqlSession session = sessions.openSession(); try {/*from ww w . ja v a2 s . c om*/ final List<Map<String, Object>> results = session.selectList(namespace + "getOutgoingCallerIds", accountSid.toString()); final List<OutgoingCallerId> outgoingCallerIds = new ArrayList<OutgoingCallerId>(); if (results != null && !results.isEmpty()) { for (final Map<String, Object> result : results) { outgoingCallerIds.add(toOutgoingCallerId(result)); } } return outgoingCallerIds; } finally { session.close(); } }
From source file:org.mobicents.servlet.restcomm.dao.mybatis.MybatisRecordingsDao.java
License:Open Source License
@Override public List<Recording> getRecordings(final Sid accountSid) { final SqlSession session = sessions.openSession(); try {/* www . j a va2s. com*/ final List<Map<String, Object>> results = session.selectList(namespace + "getRecordings", accountSid.toString()); final List<Recording> recordings = new ArrayList<Recording>(); if (results != null && !results.isEmpty()) { for (final Map<String, Object> result : results) { recordings.add(toRecording(result)); } } return recordings; } finally { session.close(); } }
From source file:org.mobicents.servlet.restcomm.dao.mybatis.MybatisRegistrationsDao.java
License:Open Source License
@Override public Registration getRegistration(String user) { final SqlSession session = sessions.openSession(); try {// ww w . ja va 2 s. c o m // https://bitbucket.org/telestax/telscale-restcomm/issue/107/dial-fails-to-call-a-client-registered // we get all registrations and sort them by latest updated date so that we target the device where the user last // updated the registration final List<Map<String, Object>> results = session.selectList(namespace + "getRegistration", user); final List<Registration> records = new ArrayList<Registration>(); if (results != null && !results.isEmpty()) { for (final Map<String, Object> result : results) { records.add(toPresenceRecord(result)); } if (records.isEmpty()) { return null; } else { Collections.sort(records); return records.get(0); } } else { return null; } } finally { session.close(); } }
From source file:org.mobicents.servlet.restcomm.dao.mybatis.MybatisRegistrationsDao.java
License:Open Source License
@Override public List<Registration> getRegistrations(String user) { final SqlSession session = sessions.openSession(); try {/*w w w .j a v a 2s .c o m*/ // https://bitbucket.org/telestax/telscale-restcomm/issue/107/dial-fails-to-call-a-client-registered // we get all registrations and sort them by latest updated date so that we target the device where the user last // updated the registration final List<Map<String, Object>> results = session.selectList(namespace + "getRegistration", user); final List<Registration> records = new ArrayList<Registration>(); if (results != null && !results.isEmpty()) { for (final Map<String, Object> result : results) { records.add(toPresenceRecord(result)); } if (records.isEmpty()) { return null; } else { Collections.sort(records); return records; } } else { return null; } } finally { session.close(); } }
From source file:org.mobicents.servlet.restcomm.dao.mybatis.MybatisShortCodesDao.java
License:Open Source License
@Override public List<ShortCode> getShortCodes(final Sid accountSid) { final SqlSession session = sessions.openSession(); try {//from ww w . j a va 2 s.com final List<Map<String, Object>> results = session.selectList(namespace + "getShortCodes", accountSid.toString()); final List<ShortCode> shortCodes = new ArrayList<ShortCode>(); if (results != null && !results.isEmpty()) { for (final Map<String, Object> result : results) { shortCodes.add(toShortCode(result)); } } return shortCodes; } finally { session.close(); } }
From source file:org.mobicents.servlet.restcomm.dao.mybatis.MybatisSmsMessagesDao.java
License:Open Source License
@Override public List<SmsMessage> getSmsMessages(final Sid accountSid) { final SqlSession session = sessions.openSession(); try {//from w ww . ja va2 s. co m final List<Map<String, Object>> results = session.selectList(namespace + "getSmsMessages", accountSid.toString()); final List<SmsMessage> smsMessages = new ArrayList<SmsMessage>(); if (results != null && !results.isEmpty()) { for (final Map<String, Object> result : results) { smsMessages.add(toSmsMessage(result)); } } return smsMessages; } finally { session.close(); } }