List of usage examples for org.springframework.dao.support DataAccessUtils singleResult
@Nullable public static <T> T singleResult(@Nullable Collection<T> results) throws IncorrectResultSizeDataAccessException
From source file:org.ojbc.intermediaries.sn.dao.rapback.FbiRapbackDao.java
/** * Decide whether the owner ORI of the transaction with the transaction number has FBI subscription qualification. * @param transactionNumber/*from ww w . ja v a2 s .c om*/ * @return */ public Boolean getfbiSubscriptionQualification(String transactionNumber) { final String sql = "SELECT fbi_subscription_qualification FROM agency_profile " + "WHERE agency_ori = (SELECT owner_ori FROM identification_transaction t WHERE t.transaction_number= ?)"; List<Boolean> fbiSubscriptionQualifications = jdbcTemplate.queryForList(sql, Boolean.class, transactionNumber); return DataAccessUtils.singleResult(fbiSubscriptionQualifications); }
From source file:org.ojbc.intermediaries.sn.dao.rapback.FbiRapbackDao.java
/** * Decide whether the owner ORI of the transaction with the subscription ID has FBI subscription qualification. * @param subscriptionId//from w ww . j a v a 2s . c o m * @return */ public Boolean getfbiSubscriptionQualification(Integer subscriptionId) { final String sql = "SELECT fbi_subscription_qualification FROM agency_profile " + "WHERE agency_ori = (SELECT owner_ori FROM identification_transaction t WHERE t.subscription_id= ?)"; List<Boolean> fbiSubscriptionQualifications = jdbcTemplate.queryForList(sql, Boolean.class, subscriptionId); return DataAccessUtils.singleResult(fbiSubscriptionQualifications); }
From source file:org.ojbc.policyacknowledgement.dao.PolicyDAOImpl.java
private Long getUserIdByFedId(String federationId) { validateFedId(federationId);/*from w ww .j av a2 s . c o m*/ List<Long> userIds = jdbcTemplate.queryForList(GET_USER_ID_BY_FED_ID, Long.class, federationId); return DataAccessUtils.singleResult(userIds); }
From source file:org.sipfoundry.sipxconfig.acd.AcdContextImpl.java
@Override public AcdServer getAcdServerForLocationId(Integer locationId) { HibernateTemplate hibernate = getHibernateTemplate(); List<AcdServer> servers = hibernate.findByNamedQueryAndNamedParam("acdServerForLocationId", "locationId", locationId);/*from ww w. j av a 2 s . c o m*/ return (AcdServer) DataAccessUtils.singleResult(servers); }
From source file:org.sipfoundry.sipxconfig.admin.alarm.AlarmServerManagerImpl.java
public AlarmServer getAlarmServer() { List servers = getHibernateTemplate().loadAll(AlarmServer.class); AlarmServer server = (AlarmServer) DataAccessUtils.singleResult(servers); if (server == null) { server = newAlarmServer();/*from w ww . ja va 2s . c o m*/ saveAlarmServer(server); } return server; }
From source file:org.sipfoundry.sipxconfig.admin.dialplan.AutoAttendantManagerImpl.java
private AttendantSpecialMode loadAttendantSpecialMode() { List asm = getHibernateTemplate().loadAll(AttendantSpecialMode.class); AttendantSpecialMode specialMode = (AttendantSpecialMode) DataAccessUtils.singleResult(asm); return specialMode; }
From source file:org.sipfoundry.sipxconfig.admin.localization.LocalizationContextImpl.java
public Localization getLocalization() { List l = getHibernateTemplate().loadAll(Localization.class); Localization localization = (Localization) DataAccessUtils.singleResult(l); if (localization == null) { // The localization table is empty - create a new localization using // default values and update the table localization = new Localization(); localization.setRegion(m_defaultRegion); localization.setLanguage(m_defaultLanguage); getHibernateTemplate().saveOrUpdate(localization); }//from w w w . j a v a2 s .c om return localization; }
From source file:org.sipfoundry.sipxconfig.common.CoreContextImpl.java
@Override public User getSpecialUser(SpecialUserType specialUserType) { List<SpecialUser> specialUsersOfType = getHibernateTemplate() .findByNamedQueryAndNamedParam(SPECIAL_USER_BY_TYPE, SPECIAL_USER_TYPE, specialUserType.name()); SpecialUser specialUser = DataAccessUtils.singleResult(specialUsersOfType); if (specialUser == null) { return null; }/*from w ww . j a v a2 s . c o m*/ User newUser = newUser(); newUser.setUserName(specialUser.getUserName()); newUser.setSipPassword(specialUser.getSipPassword()); return newUser; }
From source file:org.sipfoundry.sipxconfig.common.CoreContextImpl.java
@Override public SpecialUser getSpecialUserAsSpecialUser(SpecialUserType specialUserType) { List<SpecialUser> specialUsersOfType = getHibernateTemplate() .findByNamedQueryAndNamedParam(SPECIAL_USER_BY_TYPE, SPECIAL_USER_TYPE, specialUserType.name()); SpecialUser specialUser = DataAccessUtils.singleResult(specialUsersOfType); if (specialUser == null) { return null; }//from w ww. jav a 2 s . c o m return specialUser; }
From source file:org.sipfoundry.sipxconfig.conference.ConferenceBridgeContextImpl.java
public Conference findConferenceByName(String name) { List<Conference> conferences = getHibernateTemplate().findByNamedQueryAndNamedParam(CONFERENCE_BY_NAME, VALUE, name);/*from w w w .j a v a2s .c o m*/ return (Conference) DataAccessUtils.singleResult(conferences); }