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


Java TimeZone.getWindowsID方法代码示例

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


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

示例1: afterPropertiesSet

import com.ibm.icu.util.TimeZone; //导入方法依赖的package包/类
@Override
public void afterPropertiesSet() throws Exception {
	boolean timeZoneSet = false;
	TimeZone jvmTimeZone = TimeZone.getDefault();
	if(jvmTimeZone != null){
		String windowsID = TimeZone.getWindowsID(jvmTimeZone.getID());
		if(StringUtils.isNotBlank(windowsID)){
			log.info("windows time zone context has been set to '"+windowsID+"'.  All dates and times sent to (or recieved from) EWS must use this timezone information.");
			this.windowsTimeZoneID = windowsID;
			timeZoneSet=true;
		}else{
			log.warn("No windows time zone mapping for "+jvmTimeZone.getID());
		}
	}else{
		log.warn("jvm timezone is not set, this should never happen");
	}
	
	if(!timeZoneSet){
		log.warn("Failed to identify a matching time zone scheme.  Falling back to UTC.");
		TimeZone fallbackTimeZone = TimeZone.getTimeZone(FALLBACK_TIMEZONE_ID);
		TimeZone.setDefault(fallbackTimeZone);
		this.windowsTimeZoneID = FALLBACK_TIMEZONE_ID;
	}
}
 
开发者ID:Bedework,项目名称:exchange-ws-client,代码行数:25,代码来源:RequestServerTimeZoneInterceptor.java

示例2: getTimeZoneIds

import com.ibm.icu.util.TimeZone; //导入方法依赖的package包/类
/**
 * Executes a {@link GetServerTimeZones} request, retrieving all {@link TimeZoneDefinitionType}s from Exchange.
 * Attempts to map each {@link TimeZoneDefinitionType} to an {@link TimeZone} and logs the result.
 */
@Test
public void getTimeZoneIds(){
	int validTimeZoneCount = 0;
	List<TimeZoneDefinitionType> zones = exchangeCalendarDataDao.getServerTimeZones(null, false);
	log.info("Found "+zones.size() +" exchange time zones.");
	for(TimeZoneDefinitionType zone: zones){
		String sysTimeZoneID = TimeZone.getIDForWindowsID(zone.getId(), "US");
		
		if(StringUtils.isNotBlank(sysTimeZoneID)){
			log.info(zone.getId() +" mapped to "+ sysTimeZoneID);
			
			String windowsID = TimeZone.getWindowsID(sysTimeZoneID);
			assertEquals(zone.getId(), windowsID);
			validTimeZoneCount++;
		}else{
			log.warn("no mapping for windowsID="+zone.getId());
		}
		
	}
	log.info("Succesfully mapped "+validTimeZoneCount+"/"+zones.size()+" WindowsTimeZones");
}
 
开发者ID:Bedework,项目名称:exchange-ws-client,代码行数:26,代码来源:BaseExchangeCalendarDataDaoIntegrationTest.java

示例3: isTimeZoneValid

import com.ibm.icu.util.TimeZone; //导入方法依赖的package包/类
public boolean isTimeZoneValid(){
	boolean tzValid = false;
	TimeZone tzDefault = TimeZone.getDefault();
	if(null != tzDefault && StringUtils.isNotBlank(tzDefault.getID())){
		String windowsID = TimeZone.getWindowsID(tzDefault.getID());
		tzValid = this.windowsTimeZoneID.equals(windowsID);	
	}
	return tzValid;
}
 
开发者ID:Bedework,项目名称:exchange-ws-client,代码行数:10,代码来源:RequestServerTimeZoneInterceptor.java

示例4: getWindowsTimeZoneIDForSysTimeZoneIDs

import com.ibm.icu.util.TimeZone; //导入方法依赖的package包/类
@Test
public void getWindowsTimeZoneIDForSysTimeZoneIDs(){
	int validZonesCount = 0;
	String[] availableIDs = TimeZone.getAvailableIDs();
	for(String sysTimeZoneID : availableIDs){
		String windowsID = TimeZone.getWindowsID(sysTimeZoneID);
		if(null != windowsID){
			log.info(sysTimeZoneID+" maps to "+windowsID);
			validZonesCount++;
		}else{
			log.warn("NO MAPPING FOR "+sysTimeZoneID);
		}
	}
	log.info(validZonesCount +"/"+availableIDs.length +" system time zone ids can be mapped to a windows time zone id");
}
 
开发者ID:Bedework,项目名称:exchange-ws-client,代码行数:16,代码来源:ICU4J_Test.java


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