当前位置: 首页>>代码示例>>Java>>正文


Java DataAccessUtils.singleResult方法代码示例

本文整理汇总了Java中org.springframework.dao.support.DataAccessUtils.singleResult方法的典型用法代码示例。如果您正苦于以下问题:Java DataAccessUtils.singleResult方法的具体用法?Java DataAccessUtils.singleResult怎么用?Java DataAccessUtils.singleResult使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.springframework.dao.support.DataAccessUtils的用法示例。


在下文中一共展示了DataAccessUtils.singleResult方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getPrimaryCalendarFolder

import org.springframework.dao.support.DataAccessUtils; //导入方法依赖的package包/类
public void getPrimaryCalendarFolder() {
	initializeCredentials();
	GetFolder request = requestFactory.constructGetFolderByName(DistinguishedFolderIdNameType.CALENDAR);
	assertNotNull(request);
	
	GetFolderResponse response = ewsClient.getFolder(request);
	assertNotNull(response);
	
	Set<BaseFolderType> results = responseUtils.parseGetFolderResponse(response);
	assertNotNull(results);
	
	assertFalse(CollectionUtils.isEmpty(results));
	assertEquals(1, results.size());
	BaseFolderType singleResult = DataAccessUtils.singleResult(results);
	assertNotNull(singleResult);
	assertEquals("Calendar", singleResult.getDisplayName());
}
 
开发者ID:Bedework,项目名称:exchange-ws-client,代码行数:18,代码来源:AbstractIntegrationTest.java

示例2: uniqueResult

import org.springframework.dao.support.DataAccessUtils; //导入方法依赖的package包/类
public X uniqueResult() {

            if (isCount) {
                return jdbcTemplate.queryForObject(SQLTools.getCountSQL(sql), paras, null == resultClass ? (Class<X>) Long.class : resultClass);
            }
            if (!sql.toUpperCase().contains(" LIMIT ")) {
                sql += " limit 1";
            }
            return DataAccessUtils.singleResult(list());
        }
 
开发者ID:egzosn,项目名称:spring-jdbc-orm,代码行数:11,代码来源:SupportJdbcRepository.java

示例3: loadContractPersonEditDTO

import org.springframework.dao.support.DataAccessUtils; //导入方法依赖的package包/类
private void loadContractPersonEditDTO(Integer personId, Integer contractId, ModelMap model) {
	if (log.isDebugEnabled()) {
		log.debug("Requested person.id=" + personId);
	}
	ContractPersonEditDTO cpEditDTO = null;
	try {
		if (personId != null) {
			ContractPersonCriteria cpCriteria = new ContractPersonCriteria();
			cpCriteria.setContractId(contractId);
			cpCriteria.setPersonId(personId);
			List<ContractPerson> cps = contractPersonService.findContractPersons(cpCriteria, null, Integer.valueOf(1));

			cpEditDTO = new ContractPersonEditDTO(DataAccessUtils.singleResult(cps));
		} else {
			ContractPerson ct = new ContractPerson();
			if (contractId != null) {
				ct.setContract(contractService.findContract(contractId));
			}
			cpEditDTO = new ContractPersonEditDTO(ct);
		}
		model.addAttribute(CONTRACT_PERSON_EDIT_DTO_MODEL_KEY, cpEditDTO);
	} catch (Exception e) {
		log.error("Cannot load contract person with person.id: " + personId, e);

		model.addAttribute(CONTRACT_PERSON_EDIT_DTO_MODEL_KEY, cpEditDTO);
		WebUtils.addGlobalError(model, CONTRACT_PERSON_EDIT_DTO_MODEL_KEY, "error.load.contract.person");
	}
	if (log.isDebugEnabled()) {
		log.debug("Loaded contractPersonEditDTO: " + cpEditDTO);
	}
}
 
开发者ID:CIT-VSB-TUO,项目名称:ResBill,代码行数:32,代码来源:ContractPersonEditController.java

示例4: findFirstPriceList

import org.springframework.dao.support.DataAccessUtils; //导入方法依赖的package包/类
@Override
public PriceList findFirstPriceList(Integer tariffId) {
	PriceListCriteria criteria = new PriceListCriteria();
	criteria.setFirst(Boolean.TRUE);
	criteria.setTariffId(tariffId);
	List<PriceList> results = findPriceLists(criteria, null, null);
	return DataAccessUtils.singleResult(results);
}
 
开发者ID:CIT-VSB-TUO,项目名称:ResBill,代码行数:9,代码来源:PriceListDAOImpl.java

示例5: findLastPriceList

