List of usage examples for java.util TimeZone getDefault
public static TimeZone getDefault()
From source file:ly.count.android.sdk.DeviceInfo.java
static int getTimezoneOffset() { return TimeZone.getDefault().getOffset(new Date().getTime()) / 60000; }
From source file:ching.icecreaming.action.EditAction.java
@Action(value = "edit", results = { @Result(name = "login", location = "edit.jsp"), @Result(name = "success", location = "view.jsp"), @Result(name = "error", location = "error.jsp") }) public String execute() throws Exception { URL url1 = null;//from ww w .j a v a 2 s . c om URI uri1 = null; HttpGet httpGet1 = null; DefaultHttpClient httpClient1 = new DefaultHttpClient(); HttpResponse httpResponse1 = null; int int1 = 0, int2 = 401; String[] array1 = null; String string1 = getText("Error") + " %d: %s", result1 = LOGIN; byte[] bytes1 = null; if (StringUtils.isBlank(timeZone1)) timeZone1 = portletPreferences.getValue("timeZone", TimeZone.getDefault().getID()); if (StringUtils.isNotBlank(sid) && StringUtils.isNotBlank(uid) && StringUtils.isNotBlank(pid)) { try { url1 = new URL(sid); URIBuilder uriBuilder = new URIBuilder(sid); uriBuilder.setParameter("j_username", uid); uriBuilder.setParameter("j_password", pid); uriBuilder.setPath(url1.getPath() + "/rest/login"); uri1 = uriBuilder.build(); httpGet1 = new HttpGet(uri1); httpResponse1 = httpClient1.execute(httpGet1); int2 = httpResponse1.getStatusLine().getStatusCode(); } catch (IOException exception1) { exception1.printStackTrace(); } catch (URISyntaxException exception1) { exception1.printStackTrace(); } finally { httpClient1.getConnectionManager().shutdown(); if (int2 == HttpStatus.SC_OK) { sid = new String(Base64.encodeBase64(sid.getBytes())); uid = new String(Base64.encodeBase64(uid.getBytes())); pid = new String(Base64.encodeBase64(pid.getBytes())); urlString = "/"; wsType = "folder"; array1 = new String[] { sid, uid, pid, StringUtils.defaultString(alias1) }; portletPreferences.setValue("urlString", urlString); portletPreferences.setValue("wsType", wsType); portletPreferences.setValue("timeZone", timeZone1); portletPreferences.setValues("server", array1); portletPreferences.store(); result1 = SUCCESS; } else { array1 = portletPreferences.getValues("server", null); if (array1 != null) if (ArrayUtils.isNotEmpty(array1)) { for (int1 = 0; int1 < array1.length; int1++) { switch (int1) { case 0: sid = array1[int1]; break; case 1: uid = array1[int1]; break; case 2: pid = array1[int1]; break; case 3: alias1 = array1[int1]; break; default: break; } } sid = new String(Base64.decodeBase64(sid.getBytes())); uid = new String(Base64.decodeBase64(uid.getBytes())); pid = new String(Base64.decodeBase64(pid.getBytes())); } addActionError(String.format(string1, int2, getText(Integer.toString(int2)))); } } } else { array1 = portletPreferences.getValues("server", null); if (StringUtils.isBlank(urlString) || StringUtils.isBlank(wsType)) { urlString = portletPreferences.getValue("urlString", "/"); wsType = portletPreferences.getValue("wsType", "folder"); } if (array1 != null) { if (ArrayUtils.isNotEmpty(array1)) { for (int1 = 0; int1 < array1.length; int1++) { switch (int1) { case 0: sid = array1[int1]; break; case 1: uid = array1[int1]; break; case 2: pid = array1[int1]; break; case 3: alias1 = array1[int1]; break; default: break; } } sid = new String(Base64.decodeBase64(sid.getBytes())); uid = new String(Base64.decodeBase64(uid.getBytes())); pid = new String(Base64.decodeBase64(pid.getBytes())); } } } return result1; }
From source file:org.jfree.data.time.Quarter.java
/** * Constructs a new instance, based on a date/time and the default time * zone./* www . j ava2s.c o m*/ * * @param time the date/time (<code>null</code> not permitted). * * @see #Quarter(Date, TimeZone, Locale) */ public Quarter(Date time) { this(time, TimeZone.getDefault(), Locale.getDefault()); }
From source file:org.shredzone.cilla.ws.assembler.GallerySectionAssembler.java
@Override public GallerySectionDto createSection() throws CillaServiceException { GallerySection sec = new GallerySection(); sec.setDefaultTimePrecision(TimeDefinition.NONE); CillaUserDetails cud = securityService.getAuthenticatedUser(); sec.setDefaultTimeZone(cud != null ? cud.getTimeZone() : TimeZone.getDefault()); return assemble(sec); }
From source file:com.thinkbiganalytics.scheduler.QuartzScheduler.java
public void scheduleWithCronExpressionInTimeZone(JobIdentifier jobIdentifier, Object task, String runMethod, String cronExpression, TimeZone timeZone) throws JobSchedulerException { try {/*from w ww.ja v a 2 s . c o m*/ JobDetail jobDetail = getJobDetail(jobIdentifier, task, runMethod); if (timeZone == null) { timeZone = TimeZone.getDefault(); } Trigger trigger = TriggerBuilder.newTrigger() .withIdentity( new TriggerKey("trigger_" + jobIdentifier.getUniqueName(), jobIdentifier.getGroup())) .forJob(jobDetail).withSchedule(CronScheduleBuilder.cronSchedule(cronExpression) .inTimeZone(timeZone).withMisfireHandlingInstructionFireAndProceed()) .build(); scheduleJob(jobDetail, trigger); } catch (Exception e) { throw new JobSchedulerException(); } }
From source file:net.sf.jasperreports.engine.convert.ReportConverter.java
private TimeZone readTimeZone() { //duplicates code from JRFillDataset.defaultTimeZone String timezoneId = JRPropertiesUtil.getInstance(jasperReportsContext).getProperty(report, JRFiller.PROPERTY_DEFAULT_TIMEZONE); TimeZone timezone = (timezoneId == null || timezoneId.isEmpty()) ? TimeZone.getDefault() : JRDataUtils.getTimeZone(timezoneId); return timezone; }
From source file:com.jkoolcloud.tnt4j.core.UsecTimestamp.java
/** * <p>Creates UsecTimestamp from string representation of timestamp in the * specified format.</p>// w ww . ja v a 2 s. c o m * <p>This is based on {@link SimpleDateFormat}, but extends its support to * recognize microsecond fractional seconds. If number of fractional second * characters is greater than 3, then it's assumed to be microseconds. * Otherwise, it's assumed to be milliseconds (as this is the behavior of * {@link SimpleDateFormat}. * * @param timeStampStr timestamp string * @param formatStr format specification for timestamp string * @throws NullPointerException if timeStampStr is {@code null} * @throws IllegalArgumentException if timeStampStr is not in the correct format * @throws ParseException if failed to parse string based on specified format */ public UsecTimestamp(String timeStampStr, String formatStr) throws ParseException { this(timeStampStr, formatStr, TimeZone.getDefault()); }
From source file:org.jfree.data.time.Day.java
/** * Constructs a new instance, based on a particular date/time and the * default time zone./*w w w .j a v a2 s . co m*/ * * @param time the time (<code>null</code> not permitted). * * @see #Day(Date, TimeZone) */ public Day(Date time) { // defer argument checking... this(time, TimeZone.getDefault(), Locale.getDefault()); }
From source file:com.bdb.weather.display.summary.RainSummary.java
/** * Load the data into the plot./* w ww . j a v a2 s . co m*/ * * @param list The summary data */ public void loadData(List<SummaryRecord> list) { dataTable.setItems(FXCollections.observableList(list)); TimeSeriesCollection ds = new TimeSeriesCollection(); TimeSeries etSeries = new TimeSeries(ET_ROW_KEY); TimeSeries rainSeries = new TimeSeries(RAIN_ROW_KEY); Depth totalRain = new Depth(0.0); Depth totalET = new Depth(0.0); // // Load each record // for (SummaryRecord rec : list) { Depth rain = rec.getTotalRainfall(); RegularTimePeriod tp = RegularTimePeriod.createInstance(interval.getFreeChartClass(), TimeUtils.localDateTimeToDate(rec.getDate()), TimeZone.getDefault()); if (rain != null) { rainSeries.add(tp, rain.get()); totalRain = totalRain.add(rain); } Depth et = rec.getTotalET(); if (et != null) { etSeries.add(tp, et.get()); totalET = totalET.add(et); } } ds.addSeries(etSeries); ds.addSeries(rainSeries); rainPlot.setDataset(ds); }