List of usage examples for org.joda.time DateTimeZone UTC
DateTimeZone UTC
To view the source code for org.joda.time DateTimeZone UTC.
Click Source Link
From source file:com.abuabdul.mytravelpal.util.MyTravelPalFunc.java
License:Apache License
public static final Date getUTCDateTime() { return new DateTime(DateTimeZone.UTC).toDate(); }
From source file:com.abuabdul.notedovn.util.NoteDovnUtil.java
License:Apache License
public static Date getUTCDateTime() { return new DateTime(DateTimeZone.UTC).toDate(); }
From source file:com.ace.erp.handler.mybatis.JodaDateTimeTypeHandler.java
@Override public Object getResult(ResultSet rs, String columnName) throws SQLException { Timestamp ts = rs.getTimestamp(columnName); if (ts != null) { return new DateTime(ts.getTime(), DateTimeZone.UTC); } else {/*w w w. ja v a 2s . co m*/ return null; } }
From source file:com.ace.erp.handler.mybatis.JodaDateTimeTypeHandler.java
@Override public Object getResult(ResultSet resultSet, int columnIndex) throws SQLException { Timestamp ts = resultSet.getTimestamp(columnIndex); if (ts != null) { return new DateTime(ts.getTime(), DateTimeZone.UTC); } else {/* w w w .j a va 2 s . c o m*/ return null; } }
From source file:com.ace.erp.handler.mybatis.JodaDateTimeTypeHandler.java
@Override public Object getResult(CallableStatement cs, int columnIndex) throws SQLException { Timestamp ts = cs.getTimestamp(columnIndex); if (ts != null) { return new DateTime(ts.getTime(), DateTimeZone.UTC); } else {// w ww.j a va2 s . co m return null; } }
From source file:com.alliander.osgp.acceptancetests.ScopedGivWenZenForSlim.java
License:Open Source License
private static InstantiationStrategy autowireStepDefinitionClassesWithSpring() { rootContext = new AnnotationConfigApplicationContext(); // Force local timezone to UTC (like platform) DateTimeZone.setDefault(DateTimeZone.UTC); TimeZone.setDefault(TimeZone.getTimeZone("UTC")); // Set loglevel to INFO (instead of DEBUG) final Logger root = (Logger) LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME); root.setLevel(Level.INFO);/*from w w w . j a v a2 s . co m*/ rootContext.register(TestApplicationContext.class); try { rootContext.refresh(); } catch (final Exception e) { // just for debugging... throw e; } return new SpringInstantiationStrategy(rootContext); }
From source file:com.alliander.osgp.adapter.protocol.iec61850.infra.networking.services.commands.Iec61850ActualPowerCommand.java
License:Open Source License
@Override public MeasurementDto translate(final NodeContainer containingNode) { return new MeasurementDto(1, DataAttribute.ACTUAL_POWER.getDescription(), QualityConverter.toShort(containingNode.getQuality(SubDataAttribute.QUALITY).getValue()), new DateTime(containingNode.getDate(SubDataAttribute.TIME), DateTimeZone.UTC), containingNode.getChild(SubDataAttribute.MAGNITUDE).getFloat(SubDataAttribute.FLOAT).getFloat()); }
From source file:com.alliander.osgp.adapter.protocol.iec61850.infra.networking.services.commands.Iec61850BehaviourCommand.java
License:Open Source License
@Override public MeasurementDto translate(final NodeContainer containingNode) { return new MeasurementDto(1, DataAttribute.BEHAVIOR.getDescription(), QualityConverter.toShort(containingNode.getQuality(SubDataAttribute.QUALITY).getValue()), new DateTime(containingNode.getDate(SubDataAttribute.TIME), DateTimeZone.UTC), containingNode.getByte(SubDataAttribute.STATE).getValue()); }
From source file:com.alliander.osgp.adapter.protocol.iec61850.infra.networking.services.commands.Iec61850GetConfigurationCommand.java
License:Open Source License
public ConfigurationDto getConfigurationFromDevice(final Iec61850Client iec61850Client, final DeviceConnection deviceConnection, final Ssld ssld, final Iec61850Mapper mapper) throws ProtocolAdapterException { final Function<ConfigurationDto> function = new Function<ConfigurationDto>() { @Override/* w w w .j av a2 s . c o m*/ public ConfigurationDto apply() throws Exception { // Keeping the hardcoded values and values that aren't fetched // from the // device out of the Function // Hardcoded (not supported) final MeterTypeDto meterType = MeterTypeDto.AUX; // Hardcoded (not supported) final Integer shortTermHistoryIntervalMinutes = 15; // Hardcoded (not supported) final LinkTypeDto preferredLinkType = LinkTypeDto.ETHERNET; // Hardcoded (not supported) final Integer longTermHistoryInterval = 1; // Hardcoded (not supported) final LongTermIntervalTypeDto longTermHistoryIntervalType = LongTermIntervalTypeDto.DAYS; final List<RelayMapDto> relayMaps = new ArrayList<>(); for (final DeviceOutputSetting deviceOutputSetting : ssld.getOutputSettings()) { Iec61850GetConfigurationCommand.this.checkRelayType(iec61850Client, deviceConnection, deviceOutputSetting); relayMaps.add(mapper.map(deviceOutputSetting, RelayMapDto.class)); } final RelayConfigurationDto relayConfiguration = new RelayConfigurationDto(relayMaps); // PSLD specific => just sending null so it'll be ignored final DaliConfigurationDto daliConfiguration = null; // getting the software configuration values LOGGER.info("Reading the software configuration values"); final NodeContainer softwareConfiguration = deviceConnection.getFcModelNode(LogicalDevice.LIGHTING, LogicalNode.STREET_LIGHT_CONFIGURATION, DataAttribute.SOFTWARE_CONFIGURATION, Fc.CF); iec61850Client.readNodeDataValues(deviceConnection.getConnection().getClientAssociation(), softwareConfiguration.getFcmodelNode()); String lightTypeValue = softwareConfiguration.getString(SubDataAttribute.LIGHT_TYPE); // Fix for Kaifa bug KI-31 if (lightTypeValue == null || lightTypeValue.isEmpty()) { lightTypeValue = "RELAY"; } final LightTypeDto lightType = LightTypeDto.valueOf(lightTypeValue); final short astroGateSunRiseOffset = softwareConfiguration .getShort(SubDataAttribute.ASTRONOMIC_SUNRISE_OFFSET).getValue(); final short astroGateSunSetOffset = softwareConfiguration .getShort(SubDataAttribute.ASTRONOMIC_SUNSET_OFFSET).getValue(); final ConfigurationDto configuration = new ConfigurationDto(lightType, daliConfiguration, relayConfiguration, shortTermHistoryIntervalMinutes, preferredLinkType, meterType, longTermHistoryInterval, longTermHistoryIntervalType); // getting the registration configuration values LOGGER.info("Reading the registration configuration values"); final NodeContainer registration = deviceConnection.getFcModelNode(LogicalDevice.LIGHTING, LogicalNode.STREET_LIGHT_CONFIGURATION, DataAttribute.REGISTRATION, Fc.CF); iec61850Client.readNodeDataValues(deviceConnection.getConnection().getClientAssociation(), registration.getFcmodelNode()); final String serverAddress = registration.getString(SubDataAttribute.SERVER_ADDRESS); final int serverPort = registration.getInteger(SubDataAttribute.SERVER_PORT).getValue(); configuration.setOsgpIpAddress(serverAddress); configuration.setOsgpPortNumber(serverPort); // getting the IP configuration values LOGGER.info("Reading the IP configuration values"); final NodeContainer ipConfiguration = deviceConnection.getFcModelNode(LogicalDevice.LIGHTING, LogicalNode.STREET_LIGHT_CONFIGURATION, DataAttribute.IP_CONFIGURATION, Fc.CF); iec61850Client.readNodeDataValues(deviceConnection.getConnection().getClientAssociation(), ipConfiguration.getFcmodelNode()); final String deviceFixedIpAddress = ipConfiguration.getString(SubDataAttribute.IP_ADDRESS); final String deviceFixedIpNetmask = ipConfiguration.getString(SubDataAttribute.NETMASK); final String deviceFixedIpGateway = ipConfiguration.getString(SubDataAttribute.GATEWAY); final boolean isDhcpEnabled = ipConfiguration.getBoolean(SubDataAttribute.ENABLE_DHCP).getValue(); final DeviceFixedIpDto deviceFixedIp = new DeviceFixedIpDto(deviceFixedIpAddress, deviceFixedIpNetmask, deviceFixedIpGateway); configuration.setDeviceFixedIp(deviceFixedIp); configuration.setDhcpEnabled(isDhcpEnabled); // setting the software configuration values configuration.setAstroGateSunRiseOffset((int) astroGateSunRiseOffset); configuration.setAstroGateSunSetOffset((int) astroGateSunSetOffset); // getting the clock configuration values LOGGER.info("Reading the clock configuration values"); final NodeContainer clock = deviceConnection.getFcModelNode(LogicalDevice.LIGHTING, LogicalNode.STREET_LIGHT_CONFIGURATION, DataAttribute.CLOCK, Fc.CF); iec61850Client.readNodeDataValues(deviceConnection.getConnection().getClientAssociation(), clock.getFcmodelNode()); final int timeSyncFrequency = clock.getUnsignedShort(SubDataAttribute.TIME_SYNC_FREQUENCY) .getValue(); final boolean automaticSummerTimingEnabled = clock .getBoolean(SubDataAttribute.AUTOMATIC_SUMMER_TIMING_ENABLED).getValue(); final String summerTimeDetails = clock.getString(SubDataAttribute.SUMMER_TIME_DETAILS); final String winterTimeDetails = clock.getString(SubDataAttribute.WINTER_TIME_DETAILS); configuration.setTimeSyncFrequency(timeSyncFrequency); configuration.setAutomaticSummerTimingEnabled(automaticSummerTimingEnabled); configuration.setSummerTimeDetails( new DaylightSavingTimeTransition(TIME_ZONE_AMSTERDAM, summerTimeDetails) .getDateTimeForNextTransition().toDateTime(DateTimeZone.UTC)); configuration.setWinterTimeDetails( new DaylightSavingTimeTransition(TIME_ZONE_AMSTERDAM, winterTimeDetails) .getDateTimeForNextTransition().toDateTime(DateTimeZone.UTC)); return configuration; } }; return iec61850Client.sendCommandWithRetry(function); }
From source file:com.alliander.osgp.adapter.protocol.iec61850.infra.networking.services.commands.Iec61850HealthCommand.java
License:Open Source License
@Override public MeasurementDto translate(final NodeContainer containingNode) { return new MeasurementDto(1, DataAttribute.HEALTH.getDescription(), QualityConverter.toShort(containingNode.getQuality(SubDataAttribute.QUALITY).getValue()), new DateTime(containingNode.getDate(SubDataAttribute.TIME), DateTimeZone.UTC), containingNode.getByte(SubDataAttribute.STATE).getValue()); }