import org.springframework.dao.support.DataAccessUtils; //导入方法依赖的package包/类
@Override
public PriceList findLastPriceList(Integer tariffId) {
	PriceListCriteria criteria = new PriceListCriteria();
	criteria.setLast(Boolean.TRUE);
	criteria.setTariffId(tariffId);
	List<PriceList> results = findPriceLists(criteria, null, null);
	return DataAccessUtils.singleResult(results);
}
 
开发者ID:CIT-VSB-TUO,项目名称:ResBill,代码行数:9,代码来源:PriceListDAOImpl.java

示例6: findFirstContractInvoiceType

import org.springframework.dao.support.DataAccessUtils; //导入方法依赖的package包/类
@Override
public ContractInvoiceType findFirstContractInvoiceType(Integer contractId) {
	ContractInvoiceTypeCriteria criteria = new ContractInvoiceTypeCriteria();
	criteria.setContractId(contractId);
	criteria.setFirst(Boolean.TRUE);
	List<ContractInvoiceType> results = findContractInvoiceTypes(criteria, null, null);
	return DataAccessUtils.singleResult(results);
}
 
开发者ID:CIT-VSB-TUO,项目名称:ResBill,代码行数:9,代码来源:ContractInvoiceTypeDAOImpl.java

示例7: findLastContractInvoiceType

import org.springframework.dao.support.DataAccessUtils; //导入方法依赖的package包/类
@Override
public ContractInvoiceType findLastContractInvoiceType(Integer contractId) {
	ContractInvoiceTypeCriteria criteria = new ContractInvoiceTypeCriteria();
	criteria.setContractId(contractId);
	criteria.setLast(Boolean.TRUE);
	List<ContractInvoiceType> results = findContractInvoiceTypes(criteria, null, null);
	return DataAccessUtils.singleResult(results);
}
 
开发者ID:CIT-VSB-TUO,项目名称:ResBill,代码行数:9,代码来源:ContractInvoiceTypeDAOImpl.java

示例8: findFirstContractTariff

import org.springframework.dao.support.DataAccessUtils; //导入方法依赖的package包/类
@Override
public ContractTariff findFirstContractTariff(Integer contractId) {
	ContractTariffCriteria criteria = new ContractTariffCriteria();
	criteria.setContractId(contractId);
	criteria.setFirst(Boolean.TRUE);
	List<ContractTariff> results = findContractTariffs(criteria, null, null);
	return DataAccessUtils.singleResult(results);
}
 
开发者ID:CIT-VSB-TUO,项目名称:ResBill,代码行数:9,代码来源:ContractTariffDAOImpl.java

示例9: findLastContractTariff

import org.springframework.dao.support.DataAccessUtils; //导入方法依赖的package包/类
@Override
public ContractTariff findLastContractTariff(Integer contractId) {
	ContractTariffCriteria criteria = new ContractTariffCriteria();
	criteria.setContractId(contractId);
	criteria.setLast(Boolean.TRUE);
	List<ContractTariff> results = findContractTariffs(criteria, null, null);
	return DataAccessUtils.singleResult(results);
}
 
开发者ID:CIT-VSB-TUO,项目名称:ResBill,代码行数:9,代码来源:ContractTariffDAOImpl.java

示例10: findCurrentContractServer

import org.springframework.dao.support.DataAccessUtils; //导入方法依赖的package包/类
@Override
public ContractServer findCurrentContractServer(Integer serverId) {
	ContractServerCriteria criteria = new ContractServerCriteria();
	criteria.setServerId(serverId);
	criteria.setCurrentlyAssociated(Boolean.TRUE);
	criteria.setFetchContract(true);
	List<ContractServer> results = findContractServers(criteria, null, null);
	return DataAccessUtils.singleResult(results);
}
 
开发者ID:CIT-VSB-TUO,项目名称:ResBill,代码行数:10,代码来源:ContractServerDAOImpl.java

示例11: getCursor

import org.springframework.dao.support.DataAccessUtils; //导入方法依赖的package包/类
/**
 * @param sqlId the identifier of a parent cursor.
 * @return details of the specified parent cursor. Returns {@code null} if the cursor was not
 *         found.
 */
public Cursor getCursor(String sqlId) {
  checkNotNull(sqlId);
  List<Cursor> list =
      jdbc.query(cursorBySqlId, ImmutableMap.of("sqlId", sqlId), (rs, rowNum) -> {
        Cursor cursor = new Cursor();
        cursor.sqlId = sqlId;
        cursor.sqlText = rs.getString("sql_text");
        cursor.command = rs.getString("command_name");
        return cursor;
      });
  return DataAccessUtils.singleResult(list);
}
 
开发者ID:fernandopeinado,项目名称:ora_manager,代码行数:18,代码来源:Cursors.java

示例12: getFolder

