List of usage examples for org.joda.time DateTime DateTime
public DateTime(Object instant, Chronology chronology)
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 ww . j a v a 2s . co 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 {/*from w w w . ja v a 2 s .c om*/ return null; } }
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.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()); }
From source file:com.alliander.osgp.adapter.protocol.iec61850.infra.networking.services.commands.Iec61850LoadActualPowerCommand.java
License:Open Source License
@Override public MeasurementDto translate(final NodeContainer containingNode) { return new MeasurementDto(this.index, 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.Iec61850LoadMaximumActualPowerCommand.java
License:Open Source License
@Override public MeasurementDto translate(final NodeContainer containingNode) { return new MeasurementDto(this.index, DataAttribute.MAX_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.Iec61850LoadMinimumActualPowerCommand.java
License:Open Source License
@Override public MeasurementDto translate(final NodeContainer containingNode) { return new MeasurementDto(this.index, DataAttribute.MIN_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.Iec61850LoadTotalEnergyCommand.java
License:Open Source License
@Override public MeasurementDto translate(final NodeContainer containingNode) { // Load total energy is implemented different on both RTUs // (one uses Int64, the other Int32) // As a workaround first try to read the value as Long // If that fails read the value as Integer long value = 0; try {// w w w . jav a2s. co m value = containingNode.getLong(SubDataAttribute.ACTUAL_VALUE).getValue(); } catch (final ClassCastException e) { LOGGER.info("Reading long value resulted in class cast exception, trying to read integer value", e); value = containingNode.getInteger(SubDataAttribute.ACTUAL_VALUE).getValue(); } return new MeasurementDto(this.index, DataAttribute.TOTAL_ENERGY.getDescription(), QualityConverter.toShort(containingNode.getQuality(SubDataAttribute.QUALITY).getValue()), new DateTime(containingNode.getDate(SubDataAttribute.TIME), DateTimeZone.UTC), value); }
From source file:com.alliander.osgp.adapter.protocol.iec61850.infra.networking.services.commands.Iec61850MaximumActualPowerCommand.java
License:Open Source License
@Override public MeasurementDto translate(final NodeContainer containingNode) { return new MeasurementDto(1, DataAttribute.MAX_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()); }