List of usage examples for java.util TimeZone getDefault
public static TimeZone getDefault()
From source file:io.gravitee.reporter.file.FileReporter.java
@Override public synchronized void doStart() throws Exception { String filename = config.getFilename(); if (filename != null) { _out = new RolloverFileOutputStream(filename, config.isAppend(), config.getRetainDays(), TimeZone.getDefault(), config.getDateFormat(), config.getBackupFormat()); LOGGER.info("Opened rollover access log file " + filename); }/* w ww . ja v a2 s . c o m*/ synchronized (this) { _writer = new OutputStreamWriter(_out); } }
From source file:com.bbva.arq.devops.ae.mirrorgate.collectors.jira.config.Config.java
@Bean public TimeZone getTimeZone() { TimeZone tz = TimeZone.getDefault(); if (!StringUtils.isBlank(jiraTimeZone)) { tz = TimeZone.getTimeZone(jiraTimeZone); }//from w w w. jav a 2s. c o m return tz; }
From source file:org.jfree.data.time.YearTest.java
/** * Some checks for the getFirstMillisecond() method. *//*from w ww.j a v a2s . c o m*/ @Test public void testGetFirstMillisecond() { Locale saved = Locale.getDefault(); Locale.setDefault(Locale.UK); TimeZone savedZone = TimeZone.getDefault(); TimeZone.setDefault(TimeZone.getTimeZone("Europe/London")); Year y = new Year(1970); // TODO: Check this result... assertEquals(-3600000L, y.getFirstMillisecond()); Locale.setDefault(saved); TimeZone.setDefault(savedZone); }
From source file:com.collabnet.ccf.pi.qc.v90.QCRequirement.java
/** * Constructs the GenericArtifact Java object for the defect after getting * the schema from getSchemaAttachment method It also populates all the * values into the defect artifact./*from ww w .j a va 2 s .c o m*/ * * The logic for including attachment fields have been DEPRECATED and not * used. This piece of the code, however, has not been removed since it * might be needed in future if there are any changes with respect to making * attachments as first class citizens. * * @param qcc * @param actionId * @param entityId * @param attachmentNames * (DEPRECATED) * @param isResync * @param lastModifiedBy * @return GenericArtifact Containing all the field values. */ public GenericArtifact getGenericArtifactObject(IConnection qcc, String actionId, String entityId, int commentDescriber, int commentQualifier, List<String> attachmentNames, String syncInfoTransactionId, String connectorUser, String resyncUser, QCHandler artifactHandler, String sourceSystemTimezone, String technicalRequirementsTypeID, String lastModifiedBy) { // FIXME: remove need for isResync genericArtifact = QCConfigHelper.getSchemaFieldsForRequirement(qcc, technicalRequirementsTypeID); List<GenericArtifactField> allFields = genericArtifact.getAllGenericArtifactFields(); int noOfFields = allFields.size(); for (int cnt = 0; cnt < noOfFields; cnt++) { GenericArtifactField thisField = allFields.get(cnt); thisField.setFieldValueHasChanged(true); GenericArtifactField.FieldValueTypeValue thisFieldsDatatype = thisField.getFieldValueType(); String fieldName = thisField.getFieldName(); boolean isJoinedField = QCConfigHelper.isJoinedField(qcc, false, fieldName); if (isJoinedField) { // Assume the 'Name' property is what is wanted from these // referenced objects. Could maybe introduce something like // QCConfigHelper.mapJoinedFieldIdToDisplay() to do this, but it // looks like there's no way to map from OTA property names to // DB column names. In any case Bugs have only 4 reference props // and they all have a Name attribute, so the assumption is safe. // set the referenced ID number as this field's value. if ("RQ_TYPE_ID".equals(fieldName)) { String fieldValueAsString = getFieldAsString(fieldName); thisField.setFieldValue(fieldValueAsString); } else { Integer[] fieldValues = getReferencedFieldAsIntArray(fieldName, "ID"); String[] syntheticFieldValues = getReferencedFieldAsStringArray(fieldName, "Name"); String syntheticFieldName = null; boolean noValue = fieldValues.length == 0; thisField.setFieldValue(noValue ? null : fieldValues[0]); syntheticFieldName = thisField.getFieldName() + QCConfigHelper.HUMAN_READABLE_SUFFIX; createSyntheticField(thisField, genericArtifact.addNewField(syntheticFieldName, GenericArtifactField.VALUE_FIELD_TYPE_FLEX_FIELD), syntheticFieldName, noValue ? null : syntheticFieldValues[0]); for (int i = 1; i < fieldValues.length; ++i) { GenericArtifactField newField = genericArtifact.addNewField(fieldName, GenericArtifactField.VALUE_FIELD_TYPE_FLEX_FIELD); copyFieldAttributes(thisField, newField); newField.setFieldValue(fieldValues[i]); syntheticFieldName = thisField.getFieldName() + QCConfigHelper.HUMAN_READABLE_SUFFIX; createSyntheticField(thisField, genericArtifact.addNewField(syntheticFieldName, GenericArtifactField.VALUE_FIELD_TYPE_FLEX_FIELD), syntheticFieldName, syntheticFieldValues[i]); } } } else if (thisFieldsDatatype.equals(GenericArtifactField.FieldValueTypeValue.DATE) || thisFieldsDatatype.equals(GenericArtifactField.FieldValueTypeValue.DATETIME)) { String connectorSystemTimeZone = TimeZone.getDefault().getID(); Date dateValue = getFieldAsDate(thisField.getFieldName()); if (dateValue != null) { if (DateUtil.isAbsoluteDateInTimezone(dateValue, connectorSystemTimeZone)) { dateValue = DateUtil.convertToGMTAbsoluteDate(dateValue, connectorSystemTimeZone); thisField.setFieldValueType(GenericArtifactField.FieldValueTypeValue.DATE); thisField.setFieldValue(dateValue); } else { thisField.setFieldValueType(GenericArtifactField.FieldValueTypeValue.DATETIME); thisField.setFieldValue(dateValue); } } } else if (thisFieldsDatatype.equals(GenericArtifactField.FieldValueTypeValue.INTEGER)) { thisField.setFieldValue(getFieldAsInt(thisField.getFieldName())); } else if (thisFieldsDatatype.equals(GenericArtifactField.FieldValueTypeValue.HTMLSTRING)) { thisField.setFieldValue(getFieldAsString(thisField.getFieldName())); } else if (thisFieldsDatatype.equals(GenericArtifactField.FieldValueTypeValue.USER)) { // INFO Changes for user attributes handling... String fieldValue = getFieldAsString(thisField.getFieldName()); if (StringUtils.isEmpty(fieldValue) || fieldValue == null) { thisField.setFieldValue(null); } else { StringTokenizer st = new StringTokenizer(fieldValue, ";"); boolean firstFieldValue = true; while (st.hasMoreTokens()) { String thisFieldValue = st.nextToken(); if (firstFieldValue) { firstFieldValue = false; thisField.setFieldValue(thisFieldValue); } else { if (!StringUtils.isEmpty(thisFieldValue)) { GenericArtifactField field = genericArtifact.addNewField(thisField.getFieldName(), GenericArtifactField.VALUE_FIELD_TYPE_FLEX_FIELD); field.setFieldValueType(GenericArtifactField.FieldValueTypeValue.USER); field.setFieldValue(thisFieldValue); field.setAlternativeFieldName(thisField.getAlternativeFieldName()); } } } } } else if (thisFieldsDatatype.equals(GenericArtifactField.FieldValueTypeValue.BASE64STRING)) { thisField.setFieldValue(getFieldAsInt(thisField.getFieldName())); } else if (thisFieldsDatatype.equals(GenericArtifactField.FieldValueTypeValue.STRING)) { if (thisField.getMaxOccurs() == GenericArtifactField.CARDINALITY_UNBOUNDED) { String fieldValue = getFieldAsString(thisField.getFieldName()); List<String> fieldValues = new ArrayList<String>(); int size = 0; if (fieldValue != null) { fieldValues = getFieldValues(fieldValue); size = fieldValues.size(); } if (size >= 1) thisField.setFieldValue(fieldValues.get(0)); for (int sizeCnt = 1; sizeCnt < size; sizeCnt++) { GenericArtifactField field; field = genericArtifact.addNewField(thisField.getFieldName(), GenericArtifactField.VALUE_FIELD_TYPE_FLEX_FIELD); field.setFieldValueType(GenericArtifactField.FieldValueTypeValue.STRING); field.setFieldValue(fieldValues.get(sizeCnt)); field.setAlternativeFieldName(thisField.getAlternativeFieldName()); } } else { String fieldValueAsString = null; if (fieldName.equals("RQ_VTS")) { Date dateFieldValue = getFieldAsDate(fieldName); thisField.setFieldValue(dateFieldValue); thisField.setFieldValueType(GenericArtifactField.FieldValueTypeValue.DATETIME); } else { fieldValueAsString = getFieldAsString(fieldName); thisField.setFieldValue(fieldValueAsString); } } } } IRecordSet auditPropertiesRS = null; String deltaComment = ""; try { List<String> txnIds = artifactHandler.getTransactionIdsInRangeForRequirements(qcc, Integer.parseInt(entityId), Integer.parseInt(syncInfoTransactionId), Integer.parseInt(actionId), connectorUser, resyncUser); if (!txnIds.isEmpty()) { auditPropertiesRS = artifactHandler.getAuditPropertiesRecordSet(qcc, txnIds); deltaComment = artifactHandler.getDeltaOfCommentForRequirements(auditPropertiesRS, qcc); } } finally { if (auditPropertiesRS != null) { auditPropertiesRS.safeRelease(); } } genericArtifact.getAllGenericArtifactFieldsWithSameFieldName(QCConfigHelper.QC_RQ_DEV_COMMENTS).get(0) .setFieldValue(deltaComment); // add last modified user as a mappable field GenericArtifactField field; field = genericArtifact.addNewField(QCConfigHelper.lastModifiedUserFieldName, GenericArtifactField.VALUE_FIELD_TYPE_FLEX_FIELD); field.setFieldValueType(GenericArtifactField.FieldValueTypeValue.STRING); field.setFieldValue(lastModifiedBy); field.setFieldAction(FieldActionValue.REPLACE); return genericArtifact; }
From source file:net.audumla.astronomy.algorithims.AstronomicalTest.java
@Test public void testWrapperMethodsRome() throws Exception { TimeZone.setDefault(TimeZone.getTimeZone("Europe/Rome")); CelestialObject sun = new Sun(); Calendar c = Calendar.getInstance(TimeZone.getDefault()); c.setTimeInMillis(0);/* w w w.j a v a2 s . c o m*/ c.set(Calendar.YEAR, 2009); c.set(Calendar.MONTH, Calendar.AUGUST); c.set(Calendar.DAY_OF_MONTH, 8); Date date = c.getTime(); Geolocation.Location location = new Geolocation.Location(); location.setLatitude(41.9000, Geolocation.Direction.NORTH); location.setLongitude(12.5000, Geolocation.Direction.EAST); TransitDetails details = sun.getTransitDetails(date, location, Sun.CIVIL); logger.debug("Rome"); logger.debug("Date : " + date); logger.debug("Julian : " + new JulianDate(date).julian()); logger.debug("Sunrise : Algorithms: " + details.getRiseTime() + " : " + details.getRiseTime().getTime()); logger.debug("Sunset : Algorithms: " + details.getSetTime() + " : " + details.getSetTime().getTime()); Assert.assertEquals(details.getRiseTime().getTime(), 1249702797298l, 1000); Assert.assertEquals(details.getSetTime().getTime(), 1249757426299l, 1000); }
From source file:org.jfree.data.time.MinuteTest.java
/** * Some checks for the getLastMillisecond() method. *//*from w w w . java2 s . c o m*/ @Test public void testGetLastMillisecond() { Locale saved = Locale.getDefault(); Locale.setDefault(Locale.UK); TimeZone savedZone = TimeZone.getDefault(); TimeZone.setDefault(TimeZone.getTimeZone("Europe/London")); Minute m = new Minute(1, 1, 1, 1, 1970); assertEquals(119999L, m.getLastMillisecond()); Locale.setDefault(saved); TimeZone.setDefault(savedZone); }
From source file:org.jfree.data.time.SecondTest.java
/** * Some checks for the getLastMillisecond() method. *//*from w w w.j a v a 2 s . c o m*/ @Test public void testGetLastMillisecond() { Locale saved = Locale.getDefault(); Locale.setDefault(Locale.UK); TimeZone savedZone = TimeZone.getDefault(); TimeZone.setDefault(TimeZone.getTimeZone("Europe/London")); Second s = new Second(1, 1, 1, 1, 1, 1970); assertEquals(61999L, s.getLastMillisecond()); Locale.setDefault(saved); TimeZone.setDefault(savedZone); }
From source file:edu.dlnu.liuwenpeng.Time.TimeSeriesCollection.java
/** * Constructs a dataset containing a single series (more can be added), * tied to the default timezone. /*from w ww .ja v a2 s .co m*/ * * @param series the series (<code>null</code> permitted). */ public TimeSeriesCollection(TimeSeries series) { this(series, TimeZone.getDefault()); }
From source file:at.jku.rdfstats.RDFStatsConfiguration.java
private RDFStatsConfiguration(Model statsModel, List<String> endpoints, List<String> documentURLs, // boolean classSpecific, Integer prefSize, String outFile, String outFormat, Integer strHistMaxLen, boolean quickMode, TimeZone timeZone) {// w ww . ja v a2 s. c o m this.statsModel = (statsModel != null) ? statsModel : ModelFactory.createDefaultModel(); this.endpoints = (endpoints != null) ? endpoints : new ArrayList<String>(); this.documentURLs = (documentURLs != null) ? documentURLs : new ArrayList<String>(); // this.classSpecific = classSpecific; this.prefSize = (prefSize != null) ? prefSize : DEFAULT_PREFSIZE; this.outFile = (outFile != null) ? outFile : DEFAULT_OUTFILE; this.outFormat = (outFormat != null) ? outFormat : DEFAULT_OUTFORMAT; this.strHistMaxLength = (strHistMaxLen != null) ? strHistMaxLen : DEFAULT_STRHIST_MAXLEN; this.quickMode = quickMode; this.defaultTimeZone = (timeZone != null) ? timeZone : TimeZone.getDefault(); TimeZone.setDefault(this.defaultTimeZone); String hostname = ""; try { hostname = InetAddress.getLocalHost().getHostName(); } catch (UnknownHostException ignore) { } finally { this.localHostname = hostname; } }
From source file:com.rogchen.common.xml.UtilDateTime.java
/** * ? /*from ww w. ja v a 2 s.co m*/ * * @param stamp * @param daysLater * @return */ public static Timestamp getDayStart(Timestamp stamp, int daysLater) { return getDayStart(stamp, daysLater, TimeZone.getDefault(), Locale.getDefault()); }