Example usage for org.springframework.dao.support DataAccessUtils singleResult

List of usage examples for org.springframework.dao.support DataAccessUtils singleResult

Introduction

In this page you can find the example usage for org.springframework.dao.support DataAccessUtils singleResult.

Prototype

@Nullable
public static <T> T singleResult(@Nullable Collection<T> results)
        throws IncorrectResultSizeDataAccessException 

Source Link

Document

Return a single result object from the given Collection.

Usage

From source file:org.sipfoundry.sipxconfig.openacd.OpenAcdContextImpl.java

@Override
public OpenAcdClient getClientByIdentity(String identity) {
    List<OpenAcdClient> clients = getHibernateTemplate()
            .findByNamedQueryAndNamedParam(OPEN_ACD_CLIENT_WITH_IDENTITY, VALUE, identity);
    return DataAccessUtils.singleResult(clients);
}

From source file:org.sipfoundry.sipxconfig.openacd.OpenAcdContextImpl.java

@Override
public OpenAcdQueueGroup getQueueGroupByName(String queueGroupName) {
    List<OpenAcdQueueGroup> queueGroups = getHibernateTemplate()
            .findByNamedQueryAndNamedParam(OPEN_ACD_QUEUE_GROUP_WITH_NAME, VALUE, queueGroupName);
    return DataAccessUtils.singleResult(queueGroups);
}

From source file:org.sipfoundry.sipxconfig.openacd.OpenAcdContextImpl.java

public OpenAcdQueue getQueueByName(String queueName) {
    List<OpenAcdQueue> queues = getHibernateTemplate().findByNamedQueryAndNamedParam(OPEN_ACD_QUEUE_WITH_NAME,
            VALUE, queueName);/* w ww.  ja v  a 2  s  .  c  o m*/
    return DataAccessUtils.singleResult(queues);
}

From source file:org.sipfoundry.sipxconfig.openacd.OpenAcdContextImpl.java

private OpenAcdReleaseCode getReleaseCodeByLabel(String label) {
    List<OpenAcdReleaseCode> codes = getHibernateTemplate()
            .findByNamedQueryAndNamedParam(OPEN_ACD_RELEASE_CODE_WITH_LABEL, VALUE, label);
    return DataAccessUtils.singleResult(codes);
}

From source file:org.sipfoundry.sipxconfig.site.user.UserRegistrations.java

private Phone getCounterpathPhone() {
    Collection<Phone> phones = getPhoneContext().getPhonesByUserIdAndPhoneModel(getLoadedUser().getId(),
            COUNTERPATH_MODEL);//ww w  .j a  v  a 2  s  .  c  om
    return (Phone) DataAccessUtils.singleResult(phones);
}

From source file:org.sipfoundry.sipxconfig.vm.MailboxManagerImpl.java

private PersonalAttendant findPersonalAttendant(User user) {
    Collection pas = getHibernateTemplate().findByNamedQueryAndNamedParam("personalAttendantForUser", "user",
            user);//from  w w w.  j  a  v a 2 s. c o m
    return (PersonalAttendant) DataAccessUtils.singleResult(pas);
}