Example usage for org.apache.ibatis.session SqlSession selectOne

List of usage examples for org.apache.ibatis.session SqlSession selectOne

Introduction

In this page you can find the example usage for org.apache.ibatis.session SqlSession selectOne.

Prototype

<T> T selectOne(String statement, Object parameter);

Source Link

Document

Retrieve a single row mapped from the statement key and parameter.

Usage

From source file:org.mobicents.servlet.restcomm.dao.mybatis.MybatisClientsDao.java

License:Open Source License

private Client getClient(final String selector, final String parameter) {
    final SqlSession session = sessions.openSession();
    try {//from  w  w w  .  j  av  a 2s.  c om
        final Map<String, Object> result = session.selectOne(selector, parameter);
        if (result != null) {
            return toClient(result);
        } else {
            return null;
        }
    } finally {
        session.close();
    }
}

From source file:org.mobicents.servlet.restcomm.dao.mybatis.MybatisConferenceDetailRecordsDao.java

License:Open Source License

@Override
public ConferenceDetailRecord getConferenceDetailRecord(Sid sid) {
    final SqlSession session = sessions.openSession();
    try {/*w  w w. ja  va2 s.c o  m*/
        final Map<String, Object> result = session.selectOne(namespace + "getConferenceDetailRecord",
                sid.toString());
        if (result != null) {
            return toConferenceDetailRecord(result);
        } else {
            return null;
        }
    } finally {
        session.close();
    }
}

From source file:org.mobicents.servlet.restcomm.dao.mybatis.MybatisConferenceDetailRecordsDao.java

License:Open Source License

@Override
public Integer getTotalConferenceDetailRecords(ConferenceDetailRecordFilter filter) {

    final SqlSession session = sessions.openSession();
    try {/*from  w  w  w. ja  v a 2s.co m*/
        final Integer total = session.selectOne(namespace + "getTotalConferenceDetailRecordByUsingFilters",
                filter);
        return total;
    } finally {
        session.close();
    }

}

From source file:org.mobicents.servlet.restcomm.dao.mybatis.MybatisGatewaysDao.java

License:Open Source License

@Override
public Gateway getGateway(final Sid sid) {
    final SqlSession session = sessions.openSession();
    try {/*from w  w w .  j a v a2 s  .  c  o m*/
        final Map<String, Object> result = session.selectOne(namespace + "getGateway", sid.toString());
        if (result != null) {
            return toGateway(result);
        } else {
            return null;
        }
    } finally {
        session.close();
    }
}

From source file:org.mobicents.servlet.restcomm.dao.mybatis.MybatisHttpCookiesDao.java

License:Open Source License

@Override
public boolean hasCookie(final Sid sid, final Cookie cookie) {
    final SqlSession session = sessions.openSession();
    try {/*from w  w w .j av  a  2s  .  c o  m*/
        final Integer result = session.selectOne(namespace + "hasCookie", toMap(sid, cookie));
        if (result > 0) {
            return true;
        } else {
            return false;
        }
    } finally {
        session.close();
    }
}

From source file:org.mobicents.servlet.restcomm.dao.mybatis.MybatisHttpCookiesDao.java

License:Open Source License

@Override
public boolean hasExpiredCookies(final Sid sid) {
    final SqlSession session = sessions.openSession();
    try {//  w w w  .j av a  2s  .c o m
        final Integer result = session.selectOne(namespace + "hasExpiredCookies", sid.toString());
        if (result > 0) {
            return true;
        } else {
            return false;
        }
    } finally {
        session.close();
    }
}

From source file:org.mobicents.servlet.restcomm.dao.mybatis.MybatisIncomingPhoneNumbersDao.java

License:Open Source License

private IncomingPhoneNumber getIncomingPhoneNumber(final String selector, Object parameter) {
    final SqlSession session = sessions.openSession();
    try {//from w  w  w . j  a  v  a2s. co m
        final Map<String, Object> result = session.selectOne(namespace + selector, parameter);
        if (result != null) {
            return toIncomingPhoneNumber(result);
        } else {
            return null;
        }
    } finally {
        session.close();
    }
}

From source file:org.mobicents.servlet.restcomm.dao.mybatis.MybatisNotificationsDao.java

License:Open Source License

@Override
public Notification getNotification(final Sid sid) {
    final SqlSession session = sessions.openSession();
    try {/*from   w  w w . j  a  v  a2  s.  c  o  m*/
        final Map<String, Object> result = session.selectOne(namespace + "getNotification", sid.toString());
        if (result != null) {
            return toNotification(result);
        } else {
            return null;
        }
    } finally {
        session.close();
    }
}

From source file:org.mobicents.servlet.restcomm.dao.mybatis.MybatisOutgoingCallerIdsDao.java

License:Open Source License

@Override
public OutgoingCallerId getOutgoingCallerId(final Sid sid) {
    final SqlSession session = sessions.openSession();
    try {// ww  w . j a v  a2 s. c o  m
        final Map<String, Object> result = session.selectOne(namespace + "getOutgoingCallerId", sid.toString());
        if (result != null) {
            return toOutgoingCallerId(result);
        } else {
            return null;
        }
    } finally {
        session.close();
    }
}

From source file:org.mobicents.servlet.restcomm.dao.mybatis.MybatisRecordingsDao.java

License:Open Source License

private Recording getRecording(final String selector, final Sid sid) {
    final SqlSession session = sessions.openSession();
    try {//from  w  w  w . j a v  a2  s  .c  o m
        final Map<String, Object> result = session.selectOne(selector, sid.toString());
        if (result != null) {
            return toRecording(result);
        } else {
            return null;
        }
    } finally {
        session.close();
    }
}