import org.springframework.dao.support.DataAccessUtils; //导入方法依赖的package包/类
public BaseFolderType getFolder(String upn, FolderIdType folderIdType){
	setContextCredentials(upn);
	GetFolder getFolderRequest = getRequestFactory().constructGetFolderById(folderIdType);
	GetFolderResponse getFolderResponse = getWebServices().getFolder(getFolderRequest);
	Set<BaseFolderType> response = getResponseUtils().parseGetFolderResponse(getFolderResponse);
	return DataAccessUtils.singleResult(response);
}
 
开发者ID:Bedework,项目名称:exchange-ws-client,代码行数:8,代码来源:BaseExchangeCalendarDataDao.java

示例13: getPrimaryFolder

import org.springframework.dao.support.DataAccessUtils; //导入方法依赖的package包/类
protected BaseFolderType getPrimaryFolder(String upn, DistinguishedFolderIdNameType parent) {
	setContextCredentials(upn);
	GetFolder getFolderRequest = getRequestFactory().constructGetFolderByName(parent);
	GetFolderResponse getFolderResponse = getWebServices().getFolder(getFolderRequest);
	Set<BaseFolderType> response = getResponseUtils().parseGetFolderResponse(getFolderResponse);
	return DataAccessUtils.singleResult(response);
}
 
开发者ID:Bedework,项目名称:exchange-ws-client,代码行数:8,代码来源:BaseExchangeCalendarDataDao.java

示例14: createGetDeleteCalendarItemBadTimeZone

import org.springframework.dao.support.DataAccessUtils; //导入方法依赖的package包/类
@Test
public void createGetDeleteCalendarItemBadTimeZone() throws DatatypeConfigurationException{
	
	ApplicationContext context = new ClassPathXmlApplicationContext("classpath:test-contexts/exchangeContext.xml");
	RequestServerTimeZoneInterceptor timeZoneInterceptor = context.getBean(RequestServerTimeZoneInterceptor.class);
	ExchangeWebServices ews = context.getBean(ExchangeWebServices.class);
	BaseExchangeCalendarDataDao exchangeCalendarDao = context.getBean(BaseExchangeCalendarDataDao.class);
	exchangeCalendarDao.setWebServices(ews);
	
	
	//XMLGregorianCalendar is sortof backed by a gregorian calendar, date/times should reflect default jvm timezone
	XMLGregorianCalendar xmlStart = DateHelp.getXMLGregorianCalendarNow(java.util.TimeZone.getTimeZone("Pacific/Palau"));
	
	CalendarItemType calendarItem = new CalendarItemType();
	calendarItem.setStart(xmlStart);

	ItemIdType itemId = exchangeCalendarDao.createCalendarItem(upn, calendarItem);
	assertNotNull(itemId);
	Set<ItemIdType> itemIds = Collections.singleton(itemId);
	Set<CalendarItemType> calendarItems = exchangeCalendarDao.getCalendarItems(upn, itemIds);
	assertNotNull(calendarItems);
	CalendarItemType createdCalendarItem = DataAccessUtils.singleResult(calendarItems);
	assertNotNull(createdCalendarItem);
	XMLGregorianCalendar createdCalendarItemStart = createdCalendarItem.getStart();
	
	assertNotNull(createdCalendarItemStart);

	//because the XMLGregorian calnedar was created with a time zone other than system default
	assertFalse(xmlStart.getTimezone() == createdCalendarItemStart.getTimezone());
	
	assertTrue(DateHelp.withinOneSecond(xmlStart, createdCalendarItemStart));
	
	assertTrue(exchangeCalendarDao.deleteCalendarItems(upn, itemIds));
}
 
开发者ID:Bedework,项目名称:exchange-ws-client,代码行数:35,代码来源:TimeZoneIntegrationTest.java

示例15: createCalendarFolder

import org.springframework.dao.support.DataAccessUtils; //导入方法依赖的package包/类
public FolderIdType createCalendarFolder(String upn, String displayName) {
	setContextCredentials(upn);
	log.debug("createCalendarFolder upn="+upn+", displayName="+displayName);
	//default implementation - null for extendedProperties
	CreateFolder createCalendarFolderRequest = getRequestFactory().constructCreateCalendarFolder(displayName, null);
	CreateFolderResponse createFolderResponse = getWebServices().createFolder(createCalendarFolderRequest);
	Set<FolderIdType> folders = getResponseUtils().parseCreateFolderResponse(createFolderResponse);
	return DataAccessUtils.singleResult(folders);
}
 
开发者ID:Bedework,项目名称:exchange-ws-client,代码行数:10,代码来源:BaseExchangeCalendarDataDao.java


注:本文中的org.springframework.dao.support.DataAccessUtils.singleResult方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。