Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfkorb2017-01-15 13:29:04 -0500
committerfkorb2017-01-15 13:29:04 -0500
commite41b3a4c29af97deac6ea5f59c6d692fa947dea7 (patch)
treefc929e0d41128ced802fb188bedcbe1dd6431ede
parentd01cc124de3527e1ba5d1daa0c945831745b57a3 (diff)
downloadorg.eclipse.openk-platform.openk-repo-e41b3a4c29af97deac6ea5f59c6d692fa947dea7.tar.gz
org.eclipse.openk-platform.openk-repo-e41b3a4c29af97deac6ea5f59c6d692fa947dea7.tar.xz
org.eclipse.openk-platform.openk-repo-e41b3a4c29af97deac6ea5f59c6d692fa947dea7.zip
Refactoring of EISMAN I started.
-rw-r--r--dev/de.openkonsequenz.cim/.gitignore4
-rw-r--r--dev/de.openkonsequenz.cim/pom.xml44
-rw-r--r--dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/common/ActivityRecord.java40
-rw-r--r--dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/common/ElectronicAddress.java34
-rw-r--r--dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/common/Location.java74
-rw-r--r--dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/common/PositionPoint.java82
-rw-r--r--dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/common/StreetAddress.java65
-rw-r--r--dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/common/StreetDetail.java48
-rw-r--r--dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/common/TownDetail.java47
-rw-r--r--dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/core/AcDcTerminal.java37
-rw-r--r--dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/core/ConductingEquipment.java30
-rw-r--r--dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/core/ConnectivityNode.java35
-rw-r--r--dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/core/ConnectivityNodeContainer.java34
-rw-r--r--dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/core/Equipment.java44
-rw-r--r--dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/core/EquipmentContainer.java70
-rw-r--r--dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/core/GeographicalRegion.java40
-rw-r--r--dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/core/IdentifiedObject.java40
-rw-r--r--dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/core/OperatingParticipant.java23
-rw-r--r--dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/core/OperatingShare.java55
-rw-r--r--dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/core/PowerSystemResource.java70
-rw-r--r--dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/core/SubGeographicalRegion.java47
-rw-r--r--dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/core/Substation.java38
-rw-r--r--dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/core/Terminal.java21
-rw-r--r--dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/core/VoltageLevel.java38
-rw-r--r--dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/domain/AbsoluteDateTime.java43
-rw-r--r--dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/domain/ActivePower.java61
-rw-r--r--dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/domain/CommunicationType.java39
-rw-r--r--dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/domain/PerCent.java38
-rw-r--r--dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/domain/ReductionSetting.java32
-rw-r--r--dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/domain/UnitMultiplier.java75
-rw-r--r--dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/domain/UnitSymbol.java51
-rw-r--r--dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/domain/Voltage.java55
-rw-r--r--dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/informative/infoperations/PsrEvent.java36
-rw-r--r--dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/informative/infoperations/PsrEventKind.java42
-rw-r--r--dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/marketcommon/RegisteredResource.java24
-rw-r--r--dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/marketoperations/mktdomain/UnitType.java67
-rw-r--r--dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/marketoperations/referencedata/RegisteredGenerator.java36
-rw-r--r--dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/meas/Analog.java37
-rw-r--r--dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/meas/AnalogValue.java39
-rw-r--r--dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/meas/Measurement.java94
-rw-r--r--dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/meas/MeasurementValue.java54
-rw-r--r--dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/meas/MeasurementValueQuality.java37
-rw-r--r--dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/production/GeneratingUnit.java82
-rw-r--r--dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/production/GeneratorControlSource.java55
-rw-r--r--dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/util/BigDecimalDeserializer.java29
-rw-r--r--dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/wires/AcLineSegment.java30
-rw-r--r--dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/wires/BusbarSection.java26
-rw-r--r--dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/wires/Conductor.java24
-rw-r--r--dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/wires/Connector.java22
-rw-r--r--dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/wires/PowerTransformer.java19
-rw-r--r--dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/wires/RegulatingCondEq.java34
-rw-r--r--dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/wires/RotatingMachine.java34
-rw-r--r--dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/wires/Switch.java30
-rw-r--r--dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/wires/SynchronousMachine.java168
-rw-r--r--dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/wires/SynchronousMachineKind.java35
-rw-r--r--dev/de.openkonsequenz.cim/src/main/resources/.gitignore0
-rw-r--r--dev/de.openkonsequenz.cim/src/test/java/.gitignore0
-rw-r--r--dev/de.openkonsequenz.cim/src/test/resources/.gitignore0
-rw-r--r--dev/de.openkonsequenz.cimcache/.gitignore4
-rw-r--r--dev/de.openkonsequenz.cimcache/WebContent/META-INF/MANIFEST.MF3
-rw-r--r--dev/de.openkonsequenz.cimcache/WebContent/WEB-INF/database-flyway.xml12
-rw-r--r--dev/de.openkonsequenz.cimcache/WebContent/WEB-INF/database-spring-data.xml43
-rw-r--r--dev/de.openkonsequenz.cimcache/WebContent/WEB-INF/rest-servlet.xml11
-rw-r--r--dev/de.openkonsequenz.cimcache/WebContent/WEB-INF/restful-servlet.xml34
-rw-r--r--dev/de.openkonsequenz.cimcache/WebContent/WEB-INF/web.xml60
-rw-r--r--dev/de.openkonsequenz.cimcache/data-source/20190608 EISMAN I - anonymisierte Testdaten.zipbin0 -> 198022 bytes
-rw-r--r--dev/de.openkonsequenz.cimcache/pom.xml177
-rw-r--r--dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/CimCache.java37
-rw-r--r--dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/CimCache.properties19
-rw-r--r--dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/datainterchange/DataExchangeDefaults.java23
-rw-r--r--dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/datainterchange/SecureRequestHandlerInterceptor.java74
-rw-r--r--dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/datainterchange/adapter/rest/AbstractRestClient.java25
-rw-r--r--dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/datainterchange/adapter/rest/client/GeographicalRegionProvider.java59
-rw-r--r--dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/datainterchange/adapter/rest/client/JsonFileProvider.java48
-rw-r--r--dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/datainterchange/adapter/rest/client/SynchronousMachineProvider.java50
-rw-r--r--dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/datainterchange/adapter/rest/controller/SubGeographicalRegionRestController.java186
-rw-r--r--dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/datainterchange/adapter/rest/controller/SubstationRestController.java99
-rw-r--r--dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/datainterchange/adapter/rest/controller/SynchronousMachineRestController.java62
-rw-r--r--dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/job/JobController.java124
-rw-r--r--dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/job/JsonFileJob.java45
-rw-r--r--dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/job/NetstateJob.java46
-rw-r--r--dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/job/SynchronousMachineJob.java45
-rw-r--r--dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/job/TopologyJob.java45
-rw-r--r--dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/job/util/JobUtils.java101
-rw-r--r--dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/common/ActivityRecordJpa.java85
-rw-r--r--dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/common/ElectronicAddressJpa.java66
-rw-r--r--dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/common/LocationJpa.java165
-rw-r--r--dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/common/PositionPointJpa.java155
-rw-r--r--dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/common/StreetAddressJpa.java108
-rw-r--r--dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/common/StreetDetailJpa.java86
-rw-r--r--dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/common/TownDetailJpa.java85
-rw-r--r--dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/core/AcDcTerminalJpa.java49
-rw-r--r--dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/core/ConductingEquipmentJpa.java32
-rw-r--r--dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/core/ConnectivityNodeContainerJpa.java39
-rw-r--r--dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/core/ConnectivityNodeJpa.java57
-rw-r--r--dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/core/EquipmentContainerJpa.java172
-rw-r--r--dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/core/EquipmentJpa.java108
-rw-r--r--dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/core/GeographicalRegionJpa.java114
-rw-r--r--dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/core/IdentifiedObjectJpa.java84
-rw-r--r--dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/core/OperatingParticipantJpa.java44
-rw-r--r--dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/core/OperatingShareJpa.java124
-rw-r--r--dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/core/PowerSystemResourceJpa.java76
-rw-r--r--dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/core/SubGeographicalRegionJpa.java132
-rw-r--r--dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/core/SubstationJpa.java106
-rw-r--r--dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/core/TerminalJpa.java84
-rw-r--r--dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/core/VoltageLevelJpa.java50
-rw-r--r--dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/domain/AbsoluteDateTimeJpa.java75
-rw-r--r--dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/domain/ActivePowerJpa.java103
-rw-r--r--dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/domain/CommunicationTypeJpa.java33
-rw-r--r--dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/domain/PerCentJpa.java70
-rw-r--r--dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/domain/ReductionSettingJpa.java95
-rw-r--r--dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/domain/UnitMultiplierJpa.java69
-rw-r--r--dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/domain/UnitSymbolJpa.java46
-rw-r--r--dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/domain/VoltageJpa.java97
-rw-r--r--dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/informative/infoperations/PsrEventJpa.java97
-rw-r--r--dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/informative/infoperations/PsrEventKindJpa.java37
-rw-r--r--dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/marketcommon/RegisteredResourceJpa.java23
-rw-r--r--dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/marketoperations/mktdomain/UnitTypeJpa.java64
-rw-r--r--dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/marketoperations/referencedata/RegisteredGeneratorJpa.java41
-rw-r--r--dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/meas/AnalogJpa.java98
-rw-r--r--dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/meas/AnalogValueJpa.java93
-rw-r--r--dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/meas/MeasurementJpa.java95
-rw-r--r--dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/meas/MeasurementValueJpa.java104
-rw-r--r--dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/meas/MeasurementValueQualityJpa.java73
-rw-r--r--dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/production/GeneratingUnitJpa.java102
-rw-r--r--dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/production/GeneratorControlSourceJpa.java52
-rw-r--r--dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/util/Boolean2StringConverter.java38
-rw-r--r--dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/util/RegisteredGenerator2StringConverter.java34
-rw-r--r--dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/util/Sequence.java41
-rw-r--r--dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/util/Temporal.java30
-rw-r--r--dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/wires/AcLineSegmentJpa.java57
-rw-r--r--dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/wires/BusbarSectionJpa.java80
-rw-r--r--dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/wires/ConductorJpa.java26
-rw-r--r--dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/wires/ConnectorJpa.java25
-rw-r--r--dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/wires/PowerTransformerJpa.java73
-rw-r--r--dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/wires/RegulatingCondEqJpa.java38
-rw-r--r--dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/wires/RotatingMachineJpa.java22
-rw-r--r--dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/wires/SwitchJpa.java66
-rw-r--r--dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/wires/SynchronousMachineJpa.java301
-rw-r--r--dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/wires/SynchronousMachineKindJpa.java29
-rw-r--r--dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/util/Abstract4Tree.java79
-rw-r--r--dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/util/SubGeographicalRegion4Tree.java30
-rw-r--r--dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/util/Substation4Tree.java31
-rw-r--r--dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/util/SumContainer.java82
-rw-r--r--dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/repository/GeneratingUnitJpaRepository.java22
-rw-r--r--dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/repository/GeographicalRegionJpaRepository.java24
-rw-r--r--dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/repository/SequenceJpaRepository.java22
-rw-r--r--dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/repository/SubGeographicalRegionJpaRepository.java32
-rw-r--r--dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/repository/SubstationJpaRepository.java64
-rw-r--r--dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/repository/SynchronousMachineJpaRepository.java30
-rw-r--r--dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/repository/VoltageLevelJpaRepository.java22
-rw-r--r--dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/service/AbstractJpaService.java23
-rw-r--r--dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/service/ActivePowerJpaService.java61
-rw-r--r--dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/service/AnalogJpaService.java91
-rw-r--r--dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/service/AnalogValueJpaService.java44
-rw-r--r--dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/service/BaseMapperService.java22
-rw-r--r--dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/service/EquipmentService.java154
-rw-r--r--dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/service/GeographicalRegionJpaService.java467
-rw-r--r--dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/service/GeographicalRegionMapperService.java33
-rw-r--r--dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/service/GeographicalRegionRestConsumerService.java71
-rw-r--r--dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/service/GeographicalRegionValidatorService.java42
-rw-r--r--dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/service/JsonFileRestConsumerService.java49
-rw-r--r--dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/service/NetworkTraceService.java148
-rw-r--r--dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/service/SequenceJpaService.java33
-rw-r--r--dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/service/SignumService.java31
-rw-r--r--dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/service/SubGeographicalRegion4TreeService.java211
-rw-r--r--dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/service/SubGeographicalRegionJpaService.java97
-rw-r--r--dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/service/SubGeographicalRegionMapperService.java46
-rw-r--r--dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/service/SubGeographicalRegionService.java80
-rw-r--r--dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/service/SubstationJpaService.java334
-rw-r--r--dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/service/SubstationMapperService.java45
-rw-r--r--dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/service/SubstationService.java39
-rw-r--r--dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/service/SynchronousMachineJpaDiffCheckerService.java185
-rw-r--r--dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/service/SynchronousMachineJpaService.java193
-rw-r--r--dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/service/SynchronousMachineMapperService.java47
-rw-r--r--dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/service/SynchronousMachineRestConsumerService.java64
-rw-r--r--dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/service/SynchronousMachineValidatorService.java249
-rw-r--r--dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/service/TimePeriodPassedService.java31
-rw-r--r--dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/util/TimestampUtil.java32
-rw-r--r--dev/de.openkonsequenz.cimcache/src/main/resources/dozer-mapping.xml302
-rw-r--r--dev/de.openkonsequenz.cimcache/src/main/resources/flyway-migration/V01/_00/OPENK_STATIC_TOPOLOGY_V01_00_001__init.sql491
-rw-r--r--dev/de.openkonsequenz.cimcache/src/main/resources/quartz.properties17
-rw-r--r--dev/de.openkonsequenz.cimcache/src/test/java/.gitignore0
-rw-r--r--dev/de.openkonsequenz.cimcache/src/test/resources/.gitignore0
-rw-r--r--dev/de.openkonsequenz.common/.gitignore4
-rw-r--r--dev/de.openkonsequenz.common/pom.xml28
-rw-r--r--dev/de.openkonsequenz.common/src/main/java/de/openkonsequenz/dataexchange/adapter/rest/RestDefaults.java24
-rw-r--r--dev/de.openkonsequenz.common/src/main/java/de/openkonsequenz/dataexchange/adapter/rest/controller/AbstractRestController.java45
-rw-r--r--dev/de.openkonsequenz.common/src/main/java/de/openkonsequenz/date/DateDefaults.java174
-rw-r--r--dev/de.openkonsequenz.common/src/main/java/de/openkonsequenz/date/DateToolkit.java102
-rw-r--r--dev/de.openkonsequenz.common/src/main/java/de/openkonsequenz/module/AbstractModule.java84
-rw-r--r--dev/de.openkonsequenz.common/src/main/java/de/openkonsequenz/module/IModule.java42
-rw-r--r--dev/de.openkonsequenz.common/src/main/java/de/openkonsequenz/string/StringDefaults.java60
-rw-r--r--dev/de.openkonsequenz.common/src/main/java/de/openkonsequenz/string/StringToolkit.java68
-rw-r--r--dev/de.openkonsequenz.common/src/main/resources/.gitignore0
-rw-r--r--dev/de.openkonsequenz.common/src/test/java/.gitignore0
-rw-r--r--dev/de.openkonsequenz.common/src/test/resources/.gitignore0
-rw-r--r--dev/de.openkonsequenz.eisman.ui/.gitignore4
-rw-r--r--dev/de.openkonsequenz.eisman.ui/WebContent/.bowerrc3
-rw-r--r--dev/de.openkonsequenz.eisman.ui/WebContent/.jshintrc13
-rw-r--r--dev/de.openkonsequenz.eisman.ui/WebContent/.travis.yml14
-rw-r--r--dev/de.openkonsequenz.eisman.ui/WebContent/Web.config6
-rw-r--r--dev/de.openkonsequenz.eisman.ui/WebContent/WebEssentials2015-Settings.json58
-rw-r--r--dev/de.openkonsequenz.eisman.ui/WebContent/bower.json32
-rw-r--r--dev/de.openkonsequenz.eisman.ui/WebContent/gulpfile.js69
-rw-r--r--dev/de.openkonsequenz.eisman.ui/WebContent/karma.conf.js33
-rw-r--r--dev/de.openkonsequenz.eisman.ui/WebContent/netzzustand/app/NetworkMainStateController.js116
-rw-r--r--dev/de.openkonsequenz.eisman.ui/WebContent/netzzustand/app/NetworkSubStateController.js209
-rw-r--r--dev/de.openkonsequenz.eisman.ui/WebContent/netzzustand/app/additional.css419
-rw-r--r--dev/de.openkonsequenz.eisman.ui/WebContent/netzzustand/app/app.js276
-rw-r--r--dev/de.openkonsequenz.eisman.ui/WebContent/netzzustand/app/config.js258
-rw-r--r--dev/de.openkonsequenz.eisman.ui/WebContent/netzzustand/app/custom.css475
-rw-r--r--dev/de.openkonsequenz.eisman.ui/WebContent/netzzustand/app/directives/directive.js143
-rw-r--r--dev/de.openkonsequenz.eisman.ui/WebContent/netzzustand/app/filters/filter.js138
-rw-r--r--dev/de.openkonsequenz.eisman.ui/WebContent/netzzustand/app/libs/bootstrap-datetimepicker-directive/datetimepickerDirective.js69
-rw-r--r--dev/de.openkonsequenz.eisman.ui/WebContent/netzzustand/app/libs/eismandaterangepicker.js71
-rw-r--r--dev/de.openkonsequenz.eisman.ui/WebContent/netzzustand/app/libs/tree-grid-directive/.gitattributes22
-rw-r--r--dev/de.openkonsequenz.eisman.ui/WebContent/netzzustand/app/libs/tree-grid-directive/.gitignore227
-rw-r--r--dev/de.openkonsequenz.eisman.ui/WebContent/netzzustand/app/libs/tree-grid-directive/README.md165
-rw-r--r--dev/de.openkonsequenz.eisman.ui/WebContent/netzzustand/app/libs/tree-grid-directive/bower.json26
-rw-r--r--dev/de.openkonsequenz.eisman.ui/WebContent/netzzustand/app/libs/tree-grid-directive/package.json14
-rw-r--r--dev/de.openkonsequenz.eisman.ui/WebContent/netzzustand/app/libs/tree-grid-directive/src/tree-grid-directive.js757
-rw-r--r--dev/de.openkonsequenz.eisman.ui/WebContent/netzzustand/app/libs/tree-grid-directive/src/treeGrid.css106
-rw-r--r--dev/de.openkonsequenz.eisman.ui/WebContent/netzzustand/app/libs/tree-grid-directive/temp/getTree.js63
-rw-r--r--dev/de.openkonsequenz.eisman.ui/WebContent/netzzustand/app/libs/tree-grid-directive/temp/template.html18
-rw-r--r--dev/de.openkonsequenz.eisman.ui/WebContent/netzzustand/app/libs/tree-grid-directive/test/treeGrid.html46
-rw-r--r--dev/de.openkonsequenz.eisman.ui/WebContent/netzzustand/app/libs/tree-grid-directive/test/treeGridTest.js228
-rw-r--r--dev/de.openkonsequenz.eisman.ui/WebContent/netzzustand/app/locale-de.json210
-rw-r--r--dev/de.openkonsequenz.eisman.ui/WebContent/netzzustand/app/partials/activitydetails.html47
-rw-r--r--dev/de.openkonsequenz.eisman.ui/WebContent/netzzustand/app/partials/activitydetails2.html48
-rw-r--r--dev/de.openkonsequenz.eisman.ui/WebContent/netzzustand/app/partials/activitydetails_p.html47
-rw-r--r--dev/de.openkonsequenz.eisman.ui/WebContent/netzzustand/app/partials/confirm.html12
-rw-r--r--dev/de.openkonsequenz.eisman.ui/WebContent/netzzustand/app/partials/countdown.html3
-rw-r--r--dev/de.openkonsequenz.eisman.ui/WebContent/netzzustand/app/partials/custompaging.html12
-rw-r--r--dev/de.openkonsequenz.eisman.ui/WebContent/netzzustand/app/partials/editfinishdate.html12
-rw-r--r--dev/de.openkonsequenz.eisman.ui/WebContent/netzzustand/app/partials/enginelist.html24
-rw-r--r--dev/de.openkonsequenz.eisman.ui/WebContent/netzzustand/app/partials/error.html11
-rw-r--r--dev/de.openkonsequenz.eisman.ui/WebContent/netzzustand/app/partials/message.html11
-rw-r--r--dev/de.openkonsequenz.eisman.ui/WebContent/netzzustand/app/partials/modal.html16
-rw-r--r--dev/de.openkonsequenz.eisman.ui/WebContent/netzzustand/app/partials/spinner.html12
-rw-r--r--dev/de.openkonsequenz.eisman.ui/WebContent/netzzustand/app/partials/timermessage.html17
-rw-r--r--dev/de.openkonsequenz.eisman.ui/WebContent/netzzustand/app/services/activityService.js213
-rw-r--r--dev/de.openkonsequenz.eisman.ui/WebContent/netzzustand/app/services/dateService.js137
-rw-r--r--dev/de.openkonsequenz.eisman.ui/WebContent/netzzustand/app/services/modalService.js123
-rw-r--r--dev/de.openkonsequenz.eisman.ui/WebContent/netzzustand/index.html80
-rw-r--r--dev/de.openkonsequenz.eisman.ui/WebContent/package.json43
-rw-r--r--dev/de.openkonsequenz.eisman.ui/WebContent/www/app/ChangeSettings.html139
-rw-r--r--dev/de.openkonsequenz.eisman.ui/WebContent/www/app/CreateDownRegulation.html253
-rw-r--r--dev/de.openkonsequenz.eisman.ui/WebContent/www/app/CreateDownRegulationController.js101
-rw-r--r--dev/de.openkonsequenz.eisman.ui/WebContent/www/app/CreateProposal.html49
-rw-r--r--dev/de.openkonsequenz.eisman.ui/WebContent/www/app/CreateProposalConfirmation.html29
-rw-r--r--dev/de.openkonsequenz.eisman.ui/WebContent/www/app/CreateProposalConfirmationController.js158
-rw-r--r--dev/de.openkonsequenz.eisman.ui/WebContent/www/app/CreateProposalConfirmationModal.html95
-rw-r--r--dev/de.openkonsequenz.eisman.ui/WebContent/www/app/CreateProposalConfirmationModalController.js59
-rw-r--r--dev/de.openkonsequenz.eisman.ui/WebContent/www/app/CreateProposalController.js29
-rw-r--r--dev/de.openkonsequenz.eisman.ui/WebContent/www/app/CreateSettings.html164
-rw-r--r--dev/de.openkonsequenz.eisman.ui/WebContent/www/app/CreateSettingsController.js248
-rw-r--r--dev/de.openkonsequenz.eisman.ui/WebContent/www/app/NetworkMainState.html4
-rw-r--r--dev/de.openkonsequenz.eisman.ui/WebContent/www/app/NetworkMainStateController.js149
-rw-r--r--dev/de.openkonsequenz.eisman.ui/WebContent/www/app/NetworkMainStateInfoController.js107
-rw-r--r--dev/de.openkonsequenz.eisman.ui/WebContent/www/app/NetworkState.html11
-rw-r--r--dev/de.openkonsequenz.eisman.ui/WebContent/www/app/NetworkSubState.html2
-rw-r--r--dev/de.openkonsequenz.eisman.ui/WebContent/www/app/NetworkSubStateController.js222
-rw-r--r--dev/de.openkonsequenz.eisman.ui/WebContent/www/app/NetworkSubStateInfoController.js201
-rw-r--r--dev/de.openkonsequenz.eisman.ui/WebContent/www/app/OverviewCtrl.js591
-rw-r--r--dev/de.openkonsequenz.eisman.ui/WebContent/www/app/OverviewDetailButtons.html8
-rw-r--r--dev/de.openkonsequenz.eisman.ui/WebContent/www/app/PreselectionModal.html22
-rw-r--r--dev/de.openkonsequenz.eisman.ui/WebContent/www/app/PreselectionModalController.js68
-rw-r--r--dev/de.openkonsequenz.eisman.ui/WebContent/www/app/ProposalModal.html75
-rw-r--r--dev/de.openkonsequenz.eisman.ui/WebContent/www/app/ProposalModalController.js66
-rw-r--r--dev/de.openkonsequenz.eisman.ui/WebContent/www/app/ReductionListMock.json1560
-rw-r--r--dev/de.openkonsequenz.eisman.ui/WebContent/www/app/Regulation.html78
-rw-r--r--dev/de.openkonsequenz.eisman.ui/WebContent/www/app/RegulationController.js64
-rw-r--r--dev/de.openkonsequenz.eisman.ui/WebContent/www/app/SelectedNetworkSubStation.html2
-rw-r--r--dev/de.openkonsequenz.eisman.ui/WebContent/www/app/SelectedNetworkSubStationController.js298
-rw-r--r--dev/de.openkonsequenz.eisman.ui/WebContent/www/app/SynchronousMachineListByProcessIdCtrl.js117
-rw-r--r--dev/de.openkonsequenz.eisman.ui/WebContent/www/app/additional.css419
-rw-r--r--dev/de.openkonsequenz.eisman.ui/WebContent/www/app/app.js156
-rw-r--r--dev/de.openkonsequenz.eisman.ui/WebContent/www/app/config.js258
-rw-r--r--dev/de.openkonsequenz.eisman.ui/WebContent/www/app/custom.css480
-rw-r--r--dev/de.openkonsequenz.eisman.ui/WebContent/www/app/directives/directive.js143
-rw-r--r--dev/de.openkonsequenz.eisman.ui/WebContent/www/app/filters/filter.js138
-rw-r--r--dev/de.openkonsequenz.eisman.ui/WebContent/www/app/libs/bootstrap-datetimepicker-directive/datetimepickerDirective.js69
-rw-r--r--dev/de.openkonsequenz.eisman.ui/WebContent/www/app/libs/eismandaterangepicker.js71
-rw-r--r--dev/de.openkonsequenz.eisman.ui/WebContent/www/app/libs/tree-grid-directive/.gitattributes22
-rw-r--r--dev/de.openkonsequenz.eisman.ui/WebContent/www/app/libs/tree-grid-directive/.gitignore227
-rw-r--r--dev/de.openkonsequenz.eisman.ui/WebContent/www/app/libs/tree-grid-directive/README.md165
-rw-r--r--dev/de.openkonsequenz.eisman.ui/WebContent/www/app/libs/tree-grid-directive/bower.json26
-rw-r--r--dev/de.openkonsequenz.eisman.ui/WebContent/www/app/libs/tree-grid-directive/package.json14
-rw-r--r--dev/de.openkonsequenz.eisman.ui/WebContent/www/app/libs/tree-grid-directive/src/tree-grid-directive.js757
-rw-r--r--dev/de.openkonsequenz.eisman.ui/WebContent/www/app/libs/tree-grid-directive/src/treeGrid.css106
-rw-r--r--dev/de.openkonsequenz.eisman.ui/WebContent/www/app/libs/tree-grid-directive/temp/getTree.js63
-rw-r--r--dev/de.openkonsequenz.eisman.ui/WebContent/www/app/libs/tree-grid-directive/temp/template.html18
-rw-r--r--dev/de.openkonsequenz.eisman.ui/WebContent/www/app/libs/tree-grid-directive/test/treeGrid.html46
-rw-r--r--dev/de.openkonsequenz.eisman.ui/WebContent/www/app/libs/tree-grid-directive/test/treeGridTest.js228
-rw-r--r--dev/de.openkonsequenz.eisman.ui/WebContent/www/app/locale-de.json211
-rw-r--r--dev/de.openkonsequenz.eisman.ui/WebContent/www/app/networkStateController.js112
-rw-r--r--dev/de.openkonsequenz.eisman.ui/WebContent/www/app/overview.html138
-rw-r--r--dev/de.openkonsequenz.eisman.ui/WebContent/www/app/partials/activitydetails.html45
-rw-r--r--dev/de.openkonsequenz.eisman.ui/WebContent/www/app/partials/activitydetails2.html48
-rw-r--r--dev/de.openkonsequenz.eisman.ui/WebContent/www/app/partials/activitydetails_p.html47
-rw-r--r--dev/de.openkonsequenz.eisman.ui/WebContent/www/app/partials/confirm.html12
-rw-r--r--dev/de.openkonsequenz.eisman.ui/WebContent/www/app/partials/countdown.html3
-rw-r--r--dev/de.openkonsequenz.eisman.ui/WebContent/www/app/partials/custompaging.html12
-rw-r--r--dev/de.openkonsequenz.eisman.ui/WebContent/www/app/partials/editfinishdate.html12
-rw-r--r--dev/de.openkonsequenz.eisman.ui/WebContent/www/app/partials/enginelist.html24
-rw-r--r--dev/de.openkonsequenz.eisman.ui/WebContent/www/app/partials/error.html11
-rw-r--r--dev/de.openkonsequenz.eisman.ui/WebContent/www/app/partials/message.html11
-rw-r--r--dev/de.openkonsequenz.eisman.ui/WebContent/www/app/partials/modal.html16
-rw-r--r--dev/de.openkonsequenz.eisman.ui/WebContent/www/app/partials/spinner.html12
-rw-r--r--dev/de.openkonsequenz.eisman.ui/WebContent/www/app/partials/timermessage.html17
-rw-r--r--dev/de.openkonsequenz.eisman.ui/WebContent/www/app/services/activityService.js401
-rw-r--r--dev/de.openkonsequenz.eisman.ui/WebContent/www/app/services/dateService.js137
-rw-r--r--dev/de.openkonsequenz.eisman.ui/WebContent/www/app/services/modalService.js123
-rw-r--r--dev/de.openkonsequenz.eisman.ui/WebContent/www/app/subStationController.js246
-rw-r--r--dev/de.openkonsequenz.eisman.ui/WebContent/www/favicon.pngbin0 -> 594 bytes
-rw-r--r--dev/de.openkonsequenz.eisman.ui/WebContent/www/index.html91
-rw-r--r--dev/de.openkonsequenz.eisman/.gitignore4
-rw-r--r--dev/de.openkonsequenz.eisman/WebContent/META-INF/MANIFEST.MF3
-rw-r--r--dev/de.openkonsequenz.eisman/WebContent/WEB-INF/database-flyway.xml12
-rw-r--r--dev/de.openkonsequenz.eisman/WebContent/WEB-INF/database-spring-data.xml49
-rw-r--r--dev/de.openkonsequenz.eisman/WebContent/WEB-INF/restful-servlet.xml50
-rw-r--r--dev/de.openkonsequenz.eisman/WebContent/WEB-INF/web.xml51
-rw-r--r--dev/de.openkonsequenz.eisman/pom.xml183
-rw-r--r--dev/de.openkonsequenz.eisman/src/main/java/de/openkonsequenz/eisman/EISMAN.java77
-rw-r--r--dev/de.openkonsequenz.eisman/src/main/java/de/openkonsequenz/eisman/EISMAN.properties31
-rw-r--r--dev/de.openkonsequenz.eisman/src/main/java/de/openkonsequenz/eisman/adapter/rest/consumer/BaseRestConsumer.java26
-rw-r--r--dev/de.openkonsequenz.eisman/src/main/java/de/openkonsequenz/eisman/adapter/rest/consumer/SubGeographicalRegionRestConsumer.java73
-rw-r--r--dev/de.openkonsequenz.eisman/src/main/java/de/openkonsequenz/eisman/adapter/rest/consumer/SubstationRestConsumer.java54
-rw-r--r--dev/de.openkonsequenz.eisman/src/main/java/de/openkonsequenz/eisman/adapter/rest/consumer/SynchronousMachineRestConsumer.java33
-rw-r--r--dev/de.openkonsequenz.eisman/src/main/java/de/openkonsequenz/eisman/adapter/rest/controller/AbstractRestController.java66
-rw-r--r--dev/de.openkonsequenz.eisman/src/main/java/de/openkonsequenz/eisman/adapter/rest/controller/ActivityRestController.java445
-rw-r--r--dev/de.openkonsequenz.eisman/src/main/java/de/openkonsequenz/eisman/adapter/rest/controller/DisplayDtoRestController.java69
-rw-r--r--dev/de.openkonsequenz.eisman/src/main/java/de/openkonsequenz/eisman/adapter/rest/controller/HysteresisController.java41
-rw-r--r--dev/de.openkonsequenz.eisman/src/main/java/de/openkonsequenz/eisman/adapter/rest/controller/PreselectionRestController.java67
-rw-r--r--dev/de.openkonsequenz.eisman/src/main/java/de/openkonsequenz/eisman/adapter/rest/controller/ReasonOfReductionRestController.java39
-rw-r--r--dev/de.openkonsequenz.eisman/src/main/java/de/openkonsequenz/eisman/adapter/rest/controller/ReductionSettingListRestController.java39
-rw-r--r--dev/de.openkonsequenz.eisman/src/main/java/de/openkonsequenz/eisman/adapter/rest/controller/SubGeographicalRegionRestController.java71
-rw-r--r--dev/de.openkonsequenz.eisman/src/main/java/de/openkonsequenz/eisman/adapter/rest/controller/SubstationRestController.java86
-rw-r--r--dev/de.openkonsequenz.eisman/src/main/java/de/openkonsequenz/eisman/adapter/rest/controller/TimerRestContoller.java37
-rw-r--r--dev/de.openkonsequenz.eisman/src/main/java/de/openkonsequenz/eisman/adapter/rest/controller/exceptionhandler/RestResponseEntityExceptionHandler.java57
-rw-r--r--dev/de.openkonsequenz.eisman/src/main/java/de/openkonsequenz/eisman/adapter/rest/controller/util/IncludeAttribute4Json.java27
-rw-r--r--dev/de.openkonsequenz.eisman/src/main/java/de/openkonsequenz/eisman/adapter/rest/controller/util/SubstationToolkit.java469
-rw-r--r--dev/de.openkonsequenz.eisman/src/main/java/de/openkonsequenz/eisman/controller/BaseController.java47
-rw-r--r--dev/de.openkonsequenz.eisman/src/main/java/de/openkonsequenz/eisman/model/dto/core/ActionOverviewDto.java44
-rw-r--r--dev/de.openkonsequenz.eisman/src/main/java/de/openkonsequenz/eisman/model/dto/core/ActionSettingsDto.java210
-rw-r--r--dev/de.openkonsequenz.eisman/src/main/java/de/openkonsequenz/eisman/model/dto/core/OverviewDto.java147
-rw-r--r--dev/de.openkonsequenz.eisman/src/main/java/de/openkonsequenz/eisman/model/dto/core/PointOfInjectionType.java41
-rw-r--r--dev/de.openkonsequenz.eisman/src/main/java/de/openkonsequenz/eisman/model/dto/core/PreselectionConfigurationDto.java119
-rw-r--r--dev/de.openkonsequenz.eisman/src/main/java/de/openkonsequenz/eisman/model/dto/core/ProcessOverviewDto.java180
-rw-r--r--dev/de.openkonsequenz.eisman/src/main/java/de/openkonsequenz/eisman/model/dto/core/SynchronousMachineOverviewDto.java188
-rw-r--r--dev/de.openkonsequenz.eisman/src/main/java/de/openkonsequenz/eisman/model/jpa/common/ElectronicAddressJpa.java35
-rw-r--r--dev/de.openkonsequenz.eisman/src/main/java/de/openkonsequenz/eisman/model/jpa/common/LocationJpa.java89
-rw-r--r--dev/de.openkonsequenz.eisman/src/main/java/de/openkonsequenz/eisman/model/jpa/common/StreetAddressJpa.java61
-rw-r--r--dev/de.openkonsequenz.eisman/src/main/java/de/openkonsequenz/eisman/model/jpa/common/StreetDetailJpa.java46
-rw-r--r--dev/de.openkonsequenz.eisman/src/main/java/de/openkonsequenz/eisman/model/jpa/common/TownDetailJpa.java45
-rw-r--r--dev/de.openkonsequenz.eisman/src/main/java/de/openkonsequenz/eisman/model/jpa/core/EquipmentContainerJpa.java83
-rw-r--r--dev/de.openkonsequenz.eisman/src/main/java/de/openkonsequenz/eisman/model/jpa/core/EquipmentJpa.java59
-rw-r--r--dev/de.openkonsequenz.eisman/src/main/java/de/openkonsequenz/eisman/model/jpa/core/IdentifiedObjectJpa.java47
-rw-r--r--dev/de.openkonsequenz.eisman/src/main/java/de/openkonsequenz/eisman/model/jpa/core/SubGeographicalRegionJpa.java99
-rw-r--r--dev/de.openkonsequenz.eisman/src/main/java/de/openkonsequenz/eisman/model/jpa/core/SubstationJpa.java46
-rw-r--r--dev/de.openkonsequenz.eisman/src/main/java/de/openkonsequenz/eisman/model/jpa/core/VoltageLevelJpa.java50
-rw-r--r--dev/de.openkonsequenz.eisman/src/main/java/de/openkonsequenz/eisman/model/jpa/domain/AbsoluteDateTimeJpa.java53
-rw-r--r--dev/de.openkonsequenz.eisman/src/main/java/de/openkonsequenz/eisman/model/jpa/domain/ActivePowerJpa.java56
-rw-r--r--dev/de.openkonsequenz.eisman/src/main/java/de/openkonsequenz/eisman/model/jpa/domain/CommunicationTypeJpa.java36
-rw-r--r--dev/de.openkonsequenz.eisman/src/main/java/de/openkonsequenz/eisman/model/jpa/domain/PerCentJpa.java38
-rw-r--r--dev/de.openkonsequenz.eisman/src/main/java/de/openkonsequenz/eisman/model/jpa/domain/ReductionSettingJpa.java53
-rw-r--r--dev/de.openkonsequenz.eisman/src/main/java/de/openkonsequenz/eisman/model/jpa/domain/UnitMultiplierJpa.java43
-rw-r--r--dev/de.openkonsequenz.eisman/src/main/java/de/openkonsequenz/eisman/model/jpa/domain/UnitSymbolJpa.java43
-rw-r--r--dev/de.openkonsequenz.eisman/src/main/java/de/openkonsequenz/eisman/model/jpa/domain/VoltageJpa.java53
-rw-r--r--dev/de.openkonsequenz.eisman/src/main/java/de/openkonsequenz/eisman/model/jpa/informative/infoperations/PsrEventJpa.java85
-rw-r--r--dev/de.openkonsequenz.eisman/src/main/java/de/openkonsequenz/eisman/model/jpa/informative/infoperations/PsrEventKindJpa.java40
-rw-r--r--dev/de.openkonsequenz.eisman/src/main/java/de/openkonsequenz/eisman/model/jpa/marketoperations/mktdomain/UnitTypeJpa.java63
-rw-r--r--dev/de.openkonsequenz.eisman/src/main/java/de/openkonsequenz/eisman/model/jpa/marketoperations/referencedata/RegisteredGeneratorJpa.java41
-rw-r--r--dev/de.openkonsequenz.eisman/src/main/java/de/openkonsequenz/eisman/model/jpa/meas/AnalogJpa.java71
-rw-r--r--dev/de.openkonsequenz.eisman/src/main/java/de/openkonsequenz/eisman/model/jpa/meas/AnalogValueJpa.java65
-rw-r--r--dev/de.openkonsequenz.eisman/src/main/java/de/openkonsequenz/eisman/model/jpa/meas/MeasurementJpa.java95
-rw-r--r--dev/de.openkonsequenz.eisman/src/main/java/de/openkonsequenz/eisman/model/jpa/meas/MeasurementValueJpa.java60
-rw-r--r--dev/de.openkonsequenz.eisman/src/main/java/de/openkonsequenz/eisman/model/jpa/meas/MeasurementValueQualityJpa.java41
-rw-r--r--dev/de.openkonsequenz.eisman/src/main/java/de/openkonsequenz/eisman/model/jpa/process/AbstractBaseEntityJpa.java97
-rw-r--r--dev/de.openkonsequenz.eisman/src/main/java/de/openkonsequenz/eisman/model/jpa/process/ActivityJpa.java285
-rw-r--r--dev/de.openkonsequenz.eisman/src/main/java/de/openkonsequenz/eisman/model/jpa/process/CharacteristicForActivityStatus.java34
-rw-r--r--dev/de.openkonsequenz.eisman/src/main/java/de/openkonsequenz/eisman/model/jpa/process/CharacteristicForMissingMeasurementJpa.java33
-rw-r--r--dev/de.openkonsequenz.eisman/src/main/java/de/openkonsequenz/eisman/model/jpa/process/PreselectionConfigurationJpa.java140
-rw-r--r--dev/de.openkonsequenz.eisman/src/main/java/de/openkonsequenz/eisman/model/jpa/process/PreselectionJpa.java72
-rw-r--r--dev/de.openkonsequenz.eisman/src/main/java/de/openkonsequenz/eisman/model/jpa/process/UserSettingsJpa.java96
-rw-r--r--dev/de.openkonsequenz.eisman/src/main/java/de/openkonsequenz/eisman/model/jpa/production/GeneratingUnitJpa.java85
-rw-r--r--dev/de.openkonsequenz.eisman/src/main/java/de/openkonsequenz/eisman/model/jpa/util/Boolean2StringConverter.java34
-rw-r--r--dev/de.openkonsequenz.eisman/src/main/java/de/openkonsequenz/eisman/model/jpa/wires/SynchronousMachineJpa.java347
-rw-r--r--dev/de.openkonsequenz.eisman/src/main/java/de/openkonsequenz/eisman/model/util/Abstract4Tree.java79
-rw-r--r--dev/de.openkonsequenz.eisman/src/main/java/de/openkonsequenz/eisman/model/util/SubGeographicalRegion4Tree.java30
-rw-r--r--dev/de.openkonsequenz.eisman/src/main/java/de/openkonsequenz/eisman/model/util/Substation4Tree.java31
-rw-r--r--dev/de.openkonsequenz.eisman/src/main/java/de/openkonsequenz/eisman/model/util/mapper/BigDecimalDeserializer.java30
-rw-r--r--dev/de.openkonsequenz.eisman/src/main/java/de/openkonsequenz/eisman/repository/ActivityJpaRepository.java54
-rw-r--r--dev/de.openkonsequenz.eisman/src/main/java/de/openkonsequenz/eisman/repository/PreselectionJpaRepository.java21
-rw-r--r--dev/de.openkonsequenz.eisman/src/main/java/de/openkonsequenz/eisman/repository/SubGeographicalRegionJpaRepository.java25
-rw-r--r--dev/de.openkonsequenz.eisman/src/main/java/de/openkonsequenz/eisman/repository/SubstationJpaRepository.java20
-rw-r--r--dev/de.openkonsequenz.eisman/src/main/java/de/openkonsequenz/eisman/repository/SynchronousMachineJpaRepository.java28
-rw-r--r--dev/de.openkonsequenz.eisman/src/main/java/de/openkonsequenz/eisman/service/AbstractReductionAdviceCalculatorService.java240
-rw-r--r--dev/de.openkonsequenz.eisman/src/main/java/de/openkonsequenz/eisman/service/AbstractReductionAdviceService.java175
-rw-r--r--dev/de.openkonsequenz.eisman/src/main/java/de/openkonsequenz/eisman/service/AbstractService.java24
-rw-r--r--dev/de.openkonsequenz.eisman/src/main/java/de/openkonsequenz/eisman/service/ActivePowerJpaService.java51
-rw-r--r--dev/de.openkonsequenz.eisman/src/main/java/de/openkonsequenz/eisman/service/ActivityJpaFindService.java218
-rw-r--r--dev/de.openkonsequenz.eisman/src/main/java/de/openkonsequenz/eisman/service/ActivityJpaMappingService.java96
-rw-r--r--dev/de.openkonsequenz.eisman/src/main/java/de/openkonsequenz/eisman/service/ActivityJpaService.java347
-rw-r--r--dev/de.openkonsequenz.eisman/src/main/java/de/openkonsequenz/eisman/service/AnalogJpaService.java121
-rw-r--r--dev/de.openkonsequenz.eisman/src/main/java/de/openkonsequenz/eisman/service/AnalogValueJpaService.java116
-rw-r--r--dev/de.openkonsequenz.eisman/src/main/java/de/openkonsequenz/eisman/service/BaseMapperService.java22
-rw-r--r--dev/de.openkonsequenz.eisman/src/main/java/de/openkonsequenz/eisman/service/DiscriminationCoefficientService.java85
-rw-r--r--dev/de.openkonsequenz.eisman/src/main/java/de/openkonsequenz/eisman/service/DisplayDtoService.java113
-rw-r--r--dev/de.openkonsequenz.eisman/src/main/java/de/openkonsequenz/eisman/service/HysteresisService.java39
-rw-r--r--dev/de.openkonsequenz.eisman/src/main/java/de/openkonsequenz/eisman/service/PreselectionJpaService.java50
-rw-r--r--dev/de.openkonsequenz.eisman/src/main/java/de/openkonsequenz/eisman/service/ReasonOfReductionService.java35
-rw-r--r--dev/de.openkonsequenz.eisman/src/main/java/de/openkonsequenz/eisman/service/ReductionAdvice.java19
-rw-r--r--dev/de.openkonsequenz.eisman/src/main/java/de/openkonsequenz/eisman/service/ReductionAdviceAdjustmentService.java140
-rw-r--r--dev/de.openkonsequenz.eisman/src/main/java/de/openkonsequenz/eisman/service/ReductionAdviceCalculatorService.java135
-rw-r--r--dev/de.openkonsequenz.eisman/src/main/java/de/openkonsequenz/eisman/service/ReductionAdviceInitialService.java51
-rw-r--r--dev/de.openkonsequenz.eisman/src/main/java/de/openkonsequenz/eisman/service/ReductionAdviceService.java119
-rw-r--r--dev/de.openkonsequenz.eisman/src/main/java/de/openkonsequenz/eisman/service/ReductionAdviceUpdateService.java209
-rw-r--r--dev/de.openkonsequenz.eisman/src/main/java/de/openkonsequenz/eisman/service/ReductionSettingService.java32
-rw-r--r--dev/de.openkonsequenz.eisman/src/main/java/de/openkonsequenz/eisman/service/SubGeographicalRegionJpaService.java58
-rw-r--r--dev/de.openkonsequenz.eisman/src/main/java/de/openkonsequenz/eisman/service/SubGeographicalRegionMapperService.java29
-rw-r--r--dev/de.openkonsequenz.eisman/src/main/java/de/openkonsequenz/eisman/service/SubGeographicalRegionRestConsumerService.java133
-rw-r--r--dev/de.openkonsequenz.eisman/src/main/java/de/openkonsequenz/eisman/service/SubstationJpaService.java39
-rw-r--r--dev/de.openkonsequenz.eisman/src/main/java/de/openkonsequenz/eisman/service/SubstationMapperService.java30
-rw-r--r--dev/de.openkonsequenz.eisman/src/main/java/de/openkonsequenz/eisman/service/SubstationRestConsumerService.java52
-rw-r--r--dev/de.openkonsequenz.eisman/src/main/java/de/openkonsequenz/eisman/service/SynchronousMachineJpaService.java93
-rw-r--r--dev/de.openkonsequenz.eisman/src/main/java/de/openkonsequenz/eisman/service/SynchronousMachineMapperService.java31
-rw-r--r--dev/de.openkonsequenz.eisman/src/main/java/de/openkonsequenz/eisman/service/SynchronousMachineMeasurementService.java227
-rw-r--r--dev/de.openkonsequenz.eisman/src/main/java/de/openkonsequenz/eisman/service/SynchronousMachineOrderService.java113
-rw-r--r--dev/de.openkonsequenz.eisman/src/main/java/de/openkonsequenz/eisman/service/SynchronousMachineRestConsumerService.java32
-rw-r--r--dev/de.openkonsequenz.eisman/src/main/java/de/openkonsequenz/eisman/service/TimerService.java27
-rw-r--r--dev/de.openkonsequenz.eisman/src/main/java/de/openkonsequenz/eisman/service/util/JpaUtils.java352
-rw-r--r--dev/de.openkonsequenz.eisman/src/main/java/de/openkonsequenz/eisman/servlet/interceptor/SecureRequestHandlerInterceptor.java66
-rw-r--r--dev/de.openkonsequenz.eisman/src/main/resources/dozer-mapping.xml334
-rw-r--r--dev/de.openkonsequenz.eisman/src/main/resources/flyway-migration/V01/_00/OPENK_EISMAN_V01_00_001__init.sql308
-rw-r--r--dev/de.openkonsequenz.eisman/src/test/java/.gitignore0
-rw-r--r--dev/de.openkonsequenz.eisman/src/test/resources/.gitignore0
438 files changed, 38982 insertions, 0 deletions
diff --git a/dev/de.openkonsequenz.cim/.gitignore b/dev/de.openkonsequenz.cim/.gitignore
new file mode 100644
index 00000000..769de891
--- /dev/null
+++ b/dev/de.openkonsequenz.cim/.gitignore
@@ -0,0 +1,4 @@
+/target/
+/.classpath
+/.project
+/.settings/ \ No newline at end of file
diff --git a/dev/de.openkonsequenz.cim/pom.xml b/dev/de.openkonsequenz.cim/pom.xml
new file mode 100644
index 00000000..a58db437
--- /dev/null
+++ b/dev/de.openkonsequenz.cim/pom.xml
@@ -0,0 +1,44 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>de.openkonsequenz.cim</groupId>
+ <artifactId>cim</artifactId>
+ <version>0.0.1-SNAPSHOT</version>
+ <name>de.openkonsequenz.cim</name>
+
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
+ </properties>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>3.1</version>
+ <configuration>
+ <source>1.8</source>
+ <target>1.8</target>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+ <dependencies>
+
+ <!-- JSON -->
+ <dependency>
+ <groupId>com.fasterxml.jackson.core</groupId>
+ <artifactId>jackson-core</artifactId>
+ <version>2.8.0</version>
+ </dependency>
+
+ <dependency>
+ <groupId>com.fasterxml.jackson.core</groupId>
+ <artifactId>jackson-databind</artifactId>
+ <version>2.8.0</version>
+ </dependency>
+ </dependencies>
+
+</project> \ No newline at end of file
diff --git a/dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/common/ActivityRecord.java b/dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/common/ActivityRecord.java
new file mode 100644
index 00000000..aad11e17
--- /dev/null
+++ b/dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/common/ActivityRecord.java
@@ -0,0 +1,40 @@
+/**
+ ******************************************************************************
+ * Copyright © 2015-2017 BTC AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ ******************************************************************************
+ */
+package de.openkonsequenz.cim.common;
+
+import de.openkonsequenz.cim.core.IdentifiedObject;
+import de.openkonsequenz.cim.domain.AbsoluteDateTime;
+
+/**
+ * Records activity for an entity at a point in time; activity may be for an event
+ * that has already occurred or for a planned activity.
+ */
+public abstract class ActivityRecord extends IdentifiedObject
+{
+
+ /**
+ * Date and time this activity record has been created (different from the 'status.
+ * dateTime', which is the time of a status change of the associated object, if
+ * applicable).
+ */
+ private AbsoluteDateTime createdDateTime;
+
+ public AbsoluteDateTime getCreatedDateTime()
+ {
+ return createdDateTime;
+ }
+
+ public void setCreatedDateTime(final AbsoluteDateTime createdDateTime)
+ {
+ this.createdDateTime = createdDateTime;
+ }
+} \ No newline at end of file
diff --git a/dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/common/ElectronicAddress.java b/dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/common/ElectronicAddress.java
new file mode 100644
index 00000000..a3ec4f91
--- /dev/null
+++ b/dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/common/ElectronicAddress.java
@@ -0,0 +1,34 @@
+/**
+ ******************************************************************************
+ * Copyright © 2015-2017 BTC AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ ******************************************************************************
+ */
+package de.openkonsequenz.cim.common;
+
+/**
+ * Electronic address information.
+ */
+public class ElectronicAddress
+{
+
+ /**
+ * Email address.
+ */
+ private String email;
+
+ public String getEmail()
+ {
+ return email;
+ }
+
+ public void setEmail(final String email)
+ {
+ this.email = email;
+ }
+} \ No newline at end of file
diff --git a/dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/common/Location.java b/dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/common/Location.java
new file mode 100644
index 00000000..613edbc7
--- /dev/null
+++ b/dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/common/Location.java
@@ -0,0 +1,74 @@
+/**
+ ******************************************************************************
+ * Copyright © 2015-2017 BTC AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ ******************************************************************************
+ */
+package de.openkonsequenz.cim.common;
+
+import java.util.List;
+
+import de.openkonsequenz.cim.core.IdentifiedObject;
+
+/**
+ * The place, scene, or point of something where someone or something has been, is,
+ * and/or will be at a given moment in time. It may be:
+ * - Spatial location of an actual or planned structure, or a set of point-
+ * oriented structures (as a substation, structure, building, town, etc.) or
+ * diagram objects, which may be defined as a point or polygon, or,
+ * - Path of an underground or overhead conductor, or a linear diagram object.
+ */
+public class Location extends IdentifiedObject
+{
+
+ /**
+ * Electronic address.
+ */
+ private ElectronicAddress electronicAddress;
+
+ /**
+ * Main address of the location.
+ */
+ private StreetAddress mainAddress;
+
+ /**
+ * Sequence of position points describing this location, expressed in coordinate
+ * system 'Location.CoordinateSystem'.
+ */
+ private List<PositionPoint> positionPointList;
+
+ public ElectronicAddress getElectronicAddress()
+ {
+ return electronicAddress;
+ }
+
+ public void setElectronicAddress(final ElectronicAddress electronicAddress)
+ {
+ this.electronicAddress = electronicAddress;
+ }
+
+ public StreetAddress getMainAddress()
+ {
+ return mainAddress;
+ }
+
+ public void setMainAddress(final StreetAddress mainAddress)
+ {
+ this.mainAddress = mainAddress;
+ }
+
+ public List<PositionPoint> getPositionPointList()
+ {
+ return positionPointList;
+ }
+
+ public void setPositionPointList(final List<PositionPoint> positionPointList)
+ {
+ this.positionPointList = positionPointList;
+ }
+} \ No newline at end of file
diff --git a/dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/common/PositionPoint.java b/dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/common/PositionPoint.java
new file mode 100644
index 00000000..2c6fd552
--- /dev/null
+++ b/dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/common/PositionPoint.java
@@ -0,0 +1,82 @@
+/**
+ ******************************************************************************
+ * Copyright © 2015-2017 BTC AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ ******************************************************************************
+ */
+package de.openkonsequenz.cim.common;
+
+/**
+ * Set of spatial coordinates that determine a point. A sequence of PositionPoints
+ * can be used to describe:
+ * - physical location of non-point oriented objects like cables or lines, or
+ * - area of an object like a substation, a geographical zone or a diagram object.
+ */
+public class PositionPoint
+{
+
+ /**
+ * Zero-relative sequence number of this point within a series of points.
+ */
+ private Integer sequenceNumber;
+
+ /**
+ * X axis position.
+ */
+ private String xPosition;
+
+ /**
+ * Y axis position.
+ */
+ private String yPosition;
+
+ /**
+ * (if applicable) Z axis position.
+ */
+ private String zPosition;
+
+ public Integer getSequenceNumber()
+ {
+ return sequenceNumber;
+ }
+
+ public void setSequenceNumber(final Integer sequenceNumber)
+ {
+ this.sequenceNumber = sequenceNumber;
+ }
+
+ public String getxPosition()
+ {
+ return xPosition;
+ }
+
+ public void setxPosition(final String xPosition)
+ {
+ this.xPosition = xPosition;
+ }
+
+ public String getyPosition()
+ {
+ return yPosition;
+ }
+
+ public void setyPosition(final String yPosition)
+ {
+ this.yPosition = yPosition;
+ }
+
+ public String getzPosition()
+ {
+ return zPosition;
+ }
+
+ public void setzPosition(final String zPosition)
+ {
+ this.zPosition = zPosition;
+ }
+} \ No newline at end of file
diff --git a/dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/common/StreetAddress.java b/dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/common/StreetAddress.java
new file mode 100644
index 00000000..19f8e56b
--- /dev/null
+++ b/dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/common/StreetAddress.java
@@ -0,0 +1,65 @@
+/**
+ ******************************************************************************
+ * Copyright © 2015-2017 BTC AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ ******************************************************************************
+ */
+package de.openkonsequenz.cim.common;
+
+/**
+ * General purpose street address information.
+ */
+public class StreetAddress
+{
+
+ /**
+ * Street detail.
+ */
+ private StreetDetail streetDetail;
+
+ /**
+ * Postal code for the address.
+ * (Postleitzahl)
+ */
+ private String postalCode;
+
+ /**
+ * Town detail.
+ */
+ private TownDetail townDetail;
+
+ public StreetDetail getStreetDetail()
+ {
+ return streetDetail;
+ }
+
+ public void setStreetDetail(final StreetDetail streetDetail)
+ {
+ this.streetDetail = streetDetail;
+ }
+
+ public String getPostalCode()
+ {
+ return postalCode;
+ }
+
+ public void setPostalCode(final String postalCode)
+ {
+ this.postalCode = postalCode;
+ }
+
+ public TownDetail getTownDetail()
+ {
+ return townDetail;
+ }
+
+ public void setTownDetail(final TownDetail townDetail)
+ {
+ this.townDetail = townDetail;
+ }
+} \ No newline at end of file
diff --git a/dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/common/StreetDetail.java b/dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/common/StreetDetail.java
new file mode 100644
index 00000000..0121dea3
--- /dev/null
+++ b/dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/common/StreetDetail.java
@@ -0,0 +1,48 @@
+/**
+ ******************************************************************************
+ * Copyright © 2015-2017 BTC AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ ******************************************************************************
+ */
+package de.openkonsequenz.cim.common;
+
+/**
+ * Street details, in the context of address.
+ */
+public class StreetDetail
+{
+
+ /**
+ * Name of the street.
+ */
+ private String name;
+ /**
+ * Designator of the specific location on the street.
+ */
+ private String number;
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public void setName(final String name)
+ {
+ this.name = name;
+ }
+
+ public String getNumber()
+ {
+ return number;
+ }
+
+ public void setNumber(final String number)
+ {
+ this.number = number;
+ }
+} \ No newline at end of file
diff --git a/dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/common/TownDetail.java b/dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/common/TownDetail.java
new file mode 100644
index 00000000..f2e15b9e
--- /dev/null
+++ b/dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/common/TownDetail.java
@@ -0,0 +1,47 @@
+/**
+ ******************************************************************************
+ * Copyright © 2015-2017 BTC AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ ******************************************************************************
+ */
+package de.openkonsequenz.cim.common;
+
+/**
+ * Town details, in the context of address.
+ */
+public class TownDetail
+{
+ /**
+ * Name of the country.
+ */
+ private String country;
+ /**
+ * Town name.
+ */
+ private String name;
+
+ public String getCountry()
+ {
+ return country;
+ }
+
+ public void setCountry(final String country)
+ {
+ this.country = country;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public void setName(final String name)
+ {
+ this.name = name;
+ }
+} \ No newline at end of file
diff --git a/dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/core/AcDcTerminal.java b/dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/core/AcDcTerminal.java
new file mode 100644
index 00000000..e66c1609
--- /dev/null
+++ b/dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/core/AcDcTerminal.java
@@ -0,0 +1,37 @@
+/**
+ ******************************************************************************
+ * Copyright © 2015-2017 BTC AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ ******************************************************************************
+ */
+package de.openkonsequenz.cim.core;
+
+/**
+ * An electrical connection point (AC or DC) to a piece of conducting equipment.
+ * Terminals are connected at physical connection points called connectivity nodes.
+ */
+public class AcDcTerminal extends IdentifiedObject {
+
+ /**
+ * The connected status is related to a bus-branch model and the topological node
+ * to terminal relation. True implies the terminal is connected to the related
+ * topological node and false implies it is not.
+ * In a bus-branch model, the connected status is used to tell if equipment is
+ * disconnected without having to change the connectivity described by the
+ * topological node to terminal relation. A valid case is that conducting
+ * equipment can be connected in one end and open in the other. In particular for
+ * an AC line segment, where the reactive line charging can be significant, this
+ * is a relevant case.
+ */
+ private Boolean connected;
+
+ public Boolean isConnected() {
+
+ return connected;
+ }
+} \ No newline at end of file
diff --git a/dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/core/ConductingEquipment.java b/dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/core/ConductingEquipment.java
new file mode 100644
index 00000000..afe1fe32
--- /dev/null
+++ b/dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/core/ConductingEquipment.java
@@ -0,0 +1,30 @@
+/**
+ ******************************************************************************
+ * Copyright © 2015-2017 BTC AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ ******************************************************************************
+ */
+package de.openkonsequenz.cim.core;
+
+import java.util.List;
+
+public class ConductingEquipment extends Equipment
+{
+
+ private List<Terminal> terminalList;
+
+ public List<Terminal> getTerminalList()
+ {
+ return terminalList;
+ }
+
+ public void setTerminalList(final List<Terminal> terminalList)
+ {
+ this.terminalList = terminalList;
+ }
+}
diff --git a/dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/core/ConnectivityNode.java b/dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/core/ConnectivityNode.java
new file mode 100644
index 00000000..9d68cbca
--- /dev/null
+++ b/dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/core/ConnectivityNode.java
@@ -0,0 +1,35 @@
+/**
+ ******************************************************************************
+ * Copyright © 2015-2017 BTC AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ ******************************************************************************
+ */
+package de.openkonsequenz.cim.core;
+
+import java.util.List;
+
+/**
+ * Connectivity nodes are points where terminals of AC conducting equipment are
+ * connected together with zero impedance.
+ */
+public class ConnectivityNode extends IdentifiedObject
+{
+
+ private List<Terminal> terminalList;
+
+ public List<Terminal> getTerminalList()
+ {
+ return terminalList;
+ }
+
+ public void setTerminalList(final List<Terminal> terminalList)
+ {
+ this.terminalList = terminalList;
+ }
+
+} \ No newline at end of file
diff --git a/dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/core/ConnectivityNodeContainer.java b/dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/core/ConnectivityNodeContainer.java
new file mode 100644
index 00000000..1a88e8eb
--- /dev/null
+++ b/dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/core/ConnectivityNodeContainer.java
@@ -0,0 +1,34 @@
+/**
+ ******************************************************************************
+ * Copyright © 2015-2017 BTC AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ ******************************************************************************
+ */
+package de.openkonsequenz.cim.core;
+
+import java.util.List;
+
+/**
+ * A base class for all objects that may contain ConnectivityNodes or
+ * TopologicalNodes.
+ */
+public class ConnectivityNodeContainer extends PowerSystemResource
+{
+
+ private List<ConnectivityNode> connectivityNodeList;
+
+ public List<ConnectivityNode> getConnectivityNodeList()
+ {
+ return connectivityNodeList;
+ }
+
+ public void setConnectivityNodeList(final List<ConnectivityNode> connectivityNodeList)
+ {
+ this.connectivityNodeList = connectivityNodeList;
+ }
+} \ No newline at end of file
diff --git a/dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/core/Equipment.java b/dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/core/Equipment.java
new file mode 100644
index 00000000..077a1424
--- /dev/null
+++ b/dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/core/Equipment.java
@@ -0,0 +1,44 @@
+/**
+ ******************************************************************************
+ * Copyright © 2015-2017 BTC AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ ******************************************************************************
+ */
+package de.openkonsequenz.cim.core;
+
+import com.fasterxml.jackson.annotation.JsonTypeInfo;
+
+@JsonTypeInfo(use = JsonTypeInfo.Id.CLASS, include = JsonTypeInfo.As.PROPERTY, property = "@classname")
+public abstract class Equipment extends PowerSystemResource
+{
+
+ private String oid;
+
+ private String normallyInService;
+
+ public String getOid()
+ {
+ return oid;
+ }
+
+ public void setOid(final String oid)
+ {
+ this.oid = oid;
+ }
+
+ public String getNormallyInService()
+ {
+ return normallyInService;
+ }
+
+ public void setNormallyInService(final String normallyInService)
+ {
+ this.normallyInService = normallyInService;
+ }
+
+}
diff --git a/dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/core/EquipmentContainer.java b/dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/core/EquipmentContainer.java
new file mode 100644
index 00000000..b8c0b01a
--- /dev/null
+++ b/dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/core/EquipmentContainer.java
@@ -0,0 +1,70 @@
+/**
+ ******************************************************************************
+ * Copyright © 2015-2017 BTC AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ ******************************************************************************
+ */
+package de.openkonsequenz.cim.core;
+
+import java.sql.Timestamp;
+import java.util.List;
+
+/**
+ * A modeling construct to provide a root class for containing equipment.
+ */
+public class EquipmentContainer extends ConnectivityNodeContainer
+{
+
+ private String oid;
+
+ private List<Equipment> equipmentList;
+
+ private Timestamp validFrom;
+
+ private Timestamp validTo;
+
+ public String getOid()
+ {
+ return oid;
+ }
+
+ public void setOid(final String oid)
+ {
+ this.oid = oid;
+ }
+
+ public List<Equipment> getEquipmentList()
+ {
+ return equipmentList;
+ }
+
+ public void setEquipmentList(final List<Equipment> equipmentList)
+ {
+ this.equipmentList = equipmentList;
+ }
+
+ public Timestamp getValidFrom()
+ {
+ return validFrom;
+ }
+
+ public void setValidFrom(final Timestamp validFrom)
+ {
+ this.validFrom = validFrom;
+ }
+
+ public Timestamp getValidTo()
+ {
+ return validTo;
+ }
+
+ public void setValidTo(final Timestamp validTo)
+ {
+ this.validTo = validTo;
+ }
+}
diff --git a/dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/core/GeographicalRegion.java b/dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/core/GeographicalRegion.java
new file mode 100644
index 00000000..ec2b7f6c
--- /dev/null
+++ b/dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/core/GeographicalRegion.java
@@ -0,0 +1,40 @@
+/**
+ ******************************************************************************
+ * Copyright © 2015-2017 BTC AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ ******************************************************************************
+ */
+package de.openkonsequenz.cim.core;
+
+import java.util.List;
+
+/**
+ * A geographical region of a power system network model.
+ * All SubGeographicRegions of a DSO.
+ * <p/>
+ * Gesamtnetzgebiet.
+ */
+public class GeographicalRegion extends IdentifiedObject
+{
+
+ /**
+ * All sub-geograhpical regions within this geographical region.
+ */
+ private List<SubGeographicalRegion> subGeographicalRegionList;
+
+ public List<SubGeographicalRegion> getSubGeographicalRegionList()
+ {
+ return subGeographicalRegionList;
+ }
+
+ public void setSubGeographicalRegionList(final List<SubGeographicalRegion> subGeographicalRegionList)
+ {
+ this.subGeographicalRegionList = subGeographicalRegionList;
+ }
+
+}
diff --git a/dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/core/IdentifiedObject.java b/dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/core/IdentifiedObject.java
new file mode 100644
index 00000000..5a212a76
--- /dev/null
+++ b/dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/core/IdentifiedObject.java
@@ -0,0 +1,40 @@
+/**
+ ******************************************************************************
+ * Copyright © 2015-2017 BTC AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ ******************************************************************************
+ */
+package de.openkonsequenz.cim.core;
+
+public class IdentifiedObject
+{
+
+ private String name;
+
+ private String mRid;
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public void setName(final String name)
+ {
+ this.name = name;
+ }
+
+ public String getmRid()
+ {
+ return mRid;
+ }
+
+ public void setmRid(final String mRid)
+ {
+ this.mRid = mRid;
+ }
+}
diff --git a/dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/core/OperatingParticipant.java b/dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/core/OperatingParticipant.java
new file mode 100644
index 00000000..dc6f5e70
--- /dev/null
+++ b/dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/core/OperatingParticipant.java
@@ -0,0 +1,23 @@
+/**
+ ******************************************************************************
+ * Copyright © 2015-2017 BTC AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ ******************************************************************************
+ */
+package de.openkonsequenz.cim.core;
+
+/**
+ * An operator of multiple power system resource objects. Note multple operating
+ * participants may operate the same power system resource object. This can be
+ * used for modeling jointly owned units where each owner operates as a
+ * contractual share.
+ */
+public class OperatingParticipant extends IdentifiedObject
+{
+
+} \ No newline at end of file
diff --git a/dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/core/OperatingShare.java b/dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/core/OperatingShare.java
new file mode 100644
index 00000000..6c404fe6
--- /dev/null
+++ b/dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/core/OperatingShare.java
@@ -0,0 +1,55 @@
+/**
+ ******************************************************************************
+ * Copyright © 2015-2017 BTC AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ ******************************************************************************
+ */
+package de.openkonsequenz.cim.core;
+
+import de.openkonsequenz.cim.domain.PerCent;
+
+/**
+ * Specifies the operations contract relationship between a power system resource
+ * and a contract participant.
+ */
+public class OperatingShare
+{
+
+ /**
+ * Percentage operational ownership between the pair (power system resource and
+ * operatging participant) associated with this share. The total percentage
+ * ownership for a power system resource should add to 100%.
+ */
+ private PerCent percentage;
+
+ /**
+ * The operating participant having this share with the associated power system
+ * resource.
+ */
+ private OperatingParticipant operatingParticipant;
+
+ public PerCent getPercentage()
+ {
+ return percentage;
+ }
+
+ public void setPercentage(final PerCent percentage)
+ {
+ this.percentage = percentage;
+ }
+
+ public OperatingParticipant getOperatingParticipant()
+ {
+ return operatingParticipant;
+ }
+
+ public void setOperatingParticipant(final OperatingParticipant operatingParticipant)
+ {
+ this.operatingParticipant = operatingParticipant;
+ }
+} \ No newline at end of file
diff --git a/dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/core/PowerSystemResource.java b/dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/core/PowerSystemResource.java
new file mode 100644
index 00000000..2bf5b737
--- /dev/null
+++ b/dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/core/PowerSystemResource.java
@@ -0,0 +1,70 @@
+/**
+ ******************************************************************************
+ * Copyright © 2015-2017 BTC AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ ******************************************************************************
+ */
+package de.openkonsequenz.cim.core;
+
+import java.util.List;
+
+import de.openkonsequenz.cim.common.Location;
+import de.openkonsequenz.cim.informative.infoperations.PsrEvent;
+import de.openkonsequenz.cim.meas.Measurement;
+
+public class PowerSystemResource extends IdentifiedObject
+{
+
+ private List<PsrEvent> psrEventList;
+
+ private List<OperatingShare> operatingShareList;
+
+ private List<Measurement> measurementList;
+
+ private Location location;
+
+ public List<PsrEvent> getPsrEventList()
+ {
+ return psrEventList;
+ }
+
+ public void setPsrEventList(final List<PsrEvent> psrEventList)
+ {
+ this.psrEventList = psrEventList;
+ }
+
+ public List<OperatingShare> getOperatingShareList()
+ {
+ return operatingShareList;
+ }
+
+ public void setOperatingShareList(final List<OperatingShare> operatingShareList)
+ {
+ this.operatingShareList = operatingShareList;
+ }
+
+ public List<Measurement> getMeasurementList()
+ {
+ return measurementList;
+ }
+
+ public void setMeasurementList(final List<Measurement> measurementList)
+ {
+ this.measurementList = measurementList;
+ }
+
+ public Location getLocation()
+ {
+ return location;
+ }
+
+ public void setLocation(final Location location)
+ {
+ this.location = location;
+ }
+}
diff --git a/dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/core/SubGeographicalRegion.java b/dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/core/SubGeographicalRegion.java
new file mode 100644
index 00000000..c90ead17
--- /dev/null
+++ b/dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/core/SubGeographicalRegion.java
@@ -0,0 +1,47 @@
+/**
+ ******************************************************************************
+ * Copyright © 2015-2017 BTC AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ ******************************************************************************
+ */
+package de.openkonsequenz.cim.core;
+
+import java.util.List;
+
+/**
+ * A subset of a geographical region of a power system network model.
+ * <p/>
+ * Netzgebiet
+ */
+public class SubGeographicalRegion extends IdentifiedObject
+{
+
+ private String oid;
+
+ private List<Substation> substationList;
+
+ public String getOid()
+ {
+ return oid;
+ }
+
+ public void setOid(final String oid)
+ {
+ this.oid = oid;
+ }
+
+ public List<Substation> getSubstationList()
+ {
+ return substationList;
+ }
+
+ public void setSubstationList(final List<Substation> substationList)
+ {
+ this.substationList = substationList;
+ }
+}
diff --git a/dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/core/Substation.java b/dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/core/Substation.java
new file mode 100644
index 00000000..75c288bf
--- /dev/null
+++ b/dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/core/Substation.java
@@ -0,0 +1,38 @@
+/**
+ ******************************************************************************
+ * Copyright © 2015-2017 BTC AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ ******************************************************************************
+ */
+package de.openkonsequenz.cim.core;
+
+import java.util.List;
+
+/**
+ * A collection of equipment for purposes other than generation or utilization,
+ * through which electric energy in bulk is passed for the purposes of switching
+ * or modifying its characteristics.
+ */
+public class Substation extends EquipmentContainer
+{
+
+ /**
+ * The association is used in the naming hierarchy.
+ */
+ private List<VoltageLevel> voltageLevelList;
+
+ public List<VoltageLevel> getVoltageLevelList()
+ {
+ return voltageLevelList;
+ }
+
+ public void setVoltageLevelList(final List<VoltageLevel> voltageLevelList)
+ {
+ this.voltageLevelList = voltageLevelList;
+ }
+} \ No newline at end of file
diff --git a/dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/core/Terminal.java b/dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/core/Terminal.java
new file mode 100644
index 00000000..fe115962
--- /dev/null
+++ b/dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/core/Terminal.java
@@ -0,0 +1,21 @@
+/**
+ ******************************************************************************
+ * Copyright © 2015-2017 BTC AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ ******************************************************************************
+ */
+package de.openkonsequenz.cim.core;
+
+/**
+ * An AC electrical connection point to a piece of conducting equipment. Terminals
+ * are connected at physical connection points called connectivity nodes.
+ */
+public class Terminal extends AcDcTerminal
+{
+
+} \ No newline at end of file
diff --git a/dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/core/VoltageLevel.java b/dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/core/VoltageLevel.java
new file mode 100644
index 00000000..6fb68758
--- /dev/null
+++ b/dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/core/VoltageLevel.java
@@ -0,0 +1,38 @@
+/**
+ ******************************************************************************
+ * Copyright © 2015-2017 BTC AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ ******************************************************************************
+ */
+package de.openkonsequenz.cim.core;
+
+import de.openkonsequenz.cim.domain.Voltage;
+
+/**
+ * A collection of equipment at one common system voltage forming a switchgear.
+ * The equipment typically consist of breakers, busbars, instrumentation, control,
+ * regulation and protection devices as well as assemblies of all these.
+ */
+public class VoltageLevel extends EquipmentContainer
+{
+
+ /**
+ * The bus bar's high voltage limit
+ */
+ private Voltage highVoltageLimit;
+
+ public Voltage getHighVoltageLimit()
+ {
+ return highVoltageLimit;
+ }
+
+ public void setHighVoltageLimit(final Voltage highVoltageLimit)
+ {
+ this.highVoltageLimit = highVoltageLimit;
+ }
+} \ No newline at end of file
diff --git a/dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/domain/AbsoluteDateTime.java b/dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/domain/AbsoluteDateTime.java
new file mode 100644
index 00000000..a0682f1c
--- /dev/null
+++ b/dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/domain/AbsoluteDateTime.java
@@ -0,0 +1,43 @@
+/**
+ ******************************************************************************
+ * Copyright © 2015-2017 BTC AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ ******************************************************************************
+ */
+package de.openkonsequenz.cim.domain;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+
+import java.sql.Timestamp;
+
+/**
+ * Date and time as "yyyy-mm-ddThh:mm:ss.sss", which conforms with ISO 8601. UTC
+ * time zone is specified as "yyyy-mm-ddThh:mm:ss.sssZ". A local timezone relative
+ * UTC is specified as "yyyy-mm-ddThh:mm:ss.sss-hh:mm".
+ * AbsoluteDateTime can be used both for calender time, e.g. 2007-02-07T10:30, and
+ * for relative time, e.g. 10:30.
+ */
+public class AbsoluteDateTime
+{
+
+ /**
+ * String representation of date and time, refer to description of the class.
+ */
+ @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "dd.MM.yyyy hh:mm:ss", timezone = "CET")
+ private Timestamp value;
+
+ public Timestamp getValue()
+ {
+ return value;
+ }
+
+ public void setValue(final Timestamp value)
+ {
+ this.value = value;
+ }
+} \ No newline at end of file
diff --git a/dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/domain/ActivePower.java b/dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/domain/ActivePower.java
new file mode 100644
index 00000000..988f6e6b
--- /dev/null
+++ b/dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/domain/ActivePower.java
@@ -0,0 +1,61 @@
+/**
+ ******************************************************************************
+ * Copyright © 2015-2017 BTC AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ ******************************************************************************
+ */
+package de.openkonsequenz.cim.domain;
+
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+
+import de.openkonsequenz.cim.util.BigDecimalDeserializer;
+
+/**
+ * Product of RMS value of the voltage and the RMS value of the in-phase component
+ * of the current
+ */
+public class ActivePower
+{
+
+ @JsonDeserialize(using = BigDecimalDeserializer.class)
+ private String value;
+
+ private UnitMultiplier multiplier;
+
+ private UnitSymbol unit;
+
+ public String getValue()
+ {
+ return value;
+ }
+
+ public void setValue(final String value)
+ {
+ this.value = value;
+ }
+
+ public UnitMultiplier getMultiplier()
+ {
+ return multiplier;
+ }
+
+ public void setMultiplier(final UnitMultiplier multiplier)
+ {
+ this.multiplier = multiplier;
+ }
+
+ public UnitSymbol getUnit()
+ {
+ return unit;
+ }
+
+ public void setUnit(final UnitSymbol unit)
+ {
+ this.unit = unit;
+ }
+} \ No newline at end of file
diff --git a/dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/domain/CommunicationType.java b/dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/domain/CommunicationType.java
new file mode 100644
index 00000000..ee602c14
--- /dev/null
+++ b/dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/domain/CommunicationType.java
@@ -0,0 +1,39 @@
+/**
+ ******************************************************************************
+ * Copyright © 2015-2017 BTC AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ ******************************************************************************
+ */
+package de.openkonsequenz.cim.domain;
+
+import com.fasterxml.jackson.annotation.JsonValue;
+
+/**
+ * Communication Type EFR, FWT, TRA
+ * CIM extension by Jan Krueger, April 2015
+ */
+public enum CommunicationType
+{
+ EFR("EFR"),
+ FWT("FWT"),
+ TRA("TRA");
+
+ private final String value;
+
+ private CommunicationType(final String value)
+ {
+ this.value = value;
+ }
+
+ @JsonValue
+ public String value()
+ {
+ return this.value;
+ }
+
+}
diff --git a/dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/domain/PerCent.java b/dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/domain/PerCent.java
new file mode 100644
index 00000000..7f641afe
--- /dev/null
+++ b/dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/domain/PerCent.java
@@ -0,0 +1,38 @@
+/**
+ ******************************************************************************
+ * Copyright © 2015-2017 BTC AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ ******************************************************************************
+ */
+package de.openkonsequenz.cim.domain;
+
+/**
+ * Normally 0 - 100 on a defined base
+ */
+public class PerCent
+{
+
+ private static final UnitMultiplier MULTIPLIER = UnitMultiplier.NONE;
+
+ private static final UnitSymbol UNIT = UnitSymbol.NONE;
+
+ /**
+ * Normally 0 - 100 on a defined base
+ */
+ private String value;
+
+ public String getValue()
+ {
+ return value;
+ }
+
+ public void setValue(final String value)
+ {
+ this.value = value;
+ }
+} \ No newline at end of file
diff --git a/dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/domain/ReductionSetting.java b/dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/domain/ReductionSetting.java
new file mode 100644
index 00000000..e4ae110c
--- /dev/null
+++ b/dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/domain/ReductionSetting.java
@@ -0,0 +1,32 @@
+/**
+ ******************************************************************************
+ * Copyright © 2015-2017 BTC AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ ******************************************************************************
+ */
+package de.openkonsequenz.cim.domain;
+
+/**
+ * A Reduction Setting of a SynchronousMachine.
+ * CIM extension by Jan Krueger, April 2015
+ */
+public class ReductionSetting
+{
+
+ private PerCent setting;
+
+ public PerCent getSetting()
+ {
+ return setting;
+ }
+
+ public void setSetting(final PerCent setting)
+ {
+ this.setting = setting;
+ }
+}
diff --git a/dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/domain/UnitMultiplier.java b/dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/domain/UnitMultiplier.java
new file mode 100644
index 00000000..51197414
--- /dev/null
+++ b/dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/domain/UnitMultiplier.java
@@ -0,0 +1,75 @@
+/**
+ ******************************************************************************
+ * Copyright © 2015-2017 BTC AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ ******************************************************************************
+ */
+package de.openkonsequenz.cim.domain;
+
+import com.fasterxml.jackson.annotation.JsonValue;
+
+/**
+ * The unit multipliers defined for the CIM
+ */
+public enum UnitMultiplier
+{
+ /**
+ * Pico 10**-12
+ */
+ PICO("p"),
+ /**
+ * Nano 10**-9
+ */
+ NANO("n"),
+ /**
+ * Micro 10**-6
+ */
+ MICRO("micro"),
+ /**
+ * Milli 10**-3
+ */
+ MILLI("m"),
+ /**
+ * Centi 10**-2
+ */
+ CENTI("c"),
+ /**
+ * Deci 10**-1
+ */
+ DECI("d"),
+ /**
+ * Kilo 10**3
+ */
+ KILO("k"),
+ /**
+ * Mega 10**6
+ */
+ MEGA("M"),
+ /**
+ * Giga 10**9
+ */
+ GIGA("G"),
+ /**
+ * Tera 10**12
+ */
+ TERA("T"),
+ NONE("none");
+
+ private final String value;
+
+ private UnitMultiplier(final String value)
+ {
+ this.value = value;
+ }
+
+ @JsonValue
+ public String value()
+ {
+ return this.value;
+ }
+} \ No newline at end of file
diff --git a/dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/domain/UnitSymbol.java b/dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/domain/UnitSymbol.java
new file mode 100644
index 00000000..3658a5ef
--- /dev/null
+++ b/dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/domain/UnitSymbol.java
@@ -0,0 +1,51 @@
+/**
+ ******************************************************************************
+ * Copyright © 2015-2017 BTC AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ ******************************************************************************
+ */
+package de.openkonsequenz.cim.domain;
+
+import com.fasterxml.jackson.annotation.JsonValue;
+
+/**
+ * The units defiend for usage in the CIM
+ */
+public enum UnitSymbol
+{
+ /**
+ * Apparent power in volt ampere
+ */
+ VA("VA"),
+ /**
+ * Voltage in volt
+ */
+ V("V"),
+ /**
+ * Dimension less quantity, e.g. count, per unit, etc.
+ */
+ NONE("none"),
+ /**
+ * Active power in watt
+ */
+ W("W");
+
+ private final String value;
+
+ private UnitSymbol(final String value)
+ {
+ this.value = value;
+ }
+
+ @JsonValue
+ public String value()
+ {
+ return this.value;
+ }
+
+} \ No newline at end of file
diff --git a/dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/domain/Voltage.java b/dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/domain/Voltage.java
new file mode 100644
index 00000000..1f21eddb
--- /dev/null
+++ b/dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/domain/Voltage.java
@@ -0,0 +1,55 @@
+/**
+ ******************************************************************************
+ * Copyright © 2015-2017 BTC AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ ******************************************************************************
+ */
+package de.openkonsequenz.cim.domain;
+
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+
+import de.openkonsequenz.cim.util.BigDecimalDeserializer;
+
+/**
+ * Electrical voltage.
+ */
+public class Voltage
+{
+
+ @JsonDeserialize(using = BigDecimalDeserializer.class)
+ private String value;
+
+ private UnitMultiplier multiplier;
+
+ private final UnitSymbol unit = UnitSymbol.V;
+
+ public String getValue()
+ {
+ return value;
+ }
+
+ public void setValue(final String value)
+ {
+ this.value = value;
+ }
+
+ public UnitMultiplier getMultiplier()
+ {
+ return multiplier;
+ }
+
+ public void setMultiplier(final UnitMultiplier multiplier)
+ {
+ this.multiplier = multiplier;
+ }
+
+ public UnitSymbol getUnit()
+ {
+ return unit;
+ }
+} \ No newline at end of file
diff --git a/dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/informative/infoperations/PsrEvent.java b/dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/informative/infoperations/PsrEvent.java
new file mode 100644
index 00000000..8bf45632
--- /dev/null
+++ b/dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/informative/infoperations/PsrEvent.java
@@ -0,0 +1,36 @@
+/**
+ ******************************************************************************
+ * Copyright © 2015-2017 BTC AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ ******************************************************************************
+ */
+package de.openkonsequenz.cim.informative.infoperations;
+
+import de.openkonsequenz.cim.common.ActivityRecord;
+
+/**
+ * Event recording the change in operational status of a PowerSystemResource.
+ */
+public class PsrEvent extends ActivityRecord
+{
+
+ /**
+ * Kind of event.
+ */
+ private PsrEventKind psrEventKind;
+
+ public PsrEventKind getPsrEventKind()
+ {
+ return psrEventKind;
+ }
+
+ public void setPsrEventKind(final PsrEventKind psrEventKind)
+ {
+ this.psrEventKind = psrEventKind;
+ }
+} \ No newline at end of file
diff --git a/dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/informative/infoperations/PsrEventKind.java b/dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/informative/infoperations/PsrEventKind.java
new file mode 100644
index 00000000..27e9d7e2
--- /dev/null
+++ b/dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/informative/infoperations/PsrEventKind.java
@@ -0,0 +1,42 @@
+/**
+ ******************************************************************************
+ * Copyright © 2015-2017 BTC AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ ******************************************************************************
+ */
+package de.openkonsequenz.cim.informative.infoperations;
+
+import com.fasterxml.jackson.annotation.JsonValue;
+
+/**
+ * Kind of power system resource event.
+ */
+public enum PsrEventKind
+{
+ IN_SERVICE("inService"),
+ OUT_OF_SERVICE("outOfService"),
+ PENDING_ADD("pendingAdd"),
+ PENDING_REMOVE("pendingRemove"),
+ PENDING_REPLACE("pendingReplace"),
+ OTHER("other"),
+ UNKNOWN("unknown");
+
+ private final String value;
+
+ private PsrEventKind(final String value)
+ {
+ this.value = value;
+ }
+
+ @JsonValue
+ public String value()
+ {
+ return this.value;
+ }
+
+} \ No newline at end of file
diff --git a/dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/marketcommon/RegisteredResource.java b/dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/marketcommon/RegisteredResource.java
new file mode 100644
index 00000000..61f87a31
--- /dev/null
+++ b/dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/marketcommon/RegisteredResource.java
@@ -0,0 +1,24 @@
+/**
+ ******************************************************************************
+ * Copyright © 2015-2017 BTC AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ ******************************************************************************
+ */
+package de.openkonsequenz.cim.marketcommon;
+
+import de.openkonsequenz.cim.core.PowerSystemResource;
+
+/**
+ * A resource that is registered through the market participant registration
+ * system. Examples include generating unit, load, and non-physical generator or
+ * load.
+ */
+public class RegisteredResource extends PowerSystemResource
+{
+
+} \ No newline at end of file
diff --git a/dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/marketoperations/mktdomain/UnitType.java b/dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/marketoperations/mktdomain/UnitType.java
new file mode 100644
index 00000000..0dccdba6
--- /dev/null
+++ b/dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/marketoperations/mktdomain/UnitType.java
@@ -0,0 +1,67 @@
+/**
+ ******************************************************************************
+ * Copyright © 2015-2017 BTC AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ ******************************************************************************
+ */
+package de.openkonsequenz.cim.marketoperations.mktdomain;
+
+import com.fasterxml.jackson.annotation.JsonValue;
+
+/**
+ * Combined Cycle
+ * Gas Turbine
+ * Hydro Turbine
+ * Other
+ * Photovoltaic
+ * Hydro Pump-Turbine
+ * Reciprocating Engine
+ * Steam Turbine
+ * Synchronous Condenser
+ * Wind Turbine
+ */
+public enum UnitType {
+ /**
+ * Photovoltaic
+ */
+ PHOT("PHOT"),
+ /**
+ * Hydro Pump-Turbine
+ */
+ PTUR("PTUR"),
+ /**
+ * Wind Turbine
+ */
+ WIND("WIND"),
+ /**
+ * Hydro Turbine
+ */
+ HYDR("HYDR"),
+ /*
+ * Thermal Generating Unit (Blockheizkraftwert)
+ * CIM extension by Jan Krueger, April 2015
+ */
+ THER("THER"),
+ /**
+ * Biogas Thermal Generating Unit (Blockheizkraftwerk Biogas)
+ * CIM extension by Jan Krueger, April 2015
+ */
+ BIOG("BIOG");
+
+ private final String value;
+
+ private UnitType(final String value) {
+ this.value = value;
+ }
+
+ @JsonValue
+ public String value() {
+ return this.value;
+ }
+
+} \ No newline at end of file
diff --git a/dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/marketoperations/referencedata/RegisteredGenerator.java b/dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/marketoperations/referencedata/RegisteredGenerator.java
new file mode 100644
index 00000000..00737b4e
--- /dev/null
+++ b/dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/marketoperations/referencedata/RegisteredGenerator.java
@@ -0,0 +1,36 @@
+/**
+ ******************************************************************************
+ * Copyright © 2015-2017 BTC AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ ******************************************************************************
+ */
+package de.openkonsequenz.cim.marketoperations.referencedata;
+
+import de.openkonsequenz.cim.marketcommon.RegisteredResource;
+import de.openkonsequenz.cim.marketoperations.mktdomain.UnitType;
+
+/**
+ * Model of a generator that is registered to participate in the market
+ */
+public class RegisteredGenerator extends RegisteredResource {
+
+ /**
+ * Generating unit type: Combined Cycle, Gas Turbine, Hydro Turbine, Other,
+ * Photovoltaic, Hydro Pump-Turbine, Reciprocating Engine, Steam Turbine,
+ * Synchronous Condenser, Wind Turbine
+ */
+ private UnitType unitType;
+
+ public UnitType getUnitType() {
+ return unitType;
+ }
+
+ public void setUnitType(final UnitType unitType) {
+ this.unitType = unitType;
+ }
+} \ No newline at end of file
diff --git a/dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/meas/Analog.java b/dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/meas/Analog.java
new file mode 100644
index 00000000..601d4eb9
--- /dev/null
+++ b/dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/meas/Analog.java
@@ -0,0 +1,37 @@
+/**
+ ******************************************************************************
+ * Copyright © 2015-2017 BTC AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ ******************************************************************************
+ */
+package de.openkonsequenz.cim.meas;
+
+import java.util.List;
+
+/**
+ * Analog represents an analog Measurement.
+ */
+public class Analog extends Measurement
+{
+
+ /**
+ * The values connected to this measurement.
+ */
+ private List<AnalogValue> analogValueList;
+
+ public List<AnalogValue> getAnalogValueList()
+ {
+ return analogValueList;
+ }
+
+ public void setAnalogValueList(final List<AnalogValue> analogValueList)
+ {
+ this.analogValueList = analogValueList;
+ }
+
+} \ No newline at end of file
diff --git a/dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/meas/AnalogValue.java b/dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/meas/AnalogValue.java
new file mode 100644
index 00000000..73226366
--- /dev/null
+++ b/dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/meas/AnalogValue.java
@@ -0,0 +1,39 @@
+/**
+ ******************************************************************************
+ * Copyright © 2015-2017 BTC AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ ******************************************************************************
+ */
+package de.openkonsequenz.cim.meas;
+
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+
+import de.openkonsequenz.cim.util.BigDecimalDeserializer;
+
+/**
+ * AnalogValue represents an analog MeasurementValue.
+ */
+public class AnalogValue extends MeasurementValue
+{
+
+ /**
+ * The value to supervise.
+ */
+ @JsonDeserialize(using = BigDecimalDeserializer.class)
+ private String value;
+
+ public void setValue(final String value)
+ {
+ this.value = value;
+ }
+
+ public String getValue()
+ {
+ return value;
+ }
+} \ No newline at end of file
diff --git a/dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/meas/Measurement.java b/dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/meas/Measurement.java
new file mode 100644
index 00000000..08b6b7a9
--- /dev/null
+++ b/dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/meas/Measurement.java
@@ -0,0 +1,94 @@
+/**
+ ******************************************************************************
+ * Copyright © 2015-2017 BTC AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ ******************************************************************************
+ */
+package de.openkonsequenz.cim.meas;
+
+import com.fasterxml.jackson.annotation.JsonTypeInfo;
+
+import de.openkonsequenz.cim.core.IdentifiedObject;
+import de.openkonsequenz.cim.domain.UnitMultiplier;
+import de.openkonsequenz.cim.domain.UnitSymbol;
+
+/**
+ * A Measurement represents any measured, calculated or non-measured non-
+ * calculated quantity. Any piece of equipment may contain Measurements, e.g. a
+ * substation may have temperature measurements and door open indications, a
+ * transformer may have oil temperature and tank pressure measurements, a bay may
+ * contain a number of power flow measurements and a Breaker may contain a switch
+ * status measurement.
+ * The PSR - Measurement association is intended to capture this use of
+ * Measurement and is included in the naming hierarchy based on EquipmentContainer.
+ * The naming hierarchy typically has Measurements as leafs, e.g. Substation-
+ * VoltageLevel-Bay-Switch-Measurement.
+ * Some Measurements represent quantities related to a particular sensor location
+ * in the network, e.g. a voltage transformer (PT) at a busbar or a current
+ * transformer (CT) at the bar between a breaker and an isolator. The sensing
+ * position is not captured in the PSR - Measurement association. Instead it is
+ * captured by the Measurement - Terminal association that is used to define the
+ * sensing location in the network topology. The location is defined by the
+ * connection of the Terminal to ConductingEquipment.
+ * Two possible paths exist:
+ * 1) Measurement-Terminal- ConnectivityNode-Terminal-ConductingEquipment
+ * 2) Measurement-Terminal-ConductingEquipment
+ * Alternative 2 is the only allowed use.
+ * When the sensor location is needed both Measurement-PSR and Measurement-
+ * Terminal are used. The Measurement-Terminal association is never used alone.
+ */
+@JsonTypeInfo(use = JsonTypeInfo.Id.CLASS, include = JsonTypeInfo.As.PROPERTY, property = "@classname")
+public class Measurement extends IdentifiedObject
+{
+
+ /**
+ * Specifies the type of Measurement, e.g. IndoorTemperature, OutDoorTemperature,
+ * BusVoltage, GeneratorVoltage, LineFlow etc.
+ */
+ private String measurementType;
+
+ /**
+ * The unit multiplier of the measured quantity.
+ */
+ private UnitMultiplier unitMultiplier;
+
+ /**
+ * The unit of measure of the measured quantity.
+ */
+ private UnitSymbol unitSymbol;
+
+ public String getMeasurementType()
+ {
+ return measurementType;
+ }
+
+ public void setMeasurementType(final String measurementType)
+ {
+ this.measurementType = measurementType;
+ }
+
+ public UnitMultiplier getUnitMultiplier()
+ {
+ return unitMultiplier;
+ }
+
+ public void setUnitMultiplier(final UnitMultiplier unitMultiplier)
+ {
+ this.unitMultiplier = unitMultiplier;
+ }
+
+ public UnitSymbol getUnitSymbol()
+ {
+ return unitSymbol;
+ }
+
+ public void setUnitSymbol(final UnitSymbol unitSymbol)
+ {
+ this.unitSymbol = unitSymbol;
+ }
+} \ No newline at end of file
diff --git a/dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/meas/MeasurementValue.java b/dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/meas/MeasurementValue.java
new file mode 100644
index 00000000..393ea6d1
--- /dev/null
+++ b/dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/meas/MeasurementValue.java
@@ -0,0 +1,54 @@
+/**
+ ******************************************************************************
+ * Copyright © 2015-2017 BTC AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ ******************************************************************************
+ */
+package de.openkonsequenz.cim.meas;
+
+import de.openkonsequenz.cim.core.IdentifiedObject;
+import de.openkonsequenz.cim.domain.AbsoluteDateTime;
+
+/**
+ * The current state for a measurement. A state value is an instance of a
+ * measurement from a specific source. Measurements can be associated with many
+ * state values, each representing a different source for the measurement.
+ */
+public class MeasurementValue extends IdentifiedObject
+{
+
+ /**
+ * The time when the value was last updated
+ */
+ private AbsoluteDateTime timeStamp;
+
+ /**
+ * A MeasurementValue has a MeasurementValueQuality associated with it.
+ */
+ private MeasurementValueQuality measurementValueQuality;
+
+ public AbsoluteDateTime getTimeStamp()
+ {
+ return timeStamp;
+ }
+
+ public void setTimeStamp(final AbsoluteDateTime timeStamp)
+ {
+ this.timeStamp = timeStamp;
+ }
+
+ public MeasurementValueQuality getMeasurementValueQuality()
+ {
+ return measurementValueQuality;
+ }
+
+ public void setMeasurementValueQuality(final MeasurementValueQuality measurementValueQuality)
+ {
+ this.measurementValueQuality = measurementValueQuality;
+ }
+} \ No newline at end of file
diff --git a/dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/meas/MeasurementValueQuality.java b/dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/meas/MeasurementValueQuality.java
new file mode 100644
index 00000000..97af2aa6
--- /dev/null
+++ b/dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/meas/MeasurementValueQuality.java
@@ -0,0 +1,37 @@
+/**
+ ******************************************************************************
+ * Copyright © 2015-2017 BTC AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ ******************************************************************************
+ */
+package de.openkonsequenz.cim.meas;
+
+/**
+ * Measurement quality flags. Bits 0-10 are defined for substation automation in
+ * draft IEC 61850 part 7-3. Bits 11-15 are reserved for future expansion by that
+ * document. Bits 16-31 are reserved for EMS applications.
+ */
+public class MeasurementValueQuality
+{
+
+ /**
+ * This identifier indicates that a supervision function has detected an internal
+ * or external failure, e.g. communication failure.
+ */
+ private String failure;
+
+ public String getFailure()
+ {
+ return failure;
+ }
+
+ public void setFailure(final String failure)
+ {
+ this.failure = failure;
+ }
+}
diff --git a/dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/production/GeneratingUnit.java b/dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/production/GeneratingUnit.java
new file mode 100644
index 00000000..05e2c7b0
--- /dev/null
+++ b/dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/production/GeneratingUnit.java
@@ -0,0 +1,82 @@
+/**
+ ******************************************************************************
+ * Copyright © 2015-2017 BTC AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ ******************************************************************************
+ */
+package de.openkonsequenz.cim.production;
+
+import de.openkonsequenz.cim.core.Equipment;
+import de.openkonsequenz.cim.domain.ActivePower;
+import de.openkonsequenz.cim.marketoperations.referencedata.RegisteredGenerator;
+
+public class GeneratingUnit extends Equipment
+{
+
+ /**
+ * UnitSymbol in context of GeneratingUnit is W.
+ * Regelbare Leistung
+ */
+ private ActivePower highControlLimit;
+
+ /**
+ * UnitSymbol in context of GeneratingUnit is W.
+ * Installierte Leistung
+ */
+ private ActivePower maxOperatingP;
+
+ /**
+ * The source of controls for a generating unit.
+ */
+ private GeneratorControlSource generatorControlSource;
+
+ /**
+ * Kind of generator, wind, photovoltaic, wind turbine, ...
+ */
+ private RegisteredGenerator registeredGenerator;
+
+ public ActivePower getHighControlLimit()
+ {
+ return highControlLimit;
+ }
+
+ public void setHighControlLimit(final ActivePower highControlLimit)
+ {
+ this.highControlLimit = highControlLimit;
+ }
+
+ public ActivePower getMaxOperatingP()
+ {
+ return maxOperatingP;
+ }
+
+ public void setMaxOperatingP(final ActivePower maxOperatingP)
+ {
+ this.maxOperatingP = maxOperatingP;
+ }
+
+ public GeneratorControlSource getGeneratorControlSource()
+ {
+ return generatorControlSource;
+ }
+
+ public void setGeneratorControlSource(final GeneratorControlSource generatorControlSource)
+ {
+ this.generatorControlSource = generatorControlSource;
+ }
+
+ public RegisteredGenerator getRegisteredGenerator()
+ {
+ return registeredGenerator;
+ }
+
+ public void setRegisteredGenerator(final RegisteredGenerator registeredGenerator)
+ {
+ this.registeredGenerator = registeredGenerator;
+ }
+}
diff --git a/dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/production/GeneratorControlSource.java b/dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/production/GeneratorControlSource.java
new file mode 100644
index 00000000..a07a10a6
--- /dev/null
+++ b/dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/production/GeneratorControlSource.java
@@ -0,0 +1,55 @@
+/**
+ ******************************************************************************
+ * Copyright © 2015-2017 BTC AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ ******************************************************************************
+ */
+package de.openkonsequenz.cim.production;
+
+import com.fasterxml.jackson.annotation.JsonValue;
+
+/**
+ * The source of controls for a generating unit.
+ */
+public enum GeneratorControlSource
+{
+ /**
+ * Is Controlable by control center.
+ * CIM extension by Jan Krueger, April 2015
+ */
+ IS_CONTROLLABLE("isControllable"),
+ /**
+ * Not available.
+ */
+ UNAVAILABLE("unavailable"),
+ /**
+ * Off of automatic generation control (AGC).
+ */
+ OFF_AGC("offAGC"),
+ /**
+ * On automatic generation control (AGC).
+ */
+ ON_AGC("onAGC"),
+ /**
+ * Plant is controlling.
+ */
+ PLANT_CONTROL("plantControl");
+
+ private final String value;
+
+ private GeneratorControlSource(final String value)
+ {
+ this.value = value;
+ }
+
+ @JsonValue
+ public String value()
+ {
+ return this.value;
+ }
+} \ No newline at end of file
diff --git a/dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/util/BigDecimalDeserializer.java b/dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/util/BigDecimalDeserializer.java
new file mode 100644
index 00000000..02f9c656
--- /dev/null
+++ b/dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/util/BigDecimalDeserializer.java
@@ -0,0 +1,29 @@
+/**
+ ******************************************************************************
+ * Copyright © 2015-2017 BTC AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ ******************************************************************************
+ */
+package de.openkonsequenz.cim.util;
+
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.DeserializationContext;
+import com.fasterxml.jackson.databind.JsonDeserializer;
+
+import java.io.IOException;
+
+public class BigDecimalDeserializer extends JsonDeserializer<String>
+{
+
+ @Override
+ public String deserialize(final JsonParser jsonParser, final DeserializationContext deserializationContext) throws IOException, JsonProcessingException
+ {
+ return jsonParser.getText().replace(",", ".");
+ }
+}
diff --git a/dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/wires/AcLineSegment.java b/dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/wires/AcLineSegment.java
new file mode 100644
index 00000000..e7b0c10c
--- /dev/null
+++ b/dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/wires/AcLineSegment.java
@@ -0,0 +1,30 @@
+/**
+ ******************************************************************************
+ * Copyright © 2015-2017 BTC AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ ******************************************************************************
+ */
+package de.openkonsequenz.cim.wires;
+
+/**
+ * A wire or combination of wires, with consistent electrical characteristics, building a single
+ * electrical system, used to carry alternating current between points in the power system.
+ * For symmetrical, transposed 3ph lines, it is sufficient to use attributes of the line
+ * segment, which describe impedances and admittances for the entire length of the segment.
+ * Additionally impedances can be computed by using length and associated per length impedances.
+ * The BaseVoltage at the two ends of ACLineSegments in a Line shall have the same
+ * BaseVoltage.nominalVoltage. However, boundary lines may have slightly different
+ * BaseVoltage.nominalVoltages and variation is allowed. Larger voltage
+ * difference in general requires use of an equivalent branch.
+ * <p/>
+ * Kabel
+ */
+public class AcLineSegment extends Conductor
+{
+
+} \ No newline at end of file
diff --git a/dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/wires/BusbarSection.java b/dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/wires/BusbarSection.java
new file mode 100644
index 00000000..c798ad92
--- /dev/null
+++ b/dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/wires/BusbarSection.java
@@ -0,0 +1,26 @@
+/**
+ ******************************************************************************
+ * Copyright © 2015-2017 BTC AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ ******************************************************************************
+ */
+package de.openkonsequenz.cim.wires;
+
+/**
+ * A conductor, or group of conductors, with negligible impedance, that serve to
+ * connect other conducting equipment within a single substation.
+ * Voltage measurements are typically obtained from VoltageTransformers that are
+ * connected to busbar sections. A bus bar section may have many physical
+ * terminals but for analysis is modelled with exactly one logical terminal.
+ * <p/>
+ * Sammelschiene
+ */
+public class BusbarSection extends Connector
+{
+
+} \ No newline at end of file
diff --git a/dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/wires/Conductor.java b/dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/wires/Conductor.java
new file mode 100644
index 00000000..8a83e614
--- /dev/null
+++ b/dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/wires/Conductor.java
@@ -0,0 +1,24 @@
+/**
+ ******************************************************************************
+ * Copyright © 2015-2017 BTC AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ ******************************************************************************
+ */
+package de.openkonsequenz.cim.wires;
+
+import de.openkonsequenz.cim.core.ConductingEquipment;
+
+/**
+ * Combination of conducting material with consistent electrical characteristics,
+ * building a single electrical system, used to carry current between points in
+ * the power system.
+ */
+public class Conductor extends ConductingEquipment
+{
+
+} \ No newline at end of file
diff --git a/dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/wires/Connector.java b/dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/wires/Connector.java
new file mode 100644
index 00000000..5ebde4b2
--- /dev/null
+++ b/dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/wires/Connector.java
@@ -0,0 +1,22 @@
+/**
+ ******************************************************************************
+ * Copyright © 2015-2017 BTC AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ ******************************************************************************
+ */
+package de.openkonsequenz.cim.wires;
+
+import de.openkonsequenz.cim.core.ConductingEquipment;
+
+/**
+ * A conductor, or group of conductors, with negligible impedance, that serve to
+ * connect other conducting equipment within a single substation and are modelled
+ * with a single logical terminal.
+ */
+public class Connector extends ConductingEquipment {
+} \ No newline at end of file
diff --git a/dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/wires/PowerTransformer.java b/dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/wires/PowerTransformer.java
new file mode 100644
index 00000000..c297760b
--- /dev/null
+++ b/dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/wires/PowerTransformer.java
@@ -0,0 +1,19 @@
+/**
+ ******************************************************************************
+ * Copyright © 2015-2017 BTC AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ ******************************************************************************
+ */
+package de.openkonsequenz.cim.wires;
+
+import de.openkonsequenz.cim.core.ConductingEquipment;
+
+public class PowerTransformer extends ConductingEquipment
+{
+
+}
diff --git a/dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/wires/RegulatingCondEq.java b/dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/wires/RegulatingCondEq.java
new file mode 100644
index 00000000..c36cc745
--- /dev/null
+++ b/dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/wires/RegulatingCondEq.java
@@ -0,0 +1,34 @@
+/**
+ ******************************************************************************
+ * Copyright © 2015-2017 BTC AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ ******************************************************************************
+ */
+package de.openkonsequenz.cim.wires;
+
+import de.openkonsequenz.cim.core.ConductingEquipment;
+
+public class RegulatingCondEq extends ConductingEquipment
+{
+
+ /**
+ * Specifies the regulation status of the equipment. True is regulating, false is not regulating.
+ */
+ private String controlEnabled;
+
+ public String getControlEnabled()
+ {
+ return controlEnabled;
+ }
+
+ public void setControlEnabled(final String controlEnabled)
+ {
+ this.controlEnabled = controlEnabled;
+ }
+
+}
diff --git a/dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/wires/RotatingMachine.java b/dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/wires/RotatingMachine.java
new file mode 100644
index 00000000..34ab4001
--- /dev/null
+++ b/dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/wires/RotatingMachine.java
@@ -0,0 +1,34 @@
+/**
+ ******************************************************************************
+ * Copyright © 2015-2017 BTC AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ ******************************************************************************
+ */
+package de.openkonsequenz.cim.wires;
+
+import de.openkonsequenz.cim.production.GeneratingUnit;
+
+/**
+ * A rotating machine which may be used as a generator or motor.
+ */
+public class RotatingMachine extends RegulatingCondEq
+{
+
+ private GeneratingUnit generatingUnit;
+
+ public GeneratingUnit getGeneratingUnit()
+ {
+ return generatingUnit;
+ }
+
+ public void setGeneratingUnit(final GeneratingUnit generatingUnit)
+ {
+ this.generatingUnit = generatingUnit;
+ }
+
+} \ No newline at end of file
diff --git a/dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/wires/Switch.java b/dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/wires/Switch.java
new file mode 100644
index 00000000..1c5e78ee
--- /dev/null
+++ b/dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/wires/Switch.java
@@ -0,0 +1,30 @@
+/**
+ ******************************************************************************
+ * Copyright © 2015-2017 BTC AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ ******************************************************************************
+ */
+package de.openkonsequenz.cim.wires;
+
+import de.openkonsequenz.cim.core.ConductingEquipment;
+
+public class Switch extends ConductingEquipment
+{
+
+ private String open;
+
+ public String getOpen()
+ {
+ return open;
+ }
+
+ public void setOpen(final String open)
+ {
+ this.open = open;
+ }
+}
diff --git a/dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/wires/SynchronousMachine.java b/dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/wires/SynchronousMachine.java
new file mode 100644
index 00000000..73e1d7f4
--- /dev/null
+++ b/dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/wires/SynchronousMachine.java
@@ -0,0 +1,168 @@
+/**
+ ******************************************************************************
+ * Copyright © 2015-2017 BTC AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ ******************************************************************************
+ */
+package de.openkonsequenz.cim.wires;
+
+import java.util.List;
+
+import de.openkonsequenz.cim.domain.CommunicationType;
+import de.openkonsequenz.cim.domain.ReductionSetting;
+import de.openkonsequenz.cim.domain.Voltage;
+
+public class SynchronousMachine extends RotatingMachine
+{
+
+ /**
+ * Maximum voltage limit for the unit.
+ */
+ private Voltage maxU;
+
+ /**
+ * Modes that this synchronous machine can operate in.
+ */
+ private SynchronousMachineKind synchronousMachineKind;
+
+ /**
+ * The feed-in ranking of a generator (SynchronousMachine) as
+ * described by BDEW VKU
+ * BDEW/VKU-Praxis-Leitfaden für unterstützende Maßnahmen von Stromnetzbetreibern
+ * 31.10.2014
+ * CIM extension by Jan Krueger, April 2015
+ */
+ private String feedInRanking;
+
+ /**
+ * The feed-in priority of a generator (SynchronousMachine)
+ * 1 - high priority, ... 5 - low priority
+ * CIM extension by Jan Krueger, April 2015
+ */
+ private String feedInPriority;
+
+ /**
+ * Communication Type EFR, FWT, TRA
+ * CIM extension by Jan Krueger, April 2015
+ */
+ private CommunicationType communicationType;
+
+ /**
+ * Communication Group
+ * CIM extension by Jan Krueger, April 2015
+ */
+ private String communicationGroup;
+
+ /**
+ * Referenced SynchronousMachine
+ * CIM extension by Jan Krueger, April 2015
+ */
+ private SynchronousMachine referencedSynchronousMachine;
+
+ /**
+ * Referenced SynchronousMachine
+ * CIM extension by Jan Krueger, April 2015
+ */
+ private String referencedSynchronousMachineMrid;
+
+ /**
+ * All reduction settings of a Synchronous Machine, e.g. 30%, 60% and 100%
+ * CIM extension by Jan Krueger, April 2015
+ */
+ private List<ReductionSetting> reductionSettingList;
+
+ public Voltage getMaxU()
+ {
+ return maxU;
+ }
+
+ public void setMaxU(final Voltage maxU)
+ {
+ this.maxU = maxU;
+ }
+
+ public SynchronousMachineKind getSynchronousMachineKind()
+ {
+ return synchronousMachineKind;
+ }
+
+ public void setSynchronousMachineKind(final SynchronousMachineKind synchronousMachineKind)
+ {
+ this.synchronousMachineKind = synchronousMachineKind;
+ }
+
+ public String getFeedInRanking()
+ {
+ return feedInRanking;
+ }
+
+ public void setFeedInRanking(final String feedInRanking)
+ {
+ this.feedInRanking = feedInRanking;
+ }
+
+ public String getFeedInPriority()
+ {
+ return feedInPriority;
+ }
+
+ public void setFeedInPriority(final String feedInPriority)
+ {
+ this.feedInPriority = feedInPriority;
+ }
+
+ public CommunicationType getCommunicationType()
+ {
+ return communicationType;
+ }
+
+ public void setCommunicationType(final CommunicationType communicationType)
+ {
+ this.communicationType = communicationType;
+ }
+
+ public String getCommunicationGroup()
+ {
+ return communicationGroup;
+ }
+
+ public void setCommunicationGroup(final String communicationGroup)
+ {
+ this.communicationGroup = communicationGroup;
+ }
+
+ public SynchronousMachine getReferencedSynchronousMachine()
+ {
+ return referencedSynchronousMachine;
+ }
+
+ public void setReferencedSynchronousMachine(final SynchronousMachine referencedSynchronousMachine)
+ {
+ this.referencedSynchronousMachine = referencedSynchronousMachine;
+ }
+
+ public String getReferencedSynchronousMachineMrid()
+ {
+ return referencedSynchronousMachineMrid;
+ }
+
+ public void setReferencedSynchronousMachineMrid(final String referencedSynchronousMachineMrid)
+ {
+ this.referencedSynchronousMachineMrid = referencedSynchronousMachineMrid;
+ }
+
+ public List<ReductionSetting> getReductionSettingList()
+ {
+ return reductionSettingList;
+ }
+
+ public void setReductionSettingList(final List<ReductionSetting> reductionSettingList)
+ {
+ this.reductionSettingList = reductionSettingList;
+ }
+}
diff --git a/dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/wires/SynchronousMachineKind.java b/dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/wires/SynchronousMachineKind.java
new file mode 100644
index 00000000..d5357d94
--- /dev/null
+++ b/dev/de.openkonsequenz.cim/src/main/java/de/openkonsequenz/cim/wires/SynchronousMachineKind.java
@@ -0,0 +1,35 @@
+/**
+ ******************************************************************************
+ * Copyright © 2015-2017 BTC AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ ******************************************************************************
+ */
+package de.openkonsequenz.cim.wires;
+
+import com.fasterxml.jackson.annotation.JsonValue;
+
+public enum SynchronousMachineKind
+{
+ GENERATOR("GENERATOR"),
+ CONDENSER("CONDENSER"),
+ MOTOR("MOTOR");
+
+ private final String value;
+
+ private SynchronousMachineKind(final String value)
+ {
+ this.value = value;
+ }
+
+ @JsonValue
+ public String value()
+ {
+ return this.value;
+ }
+
+}
diff --git a/dev/de.openkonsequenz.cim/src/main/resources/.gitignore b/dev/de.openkonsequenz.cim/src/main/resources/.gitignore
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/dev/de.openkonsequenz.cim/src/main/resources/.gitignore
diff --git a/dev/de.openkonsequenz.cim/src/test/java/.gitignore b/dev/de.openkonsequenz.cim/src/test/java/.gitignore
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/dev/de.openkonsequenz.cim/src/test/java/.gitignore
diff --git a/dev/de.openkonsequenz.cim/src/test/resources/.gitignore b/dev/de.openkonsequenz.cim/src/test/resources/.gitignore
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/dev/de.openkonsequenz.cim/src/test/resources/.gitignore
diff --git a/dev/de.openkonsequenz.cimcache/.gitignore b/dev/de.openkonsequenz.cimcache/.gitignore
new file mode 100644
index 00000000..769de891
--- /dev/null
+++ b/dev/de.openkonsequenz.cimcache/.gitignore
@@ -0,0 +1,4 @@
+/target/
+/.classpath
+/.project
+/.settings/ \ No newline at end of file
diff --git a/dev/de.openkonsequenz.cimcache/WebContent/META-INF/MANIFEST.MF b/dev/de.openkonsequenz.cimcache/WebContent/META-INF/MANIFEST.MF
new file mode 100644
index 00000000..254272e1
--- /dev/null
+++ b/dev/de.openkonsequenz.cimcache/WebContent/META-INF/MANIFEST.MF
@@ -0,0 +1,3 @@
+Manifest-Version: 1.0
+Class-Path:
+
diff --git a/dev/de.openkonsequenz.cimcache/WebContent/WEB-INF/database-flyway.xml b/dev/de.openkonsequenz.cimcache/WebContent/WEB-INF/database-flyway.xml
new file mode 100644
index 00000000..5c31ea61
--- /dev/null
+++ b/dev/de.openkonsequenz.cimcache/WebContent/WEB-INF/database-flyway.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans
+ http://www.springframework.org/schema/beans/spring-beans.xsd">
+
+ <!-- see http://flywaydb.org/documentation/api/ -->
+ <bean id="flyway" class="org.flywaydb.core.Flyway" init-method="migrate">
+ <property name="dataSource" ref="staticTopologyDataSource" />
+ <property name="sqlMigrationPrefix" value="OPENK_STATIC_TOPOLOGY_V" />
+ <property name="locations" value="/flyway-migration" />
+ </bean>
+
+</beans> \ No newline at end of file
diff --git a/dev/de.openkonsequenz.cimcache/WebContent/WEB-INF/database-spring-data.xml b/dev/de.openkonsequenz.cimcache/WebContent/WEB-INF/database-spring-data.xml
new file mode 100644
index 00000000..69ba6627
--- /dev/null
+++ b/dev/de.openkonsequenz.cimcache/WebContent/WEB-INF/database-spring-data.xml
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:jpa="http://www.springframework.org/schema/data/jpa" xsi:schemaLocation="http://www.springframework.org/schema/beans
+ http://www.springframework.org/schema/beans/spring-beans.xsd
+ http://www.springframework.org/schema/data/jpa
+ http://www.springframework.org/schema/data/jpa/spring-jpa.xsd">
+
+ <jpa:repositories base-package="de.openkonsequenz.cimcache.repository" entity-manager-factory-ref="staticTopologyEntityManagerFactory" transaction-manager-ref="staticTopologyTransactionManager" />
+
+ <!-- Get properties from Liferay portal-ext.properties. -->
+ <!--<bean id="staticTopologyDataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource"> -->
+ <bean id="staticTopologyDataSource" class="org.postgresql.ds.PGPoolingDataSource">
+ <property name="serverName" value="localhost" />
+ <property name="databaseName" value="StaticTopology" />
+ <property name="portNumber" value="5432" />
+ <property name="user" value="openK"></property>
+ <property name="password" value="openK"></property>
+ <property name="initialConnections" value="3" />
+ <property name="maxConnections" value="10" />
+ </bean>
+
+ <bean id="eclipseLinkJpaVendorAdapter" class="org.springframework.orm.jpa.vendor.EclipseLinkJpaVendorAdapter">
+ <property name="databasePlatform" value="org.eclipse.persistence.platform.database.SQLServerPlatform" />
+ <property name="database" value="POSTGRESQL" />
+ <property name="showSql" value="false" />
+ <property name="generateDdl" value="false" />
+ </bean>
+
+ <bean id="staticTopologyEntityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
+ <property name="packagesToScan" value="de.openkonsequenz.cimcache.model.jpa" />
+ <property name="dataSource" ref="staticTopologyDataSource" />
+ <property name="jpaPropertyMap">
+ <map>
+ <entry key="eclipselink.weaving" value="false" />
+ </map>
+ </property>
+ <property name="jpaVendorAdapter" ref="eclipseLinkJpaVendorAdapter" />
+ </bean>
+
+ <bean id="staticTopologyTransactionManager" class="org.springframework.orm.jpa.JpaTransactionManager">
+ <property name="entityManagerFactory" ref="staticTopologyEntityManagerFactory" />
+ </bean>
+
+</beans> \ No newline at end of file
diff --git a/dev/de.openkonsequenz.cimcache/WebContent/WEB-INF/rest-servlet.xml b/dev/de.openkonsequenz.cimcache/WebContent/WEB-INF/rest-servlet.xml
new file mode 100644
index 00000000..40f818fb
--- /dev/null
+++ b/dev/de.openkonsequenz.cimcache/WebContent/WEB-INF/rest-servlet.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans" xmlns:context="http://www.springframework.org/schema/context" xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p" xsi:schemaLocation="
+ http://www.springframework.org/schema/beans
+ http://www.springframework.org/schema/beans/spring-beans-4.0.xsd
+ http://www.springframework.org/schema/context
+ http://www.springframework.org/schema/context/spring-context-4.0.xsd
+ http://www.springframework.org/schema/mvc
+ http://www.springframework.org/schema/mvc/spring-mvc-4.0.xsd">
+ <context:component-scan base-package="de.openkonsequenz.cimcache" />
+ <mvc:annotation-driven />
+</beans> \ No newline at end of file
diff --git a/dev/de.openkonsequenz.cimcache/WebContent/WEB-INF/restful-servlet.xml b/dev/de.openkonsequenz.cimcache/WebContent/WEB-INF/restful-servlet.xml
new file mode 100644
index 00000000..ff6e480a
--- /dev/null
+++ b/dev/de.openkonsequenz.cimcache/WebContent/WEB-INF/restful-servlet.xml
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:context="http://www.springframework.org/schema/context"
+ xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.springframework.org/schema/beans
+ http://www.springframework.org/schema/beans/spring-beans.xsd
+ http://www.springframework.org/schema/context
+ http://www.springframework.org/schema/context/spring-context.xsd
+ http://www.springframework.org/schema/mvc
+ http://www.springframework.org/schema/mvc/spring-mvc.xsd">
+
+ <!-- see https://www.liferay.com/de/web/vitor.silva/blog/-/blogs/using-restful-services-with-liferay
+ http://spring.io/blog/2013/06/03/content-negotiation-using-views http://hmkcode.com/spring-mvc-return-json-using-responseboyd/ -->
+ <context:component-scan base-package="de.openkonsequenz.cimcache" />
+
+ <mvc:annotation-driven />
+
+ <!-- Security check on ALL Rest-Requests -->
+ <!-- <mvc:interceptors> <mvc:interceptor> <mvc:mapping path="/**"/> <bean
+ class="de.openkonsequenz.cimcache.adapter.rest.spring.servlet.interceptor.SecureRequestHandlerInterceptor"></bean>
+ </mvc:interceptor> </mvc:interceptors> -->
+
+ <bean id="org.dozer.Mapper" class="org.dozer.DozerBeanMapper">
+ <property name="mappingFiles">
+ <list>
+ <value>dozer-mapping.xml</value>
+ </list>
+ </property>
+ </bean>
+
+ <import resource="database-flyway.xml" />
+ <import resource="database-spring-data.xml" />
+
+</beans> \ No newline at end of file
diff --git a/dev/de.openkonsequenz.cimcache/WebContent/WEB-INF/web.xml b/dev/de.openkonsequenz.cimcache/WebContent/WEB-INF/web.xml
new file mode 100644
index 00000000..f86d7144
--- /dev/null
+++ b/dev/de.openkonsequenz.cimcache/WebContent/WEB-INF/web.xml
@@ -0,0 +1,60 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" id="WebApp_ID" version="3.1">
+ <display-name>openK.StaticTopology</display-name>
+ <context-param>
+ <param-name>log4jConfigLocation</param-name>
+ <param-value>log4j.properties</param-value>
+ </context-param>
+ <servlet>
+ <servlet-name>view-servlet</servlet-name>
+ <servlet-class>org.springframework.web.servlet.ViewRendererServlet</servlet-class>
+ <load-on-startup>1</load-on-startup>
+ </servlet>
+ <servlet-mapping>
+ <servlet-name>view-servlet</servlet-name>
+ <url-pattern>/WEB-INF/servlet/view</url-pattern>
+ </servlet-mapping>
+ <servlet>
+ <servlet-name>restful</servlet-name>
+ <servlet-class>
+ org.springframework.web.servlet.DispatcherServlet
+ </servlet-class>
+ <load-on-startup>2</load-on-startup>
+ </servlet>
+ <servlet-mapping>
+ <servlet-name>restful</servlet-name>
+ <url-pattern>/rest/*</url-pattern>
+ </servlet-mapping>
+ <filter>
+ <filter-name>CorsFilter</filter-name>
+ <filter-class>org.apache.catalina.filters.CorsFilter</filter-class>
+ <init-param>
+ <param-name>cors.allowed.origins</param-name>
+ <param-value>*</param-value>
+ </init-param>
+ <init-param>
+ <param-name>cors.allowed.methods</param-name>
+ <param-value>GET,POST,HEAD,OPTIONS,PUT</param-value>
+ </init-param>
+ <init-param>
+ <param-name>cors.allowed.headers</param-name>
+ <param-value>Content-Type,X-Requested-With,accept,Origin,Access-Control-Request-Method,Access-Control-Request-Headers</param-value>
+ </init-param>
+ <init-param>
+ <param-name>cors.exposed.headers</param-name>
+ <param-value>Access-Control-Allow-Origin,Access-Control-Allow-Credentials</param-value>
+ </init-param>
+ <init-param>
+ <param-name>cors.support.credentials</param-name>
+ <param-value>true</param-value>
+ </init-param>
+ <init-param>
+ <param-name>cors.preflight.maxage</param-name>
+ <param-value>10</param-value>
+ </init-param>
+ </filter>
+ <filter-mapping>
+ <filter-name>CorsFilter</filter-name>
+ <url-pattern>/*</url-pattern>
+ </filter-mapping>
+</web-app> \ No newline at end of file
diff --git a/dev/de.openkonsequenz.cimcache/data-source/20190608 EISMAN I - anonymisierte Testdaten.zip b/dev/de.openkonsequenz.cimcache/data-source/20190608 EISMAN I - anonymisierte Testdaten.zip
new file mode 100644
index 00000000..2fdfe93c
--- /dev/null
+++ b/dev/de.openkonsequenz.cimcache/data-source/20190608 EISMAN I - anonymisierte Testdaten.zip
Binary files differ
diff --git a/dev/de.openkonsequenz.cimcache/pom.xml b/dev/de.openkonsequenz.cimcache/pom.xml
new file mode 100644
index 00000000..db24e007
--- /dev/null
+++ b/dev/de.openkonsequenz.cimcache/pom.xml
@@ -0,0 +1,177 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>de.openkonsequenz.cimcache</groupId>
+ <artifactId>cimcache</artifactId>
+ <version>0.0.1-SNAPSHOT</version>
+ <name>de.openkonsequenz.cimcache</name>
+
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
+ </properties>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>3.1</version>
+ <configuration>
+ <source>1.8</source>
+ <target>1.8</target>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+ <repositories>
+ <repository>
+ <id>Java.Net</id>
+ <url>http://download.java.net/maven/2/</url>
+ </repository>
+ </repositories>
+
+ <dependencies>
+ <!-- Apache -->
+ <dependency>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-lang3</artifactId>
+ <version>3.3.2</version>
+ <scope>compile</scope>
+ </dependency>
+ <!-- Dozer Mapper -->
+ <dependency>
+ <groupId>net.sf.dozer</groupId>
+ <artifactId>dozer</artifactId>
+ <version>5.5.1</version>
+ </dependency>
+ <!-- EclipseLink -->
+ <dependency>
+ <groupId>org.eclipse.persistence</groupId>
+ <artifactId>eclipselink</artifactId>
+ <version>2.5.2</version>
+ <scope>compile</scope>
+ </dependency>
+ <!-- Flyway -->
+ <dependency>
+ <groupId>org.flywaydb</groupId>
+ <artifactId>flyway-core</artifactId>
+ <version>3.2.1</version>
+ </dependency>
+ <!-- Guava -->
+ <dependency>
+ <groupId>com.google.guava</groupId>
+ <artifactId>guava</artifactId>
+ <version>18.0</version>
+ </dependency>
+ <!-- Javax: REST, Servlet, JSP, JSTL & Portlet -->
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>javax.servlet-api</artifactId>
+ <version>3.1.0</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>javax.servlet.jsp</groupId>
+ <artifactId>jsp-api</artifactId>
+ <version>2.0</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>javax.portlet</groupId>
+ <artifactId>portlet-api</artifactId>
+ <version>2.0</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>jstl</artifactId>
+ <version>1.2</version>
+ </dependency>
+ <!-- JSON -->
+ <dependency>
+ <groupId>com.fasterxml.jackson.core</groupId>
+ <artifactId>jackson-core</artifactId>
+ <version>2.8.0</version>
+ </dependency>
+ <dependency>
+ <groupId>com.fasterxml.jackson.core</groupId>
+ <artifactId>jackson-databind</artifactId>
+ <version>2.8.0</version>
+ </dependency>
+ <!-- Log4j -->
+ <dependency>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ <version>1.2.17</version>
+ </dependency>
+ <!-- openKONSEQUENZ -->
+ <dependency>
+ <groupId>de.openkonsequenz.common</groupId>
+ <artifactId>common</artifactId>
+ <version>0.0.1-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>de.openkonsequenz.cim</groupId>
+ <artifactId>cim</artifactId>
+ <version>0.0.1-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+ <!-- PostgreSQL -->
+ <dependency>
+ <groupId>org.postgresql</groupId>
+ <artifactId>postgresql</artifactId>
+ <version>9.4-1200-jdbc41</version>
+ </dependency>
+ <!-- Quartz Job -->
+ <dependency>
+ <groupId>org.quartz-scheduler</groupId>
+ <artifactId>quartz</artifactId>
+ <version>2.2.1</version>
+ </dependency>
+ <dependency>
+ <groupId>org.quartz-scheduler</groupId>
+ <artifactId>quartz-jobs</artifactId>
+ <version>2.2.1</version>
+ </dependency>
+ <!-- Spring -->
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-context</artifactId>
+ <version>4.2.4.RELEASE</version>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-core</artifactId>
+ <version>4.2.4.RELEASE</version>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-jdbc</artifactId>
+ <version>4.2.4.RELEASE</version>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-web</artifactId>
+ <version>4.2.4.RELEASE</version>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-webmvc</artifactId>
+ <version>4.2.4.RELEASE</version>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-webmvc-portlet</artifactId>
+ <version>4.2.4.RELEASE</version>
+ </dependency>
+ <!-- Spring Data -->
+ <dependency>
+ <groupId>org.springframework.data</groupId>
+ <artifactId>spring-data-jpa</artifactId>
+ <version>1.9.2.RELEASE</version>
+ </dependency>
+ </dependencies>
+</project> \ No newline at end of file
diff --git a/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/CimCache.java b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/CimCache.java
new file mode 100644
index 00000000..87e0a88b
--- /dev/null
+++ b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/CimCache.java
@@ -0,0 +1,37 @@
+/**
+ ******************************************************************************
+ * Copyright © 2015-2017 BTC AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ ******************************************************************************
+ */
+package de.openkonsequenz.cimcache;
+
+import java.util.Locale;
+
+import org.springframework.beans.factory.config.ConfigurableBeanFactory;
+import org.springframework.context.annotation.Scope;
+import org.springframework.stereotype.Service;
+
+import de.openkonsequenz.module.AbstractModule;
+
+/**
+ * The service-module.
+ *
+ * @author Felix Korb
+ */
+@Scope(scopeName = ConfigurableBeanFactory.SCOPE_SINGLETON)
+@Service
+public final class CimCache extends AbstractModule
+{
+ // Methods
+ @Override
+ protected Locale createLocale()
+ {
+ return Locale.getDefault();
+ }
+} \ No newline at end of file
diff --git a/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/CimCache.properties b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/CimCache.properties
new file mode 100644
index 00000000..9997a2f3
--- /dev/null
+++ b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/CimCache.properties
@@ -0,0 +1,19 @@
+# Jobs
+# alle 4 Stunden
+openk.scheduler.job.synchronousmachine.cron=0 4 * * * ?
+openk.scheduler.job.netstate.cron=0 3 * * * ?
+openk.scheduler.job.topology.cron=0 4 * * * ?
+openk.scheduler.job.json.file.cron=0 4 * * * ?
+# alle paar Minuten
+#openk.scheduler.job.synchronousmachine.cron=0 0/4 * * * ?
+#openk.scheduler.job.netstate.cron=0 0/5 * * * ?
+#openk.scheduler.job.topology.cron=0 0/4 * * * ?
+#openk.scheduler.job.json.file.cron=0 0/2 * * * ?
+
+# ESB and REST URIs running on ESB
+esb.url.base=http://localhost:8080
+
+esb.rest.uri.synchronousmachine.list=/services/einspeiser
+esb.rest.uri.topology.geographicalregion=/minitopo
+esb.rest.uri.netstate.geographicalregion=/services/netz
+esb.rest.uri.json.file=/to-be-defined \ No newline at end of file
diff --git a/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/datainterchange/DataExchangeDefaults.java b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/datainterchange/DataExchangeDefaults.java
new file mode 100644
index 00000000..1e8564f9
--- /dev/null
+++ b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/datainterchange/DataExchangeDefaults.java
@@ -0,0 +1,23 @@
+/**
+ ******************************************************************************
+ * Copyright © 2015-2017 BTC AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ ******************************************************************************
+ */
+package de.openkonsequenz.cimcache.datainterchange;
+
+/**
+ * Provides some default values.
+ *
+ * @author Felix Korb
+ */
+public final class DataExchangeDefaults
+{
+ // Constants
+ public final static String SETTINGS_KEY_ESB_URL = "esb.url.base";
+} \ No newline at end of file
diff --git a/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/datainterchange/SecureRequestHandlerInterceptor.java b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/datainterchange/SecureRequestHandlerInterceptor.java
new file mode 100644
index 00000000..03877693
--- /dev/null
+++ b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/datainterchange/SecureRequestHandlerInterceptor.java
@@ -0,0 +1,74 @@
+/**
+ ******************************************************************************
+ * Copyright © 2015-2017 BTC AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ ******************************************************************************
+ */
+package de.openkonsequenz.cimcache.datainterchange;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.log4j.Logger;
+import org.omg.CORBA.SystemException;
+import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
+
+public class SecureRequestHandlerInterceptor extends HandlerInterceptorAdapter
+{
+
+ private static final Logger LOG = Logger.getLogger(SecureRequestHandlerInterceptor.class);
+ private static final String USER_ID = "USER_ID";
+
+ /**
+ * Check any REST-Request if there is a user in the session.
+ * This is only possible if the request comes from portal
+ * and the user has been logged in.
+ *
+ * @param request
+ * @param response
+ * @param handler
+ * @return
+ * @throws Exception
+ */
+ @Override
+ public boolean preHandle(final HttpServletRequest request, final HttpServletResponse response, final Object handler) throws SystemException //, PortalException
+ {
+ //
+ // LOG.info("preHandle() " + request.getRequestURI());
+ //
+ // User user = null;
+ // Company company;
+ //
+ // for(final HttpSession httpSession : PortalSessionContext.values())
+ // {
+ //
+ // if(httpSession.getAttribute(USER_ID) != null)
+ // {
+ //
+ // final long userId = (long) httpSession.getAttribute(USER_ID);
+ // user = UserLocalServiceUtil.getUser(userId);
+ // company = CompanyLocalServiceUtil.getCompanyById(user.getCompanyId());
+ // LOG.info("REST Request by User: " + user.getEmailAddress());
+ // LOG.info("Company: " + company.getCompanyId());
+ // }
+ // }
+ //
+ // // todo: mit dem User pruefen, ob Berechtigung existiert.
+ // // todo: throw Security Exception!
+ // if(user == null)
+ // {
+ //
+ // LOG.info("REST Request denied!");
+ // }
+ //
+ // return user != null;
+
+ return true;
+ }
+
+}
diff --git a/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/datainterchange/adapter/rest/AbstractRestClient.java b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/datainterchange/adapter/rest/AbstractRestClient.java
new file mode 100644
index 00000000..d0cffdd2
--- /dev/null
+++ b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/datainterchange/adapter/rest/AbstractRestClient.java
@@ -0,0 +1,25 @@
+/**
+ ******************************************************************************
+ * Copyright © 2015-2017 BTC AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ ******************************************************************************
+ */
+package de.openkonsequenz.cimcache.datainterchange.adapter.rest;
+
+import org.springframework.web.client.RestTemplate;
+
+/**
+ * The base of all <i>REST</i>-clients.
+ *
+ * @author Felix Korb
+ */
+public abstract class AbstractRestClient
+{
+ // Attributes
+ protected RestTemplate restTemplate = new RestTemplate();
+} \ No newline at end of file
diff --git a/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/datainterchange/adapter/rest/client/GeographicalRegionProvider.java b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/datainterchange/adapter/rest/client/GeographicalRegionProvider.java
new file mode 100644
index 00000000..55510482
--- /dev/null
+++ b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/datainterchange/adapter/rest/client/GeographicalRegionProvider.java
@@ -0,0 +1,59 @@
+/**
+ ******************************************************************************
+ * Copyright © 2015-2017 BTC AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ ******************************************************************************
+ */
+package de.openkonsequenz.cimcache.datainterchange.adapter.rest.client;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import de.openkonsequenz.cim.core.GeographicalRegion;
+import de.openkonsequenz.cimcache.CimCache;
+import de.openkonsequenz.cimcache.datainterchange.DataExchangeDefaults;
+import de.openkonsequenz.cimcache.datainterchange.adapter.rest.AbstractRestClient;
+
+/**
+ * The {@link GeographicalRegion}-provider.
+ *
+ * @author Felix Korb
+ * @author Jan Krüger
+ */
+@Service
+public final class GeographicalRegionProvider extends AbstractRestClient
+{
+ // Constants
+ public final static String SETTINGS_KEY_NETSTATE_GEOGRAPHICALREGION = "esb.rest.uri.netstate.geographicalregion";
+ public final static String SETTINGS_KEY_TOPOLOGY_GEOGRAPHICALREGION = "esb.rest.uri.topology.geographicalregion";
+
+ // Attributes
+ @Autowired
+ private CimCache module;
+
+ // Methods
+ /**
+ * @return the netstate-{@link GeographicalRegion}
+ */
+ public GeographicalRegion getGeographicalRegionNetstate()
+ {
+ String tempUri = module.getSetting(DataExchangeDefaults.SETTINGS_KEY_ESB_URL) + module.getSetting(SETTINGS_KEY_NETSTATE_GEOGRAPHICALREGION);
+
+ return restTemplate.getForObject(tempUri, GeographicalRegion.class);
+ }
+
+ /**
+ * @return the topology-{@link GeographicalRegion}
+ */
+ public GeographicalRegion getGeographicalRegionTopology()
+ {
+ String tempUri = module.getSetting(DataExchangeDefaults.SETTINGS_KEY_ESB_URL) + module.getSetting(SETTINGS_KEY_TOPOLOGY_GEOGRAPHICALREGION);
+
+ return restTemplate.getForObject(tempUri, GeographicalRegion.class);
+ }
+}
diff --git a/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/datainterchange/adapter/rest/client/JsonFileProvider.java b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/datainterchange/adapter/rest/client/JsonFileProvider.java
new file mode 100644
index 00000000..e55e0b8d
--- /dev/null
+++ b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/datainterchange/adapter/rest/client/JsonFileProvider.java
@@ -0,0 +1,48 @@
+/**
+ ******************************************************************************
+ * Copyright © 2015-2017 BTC AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ ******************************************************************************
+ */
+package de.openkonsequenz.cimcache.datainterchange.adapter.rest.client;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import de.openkonsequenz.cim.core.GeographicalRegion;
+import de.openkonsequenz.cimcache.CimCache;
+import de.openkonsequenz.cimcache.datainterchange.DataExchangeDefaults;
+import de.openkonsequenz.cimcache.datainterchange.adapter.rest.AbstractRestClient;
+
+/**
+ * The {@link GeographicalRegion}-provider.
+ *
+ * @author Felix Korb
+ * @author Jan Krüger
+ */
+@Service
+public class JsonFileProvider extends AbstractRestClient
+{
+ // Constants
+ public final static String SETTINGS_KEY_JSON_FILE = "esb.rest.uri.json.file";
+
+ // Attributes
+ @Autowired
+ private CimCache module;
+
+ // Methods
+ /**
+ * @return the {@link GeographicalRegion} from the <i>JSON</i>-file
+ */
+ public GeographicalRegion getGeographicalRegion()
+ {
+ String tempUri = module.getSetting(DataExchangeDefaults.SETTINGS_KEY_ESB_URL) + module.getSetting(SETTINGS_KEY_JSON_FILE);
+
+ return restTemplate.getForObject(tempUri, GeographicalRegion.class);
+ }
+}
diff --git a/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/datainterchange/adapter/rest/client/SynchronousMachineProvider.java b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/datainterchange/adapter/rest/client/SynchronousMachineProvider.java
new file mode 100644
index 00000000..e0027aee
--- /dev/null
+++ b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/datainterchange/adapter/rest/client/SynchronousMachineProvider.java
@@ -0,0 +1,50 @@
+/**
+ ******************************************************************************
+ * Copyright © 2015-2017 BTC AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ ******************************************************************************
+ */
+package de.openkonsequenz.cimcache.datainterchange.adapter.rest.client;
+
+import java.util.List;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import com.google.common.collect.Lists;
+
+import de.openkonsequenz.cim.core.GeographicalRegion;
+import de.openkonsequenz.cim.wires.SynchronousMachine;
+import de.openkonsequenz.cimcache.CimCache;
+import de.openkonsequenz.cimcache.datainterchange.DataExchangeDefaults;
+import de.openkonsequenz.cimcache.datainterchange.adapter.rest.AbstractRestClient;
+
+/**
+ * The {@link GeographicalRegion}-provider.
+ *
+ * @author Felix Korb
+ * @author Jan Krüger
+ */
+@Service
+public class SynchronousMachineProvider extends AbstractRestClient
+{
+ // Constants
+ public final static String SETTINGS_KEY_SYNCHRONOUS_MACHINES = "esb.rest.uri.synchronousmachine.list";
+
+ // Attributes
+ @Autowired
+ private CimCache module;
+
+ // Methods
+ public List<SynchronousMachine> getSynchronousMachineList()
+ {
+ String tempUri = module.getSetting(DataExchangeDefaults.SETTINGS_KEY_ESB_URL) + module.getSetting(SETTINGS_KEY_SYNCHRONOUS_MACHINES);
+
+ return Lists.newArrayList(restTemplate.getForObject(tempUri, SynchronousMachine[].class));
+ }
+} \ No newline at end of file
diff --git a/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/datainterchange/adapter/rest/controller/SubGeographicalRegionRestController.java b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/datainterchange/adapter/rest/controller/SubGeographicalRegionRestController.java
new file mode 100644
index 00000000..1ffb7562
--- /dev/null
+++ b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/datainterchange/adapter/rest/controller/SubGeographicalRegionRestController.java
@@ -0,0 +1,186 @@
+/**
+ ******************************************************************************
+ * Copyright © 2015-2017 BTC AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ ******************************************************************************
+ */
+package de.openkonsequenz.cimcache.datainterchange.adapter.rest.controller;
+
+import java.sql.Timestamp;
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RestController;
+
+import de.openkonsequenz.cim.core.SubGeographicalRegion;
+import de.openkonsequenz.cimcache.CimCache;
+import de.openkonsequenz.cimcache.model.jpa.core.SubGeographicalRegionJpa;
+import de.openkonsequenz.cimcache.model.jpa.core.SubstationJpa;
+import de.openkonsequenz.cimcache.model.jpa.core.VoltageLevelJpa;
+import de.openkonsequenz.cimcache.model.jpa.domain.CommunicationTypeJpa;
+import de.openkonsequenz.cimcache.model.jpa.wires.SynchronousMachineJpa;
+import de.openkonsequenz.cimcache.model.util.SubGeographicalRegion4Tree;
+import de.openkonsequenz.cimcache.service.NetworkTraceService;
+import de.openkonsequenz.cimcache.service.SubGeographicalRegion4TreeService;
+import de.openkonsequenz.cimcache.service.SubGeographicalRegionJpaService;
+import de.openkonsequenz.cimcache.service.SubGeographicalRegionMapperService;
+import de.openkonsequenz.cimcache.service.SubGeographicalRegionService;
+import de.openkonsequenz.cimcache.service.SubstationJpaService;
+import de.openkonsequenz.cimcache.service.SynchronousMachineJpaService;
+import de.openkonsequenz.dataexchange.adapter.rest.RestDefaults;
+import de.openkonsequenz.dataexchange.adapter.rest.controller.AbstractRestController;
+import de.openkonsequenz.date.DateToolkit;
+
+@RestController
+public final class SubGeographicalRegionRestController extends AbstractRestController {
+
+ // Attributes
+ @Autowired
+ private CimCache module;
+
+ @Autowired
+ private NetworkTraceService networkTraceService;
+
+ @Autowired
+ private SubGeographicalRegionJpaService subGeographicalRegionJpaService;
+
+ @Autowired
+ private SubGeographicalRegionMapperService subGeographicalRegionMapperService;
+
+ @Autowired
+ private SubGeographicalRegionService subGeographicalRegionService;
+
+ @Autowired
+ private SubGeographicalRegion4TreeService subGeographicalRegion4TreeService;
+
+ @Autowired
+ private SubstationJpaService substationJpaService;
+
+ @Autowired
+ private SynchronousMachineJpaService synchronousMachineJpaService;
+
+ // Methods
+ @Override
+ protected DateFormat createDateFormat() {
+
+ return new SimpleDateFormat(RestDefaults.DATE_FORMAT_FOR_REST_SERVICES, module.getLocale());
+ }
+
+ /**
+ * List of all SubGeographicalRegion for a List-of-Value.
+ * Netzgebiete
+ *
+ * @return
+ */
+ @RequestMapping(value = "/subgeographicalregion/lov", method = RequestMethod.GET)
+ public List<SubGeographicalRegion> findAllSubGeographicalRegion4Lov() {
+
+ final List<SubGeographicalRegion> subGeographicalRegionList = new ArrayList<>();
+
+ for(final SubGeographicalRegionJpa subGeographicalRegionJpa : subGeographicalRegionJpaService.findSubGeographicalRegionJpa4Lov()) {
+
+ subGeographicalRegionList.add(subGeographicalRegionMapperService.mapSubGeographicalRegionJpa(subGeographicalRegionJpa));
+ }
+
+ return subGeographicalRegionList;
+ }
+
+ /**
+ * List of all SubGeographicalRegion and its Substations.
+ * The List is used in a tree-view of the user-interface.
+ * Netzgebiete
+ *
+ * @return
+ */
+ @RequestMapping(value = "/subgeographicalregion/tree", method = RequestMethod.GET)
+ public List<SubGeographicalRegion4Tree> getSubGeographicalRegion4Tree() {
+
+ return subGeographicalRegion4TreeService.getTree();
+ }
+
+ /**
+ * Gets a SubgeographicalRegion which holds Substations and SynchronousMachine
+ * which are ready to use for the Reduction Advice of the Eisman-App.
+ * Hereby only the latest measurements are included.
+ *
+ * @param oid
+ * @return
+ */
+ @RequestMapping(value = "/eisman/subgeographicalregion/oid/{oid}", method = RequestMethod.GET)
+ public SubGeographicalRegion getSubGeographicalRegion4Eisman(@PathVariable final Long oid) {
+
+ final SubGeographicalRegionJpa subGeographicalRegionJpa = subGeographicalRegionJpaService.getSubGeographicalRegionJpa(oid, CommunicationTypeJpa.FWT);
+
+ subGeographicalRegionJpa.getSubstationJpaList().add(substationJpaService.createVirtualTransformerStation(Long.toString(oid * -1)));
+
+ final SubGeographicalRegion subGeographicalRegion = subGeographicalRegionMapperService.mapSubGeographicalRegionJpa(subGeographicalRegionJpa);
+
+ return subGeographicalRegionService.createSubGeographicalRegion4Eisman(subGeographicalRegion);
+ }
+
+ @RequestMapping(value = "/eisman/subgeographicalregion/substation/oid/{oid}", method = RequestMethod.GET)
+ public SubGeographicalRegion getSubGeographicalRegionOfSubstation4Eisman(@PathVariable final String oid) {
+
+ Timestamp tempNow = DateToolkit.getCurrentTimestamp();
+
+ final SubstationJpa transformerStation = substationJpaService.findSubstationJpaByOidAndValidToNull(oid);
+
+ final SubGeographicalRegionJpa subGeographicalRegionJpa = transformerStation.getSubGeographicalRegionJpa();
+
+ final List<SubstationJpa> substationJpaList = new ArrayList<>();
+ substationJpaList.add(transformerStation);
+ substationJpaList.addAll(networkTraceService.getLocalNetworStationListOfTransformerStation(transformerStation));
+
+ for(final SubstationJpa substationJpa : substationJpaList) {
+
+ substationJpa.setEquipmentJpaList(substationJpa.getEquipmentJpaListWithTimestampOnlySynchronousMachineJpa(tempNow, null));
+
+ for(final VoltageLevelJpa voltageLevelJpa : substationJpa.getVoltageLevelJpaList()) {
+
+ voltageLevelJpa.setEquipmentJpaList(voltageLevelJpa.getEquipmentJpaListWithTimestampOnlySynchronousMachineJpa(tempNow, null));
+ }
+ }
+
+ subGeographicalRegionJpa.setSubstationJpaList(substationJpaList);
+
+ final SubstationJpa virtualTransformerstation = substationJpaService.createVirtualTransformerStation(Long.toString(Long.parseLong(oid) * -1));
+
+ if(virtualTransformerstation != null) {
+
+ subGeographicalRegionJpa.getSubstationJpaList().add(virtualTransformerstation);
+ }
+
+ final SubGeographicalRegion subGeographicalRegion = subGeographicalRegionMapperService.mapSubGeographicalRegionJpa(subGeographicalRegionJpa);
+
+ return subGeographicalRegionService.createSubGeographicalRegion4Eisman(subGeographicalRegion);
+ }
+
+ @RequestMapping(value = "/subgeographicalregion/synchronousmachine/oid/{oid}/timestamp/{timestamp}", method = RequestMethod.GET)
+ public SubGeographicalRegion getSubGeographicalRegionOfSynchronousMachine(@PathVariable(value = "oid") final String oid, @PathVariable(value = "timestamp") final String timestampString) {
+
+ final Timestamp timestamp = DateToolkit.decodeTimestamp(timestampString, getDateFormat());
+
+ final SynchronousMachineJpa synchronousMachineJpa = synchronousMachineJpaService.findSynchronousMachineJpaByOidAndTimestamp(Long.parseLong(oid), timestamp);
+
+ final SubstationJpa substationJpa = (SubstationJpa) synchronousMachineJpa.getEquipmentContainerJpa();
+ substationJpa.getEquipmentJpaList().clear();
+ substationJpa.getEquipmentJpaList().add(synchronousMachineJpa);
+
+ final SubGeographicalRegionJpa subGeographicalRegionJpa = substationJpa.getSubGeographicalRegionJpa();
+ subGeographicalRegionJpa.getSubstationJpaList().clear();
+ subGeographicalRegionJpa.getSubstationJpaList().add(substationJpa);
+
+ return subGeographicalRegionMapperService.mapSubGeographicalRegionJpa(subGeographicalRegionJpa);
+ }
+} \ No newline at end of file
diff --git a/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/datainterchange/adapter/rest/controller/SubstationRestController.java b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/datainterchange/adapter/rest/controller/SubstationRestController.java
new file mode 100644
index 00000000..26ea794c
--- /dev/null
+++ b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/datainterchange/adapter/rest/controller/SubstationRestController.java
@@ -0,0 +1,99 @@
+/**
+ ******************************************************************************
+ * Copyright © 2015-2017 BTC AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ ******************************************************************************
+ */
+package de.openkonsequenz.cimcache.datainterchange.adapter.rest.controller;
+
+import java.sql.Timestamp;
+import java.text.DateFormat;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.List;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RestController;
+
+import de.openkonsequenz.cim.core.Substation;
+import de.openkonsequenz.cimcache.CimCache;
+import de.openkonsequenz.cimcache.service.SubstationJpaService;
+import de.openkonsequenz.cimcache.service.SubstationMapperService;
+import de.openkonsequenz.cimcache.service.SubstationService;
+import de.openkonsequenz.dataexchange.adapter.rest.RestDefaults;
+import de.openkonsequenz.dataexchange.adapter.rest.controller.AbstractRestController;
+import de.openkonsequenz.date.DateToolkit;
+
+@RestController
+public class SubstationRestController extends AbstractRestController {
+
+ // Attributes
+ @Autowired
+ private CimCache module;
+
+ @Autowired
+ private SubstationJpaService substationJpaService;
+
+ @Autowired
+ private SubstationMapperService substationMapperService;
+
+ @Autowired
+ private SubstationService substationService;
+
+ // Methods
+ @Override
+ protected DateFormat createDateFormat() {
+
+ return new SimpleDateFormat(RestDefaults.DATE_FORMAT_FOR_REST_SERVICES, module.getLocale());
+ }
+
+ /**
+ * List of Substations, which are TransformerStations.
+ * <p/>
+ * (Einspeisepunkte)
+ *
+ * @return
+ */
+ @RequestMapping(value = "/substation/lov", method = RequestMethod.GET)
+ public List<Substation> findAllSubstation4Lov() {
+
+ return substationMapperService.mapSubstationList(substationJpaService.getSubstationJpa4Lov());
+ }
+
+ /**
+ * Get all SynchronousMachine of a Substation, which are valid for a speciic timestamp.
+ *
+ * @param oid
+ * @param timestampString
+ * @return
+ * @throws ParseException
+ */
+ @RequestMapping(value = "/substation/oid/{oid}/synchronousmachinelist/timestamp/{timestamp}", method = RequestMethod.GET)
+ public Substation findSubstationWithSynchronousMachineListByOidAndTimestamp(@PathVariable(value = "oid") final String oid, @PathVariable(value = "timestamp") final String timestampString) throws ParseException {
+
+ final Timestamp timestamp = DateToolkit.decodeTimestamp(timestampString, getDateFormat());
+
+ return substationService.prepare4Eisman(substationMapperService.mapSubstationJpa(substationJpaService.getSubstationByOidAndTimestampWithSynchronousMachineList(oid, timestamp)));
+ }
+
+ /**
+ * Get a Substation and all SynchronousMachine.
+ *
+ * @param oid
+ * @return
+ */
+ @RequestMapping(value = "/substation/oid/{oid}/synchronousmachinelist", method = RequestMethod.GET)
+ public Substation getSubstationWithSynchronousMachineList(@PathVariable(value = "oid") final String oid) {
+
+ return substationService.prepare4Eisman(substationMapperService.mapSubstationJpa(substationJpaService.getSubstationByOidAndTimestampWithSynchronousMachineList(oid, null)));
+ }
+
+}
diff --git a/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/datainterchange/adapter/rest/controller/SynchronousMachineRestController.java b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/datainterchange/adapter/rest/controller/SynchronousMachineRestController.java
new file mode 100644
index 00000000..2445408d
--- /dev/null
+++ b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/datainterchange/adapter/rest/controller/SynchronousMachineRestController.java
@@ -0,0 +1,62 @@
+/**
+ ******************************************************************************
+ * Copyright © 2015-2017 BTC AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ ******************************************************************************
+ */
+package de.openkonsequenz.cimcache.datainterchange.adapter.rest.controller;
+
+import java.sql.Timestamp;
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RestController;
+
+import de.openkonsequenz.cim.wires.SynchronousMachine;
+import de.openkonsequenz.cimcache.CimCache;
+import de.openkonsequenz.cimcache.model.jpa.wires.SynchronousMachineJpa;
+import de.openkonsequenz.cimcache.service.SynchronousMachineJpaService;
+import de.openkonsequenz.cimcache.service.SynchronousMachineMapperService;
+import de.openkonsequenz.dataexchange.adapter.rest.RestDefaults;
+import de.openkonsequenz.dataexchange.adapter.rest.controller.AbstractRestController;
+import de.openkonsequenz.date.DateToolkit;
+
+@RestController
+public class SynchronousMachineRestController extends AbstractRestController {
+
+ // Attributes
+ @Autowired
+ private CimCache module;
+
+ @Autowired
+ private SynchronousMachineJpaService synchronousMachineJpaService;
+
+ @Autowired
+ private SynchronousMachineMapperService synchronousMachineMapperService;
+
+ // Methods
+ @Override
+ protected DateFormat createDateFormat() {
+
+ return new SimpleDateFormat(RestDefaults.DATE_FORMAT_FOR_REST_SERVICES, module.getLocale());
+ }
+
+ @RequestMapping(value = "/synchronousmachine/oid/{oid}/timestamp/{timestamp}", method = RequestMethod.GET)
+ public SynchronousMachine getSynchronousMachine(@PathVariable(value = "oid") final String oid, @PathVariable(value = "timestamp") final String timestamp) {
+
+ Timestamp tempTimestamp = DateToolkit.decodeTimestamp(timestamp, getDateFormat());
+
+ final SynchronousMachineJpa synchronousMachineJpa = synchronousMachineJpaService.findSynchronousMachineJpaByOidAndTimestamp(Long.parseLong(oid), tempTimestamp);
+
+ return synchronousMachineMapperService.mapSynchronousMachineJpa(synchronousMachineJpa);
+ }
+} \ No newline at end of file
diff --git a/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/job/JobController.java b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/job/JobController.java
new file mode 100644
index 00000000..66dc1cf9
--- /dev/null
+++ b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/job/JobController.java
@@ -0,0 +1,124 @@
+/**
+ ******************************************************************************
+ * Copyright © 2015-2017 BTC AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ ******************************************************************************
+ */
+package de.openkonsequenz.cimcache.job;
+
+import javax.annotation.PostConstruct;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+
+import org.apache.log4j.Logger;
+import org.quartz.JobDetail;
+import org.quartz.Scheduler;
+import org.quartz.SchedulerException;
+import org.quartz.impl.StdSchedulerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.Model;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.portlet.bind.annotation.RenderMapping;
+
+import de.openkonsequenz.cimcache.CimCache;
+import de.openkonsequenz.cimcache.job.util.JobUtils;
+import de.openkonsequenz.cimcache.service.GeographicalRegionRestConsumerService;
+import de.openkonsequenz.cimcache.service.JsonFileRestConsumerService;
+import de.openkonsequenz.cimcache.service.SynchronousMachineRestConsumerService;
+
+@Controller(value = "jobController")
+@RequestMapping(value = "VIEW")
+public class JobController
+{
+ // Constants
+ private static final Logger LOG = Logger.getLogger(JobController.class);
+
+ private static final String CRON_SCHEDULE_SYNCHRONOUS_MACHINE_PROPS = "openk.scheduler.job.synchronousmachine.cron";
+ private static final String CRON_SCHEDULE_NETSTATE_PROPS = "openk.scheduler.job.netstate.cron";
+ private static final String CRON_SCHEDULE_TOPOLOGY_PROPS = "openk.scheduler.job.topology.cron";
+ private static final String CRON_SCHEDULE_JSON_FILE_PROPS = "openk.scheduler.job.json.file.cron";
+
+ // Attributes
+ @Autowired
+ private CimCache module;
+
+ private Scheduler scheduler;
+
+ @Autowired
+ private SynchronousMachineRestConsumerService synchronousMachineRestConsumerService;
+
+ @Autowired
+ private GeographicalRegionRestConsumerService geographicalRegionRestConsumerService;
+
+ @Autowired
+ private JsonFileRestConsumerService jsonFileRestConsumerService;
+
+ @RenderMapping
+ public String show(final RenderRequest request, final Model model, final RenderResponse response)
+ {
+ // to be defined
+ return null;
+ }
+
+ @PostConstruct
+ public void startJobsInitial()
+ {
+
+ initScheduler();
+
+ startJob(JobUtils.SYNCHRONOUS_MACHINE_JOB, CRON_SCHEDULE_SYNCHRONOUS_MACHINE_PROPS, JobUtils.getSynchronousMachineJobDetail(synchronousMachineRestConsumerService));
+
+ startJob(JobUtils.NETSTATE_JOB, CRON_SCHEDULE_NETSTATE_PROPS, JobUtils.getNetstateJobDetail(geographicalRegionRestConsumerService));
+
+ startJob(JobUtils.TOPOLOGY_JOB, CRON_SCHEDULE_TOPOLOGY_PROPS, JobUtils.getTopologyJobDetail(geographicalRegionRestConsumerService));
+
+ startJob(JobUtils.JSON_FILE_JOB, CRON_SCHEDULE_JSON_FILE_PROPS, JobUtils.getJsonFileJobDetail(jsonFileRestConsumerService));
+ }
+
+ private void initScheduler()
+ {
+
+ try
+ {
+
+ scheduler = StdSchedulerFactory.getDefaultScheduler();
+
+ if(!scheduler.isStarted())
+ {
+ scheduler.start();
+ }
+
+ }
+ catch(SchedulerException e)
+ {
+
+ LOG.error("Failed to initialize scheduler", e);
+ }
+ }
+
+ private void startJob(final String jobName, final String cronScheduleProps, final JobDetail entry)
+ {
+
+ LOG.info("Read Cron Properties: " + cronScheduleProps);
+ final String cronSchedule = module.getSetting(cronScheduleProps);
+
+ try
+ {
+ scheduler.scheduleJob(entry, JobUtils.createTrigger(jobName, cronSchedule));
+ LOG.info("Started Job: " + jobName + " with Cron Schedule: " + cronSchedule);
+
+ }
+ catch(SchedulerException e)
+ {
+
+ LOG.error("Failed to start job: " + jobName, e);
+ }
+ }
+
+}
diff --git a/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/job/JsonFileJob.java b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/job/JsonFileJob.java
new file mode 100644
index 00000000..09905b04
--- /dev/null
+++ b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/job/JsonFileJob.java
@@ -0,0 +1,45 @@
+/**
+ ******************************************************************************
+ * Copyright © 2015-2017 BTC AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ ******************************************************************************
+ */
+package de.openkonsequenz.cimcache.job;
+
+import org.apache.log4j.Logger;
+import org.quartz.Job;
+import org.quartz.JobExecutionContext;
+import org.quartz.JobExecutionException;
+import org.springframework.web.client.HttpClientErrorException;
+
+import de.openkonsequenz.cimcache.job.util.JobUtils;
+import de.openkonsequenz.cimcache.service.JsonFileRestConsumerService;
+
+public class JsonFileJob implements Job {
+
+ private static final Logger LOG = Logger.getLogger(JsonFileJob.class);
+
+ @Override
+ public void execute(final JobExecutionContext jobExecutionContext) throws JobExecutionException {
+
+ LOG.info("Job starts execution");
+
+ final JsonFileRestConsumerService jsonFileRestConsumerService =
+ (JsonFileRestConsumerService) jobExecutionContext.getMergedJobDataMap().get(
+ JobUtils.JSON_FILE_REST_CONSUMER_SERVICE);
+
+ try {
+
+ jsonFileRestConsumerService.getGeographicalRegion();
+
+ } catch (HttpClientErrorException httpEx) {
+
+ LOG.error("Endpoint on Enterprise Service Bus not found: " + httpEx.getMessage());
+ }
+ }
+}
diff --git a/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/job/NetstateJob.java b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/job/NetstateJob.java
new file mode 100644
index 00000000..72165f08
--- /dev/null
+++ b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/job/NetstateJob.java
@@ -0,0 +1,46 @@
+/**
+ ******************************************************************************
+ * Copyright © 2015-2017 BTC AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ ******************************************************************************
+ */
+package de.openkonsequenz.cimcache.job;
+
+import org.apache.log4j.Logger;
+import org.quartz.Job;
+import org.quartz.JobExecutionContext;
+import org.quartz.JobExecutionException;
+import org.springframework.web.client.HttpClientErrorException;
+
+import de.openkonsequenz.cimcache.job.util.JobUtils;
+import de.openkonsequenz.cimcache.service.GeographicalRegionRestConsumerService;
+
+public class NetstateJob implements Job {
+
+ private static final Logger LOG = Logger.getLogger(NetstateJob.class);
+
+
+ @Override
+ public void execute(final JobExecutionContext jobExecutionContext) throws JobExecutionException {
+
+ LOG.info("Job starts execution");
+
+ final GeographicalRegionRestConsumerService geographicalRegionRestConsumerService =
+ (GeographicalRegionRestConsumerService) jobExecutionContext.getMergedJobDataMap().get(
+ JobUtils.GEOGRAPHICAL_REGION_REST_CONSUMER_SERVICE);
+
+ try {
+
+ geographicalRegionRestConsumerService.getGeographicalRegionNetstate();
+
+ } catch (HttpClientErrorException httpEx) {
+
+ LOG.error("Endpoint on Enterprise Service Bus not found: " + httpEx.getMessage());
+ }
+ }
+}
diff --git a/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/job/SynchronousMachineJob.java b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/job/SynchronousMachineJob.java
new file mode 100644
index 00000000..498c0436
--- /dev/null
+++ b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/job/SynchronousMachineJob.java
@@ -0,0 +1,45 @@
+/**
+ ******************************************************************************
+ * Copyright © 2015-2017 BTC AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ ******************************************************************************
+ */
+package de.openkonsequenz.cimcache.job;
+
+import org.apache.log4j.Logger;
+import org.quartz.Job;
+import org.quartz.JobExecutionContext;
+import org.quartz.JobExecutionException;
+import org.springframework.web.client.HttpClientErrorException;
+
+import de.openkonsequenz.cimcache.job.util.JobUtils;
+import de.openkonsequenz.cimcache.service.SynchronousMachineRestConsumerService;
+
+public class SynchronousMachineJob implements Job {
+
+ private static final Logger LOG = Logger.getLogger(SynchronousMachineJob.class);
+
+ @Override
+ public void execute(final JobExecutionContext jobExecutionContext) throws JobExecutionException {
+
+ LOG.info("Job starts execution");
+
+ final SynchronousMachineRestConsumerService synchronousMachineRestConsumer =
+ (SynchronousMachineRestConsumerService) jobExecutionContext.getMergedJobDataMap().get(
+ JobUtils.SYNCHRONOUS_MACHINE_REST_CONSUMER_SERVICE);
+
+ try {
+
+ synchronousMachineRestConsumer.getSynchronousMachineList();
+
+ } catch (HttpClientErrorException httpEx) {
+
+ LOG.error("Endpoint on Enterprise Service Bus not found: " + httpEx.getMessage());
+ }
+ }
+}
diff --git a/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/job/TopologyJob.java b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/job/TopologyJob.java
new file mode 100644
index 00000000..e09e6aec
--- /dev/null
+++ b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/job/TopologyJob.java
@@ -0,0 +1,45 @@
+/**
+ ******************************************************************************
+ * Copyright © 2015-2017 BTC AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ ******************************************************************************
+ */
+package de.openkonsequenz.cimcache.job;
+
+import org.apache.log4j.Logger;
+import org.quartz.Job;
+import org.quartz.JobExecutionContext;
+import org.quartz.JobExecutionException;
+import org.springframework.web.client.HttpClientErrorException;
+
+import de.openkonsequenz.cimcache.job.util.JobUtils;
+import de.openkonsequenz.cimcache.service.GeographicalRegionRestConsumerService;
+
+public class TopologyJob implements Job {
+
+ private static final Logger LOG = Logger.getLogger(TopologyJob.class);
+
+ @Override
+ public void execute(final JobExecutionContext jobExecutionContext) throws JobExecutionException {
+
+ LOG.info("Job starts execution");
+
+ final GeographicalRegionRestConsumerService geographicalRegionRestConsumerService =
+ (GeographicalRegionRestConsumerService) jobExecutionContext.getMergedJobDataMap().get(
+ JobUtils.GEOGRAPHICAL_REGION_REST_CONSUMER_SERVICE);
+
+ try {
+
+ geographicalRegionRestConsumerService.getGeographicalRegionTopology();
+
+ } catch (HttpClientErrorException httpEx) {
+
+ LOG.error("Endpoint on Enterprise Service Bus not found: " + httpEx.getMessage());
+ }
+ }
+}
diff --git a/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/job/util/JobUtils.java b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/job/util/JobUtils.java
new file mode 100644
index 00000000..fd997cb3
--- /dev/null
+++ b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/job/util/JobUtils.java
@@ -0,0 +1,101 @@
+/**
+ ******************************************************************************
+ * Copyright © 2015-2017 BTC AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ ******************************************************************************
+ */
+package de.openkonsequenz.cimcache.job.util;
+
+import org.quartz.CronScheduleBuilder;
+import org.quartz.JobBuilder;
+import org.quartz.JobDetail;
+import org.quartz.Trigger;
+import org.quartz.TriggerBuilder;
+
+import de.openkonsequenz.cimcache.job.JsonFileJob;
+import de.openkonsequenz.cimcache.job.NetstateJob;
+import de.openkonsequenz.cimcache.job.SynchronousMachineJob;
+import de.openkonsequenz.cimcache.job.TopologyJob;
+import de.openkonsequenz.cimcache.service.GeographicalRegionRestConsumerService;
+import de.openkonsequenz.cimcache.service.JsonFileRestConsumerService;
+import de.openkonsequenz.cimcache.service.SynchronousMachineRestConsumerService;
+
+public final class JobUtils {
+
+ public static final String SYNCHRONOUS_MACHINE_JOB = "synchronousMachineJob";
+ public static final String NETSTATE_JOB = "netstateJob";
+ public static final String TOPOLOGY_JOB = "topologyJob";
+ public static final String JSON_FILE_JOB = "jsonFileJob";
+
+ public static final String SYNCHRONOUS_MACHINE_REST_CONSUMER_SERVICE = "synchronousMachineRestConsumerService";
+ public static final String GEOGRAPHICAL_REGION_REST_CONSUMER_SERVICE = "geographicalRegionRestConsumerService";
+ public static final String JSON_FILE_REST_CONSUMER_SERVICE = "jsonFileRestConsumerService";
+
+ public static final String OPENK_JOB_GROUP = "openkJobGroup";
+
+ public static Trigger createTrigger(final String name, final String cronSchedule) {
+ return TriggerBuilder.newTrigger()
+ .withIdentity(name, OPENK_JOB_GROUP)
+ .startNow()
+ .withSchedule(CronScheduleBuilder.cronSchedule(cronSchedule))
+ .build();
+ }
+
+ public static JobDetail getSynchronousMachineJobDetail(
+ final SynchronousMachineRestConsumerService synchronousMachineRestConsumerService) {
+
+ final JobDetail jobDetail = JobBuilder.newJob(SynchronousMachineJob.class)
+ .withIdentity(SYNCHRONOUS_MACHINE_JOB, OPENK_JOB_GROUP)
+ .build();
+
+ jobDetail.getJobDataMap().put(SYNCHRONOUS_MACHINE_REST_CONSUMER_SERVICE, synchronousMachineRestConsumerService);
+
+ return jobDetail;
+ }
+
+ public static JobDetail getNetstateJobDetail(
+ final GeographicalRegionRestConsumerService geographicalRegionRestConsumerService) {
+
+ final JobDetail jobDetail = JobBuilder.newJob(NetstateJob.class)
+ .withIdentity(NETSTATE_JOB, OPENK_JOB_GROUP)
+ .build();
+
+ jobDetail.getJobDataMap().put(GEOGRAPHICAL_REGION_REST_CONSUMER_SERVICE, geographicalRegionRestConsumerService);
+
+ return jobDetail;
+ }
+
+ public static JobDetail getTopologyJobDetail(
+ final GeographicalRegionRestConsumerService geographicalRegionRestConsumerService) {
+
+ final JobDetail jobDetail = JobBuilder.newJob(TopologyJob.class)
+ .withIdentity(TOPOLOGY_JOB, OPENK_JOB_GROUP)
+ .build();
+
+ jobDetail.getJobDataMap().put(GEOGRAPHICAL_REGION_REST_CONSUMER_SERVICE, geographicalRegionRestConsumerService);
+
+ return jobDetail;
+ }
+
+ public static JobDetail getJsonFileJobDetail(
+ final JsonFileRestConsumerService jsonFileRestConsumerService) {
+
+ final JobDetail jobDetail = JobBuilder.newJob(JsonFileJob.class)
+ .withIdentity(JSON_FILE_JOB, OPENK_JOB_GROUP)
+ .build();
+
+ jobDetail.getJobDataMap().put(JSON_FILE_REST_CONSUMER_SERVICE, jsonFileRestConsumerService);
+
+ return jobDetail;
+ }
+
+
+ private JobUtils() {
+ // do not call
+ }
+}
diff --git a/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/common/ActivityRecordJpa.java b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/common/ActivityRecordJpa.java
new file mode 100644
index 00000000..1c90c25b
--- /dev/null
+++ b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/common/ActivityRecordJpa.java
@@ -0,0 +1,85 @@
+/**
+ ******************************************************************************
+ * Copyright © 2015-2017 BTC AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ ******************************************************************************
+ */
+package de.openkonsequenz.cimcache.model.jpa.common;
+
+import javax.persistence.AttributeOverride;
+import javax.persistence.Column;
+import javax.persistence.Embedded;
+import javax.persistence.MappedSuperclass;
+
+import de.openkonsequenz.cimcache.model.jpa.core.IdentifiedObjectJpa;
+import de.openkonsequenz.cimcache.model.jpa.domain.AbsoluteDateTimeJpa;
+
+/**
+ * Records activity for an entity at a point in time; activity may be for an event
+ * that has already occurred or for a planned activity.
+ */
+@MappedSuperclass
+public abstract class ActivityRecordJpa extends IdentifiedObjectJpa {
+
+ /**
+ * Date and time this activity record has been created (different from the 'status.
+ * dateTime', which is the time of a status change of the associated object, if
+ * applicable).
+ */
+ @Embedded
+ @AttributeOverride(name = "value", column = @Column(name = "TIMESTAMP_CREATED"))
+ private AbsoluteDateTimeJpa createdDateTime;
+
+ public AbsoluteDateTimeJpa getCreatedDateTime() {
+ return createdDateTime;
+ }
+
+ public void setCreatedDateTime(final AbsoluteDateTimeJpa createdDateTime) {
+ this.createdDateTime = createdDateTime;
+ }
+
+ @Override
+ public boolean equals(final Object o) {
+
+ if (this == o) {
+ return true;
+ }
+
+ if (!(o instanceof ActivityRecordJpa)) {
+ return false;
+ }
+
+ if (!super.equals(o)) {
+ return false;
+ }
+
+ final ActivityRecordJpa that = (ActivityRecordJpa) o;
+
+ boolean result = false;
+
+ if ((getCreatedDateTime() == null || getCreatedDateTime().getValue() == null)
+ && (that.getCreatedDateTime() == null || that.getCreatedDateTime().getValue() == null)) {
+
+ result = true;
+
+ } else if (getCreatedDateTime() != null && that.getCreatedDateTime() != null) {
+
+ result = getCreatedDateTime().getValue().equals(that.getCreatedDateTime().getValue());
+ }
+
+ return result;
+ }
+
+ @Override
+ public int hashCode() {
+ int result = super.hashCode();
+ result = 31 * result + (getCreatedDateTime() == null ? 0 : getCreatedDateTime().hashCode());
+ return result;
+ }
+
+} \ No newline at end of file
diff --git a/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/common/ElectronicAddressJpa.java b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/common/ElectronicAddressJpa.java
new file mode 100644
index 00000000..ad26989b
--- /dev/null
+++ b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/common/ElectronicAddressJpa.java
@@ -0,0 +1,66 @@
+/**
+ ******************************************************************************
+ * Copyright © 2015-2017 BTC AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ ******************************************************************************
+ */
+package de.openkonsequenz.cimcache.model.jpa.common;
+
+import javax.persistence.Embeddable;
+
+/**
+ * Electronic address information.
+ */
+@Embeddable
+public class ElectronicAddressJpa {
+
+ /**
+ * Email address.
+ */
+ private String email;
+
+ public String getEmail() {
+ return email;
+ }
+
+ public void setEmail(final String email) {
+ this.email = email;
+ }
+
+ @Override
+ public boolean equals(final Object o) {
+
+ if (this == o) {
+ return true;
+ }
+
+ if (!(o instanceof ElectronicAddressJpa)) {
+ return false;
+ }
+
+ final ElectronicAddressJpa that = (ElectronicAddressJpa) o;
+
+ boolean result = false;
+
+ if (getEmail() == null && that.getEmail() == null) {
+
+ result = true;
+
+ } else if (getEmail() != null && that.getEmail() != null) {
+
+ result = getEmail().equals(that.getEmail());
+ }
+
+ return result;
+ }
+
+ @Override
+ public int hashCode() {
+ return getEmail() == null ? 0 : getEmail().hashCode();
+ }
+} \ No newline at end of file
diff --git a/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/common/LocationJpa.java b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/common/LocationJpa.java
new file mode 100644
index 00000000..8ca39c94
--- /dev/null
+++ b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/common/LocationJpa.java
@@ -0,0 +1,165 @@
+/**
+ ******************************************************************************
+ * Copyright © 2015-2017 BTC AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ ******************************************************************************
+ */
+package de.openkonsequenz.cimcache.model.jpa.common;
+
+
+import java.util.List;
+
+import javax.persistence.AttributeOverride;
+import javax.persistence.AttributeOverrides;
+import javax.persistence.CascadeType;
+import javax.persistence.Column;
+import javax.persistence.Embedded;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.JoinColumn;
+import javax.persistence.OneToMany;
+import javax.persistence.Table;
+import javax.persistence.TableGenerator;
+
+import com.fasterxml.jackson.annotation.JsonIgnore;
+
+import de.openkonsequenz.cimcache.model.jpa.core.IdentifiedObjectJpa;
+
+/**
+ * The place, scene, or point of something where someone or something has been, is,
+ * and/or will be at a given moment in time. It may be:
+ * - Spatial location of an actual or planned structure, or a set of point-
+ * oriented structures (as a substation, structure, building, town, etc.) or
+ * diagram objects, which may be defined as a point or polygon, or,
+ * - Path of an underground or overhead conductor, or a linear diagram object.
+ */
+@Entity
+@Table(name = "LOCATION")
+public class LocationJpa extends IdentifiedObjectJpa {
+
+ @JsonIgnore
+ @Id
+ @TableGenerator(name = "LocationTableGen",
+ allocationSize = DEFAULT_ALLOCATION_SIZE,
+ table = "OPENK_STATICTOPOLOGY_SEQ_TABLE",
+ pkColumnName = "SEQ_NAME",
+ valueColumnName = "SEQ_COUNT",
+ pkColumnValue = "LOCATION_SEQ")
+ @GeneratedValue(strategy = GenerationType.TABLE, generator = "LocationTableGen")
+ @Column(name = "ID")
+ private Long id;
+
+ /**
+ * Electronic address.
+ */
+ @Embedded
+ @AttributeOverrides({
+ @AttributeOverride(name = "email", column = @Column(name = "EMAIL"))
+ })
+ private ElectronicAddressJpa electronicAddressJpa;
+
+ /**
+ * Main address of the location.
+ */
+ @Embedded
+ @AttributeOverrides({
+ @AttributeOverride(name = "postalCode", column = @Column(name = "POSTAL_CODE")),
+ @AttributeOverride(name = "streetDetailJpa.name", column = @Column(name = "STREET_NAME")),
+ @AttributeOverride(name = "streetDetailJpa.number", column = @Column(name = "STREET_NUMBER")),
+ @AttributeOverride(name = "townDetailJpa.name", column = @Column(name = "CITY")),
+ @AttributeOverride(name = "townDetailJpa.country", column = @Column(name = "COUNTRY"))
+ })
+ private StreetAddressJpa mainAddress;
+
+ /**
+ * Sequence of position points describing this location, expressed in coordinate
+ * system 'Location.CoordinateSystem'.
+ */
+ @OneToMany(targetEntity = PositionPointJpa.class, cascade = CascadeType.PERSIST)
+ @JoinColumn(name = "LOCATION_ID")
+ private List<PositionPointJpa> positionPointJpaList;
+
+ public StreetAddressJpa getMainAddress() {
+ return mainAddress;
+ }
+
+ public ElectronicAddressJpa getElectronicAddressJpa() {
+ return electronicAddressJpa;
+ }
+
+ public List<PositionPointJpa> getPositionPointJpaList() {
+ return positionPointJpaList;
+ }
+
+ public void setElectronicAddressJpa(final ElectronicAddressJpa electronicAddressJpa) {
+ this.electronicAddressJpa = electronicAddressJpa;
+ }
+
+ public void setMainAddress(final StreetAddressJpa mainAddress) {
+ this.mainAddress = mainAddress;
+ }
+
+ public void setPositionPointJpaList(final List<PositionPointJpa> positionPointJpaList) {
+ this.positionPointJpaList = positionPointJpaList;
+ }
+
+ @Override
+ public boolean equals(final Object o) {
+
+ if (this == o) {
+ return true;
+ }
+
+ if (!(o instanceof LocationJpa)) {
+ return false;
+ }
+
+ if (!super.equals(o)) {
+ return false;
+ }
+
+ final LocationJpa that = (LocationJpa) o;
+
+ if (getElectronicAddressJpa() == null
+ ? that.getElectronicAddressJpa() != null
+ : !getElectronicAddressJpa().equals(that.getElectronicAddressJpa())) {
+ return false;
+ }
+
+ if (getMainAddress() == null
+ ? that.getMainAddress() != null
+ : !getMainAddress().equals(that.getMainAddress())) {
+ return false;
+ }
+
+ boolean result = false;
+
+ if ((getPositionPointJpaList() == null || getPositionPointJpaList().isEmpty())
+ && (that.getPositionPointJpaList() == null || that.getPositionPointJpaList().isEmpty())) {
+
+ result = true;
+
+ } else if (getPositionPointJpaList() != null && that.getPositionPointJpaList() != null) {
+
+ result = getPositionPointJpaList().equals(that.getPositionPointJpaList());
+ }
+
+ return result;
+ }
+
+ @Override
+ public int hashCode() {
+ int result = super.hashCode();
+ result = 31 * result + (getElectronicAddressJpa() == null ? 0 : getElectronicAddressJpa().hashCode());
+ result = 31 * result + (getMainAddress() == null ? 0 : getMainAddress().hashCode());
+ result = 31 * result + (getPositionPointJpaList() == null ? 0 : getPositionPointJpaList().hashCode());
+ return result;
+ }
+} \ No newline at end of file
diff --git a/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/common/PositionPointJpa.java b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/common/PositionPointJpa.java
new file mode 100644
index 00000000..b2f7d969
--- /dev/null
+++ b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/common/PositionPointJpa.java
@@ -0,0 +1,155 @@
+/**
+ ******************************************************************************
+ * Copyright © 2015-2017 BTC AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ ******************************************************************************
+ */
+package de.openkonsequenz.cimcache.model.jpa.common;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Table;
+import javax.persistence.TableGenerator;
+
+import com.fasterxml.jackson.annotation.JsonIgnore;
+
+/**
+ * Set of spatial coordinates that determine a point. A sequence of PositionPoints
+ * can be used to describe:
+ * - physical location of non-point oriented objects like cables or lines, or
+ * - area of an object like a substation, a geographical zone or a diagram object.
+ */
+@Entity
+@Table(name = "POSITION_POINT")
+public class PositionPointJpa {
+
+ @JsonIgnore
+ @Id
+ @TableGenerator(name = "PositionPointTableGen",
+ allocationSize = 1,
+ table = "OPENK_STATICTOPOLOGY_SEQ_TABLE",
+ pkColumnName = "SEQ_NAME",
+ valueColumnName = "SEQ_COUNT",
+ pkColumnValue = "POSITION_POINT_SEQ")
+ @GeneratedValue(strategy = GenerationType.TABLE, generator = "PositionPointTableGen")
+ @Column(name = "ID")
+ private Long id;
+
+ /**
+ * Zero-relative sequence number of this point within a series of points.
+ */
+ @Column(name = "SEQUENCE_NUMBER")
+ private Integer sequenceNumber;
+
+ /**
+ * X axis position.
+ */
+ @Column(name = "X_POSITION")
+ private String xPosition;
+
+ /**
+ * Y axis position.
+ */
+ @Column(name = "Y_POSITION")
+ private String yPosition;
+
+ /**
+ * (if applicable) Z axis position.
+ */
+ @Column(name = "Z_POSITION")
+ private String zPosition;
+
+ public Integer getSequenceNumber() {
+ return sequenceNumber;
+ }
+
+ public String getxPosition() {
+ return xPosition;
+ }
+
+ public String getyPosition() {
+ return yPosition;
+ }
+
+ public String getzPosition() {
+ return zPosition;
+ }
+
+ public void setSequenceNumber(final Integer sequenceNumber) {
+ this.sequenceNumber = sequenceNumber;
+ }
+
+ public void setxPosition(final String xPosition) {
+ this.xPosition = xPosition;
+ }
+
+ public void setyPosition(final String yPosition) {
+ this.yPosition = yPosition;
+ }
+
+ public void setzPosition(final String zPosition) {
+ this.zPosition = zPosition;
+ }
+
+ @Override
+ public boolean equals(final Object o) {
+
+ if (this == o) {
+ return true;
+ }
+
+ if (!(o instanceof PositionPointJpa)) {
+ return false;
+ }
+
+ final PositionPointJpa that = (PositionPointJpa) o;
+
+ if (getSequenceNumber() == null
+ ? that.getSequenceNumber() != null
+ : !getSequenceNumber().equals(that.getSequenceNumber())) {
+ return false;
+ }
+
+ if (getxPosition() == null
+ ? that.getxPosition() != null
+ : !getxPosition().equals(that.getxPosition())) {
+ return false;
+ }
+
+ if (getyPosition() == null
+ ? that.getyPosition() != null
+ : !getyPosition().equals(that.getyPosition())) {
+ return false;
+ }
+
+ boolean result = false;
+
+ if (getzPosition() == null && that.getzPosition() == null) {
+
+ result = true;
+
+ } else if (getzPosition() != null && that.getzPosition() != null) {
+
+ result = getzPosition().equals(that.getzPosition());
+ }
+
+ return result;
+ }
+
+ @Override
+ public int hashCode() {
+ int result = getSequenceNumber() == null ? 0 : getSequenceNumber().hashCode();
+ result = 31 * result + (getxPosition() == null ? 0 : getxPosition().hashCode());
+ result = 31 * result + (getyPosition() == null ? 0 : getyPosition().hashCode());
+ result = 31 * result + (getzPosition() == null ? 0 : getzPosition().hashCode());
+ return result;
+ }
+} \ No newline at end of file
diff --git a/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/common/StreetAddressJpa.java b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/common/StreetAddressJpa.java
new file mode 100644
index 00000000..c911093f
--- /dev/null
+++ b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/common/StreetAddressJpa.java
@@ -0,0 +1,108 @@
+/**
+ ******************************************************************************
+ * Copyright © 2015-2017 BTC AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ ******************************************************************************
+ */
+package de.openkonsequenz.cimcache.model.jpa.common;
+
+import javax.persistence.Embeddable;
+
+/**
+ * General purpose street address information.
+ */
+@Embeddable
+public class StreetAddressJpa {
+
+ /**
+ * Street detail.
+ */
+ private StreetDetailJpa streetDetailJpa;
+
+ /**
+ * Postal code for the address.
+ * (Postleitzahl)
+ */
+ private String postalCode;
+
+ /**
+ * Town detail.
+ */
+ private TownDetailJpa townDetailJpa;
+
+ public StreetDetailJpa getStreetDetailJpa() {
+ return streetDetailJpa;
+ }
+
+ public String getPostalCode() {
+ return postalCode;
+ }
+
+ public TownDetailJpa getTownDetailJpa() {
+ return townDetailJpa;
+ }
+
+ public void setStreetDetailJpa(final StreetDetailJpa streetDetailJpa) {
+ this.streetDetailJpa = streetDetailJpa;
+ }
+
+ public void setPostalCode(final String postalCode) {
+ this.postalCode = postalCode;
+ }
+
+ public void setTownDetailJpa(final TownDetailJpa townDetailJpa) {
+ this.townDetailJpa = townDetailJpa;
+ }
+
+ @Override
+ public boolean equals(final Object o) {
+
+ if (this == o) {
+ return true;
+ }
+
+ if (!(o instanceof StreetAddressJpa)) {
+ return false;
+ }
+
+ final StreetAddressJpa that = (StreetAddressJpa) o;
+
+ if (getStreetDetailJpa() == null
+ ? that.getStreetDetailJpa() != null
+ : !getStreetDetailJpa().equals(that.getStreetDetailJpa())) {
+ return false;
+ }
+
+ if (getPostalCode() == null
+ ? that.getPostalCode() != null
+ : !getPostalCode().equals(that.getPostalCode())) {
+ return false;
+ }
+
+ boolean result = false;
+
+ if (getTownDetailJpa() == null && that.getTownDetailJpa() == null) {
+
+ result = true;
+
+ } else if (getTownDetailJpa() != null && that.getTownDetailJpa() != null) {
+
+ result = getTownDetailJpa().equals(that.getTownDetailJpa());
+ }
+
+ return result;
+ }
+
+ @Override
+ public int hashCode() {
+ int result = getStreetDetailJpa() == null ? 0 : getStreetDetailJpa().hashCode();
+ result = 31 * result + (getPostalCode() == null ? 0 : getPostalCode().hashCode());
+ result = 31 * result + (getTownDetailJpa() == null ? 0 : getTownDetailJpa().hashCode());
+ return result;
+ }
+} \ No newline at end of file
diff --git a/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/common/StreetDetailJpa.java b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/common/StreetDetailJpa.java
new file mode 100644
index 00000000..f291e15d
--- /dev/null
+++ b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/common/StreetDetailJpa.java
@@ -0,0 +1,86 @@
+/**
+ ******************************************************************************
+ * Copyright © 2015-2017 BTC AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ ******************************************************************************
+ */
+package de.openkonsequenz.cimcache.model.jpa.common;
+
+import javax.persistence.Embeddable;
+
+/**
+ * Street details, in the context of address.
+ */
+@Embeddable
+public class StreetDetailJpa {
+
+ /**
+ * Name of the street.
+ */
+ private String name;
+ /**
+ * Designator of the specific location on the street.
+ */
+ private String number;
+
+ public String getName() {
+ return name;
+ }
+
+ public String getNumber() {
+ return number;
+ }
+
+ public void setName(final String name) {
+ this.name = name;
+ }
+
+ public void setNumber(final String number) {
+ this.number = number;
+ }
+
+ @Override
+ public boolean equals(final Object o) {
+
+ if (this == o) {
+ return true;
+ }
+
+ if (!(o instanceof StreetDetailJpa)) {
+ return false;
+ }
+
+ final StreetDetailJpa that = (StreetDetailJpa) o;
+
+ if (getName() == null
+ ? that.getName() != null
+ : !getName().equals(that.getName())) {
+ return false;
+ }
+
+ boolean result = false;
+
+ if (getNumber() == null && that.getNumber() == null) {
+
+ result = true;
+
+ } else if (getNumber() != null && that.getNumber() != null) {
+
+ result = getNumber().equals(that.getNumber());
+ }
+
+ return result;
+ }
+
+ @Override
+ public int hashCode() {
+ int result = getName() == null ? 0 : getName().hashCode();
+ result = 31 * result + (getNumber() == null ? 0 : getNumber().hashCode());
+ return result;
+ }
+} \ No newline at end of file
diff --git a/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/common/TownDetailJpa.java b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/common/TownDetailJpa.java
new file mode 100644
index 00000000..ce664749
--- /dev/null
+++ b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/common/TownDetailJpa.java
@@ -0,0 +1,85 @@
+/**
+ ******************************************************************************
+ * Copyright © 2015-2017 BTC AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ ******************************************************************************
+ */
+package de.openkonsequenz.cimcache.model.jpa.common;
+
+import javax.persistence.Embeddable;
+
+/**
+ * Town details, in the context of address.
+ */
+@Embeddable
+public class TownDetailJpa {
+ /**
+ * Name of the country.
+ */
+ private String country;
+ /**
+ * Town name.
+ */
+ private String name;
+
+ public String getCountry() {
+ return country;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setCountry(final String country) {
+ this.country = country;
+ }
+
+ public void setName(final String name) {
+ this.name = name;
+ }
+
+ @Override
+ public boolean equals(final Object o) {
+
+ if (this == o) {
+ return true;
+ }
+
+ if (!(o instanceof TownDetailJpa)) {
+ return false;
+ }
+
+ final TownDetailJpa that = (TownDetailJpa) o;
+
+ if (getCountry() == null
+ ? that.getCountry() != null
+ : !getCountry().equals(that.getCountry())) {
+ return false;
+ }
+
+ boolean result = false;
+
+ if (getName() == null && that.getName() == null) {
+
+ result = true;
+
+ } else if (getName() != null && that.getName() != null) {
+
+ result = getName().equals(that.getName());
+ }
+
+ return result;
+ }
+
+ @Override
+ public int hashCode() {
+ int result = getCountry() == null ? 0 : getCountry().hashCode();
+ result = 31 * result + (getName() == null ? 0 : getName().hashCode());
+ return result;
+ }
+} \ No newline at end of file
diff --git a/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/core/AcDcTerminalJpa.java b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/core/AcDcTerminalJpa.java
new file mode 100644
index 00000000..0db95a54
--- /dev/null
+++ b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/core/AcDcTerminalJpa.java
@@ -0,0 +1,49 @@
+/**
+ ******************************************************************************
+ * Copyright © 2015-2017 BTC AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ ******************************************************************************
+ */
+package de.openkonsequenz.cimcache.model.jpa.core;
+
+import javax.persistence.Column;
+import javax.persistence.Convert;
+import javax.persistence.MappedSuperclass;
+
+import de.openkonsequenz.cimcache.model.jpa.util.Boolean2StringConverter;
+
+/**
+ * An electrical connection point (AC or DC) to a piece of conducting equipment.
+ * Terminals are connected at physical connection points called connectivity nodes.
+ */
+@MappedSuperclass
+public class AcDcTerminalJpa extends IdentifiedObjectJpa {
+
+ /**
+ * The connected status is related to a bus-branch model and the topological node
+ * to terminal relation. True implies the terminal is connected to the related
+ * topological node and false implies it is not.
+ * In a bus-branch model, the connected status is used to tell if equipment is
+ * disconnected without having to change the connectivity described by the
+ * topological node to terminal relation. A valid case is that conducting
+ * equipment can be connected in one end and open in the other. In particular for
+ * an AC line segment, where the reactive line charging can be significant, this
+ * is a relevant case.
+ */
+ @Convert(converter = Boolean2StringConverter.class)
+ @Column(name = "CONNECTED")
+ private Boolean connected;
+
+ public Boolean isConnected() {
+ return connected;
+ }
+
+ public void setConnected(final Boolean connected) {
+ this.connected = connected;
+ }
+} \ No newline at end of file
diff --git a/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/core/ConductingEquipmentJpa.java b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/core/ConductingEquipmentJpa.java
new file mode 100644
index 00000000..e721f63e
--- /dev/null
+++ b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/core/ConductingEquipmentJpa.java
@@ -0,0 +1,32 @@
+/**
+ ******************************************************************************
+ * Copyright © 2015-2017 BTC AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ ******************************************************************************
+ */
+package de.openkonsequenz.cimcache.model.jpa.core;
+
+import java.util.List;
+
+import javax.persistence.MappedSuperclass;
+import javax.persistence.Transient;
+
+@MappedSuperclass
+public class ConductingEquipmentJpa extends EquipmentJpa {
+
+ @Transient
+ private List<TerminalJpa> terminalJpaList;
+
+ public List<TerminalJpa> getTerminalJpaList() {
+ return terminalJpaList;
+ }
+
+ public void setTerminalJpaList(final List<TerminalJpa> terminalJpaList) {
+ this.terminalJpaList = terminalJpaList;
+ }
+}
diff --git a/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/core/ConnectivityNodeContainerJpa.java b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/core/ConnectivityNodeContainerJpa.java
new file mode 100644
index 00000000..66afc4c5
--- /dev/null
+++ b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/core/ConnectivityNodeContainerJpa.java
@@ -0,0 +1,39 @@
+/**
+ ******************************************************************************
+ * Copyright © 2015-2017 BTC AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ ******************************************************************************
+ */
+package de.openkonsequenz.cimcache.model.jpa.core;
+
+import java.util.List;
+
+import javax.persistence.CascadeType;
+import javax.persistence.JoinColumn;
+import javax.persistence.MappedSuperclass;
+import javax.persistence.OneToMany;
+
+/**
+ * A base class for all objects that may contain ConnectivityNodes or
+ * TopologicalNodes.
+ */
+@MappedSuperclass
+public class ConnectivityNodeContainerJpa extends PowerSystemResourceJpa {
+
+ @OneToMany(targetEntity = ConnectivityNodeJpa.class, cascade = CascadeType.PERSIST)
+ @JoinColumn(name = "EQUIPMENT_CONTAINER_OID")
+ private List<ConnectivityNodeJpa> connectivityNodeJpaList;
+
+ public List<ConnectivityNodeJpa> getConnectivityNodeJpaList() {
+ return connectivityNodeJpaList;
+ }
+
+ public void setConnectivityNodeJpaList(final List<ConnectivityNodeJpa> connectivityNodeJpaList) {
+ this.connectivityNodeJpaList = connectivityNodeJpaList;
+ }
+} \ No newline at end of file
diff --git a/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/core/ConnectivityNodeJpa.java b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/core/ConnectivityNodeJpa.java
new file mode 100644
index 00000000..a6a698e8
--- /dev/null
+++ b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/core/ConnectivityNodeJpa.java
@@ -0,0 +1,57 @@
+/**
+ ******************************************************************************
+ * Copyright © 2015-2017 BTC AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ ******************************************************************************
+ */
+package de.openkonsequenz.cimcache.model.jpa.core;
+
+import java.util.List;
+
+import javax.persistence.CascadeType;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.JoinColumn;
+import javax.persistence.OneToMany;
+import javax.persistence.Table;
+import javax.persistence.TableGenerator;
+
+/**
+ * Connectivity nodes are points where terminals of AC conducting equipment are
+ * connected together with zero impedance.
+ */
+@Entity
+@Table(name = "CONNECTIVITY_NODE")
+public class ConnectivityNodeJpa extends IdentifiedObjectJpa {
+
+ @Id
+ @TableGenerator(name = "ConnectivityNodeTableGen",
+ allocationSize = DEFAULT_ALLOCATION_SIZE,
+ table = "OPENK_STATICTOPOLOGY_SEQ_TABLE",
+ pkColumnName = "SEQ_NAME",
+ valueColumnName = "SEQ_COUNT",
+ pkColumnValue = "CONNECTIVITY_NODE_SEQ")
+ @GeneratedValue(strategy = GenerationType.TABLE, generator = "ConnectivityNodeTableGen")
+ @Column(name = "ID")
+ private Long id;
+
+ @OneToMany(targetEntity = TerminalJpa.class, cascade = CascadeType.PERSIST)
+ @JoinColumn(name = "CONNECTIVITY_NODE_ID")
+ private List<TerminalJpa> terminalJpaList;
+
+ public List<TerminalJpa> getTerminalJpaList() {
+ return terminalJpaList;
+ }
+
+ public void setTerminalJpaList(final List<TerminalJpa> terminalJpaList) {
+ this.terminalJpaList = terminalJpaList;
+ }
+} \ No newline at end of file
diff --git a/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/core/EquipmentContainerJpa.java b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/core/EquipmentContainerJpa.java
new file mode 100644
index 00000000..ad940a80
--- /dev/null
+++ b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/core/EquipmentContainerJpa.java
@@ -0,0 +1,172 @@
+/**
+ ******************************************************************************
+ * Copyright © 2015-2017 BTC AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ ******************************************************************************
+ */
+package de.openkonsequenz.cimcache.model.jpa.core;
+
+import java.sql.Timestamp;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.persistence.CascadeType;
+import javax.persistence.Column;
+import javax.persistence.DiscriminatorColumn;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Inheritance;
+import javax.persistence.InheritanceType;
+import javax.persistence.OneToMany;
+import javax.persistence.Table;
+import javax.persistence.TableGenerator;
+
+import de.openkonsequenz.cimcache.model.jpa.domain.CommunicationTypeJpa;
+import de.openkonsequenz.cimcache.model.jpa.util.Temporal;
+import de.openkonsequenz.cimcache.model.jpa.wires.SynchronousMachineJpa;
+
+/**
+ * A modeling construct to provide a root class for containing equipment.
+ */
+@Entity
+@Table(name = "EQUIPMENT_CONTAINER")
+@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
+@DiscriminatorColumn(name = "EQUIPMENT_CONTAINER_TYPE")
+public class EquipmentContainerJpa extends ConnectivityNodeContainerJpa implements Temporal {
+
+ @Id
+ @TableGenerator(name = "EquipmentContainerTableGen",
+ allocationSize = DEFAULT_ALLOCATION_SIZE,
+ table = "OPENK_STATICTOPOLOGY_SEQ_TABLE",
+ pkColumnName = "SEQ_NAME",
+ valueColumnName = "SEQ_COUNT",
+ pkColumnValue = "EQUIPMENT_CONTAINER_SEQ_ID")
+ @GeneratedValue(strategy = GenerationType.TABLE, generator = "EquipmentContainerTableGen")
+ @Column(name = "ID")
+ private Long id;
+
+ @Column(name = "OID")
+ private Long oid;
+
+ @Column(name = "VALID_FROM")
+ private Timestamp validFrom;
+
+ @Column(name = "VALID_TO")
+ private Timestamp validTo;
+
+ @OneToMany(cascade = {CascadeType.PERSIST, CascadeType.MERGE}, mappedBy = "equipmentContainerJpa")
+ private List<EquipmentJpa> equipmentJpaList;
+
+ /**
+ * Get all SynchronousMachine of this Substation which are valid for a specified timestamp
+ * and which have the defined CommunictionType EFR or FWT.
+ *
+ * @param timestamp
+ * @return
+ */
+ public List<EquipmentJpa> getEquipmentJpaListWithTimestampOnlySynchronousMachineJpa(
+ final Timestamp timestamp,
+ final CommunicationTypeJpa communicationTypeJpa) {
+
+ final List<EquipmentJpa> synchronousMachineJpaList = new ArrayList<>();
+
+ for (final EquipmentJpa equipmentJpa : getEquipmentJpaList()) {
+
+ if (equipmentJpa instanceof SynchronousMachineJpa
+ && equipmentJpa.getValidFrom().before(timestamp)
+ && communicationTypeJpa == null
+ && (equipmentJpa.getValidTo() == null || equipmentJpa.getValidTo().after(timestamp))) {
+
+ synchronousMachineJpaList.add(equipmentJpa);
+
+ } else if (equipmentJpa instanceof SynchronousMachineJpa
+ && equipmentJpa.getValidFrom() != null
+ && equipmentJpa.getValidFrom().before(timestamp)
+ && ((SynchronousMachineJpa) equipmentJpa).getCommunicationTypeJpa() != null
+ && ((SynchronousMachineJpa) equipmentJpa).getCommunicationTypeJpa().equals(communicationTypeJpa)
+ && (equipmentJpa.getValidTo() == null || equipmentJpa.getValidTo().after(timestamp))) {
+
+ synchronousMachineJpaList.add(equipmentJpa);
+ }
+ }
+
+ return synchronousMachineJpaList;
+ }
+
+ /**
+ * Get all SynchrnonousMachine of this Substation.
+ *
+ * @return List<SynchronousMachineJpa>
+ */
+ public List<SynchronousMachineJpa> getSynchronousMachineJpaList() {
+
+ final List<SynchronousMachineJpa> synchronousMachineJpaList = new ArrayList<>();
+
+ if (equipmentJpaList != null) {
+
+ for (final EquipmentJpa equipmentJpa : getEquipmentJpaList()) {
+
+ if (equipmentJpa instanceof SynchronousMachineJpa && equipmentJpa.getValidTo() == null) {
+
+ synchronousMachineJpaList.add((SynchronousMachineJpa) equipmentJpa);
+ }
+ }
+ }
+
+ return synchronousMachineJpaList;
+ }
+
+ public List<EquipmentJpa> getEquipmentJpaList() {
+ return equipmentJpaList;
+ }
+
+ public void setEquipmentJpaList(final List<EquipmentJpa> equipmentJpaList) {
+ this.equipmentJpaList = equipmentJpaList;
+ }
+
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(final Long id) {
+ this.id = id;
+ }
+
+ @Override
+ public Long getOid() {
+ return oid;
+ }
+
+ @Override
+ public void setOid(final Long oid) {
+ this.oid = oid;
+ }
+
+ @Override
+ public Timestamp getValidFrom() {
+ return validFrom;
+ }
+
+ @Override
+ public void setValidFrom(final Timestamp validFrom) {
+ this.validFrom = validFrom;
+ }
+
+ @Override
+ public Timestamp getValidTo() {
+ return validTo;
+ }
+
+ @Override
+ public void setValidTo(final Timestamp validTo) {
+ this.validTo = validTo;
+ }
+
+}
diff --git a/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/core/EquipmentJpa.java b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/core/EquipmentJpa.java
new file mode 100644
index 00000000..0018be24
--- /dev/null
+++ b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/core/EquipmentJpa.java
@@ -0,0 +1,108 @@
+/**
+ ******************************************************************************
+ * Copyright © 2015-2017 BTC AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ ******************************************************************************
+ */
+package de.openkonsequenz.cimcache.model.jpa.core;
+
+import java.sql.Timestamp;
+
+import javax.persistence.Column;
+import javax.persistence.Convert;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Inheritance;
+import javax.persistence.InheritanceType;
+import javax.persistence.JoinColumn;
+import javax.persistence.ManyToOne;
+import javax.persistence.TableGenerator;
+
+import de.openkonsequenz.cimcache.model.jpa.util.Boolean2StringConverter;
+import de.openkonsequenz.cimcache.model.jpa.util.Temporal;
+
+@Entity
+@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
+public abstract class EquipmentJpa extends PowerSystemResourceJpa implements Temporal {
+
+ @Id
+ @TableGenerator(name = "EquipmentTableGen",
+ allocationSize = DEFAULT_ALLOCATION_SIZE,
+ table = "OPENK_STATICTOPOLOGY_SEQ_TABLE",
+ pkColumnName = "SEQ_NAME",
+ valueColumnName = "SEQ_COUNT",
+ pkColumnValue = "EQUIPMENT_SEQ_ID")
+ @GeneratedValue(strategy = GenerationType.TABLE, generator = "EquipmentTableGen")
+ @Column(name = "ID")
+ private Long id;
+
+ @Column(name = "OID")
+ private Long oid;
+
+ @Column(name = "VALID_FROM")
+ private Timestamp validFrom;
+
+ @Column(name = "VALID_TO")
+ private Timestamp validTo;
+
+ @Convert(converter = Boolean2StringConverter.class)
+ @Column(name = "NORMALLY_IN_SERVICE")
+ private Boolean normallyInService;
+
+ @ManyToOne(targetEntity = EquipmentContainerJpa.class)
+ @JoinColumn(name = "EQUIPMENT_CONTAINER_OID", referencedColumnName = "OID")
+ private EquipmentContainerJpa equipmentContainerJpa;
+
+ public Boolean getNormallyInService() {
+ return normallyInService;
+ }
+
+ public void setNormallyInService(final Boolean normallyInService) {
+ this.normallyInService = normallyInService;
+ }
+
+ public EquipmentContainerJpa getEquipmentContainerJpa() {
+ return equipmentContainerJpa;
+ }
+
+ public void setEquipmentContainerJpa(final EquipmentContainerJpa equipmentContainerJpa) {
+ this.equipmentContainerJpa = equipmentContainerJpa;
+ }
+
+ @Override
+ public Long getOid() {
+ return oid;
+ }
+
+ @Override
+ public void setOid(final Long oid) {
+ this.oid = oid;
+ }
+
+ @Override
+ public Timestamp getValidFrom() {
+ return validFrom;
+ }
+
+ @Override
+ public void setValidFrom(final Timestamp validFrom) {
+ this.validFrom = validFrom;
+ }
+
+ @Override
+ public Timestamp getValidTo() {
+ return validTo;
+ }
+
+ @Override
+ public void setValidTo(final Timestamp validTo) {
+ this.validTo = validTo;
+ }
+}
diff --git a/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/core/GeographicalRegionJpa.java b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/core/GeographicalRegionJpa.java
new file mode 100644
index 00000000..02c6767a
--- /dev/null
+++ b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/core/GeographicalRegionJpa.java
@@ -0,0 +1,114 @@
+/**
+ ******************************************************************************
+ * Copyright © 2015-2017 BTC AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ ******************************************************************************
+ */
+package de.openkonsequenz.cimcache.model.jpa.core;
+
+import java.sql.Timestamp;
+import java.util.List;
+
+import javax.persistence.CascadeType;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.JoinColumn;
+import javax.persistence.OneToMany;
+import javax.persistence.Table;
+import javax.persistence.TableGenerator;
+
+import de.openkonsequenz.cimcache.model.jpa.util.Temporal;
+
+/**
+ * A geographical region of a power system network model.
+ * All SubGeographicRegions of a DSO.
+ * <p/>
+ * Gesamtnetzgebiet.
+ */
+@Entity
+@Table(name = "GEOGRAPHICAL_REGION")
+public class GeographicalRegionJpa extends IdentifiedObjectJpa implements Temporal {
+
+ @Id
+ @TableGenerator(name = "GeographicalRegionTableGen",
+ allocationSize = DEFAULT_ALLOCATION_SIZE,
+ table = "OPENK_STATICTOPOLOGY_SEQ_TABLE",
+ pkColumnName = "SEQ_NAME",
+ valueColumnName = "SEQ_COUNT",
+ pkColumnValue = "GEOGRAPHICAL_REGION_SEQ_ID")
+ @GeneratedValue(strategy = GenerationType.TABLE, generator = "GeographicalRegionTableGen")
+ @Column(name = "ID")
+ private Long id;
+
+ @Column(name = "OID")
+ private Long oid;
+
+ @Column(name = "VALID_FROM")
+ private Timestamp validFrom;
+
+ @Column(name = "VALID_TO")
+ private Timestamp validTo;
+
+ /**
+ * All sub-geograhpical regions within this geographical region.
+ */
+ @OneToMany(targetEntity = SubGeographicalRegionJpa.class, cascade = {CascadeType.PERSIST, CascadeType.MERGE})
+ @JoinColumn(referencedColumnName = "OID", name = "GEOGRAPHICAL_REGION_OID")
+ private List<SubGeographicalRegionJpa> subGeographicalRegionJpaList;
+
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(final Long id) {
+ this.id = id;
+ }
+
+ public List<SubGeographicalRegionJpa> getSubGeographicalRegionJpaList() {
+ return subGeographicalRegionJpaList;
+ }
+
+ public void setSubGeographicalRegionJpaList(final List<SubGeographicalRegionJpa> subGeographicalRegionJpaList) {
+ this.subGeographicalRegionJpaList = subGeographicalRegionJpaList;
+ }
+
+ @Override
+ public Long getOid() {
+ return oid;
+ }
+
+ @Override
+ public void setOid(final Long oid) {
+ this.oid = oid;
+ }
+
+ @Override
+ public Timestamp getValidFrom() {
+ return validFrom;
+ }
+
+ @Override
+ public void setValidFrom(final Timestamp validFrom) {
+ this.validFrom = validFrom;
+ }
+
+ @Override
+ public Timestamp getValidTo() {
+ return validTo;
+ }
+
+ @Override
+ public void setValidTo(final Timestamp validTo) {
+ this.validTo = validTo;
+ }
+
+}
+
diff --git a/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/core/IdentifiedObjectJpa.java b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/core/IdentifiedObjectJpa.java
new file mode 100644
index 00000000..4181b4cf
--- /dev/null
+++ b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/core/IdentifiedObjectJpa.java
@@ -0,0 +1,84 @@
+/**
+ ******************************************************************************
+ * Copyright © 2015-2017 BTC AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ ******************************************************************************
+ */
+package de.openkonsequenz.cimcache.model.jpa.core;
+
+import javax.persistence.Column;
+import javax.persistence.MappedSuperclass;
+
+@MappedSuperclass
+public class IdentifiedObjectJpa {
+
+ protected static final int DEFAULT_ALLOCATION_SIZE = 1;
+
+ @Column(name = "NAME")
+ protected String name;
+
+ @Column(name = "MRID")
+ protected String mRid;
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(final String name) {
+ this.name = name;
+ }
+
+ public String getmRid() {
+ return mRid;
+ }
+
+ public void setmRid(final String mRid) {
+ this.mRid = mRid;
+ }
+
+ @Override
+ public boolean equals(final Object o) {
+
+ if (this == o) {
+ return true;
+ }
+
+ if (!(o instanceof IdentifiedObjectJpa)) {
+ return false;
+ }
+
+ final IdentifiedObjectJpa that = (IdentifiedObjectJpa) o;
+
+ if (getName() == null
+ ? that.getName() != null
+ : !getName().equals(that.getName())) {
+ return false;
+ }
+
+ boolean result = false;
+
+ if (getmRid() == null && that.getmRid() == null) {
+
+ result = true;
+
+ } else if (getmRid() != null && that.getmRid() != null) {
+
+ result = getmRid().equals(that.getmRid());
+ }
+
+ return result;
+ }
+
+ @Override
+ public int hashCode() {
+ int result = getName() == null ? 0 : getName().hashCode();
+ result = 31 * result + (getmRid() == null ? 0 : getmRid().hashCode());
+ return result;
+ }
+
+}
diff --git a/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/core/OperatingParticipantJpa.java b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/core/OperatingParticipantJpa.java
new file mode 100644
index 00000000..1ee4c3a1
--- /dev/null
+++ b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/core/OperatingParticipantJpa.java
@@ -0,0 +1,44 @@
+/**
+ ******************************************************************************
+ * Copyright © 2015-2017 BTC AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ ******************************************************************************
+ */
+package de.openkonsequenz.cimcache.model.jpa.core;
+
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Table;
+import javax.persistence.TableGenerator;
+
+/**
+ * An operator of multiple power system resource objects. Note multple operating
+ * participants may operate the same power system resource object. This can be
+ * used for modeling jointly owned units where each owner operates as a
+ * contractual share.
+ */
+@Entity
+@Table(name = "OPERATING_PARTICIPANT")
+public class OperatingParticipantJpa extends IdentifiedObjectJpa {
+
+ @Id
+ @TableGenerator(name = "OperatingParticipantTableGen",
+ allocationSize = DEFAULT_ALLOCATION_SIZE,
+ table = "OPENK_STATICTOPOLOGY_SEQ_TABLE",
+ pkColumnName = "SEQ_NAME",
+ valueColumnName = "SEQ_COUNT",
+ pkColumnValue = "OPERATING_PARTICIPANT_SEQ")
+ @GeneratedValue(strategy = GenerationType.TABLE, generator = "OperatingParticipantTableGen")
+ @Column(name = "ID")
+ private Long id;
+
+} \ No newline at end of file
diff --git a/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/core/OperatingShareJpa.java b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/core/OperatingShareJpa.java
new file mode 100644
index 00000000..2820ecbe
--- /dev/null
+++ b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/core/OperatingShareJpa.java
@@ -0,0 +1,124 @@
+/**
+ ******************************************************************************
+ * Copyright © 2015-2017 BTC AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ ******************************************************************************
+ */
+package de.openkonsequenz.cimcache.model.jpa.core;
+
+
+import javax.persistence.AttributeOverride;
+import javax.persistence.CascadeType;
+import javax.persistence.Column;
+import javax.persistence.Embedded;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.JoinColumn;
+import javax.persistence.ManyToOne;
+import javax.persistence.Table;
+import javax.persistence.TableGenerator;
+
+import de.openkonsequenz.cimcache.model.jpa.domain.PerCentJpa;
+
+/**
+ * Specifies the operations contract relationship between a power system resource
+ * and a contract participant.
+ */
+@Entity
+@Table(name = "OPERATING_SHARE")
+public class OperatingShareJpa {
+
+ @Id
+ @TableGenerator(name = "OperatingShareTableGen",
+ allocationSize = 1,
+ table = "OPENK_STATICTOPOLOGY_SEQ_TABLE",
+ pkColumnName = "SEQ_NAME",
+ valueColumnName = "SEQ_COUNT",
+ pkColumnValue = "OPERATING_SHARE_SEQ")
+ @GeneratedValue(strategy = GenerationType.TABLE, generator = "OperatingShareTableGen")
+ @Column(name = "ID")
+ private Long id;
+
+ /**
+ * Percentage operational ownership between the pair (power system resource and
+ * operatging participant) associated with this share. The total percentage
+ * ownership for a power system resource should add to 100%.
+ */
+ @Embedded
+ @AttributeOverride(name = "value", column = @Column(name = "SHARE_PER_CENT"))
+ private PerCentJpa percentage;
+
+ /**
+ * The operating participant having this share with the associated power system
+ * resource.
+ */
+ @ManyToOne(cascade = CascadeType.PERSIST)
+ @JoinColumn(name = "OPERATING_PARTICIPANT_ID", referencedColumnName = "ID")
+ private OperatingParticipantJpa operatingParticipantJpa;
+
+ public PerCentJpa getPercentage() {
+ return percentage;
+ }
+
+ public void setPercentage(final PerCentJpa percentage) {
+ this.percentage = percentage;
+ }
+
+ public OperatingParticipantJpa getOperatingParticipantJpa() {
+ return operatingParticipantJpa;
+ }
+
+ public void setOperatingParticipantJpa(final OperatingParticipantJpa operatingParticipantJpa) {
+ this.operatingParticipantJpa = operatingParticipantJpa;
+ }
+
+ @Override
+ public boolean equals(final Object o) {
+
+ if (this == o) {
+ return true;
+ }
+
+ if (!(o instanceof OperatingShareJpa)) {
+ return false;
+ }
+
+ final OperatingShareJpa that = (OperatingShareJpa) o;
+
+ if (getPercentage() == null
+ ? that.getPercentage() != null
+ : !getPercentage().equals(that.getPercentage())) {
+ return false;
+ }
+
+ boolean result = false;
+
+ if (getOperatingParticipantJpa() == null
+ && that.getOperatingParticipantJpa() == null) {
+
+ result = true;
+
+ } else if (getOperatingParticipantJpa() != null && that.getOperatingParticipantJpa() != null) {
+
+ result = getOperatingParticipantJpa().getmRid().equals(that.getOperatingParticipantJpa().getmRid())
+ && getOperatingParticipantJpa().getName().equals(that.getOperatingParticipantJpa().getName());
+
+ }
+
+ return result;
+ }
+
+ @Override
+ public int hashCode() {
+ int result = getPercentage() == null ? 0 : getPercentage().hashCode();
+ result = 31 * result + (getOperatingParticipantJpa() == null ? 0 : getOperatingParticipantJpa().hashCode());
+ return result;
+ }
+} \ No newline at end of file
diff --git a/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/core/PowerSystemResourceJpa.java b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/core/PowerSystemResourceJpa.java
new file mode 100644
index 00000000..3c78f2cf
--- /dev/null
+++ b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/core/PowerSystemResourceJpa.java
@@ -0,0 +1,76 @@
+/**
+ ******************************************************************************
+ * Copyright © 2015-2017 BTC AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ ******************************************************************************
+ */
+package de.openkonsequenz.cimcache.model.jpa.core;
+
+import java.util.List;
+
+import javax.persistence.Access;
+import javax.persistence.AccessType;
+import javax.persistence.CascadeType;
+import javax.persistence.JoinColumn;
+import javax.persistence.ManyToOne;
+import javax.persistence.MappedSuperclass;
+import javax.persistence.Transient;
+
+import de.openkonsequenz.cimcache.model.jpa.common.LocationJpa;
+import de.openkonsequenz.cimcache.model.jpa.informative.infoperations.PsrEventJpa;
+import de.openkonsequenz.cimcache.model.jpa.meas.AnalogJpa;
+
+@MappedSuperclass
+@Access(AccessType.FIELD)
+public class PowerSystemResourceJpa extends IdentifiedObjectJpa {
+
+ @Transient
+ private List<AnalogJpa> analogJpaList;
+
+ @Transient
+ private List<OperatingShareJpa> operatingShareJpaList;
+
+ @Transient
+ private List<PsrEventJpa> psrEventJpaList;
+
+ @ManyToOne(cascade = CascadeType.PERSIST)
+ @JoinColumn(name = "LOCATION_ID")
+ private LocationJpa locationJpa;
+
+ public List<OperatingShareJpa> getOperatingShareJpaList() {
+ return operatingShareJpaList;
+ }
+
+ public void setOperatingShareJpaList(final List<OperatingShareJpa> operatingShareJpaList) {
+ this.operatingShareJpaList = operatingShareJpaList;
+ }
+
+ public List<PsrEventJpa> getPsrEventJpaList() {
+ return psrEventJpaList;
+ }
+
+ public void setPsrEventJpaList(final List<PsrEventJpa> psrEventJpaList) {
+ this.psrEventJpaList = psrEventJpaList;
+ }
+
+ public LocationJpa getLocationJpa() {
+ return locationJpa;
+ }
+
+ public void setLocationJpa(final LocationJpa locationJpa) {
+ this.locationJpa = locationJpa;
+ }
+
+ public List<AnalogJpa> getAnalogJpaList() {
+ return analogJpaList;
+ }
+
+ public void setAnalogJpaList(final List<AnalogJpa> analogJpaList) {
+ this.analogJpaList = analogJpaList;
+ }
+}
diff --git a/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/core/SubGeographicalRegionJpa.java b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/core/SubGeographicalRegionJpa.java
new file mode 100644
index 00000000..ca9400c0
--- /dev/null
+++ b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/core/SubGeographicalRegionJpa.java
@@ -0,0 +1,132 @@
+/**
+ ******************************************************************************
+ * Copyright © 2015-2017 BTC AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ ******************************************************************************
+ */
+package de.openkonsequenz.cimcache.model.jpa.core;
+
+import java.sql.Timestamp;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.persistence.CascadeType;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.JoinColumn;
+import javax.persistence.OneToMany;
+import javax.persistence.Table;
+import javax.persistence.TableGenerator;
+
+import de.openkonsequenz.cimcache.model.jpa.util.Temporal;
+
+/**
+ * A subset of a geographical region of a power system network model.
+ * <p/>
+ * Netzgebiet
+ */
+@Entity
+@Table(name = "SUBGEOGRAPHICAL_REGION")
+public class SubGeographicalRegionJpa extends IdentifiedObjectJpa implements Temporal {
+
+ @Id
+ @TableGenerator(name = "SubGeographicalRegionTableGen",
+ allocationSize = DEFAULT_ALLOCATION_SIZE,
+ table = "OPENK_STATICTOPOLOGY_SEQ_TABLE",
+ pkColumnName = "SEQ_NAME",
+ valueColumnName = "SEQ_COUNT",
+ pkColumnValue = "SUBGEOGRAPHICAL_REGION_SEQ_ID")
+ @GeneratedValue(strategy = GenerationType.TABLE, generator = "SubGeographicalRegionTableGen")
+ @Column(name = "ID")
+ private Long id;
+
+ @Column(name = "OID")
+ private Long oid;
+
+ @Column(name = "VALID_FROM")
+ private Timestamp validFrom;
+
+ @Column(name = "VALID_TO")
+ private Timestamp validTo;
+
+ @OneToMany(targetEntity = SubstationJpa.class, cascade = {CascadeType.PERSIST, CascadeType.MERGE})
+ @JoinColumn(referencedColumnName = "OID", name = "SUBGEOGRAPHICAL_REGION_OID")
+ private List<SubstationJpa> substationJpaList;
+
+ /**
+ * Gets all Substation of this GeographicalRegion which are Transformer Station.
+ * A Substation is a Transformer Station if it has two VoltageLevel and one VoltageLevel
+ * has 110kV.
+ *
+ * @return
+ */
+ public List<SubstationJpa> getTransformerStationList() {
+
+ final List<SubstationJpa> transformerStationList = new ArrayList<>();
+
+ for (final SubstationJpa substationJpa : getSubstationJpaList()) {
+
+ if (substationJpa.isTransformerStation()) {
+
+ transformerStationList.add(substationJpa);
+ }
+ }
+
+ return transformerStationList;
+ }
+
+
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(final Long id) {
+ this.id = id;
+ }
+
+ public List<SubstationJpa> getSubstationJpaList() {
+ return substationJpaList;
+ }
+
+ public void setSubstationJpaList(final List<SubstationJpa> substationJpaList) {
+ this.substationJpaList = substationJpaList;
+ }
+
+ @Override
+ public Long getOid() {
+ return oid;
+ }
+
+ @Override
+ public void setOid(final Long oid) {
+ this.oid = oid;
+ }
+
+ @Override
+ public Timestamp getValidFrom() {
+ return validFrom;
+ }
+
+ @Override
+ public void setValidFrom(final Timestamp validFrom) {
+ this.validFrom = validFrom;
+ }
+
+ @Override
+ public Timestamp getValidTo() {
+ return validTo;
+ }
+
+ @Override
+ public void setValidTo(final Timestamp validTo) {
+ this.validTo = validTo;
+ }
+}
diff --git a/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/core/SubstationJpa.java b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/core/SubstationJpa.java
new file mode 100644
index 00000000..1deee6ff
--- /dev/null
+++ b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/core/SubstationJpa.java
@@ -0,0 +1,106 @@
+/**
+ ******************************************************************************
+ * Copyright © 2015-2017 BTC AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ ******************************************************************************
+ */
+package de.openkonsequenz.cimcache.model.jpa.core;
+
+import java.math.BigDecimal;
+import java.util.List;
+
+import javax.persistence.CascadeType;
+import javax.persistence.DiscriminatorValue;
+import javax.persistence.Entity;
+import javax.persistence.JoinColumn;
+import javax.persistence.ManyToOne;
+import javax.persistence.OneToMany;
+
+import de.openkonsequenz.cimcache.model.jpa.domain.UnitMultiplierJpa;
+import de.openkonsequenz.cimcache.model.jpa.domain.VoltageJpa;
+
+/**
+ * A collection of equipment for purposes other than generation or utilization,
+ * through which electric energy in bulk is passed for the purposes of switching
+ * or modifying its characteristics.
+ */
+@Entity
+@DiscriminatorValue("SubstationType")
+public class SubstationJpa extends EquipmentContainerJpa {
+
+ /**
+ * The association is used in the naming hierarchy.
+ */
+ @OneToMany(targetEntity = VoltageLevelJpa.class, cascade = CascadeType.PERSIST)
+ @JoinColumn(referencedColumnName = "OID", name = "EQUIPMENT_CONTAINER_OID")
+ private List<VoltageLevelJpa> voltageLevelJpaList;
+
+ @ManyToOne(targetEntity = SubGeographicalRegionJpa.class)
+ @JoinColumn(name = "SUBGEOGRAPHICAL_REGION_OID", referencedColumnName = "OID", updatable = false, insertable = false)
+ private SubGeographicalRegionJpa subGeographicalRegionJpa;
+
+ /**
+ * Is this Substation a Transformer Station.
+ */
+ public boolean isTransformerStation() {
+
+ boolean result = false;
+
+ if (!voltageLevelJpaList.isEmpty() && voltageLevelJpaList.size() == 2) {
+
+ for (final VoltageLevelJpa voltageLevelJpa : voltageLevelJpaList) {
+
+ final VoltageJpa voltageJpa = voltageLevelJpa.getHighVoltageJpaLimit();
+
+ final VoltageJpa voltage110kV = new VoltageJpa();
+ voltage110kV.setMultiplier(UnitMultiplierJpa.KILO);
+ voltage110kV.setValue(BigDecimal.valueOf(110L));
+
+ if (voltageJpa != null && voltageJpa.getValue().compareTo(voltage110kV.getValue()) == 0
+ && voltageJpa.getMultiplier().equals(voltage110kV.getMultiplier())
+ && voltageJpa.getUnit().equals(voltage110kV.getUnit())) {
+
+ result = true;
+ }
+ }
+ }
+
+ return result;
+ }
+
+ public boolean hasEqualData(final SubstationJpa that) {
+
+ boolean result = false;
+
+ if (this.getmRid().equals(that.getmRid())
+ && this.getName().equals(that.getName())
+ && this.getmRid().equals(that.getmRid())) {
+
+ result = true;
+ }
+
+ return result;
+ }
+
+ public List<VoltageLevelJpa> getVoltageLevelJpaList() {
+ return voltageLevelJpaList;
+ }
+
+ public void setVoltageLevelJpaList(final List<VoltageLevelJpa> voltageLevelJpaList) {
+
+ this.voltageLevelJpaList = voltageLevelJpaList;
+ }
+
+ public SubGeographicalRegionJpa getSubGeographicalRegionJpa() {
+ return subGeographicalRegionJpa;
+ }
+
+ public void setSubGeographicalRegionJpa(final SubGeographicalRegionJpa subGeographicalRegionJpa) {
+ this.subGeographicalRegionJpa = subGeographicalRegionJpa;
+ }
+} \ No newline at end of file
diff --git a/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/core/TerminalJpa.java b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/core/TerminalJpa.java
new file mode 100644
index 00000000..3611fa1d
--- /dev/null
+++ b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/core/TerminalJpa.java
@@ -0,0 +1,84 @@
+/**
+ ******************************************************************************
+ * Copyright © 2015-2017 BTC AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ ******************************************************************************
+ */
+package de.openkonsequenz.cimcache.model.jpa.core;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.JoinColumn;
+import javax.persistence.ManyToOne;
+import javax.persistence.Table;
+import javax.persistence.TableGenerator;
+
+import com.fasterxml.jackson.annotation.JsonIgnore;
+
+import de.openkonsequenz.cimcache.model.jpa.wires.AcLineSegmentJpa;
+import de.openkonsequenz.cimcache.model.jpa.wires.SwitchJpa;
+
+/**
+ * An AC electrical connection point to a piece of conducting equipment. Terminals
+ * are connected at physical connection points called connectivity nodes.
+ */
+@Entity
+@Table(name = "TERMINAL")
+public class TerminalJpa extends AcDcTerminalJpa {
+
+ @JsonIgnore
+ @Id
+ @TableGenerator(name = "TerminalTableGen",
+ allocationSize = DEFAULT_ALLOCATION_SIZE,
+ table = "OPENK_STATICTOPOLOGY_SEQ_TABLE",
+ pkColumnName = "SEQ_NAME",
+ valueColumnName = "SEQ_COUNT",
+ pkColumnValue = "TERMINAL_SEQ")
+ @GeneratedValue(strategy = GenerationType.TABLE, generator = "TerminalTableGen")
+ @Column(name = "ID")
+ private Long id;
+
+ @ManyToOne
+ @JoinColumn(name = "CONNECTIVITY_NODE_ID", referencedColumnName = "ID", insertable = false, updatable = false)
+ private ConnectivityNodeJpa connectivityNodeJpa;
+
+ @ManyToOne
+ @JoinColumn(name = "AC_LINE_SEGMENT_ID", referencedColumnName = "ID", insertable = false, updatable = false)
+ private AcLineSegmentJpa acLineSegmentJpa;
+
+ @ManyToOne
+ @JoinColumn(name = "SWITCH_ID", referencedColumnName = "ID", insertable = false, updatable = false)
+ private SwitchJpa switchJpa;
+
+ public ConnectivityNodeJpa getConnectivityNodeJpa() {
+ return connectivityNodeJpa;
+ }
+
+ public void setConnectivityNodeJpa(final ConnectivityNodeJpa connectivityNodeJpa) {
+ this.connectivityNodeJpa = connectivityNodeJpa;
+ }
+
+ public AcLineSegmentJpa getAcLineSegmentJpa() {
+ return acLineSegmentJpa;
+ }
+
+ public void setAcLineSegmentJpa(final AcLineSegmentJpa acLineSegmentJpa) {
+ this.acLineSegmentJpa = acLineSegmentJpa;
+ }
+
+ public SwitchJpa getSwitchJpa() {
+ return switchJpa;
+ }
+
+ public void setSwitchJpa(final SwitchJpa switchJpa) {
+ this.switchJpa = switchJpa;
+ }
+} \ No newline at end of file
diff --git a/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/core/VoltageLevelJpa.java b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/core/VoltageLevelJpa.java
new file mode 100644
index 00000000..ba2e7e65
--- /dev/null
+++ b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/core/VoltageLevelJpa.java
@@ -0,0 +1,50 @@
+/**
+ ******************************************************************************
+ * Copyright © 2015-2017 BTC AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ ******************************************************************************
+ */
+package de.openkonsequenz.cimcache.model.jpa.core;
+
+import javax.persistence.AttributeOverride;
+import javax.persistence.AttributeOverrides;
+import javax.persistence.Column;
+import javax.persistence.DiscriminatorValue;
+import javax.persistence.Embedded;
+import javax.persistence.Entity;
+
+import de.openkonsequenz.cimcache.model.jpa.domain.VoltageJpa;
+
+/**
+ * A collection of equipment at one common system voltage forming a switchgear.
+ * The equipment typically consist of breakers, busbars, instrumentation, control,
+ * regulation and protection devices as well as assemblies of all these.
+ */
+@Entity
+@DiscriminatorValue("VoltageLevelType")
+public class VoltageLevelJpa extends EquipmentContainerJpa {
+
+ /**
+ * The bus bar's high voltage limit
+ */
+ @Embedded
+ @AttributeOverrides({
+ @AttributeOverride(name = "value", column = @Column(name = "HIGH_VOLTAGE_LIMIT_VALUE")),
+ @AttributeOverride(name = "multiplier", column = @Column(name = "HIGH_VOLTAGE_LIMIT_UNIT_MULTIPLIER")),
+ @AttributeOverride(name = "unit", column = @Column(name = "HIGH_VOLTAGE_LIMIT_UNIT_SYMBOL"))
+ })
+ private VoltageJpa highVoltageJpaLimit;
+
+ public VoltageJpa getHighVoltageJpaLimit() {
+ return highVoltageJpaLimit;
+ }
+
+ public void setHighVoltageJpaLimit(final VoltageJpa highVoltageJpaLimit) {
+ this.highVoltageJpaLimit = highVoltageJpaLimit;
+ }
+} \ No newline at end of file
diff --git a/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/domain/AbsoluteDateTimeJpa.java b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/domain/AbsoluteDateTimeJpa.java
new file mode 100644
index 00000000..e5f33cb5
--- /dev/null
+++ b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/domain/AbsoluteDateTimeJpa.java
@@ -0,0 +1,75 @@
+/**
+ ******************************************************************************
+ * Copyright © 2015-2017 BTC AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ ******************************************************************************
+ */
+package de.openkonsequenz.cimcache.model.jpa.domain;
+
+import java.sql.Timestamp;
+
+import javax.persistence.Embeddable;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+
+/**
+ * Date and time as "yyyy-mm-ddThh:mm:ss.sss", which conforms with ISO 8601. UTC
+ * time zone is specified as "yyyy-mm-ddThh:mm:ss.sssZ". A local timezone relative
+ * UTC is specified as "yyyy-mm-ddThh:mm:ss.sss-hh:mm".
+ * AbsoluteDateTime can be used both for calender time, e.g. 2007-02-07T10:30, and
+ * for relative time, e.g. 10:30.
+ */
+@Embeddable
+public class AbsoluteDateTimeJpa {
+
+ /**
+ * String representation of date and time, refer to description of the class.
+ */
+ @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "dd.MM.yyyy hh:mm:ss", timezone = "CET")
+ private Timestamp value;
+
+ public Timestamp getValue() {
+ return value;
+ }
+
+ public void setValue(final Timestamp value) {
+ this.value = value;
+ }
+
+ @Override
+ public boolean equals(final Object o) {
+
+ if (this == o) {
+ return true;
+ }
+
+ if (!(o instanceof AbsoluteDateTimeJpa)) {
+ return false;
+ }
+
+ final AbsoluteDateTimeJpa that = (AbsoluteDateTimeJpa) o;
+
+ boolean result = false;
+
+ if (getValue() == null && that.getValue() == null) {
+
+ result = true;
+
+ } else if (getValue() != null && that.getValue() != null) {
+
+ result = getValue().equals(that.getValue());
+ }
+
+ return result;
+ }
+
+ @Override
+ public int hashCode() {
+ return getValue() == null ? 0 : getValue().hashCode();
+ }
+} \ No newline at end of file
diff --git a/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/domain/ActivePowerJpa.java b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/domain/ActivePowerJpa.java
new file mode 100644
index 00000000..fd3691eb
--- /dev/null
+++ b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/domain/ActivePowerJpa.java
@@ -0,0 +1,103 @@
+/**
+ ******************************************************************************
+ * Copyright © 2015-2017 BTC AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ ******************************************************************************
+ */
+package de.openkonsequenz.cimcache.model.jpa.domain;
+
+import java.math.BigDecimal;
+
+import javax.persistence.Embeddable;
+import javax.persistence.EnumType;
+import javax.persistence.Enumerated;
+
+import com.google.common.collect.ComparisonChain;
+
+/**
+ * Product of RMS value of the voltage and the RMS value of the in-phase component
+ * of the current
+ */
+@Embeddable
+public class ActivePowerJpa implements Comparable<ActivePowerJpa> {
+
+ private BigDecimal value;
+
+ @Enumerated(EnumType.STRING)
+ private UnitMultiplierJpa multiplier;
+
+ @Enumerated(EnumType.STRING)
+ private UnitSymbolJpa unit;
+
+ public BigDecimal getValue() {
+ return value;
+ }
+
+ public UnitMultiplierJpa getMultiplier() {
+ return multiplier;
+ }
+
+ public UnitSymbolJpa getUnit() {
+ return unit;
+ }
+
+ public void setValue(final BigDecimal value) {
+ this.value = value;
+ }
+
+ public void setMultiplier(final UnitMultiplierJpa multiplier) {
+ this.multiplier = multiplier;
+ }
+
+ public void setUnit(final UnitSymbolJpa unit) {
+ this.unit = unit;
+ }
+
+ @Override
+ public int compareTo(final ActivePowerJpa that) {
+ return ComparisonChain.start()
+ .compare(this.value, that.value)
+ .compare(this.multiplier, that.multiplier)
+ .compare(this.unit, that.unit)
+ .result();
+ }
+
+ @Override
+ public boolean equals(final Object o) {
+
+ if (this == o) {
+ return true;
+ }
+
+ if (!(o instanceof ActivePowerJpa)) {
+ return false;
+ }
+
+ final ActivePowerJpa that = (ActivePowerJpa) o;
+
+ if (getValue() == null
+ ? that.getValue() != null
+ : !getValue().equals(that.getValue())) {
+ return false;
+ }
+
+ if (getMultiplier() != that.getMultiplier()) {
+ return false;
+ }
+
+ return getUnit() == that.getUnit();
+ }
+
+ @Override
+ public int hashCode() {
+ int result = getValue() == null ? 0 : getValue().hashCode();
+ result = 31 * result + (getMultiplier() == null ? 0 : getMultiplier().hashCode());
+ result = 31 * result + (getUnit() == null ? 0 : getUnit().hashCode());
+ return result;
+ }
+} \ No newline at end of file
diff --git a/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/domain/CommunicationTypeJpa.java b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/domain/CommunicationTypeJpa.java
new file mode 100644
index 00000000..0bd2f73f
--- /dev/null
+++ b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/domain/CommunicationTypeJpa.java
@@ -0,0 +1,33 @@
+/**
+ ******************************************************************************
+ * Copyright © 2015-2017 BTC AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ ******************************************************************************
+ */
+package de.openkonsequenz.cimcache.model.jpa.domain;
+
+/**
+ * Communication Type EFR, FWT, TRA
+ * CIM extension by Jan Krueger, April 2015
+ */
+public enum CommunicationTypeJpa {
+ EFR("EFR"),
+ FWT("FWT"),
+ TRA("TRA");
+
+ private final String value;
+
+ private CommunicationTypeJpa(final String value) {
+ this.value = value;
+ }
+
+ public String value() {
+ return this.value;
+ }
+
+}
diff --git a/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/domain/PerCentJpa.java b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/domain/PerCentJpa.java
new file mode 100644
index 00000000..2ad265d8
--- /dev/null
+++ b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/domain/PerCentJpa.java
@@ -0,0 +1,70 @@
+/**
+ ******************************************************************************
+ * Copyright © 2015-2017 BTC AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ ******************************************************************************
+ */
+package de.openkonsequenz.cimcache.model.jpa.domain;
+
+import javax.persistence.Embeddable;
+
+/**
+ * 0 - 100 on a defined base
+ */
+@Embeddable
+public class PerCentJpa {
+
+ private static final UnitMultiplierJpa MULTIPLIER = UnitMultiplierJpa.NONE;
+
+ private static final UnitSymbolJpa UNIT = UnitSymbolJpa.NONE;
+
+ /**
+ * 0 - 100 on a defined base
+ */
+ private Integer value;
+
+ public Integer getValue() {
+ return value;
+ }
+
+ public void setValue(final Integer value) {
+ this.value = value;
+ }
+
+ @Override
+ public boolean equals(final Object o) {
+
+ if (this == o) {
+ return true;
+ }
+
+ if (!(o instanceof PerCentJpa)) {
+ return false;
+ }
+
+ final PerCentJpa that = (PerCentJpa) o;
+
+ boolean result = false;
+
+ if (getValue() == null && that.getValue() == null) {
+
+ result = true;
+
+ } else if (getValue() != null && that.getValue() != null) {
+
+ result = getValue().equals(that.getValue());
+ }
+
+ return result;
+ }
+
+ @Override
+ public int hashCode() {
+ return getValue() == null ? 0 : getValue().hashCode();
+ }
+} \ No newline at end of file
diff --git a/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/domain/ReductionSettingJpa.java b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/domain/ReductionSettingJpa.java
new file mode 100644
index 00000000..e7c40aeb
--- /dev/null
+++ b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/domain/ReductionSettingJpa.java
@@ -0,0 +1,95 @@
+/**
+ ******************************************************************************
+ * Copyright © 2015-2017 BTC AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ ******************************************************************************
+ */
+package de.openkonsequenz.cimcache.model.jpa.domain;
+
+import javax.persistence.AttributeOverride;
+import javax.persistence.Column;
+import javax.persistence.Embedded;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Table;
+import javax.persistence.TableGenerator;
+
+import com.google.common.collect.ComparisonChain;
+
+/**
+ * A Reduction Setting of a SynchronousMachine.
+ * CIM extension by Jan Krueger, April 2015
+ */
+@Entity
+@Table(name = "REDUCTION_SETTING")
+public class ReductionSettingJpa implements Comparable<ReductionSettingJpa> {
+
+ @Id
+ @TableGenerator(name = "ReductionSettingTableGen",
+ allocationSize = 1,
+ table = "OPENK_STATICTOPOLOGY_SEQ_TABLE",
+ pkColumnName = "SEQ_NAME",
+ valueColumnName = "SEQ_COUNT",
+ pkColumnValue = "REDUCTION_SETTING_SEQ")
+ @GeneratedValue(strategy = GenerationType.TABLE, generator = "ReductionSettingTableGen")
+ @Column(name = "ID")
+ private Long id;
+
+ @Embedded
+ @AttributeOverride(name = "value", column = @Column(name = "REDUCTION_SETTING_PER_CENT"))
+ private PerCentJpa setting;
+
+ @Override
+ public boolean equals(final Object o) {
+
+ if (this == o) {
+ return true;
+ }
+
+ if (!(o instanceof ReductionSettingJpa)) {
+ return false;
+ }
+
+ final ReductionSettingJpa that = (ReductionSettingJpa) o;
+
+ boolean result = false;
+
+ if (getSetting() == null && that.getSetting() == null) {
+
+ result = true;
+
+ } else if (getSetting() != null && that.getSetting() != null) {
+
+ result = getSetting().equals(that.getSetting());
+ }
+
+ return result;
+ }
+
+ @Override
+ public int hashCode() {
+ return getSetting() == null ? 0 : getSetting().hashCode();
+ }
+
+ public PerCentJpa getSetting() {
+ return setting;
+ }
+
+ public void setSetting(final PerCentJpa setting) {
+ this.setting = setting;
+ }
+
+ @Override
+ public int compareTo(final ReductionSettingJpa that) {
+ return ComparisonChain.start()
+ .compare(this.setting.getValue(), that.setting.getValue())
+ .result();
+ }
+}
diff --git a/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/domain/UnitMultiplierJpa.java b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/domain/UnitMultiplierJpa.java
new file mode 100644
index 00000000..f5ccbe52
--- /dev/null
+++ b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/domain/UnitMultiplierJpa.java
@@ -0,0 +1,69 @@
+/**
+ ******************************************************************************
+ * Copyright © 2015-2017 BTC AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ ******************************************************************************
+ */
+package de.openkonsequenz.cimcache.model.jpa.domain;
+
+/**
+ * The unit multipliers defined for the CIM
+ */
+public enum UnitMultiplierJpa {
+ /**
+ * Pico 10**-12
+ */
+ PICO("p"),
+ /**
+ * Nano 10**-9
+ */
+ NANO("n"),
+ /**
+ * Micro 10**-6
+ */
+ MICRO("micro"),
+ /**
+ * Milli 10**-3
+ */
+ MILLI("m"),
+ /**
+ * Centi 10**-2
+ */
+ CENTI("c"),
+ /**
+ * Deci 10**-1
+ */
+ DECI("d"),
+ /**
+ * Kilo 10**3
+ */
+ KILO("k"),
+ /**
+ * Mega 10**6
+ */
+ MEGA("M"),
+ /**
+ * Giga 10**9
+ */
+ GIGA("G"),
+ /**
+ * Tera 10**12
+ */
+ TERA("T"),
+ NONE("none");
+
+ private final String value;
+
+ private UnitMultiplierJpa(final String value) {
+ this.value = value;
+ }
+
+ public String value() {
+ return this.value;
+ }
+} \ No newline at end of file
diff --git a/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/domain/UnitSymbolJpa.java b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/domain/UnitSymbolJpa.java
new file mode 100644
index 00000000..5012443f
--- /dev/null
+++ b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/domain/UnitSymbolJpa.java
@@ -0,0 +1,46 @@
+/**
+ ******************************************************************************
+ * Copyright © 2015-2017 BTC AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ ******************************************************************************
+ */
+package de.openkonsequenz.cimcache.model.jpa.domain;
+
+
+/**
+ * The units defiend for usage in the CIM
+ */
+public enum UnitSymbolJpa {
+ /**
+ * Apparent power in volt ampere
+ */
+ VA("VA"),
+ /**
+ * Voltage in volt
+ */
+ V("V"),
+ /**
+ * Dimension less quantity, e.g. count, per unit, etc.
+ */
+ NONE("none"),
+ /**
+ * Active power in watt
+ */
+ W("W");
+
+ private final String value;
+
+ private UnitSymbolJpa(final String value) {
+ this.value = value;
+ }
+
+ public String value() {
+ return this.value;
+ }
+
+} \ No newline at end of file
diff --git a/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/domain/VoltageJpa.java b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/domain/VoltageJpa.java
new file mode 100644
index 00000000..a0728f4f
--- /dev/null
+++ b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/domain/VoltageJpa.java
@@ -0,0 +1,97 @@
+/**
+ ******************************************************************************
+ * Copyright © 2015-2017 BTC AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ ******************************************************************************
+ */
+package de.openkonsequenz.cimcache.model.jpa.domain;
+
+import java.math.BigDecimal;
+
+import javax.persistence.Embeddable;
+import javax.persistence.EnumType;
+import javax.persistence.Enumerated;
+
+import com.google.common.collect.ComparisonChain;
+
+/**
+ * Electrical voltage.
+ */
+@Embeddable
+public class VoltageJpa implements Comparable<VoltageJpa> {
+
+ private BigDecimal value;
+
+ @Enumerated(EnumType.STRING)
+ private UnitMultiplierJpa multiplier;
+
+ @Enumerated(EnumType.STRING)
+ private final UnitSymbolJpa unit = UnitSymbolJpa.V;
+
+ @Override
+ public int compareTo(final VoltageJpa that) {
+ return ComparisonChain.start()
+ .compare(this.value, that.value)
+ .compare(this.multiplier, that.multiplier)
+ .result();
+ }
+
+ public BigDecimal getValue() {
+ return value;
+ }
+
+ public void setValue(final BigDecimal value) {
+ this.value = value;
+ }
+
+ public UnitMultiplierJpa getMultiplier() {
+ return multiplier;
+ }
+
+ public void setMultiplier(final UnitMultiplierJpa multiplier) {
+ this.multiplier = multiplier;
+ }
+
+ public UnitSymbolJpa getUnit() {
+ return unit;
+ }
+
+ @Override
+ public boolean equals(final Object o) {
+
+ if (this == o) {
+ return true;
+ }
+
+ if (!(o instanceof VoltageJpa)) {
+ return false;
+ }
+
+ final VoltageJpa that = (VoltageJpa) o;
+
+ if (getMultiplier() != that.getMultiplier()) {
+ return false;
+ }
+
+ if (getValue() == null
+ ? that.getValue() != null
+ : !getValue().equals(that.getValue())) {
+ return false;
+ }
+
+ return getUnit() == that.getUnit();
+ }
+
+ @Override
+ public int hashCode() {
+ int result = getValue() == null ? 0 : getValue().hashCode();
+ result = 31 * result + (getMultiplier() == null ? 0 : getMultiplier().hashCode());
+ result = 31 * result + (getUnit() == null ? 0 : getUnit().hashCode());
+ return result;
+ }
+} \ No newline at end of file
diff --git a/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/informative/infoperations/PsrEventJpa.java b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/informative/infoperations/PsrEventJpa.java
new file mode 100644
index 00000000..b825bebb
--- /dev/null
+++ b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/informative/infoperations/PsrEventJpa.java
@@ -0,0 +1,97 @@
+/**
+ ******************************************************************************
+ * Copyright © 2015-2017 BTC AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ ******************************************************************************
+ */
+package de.openkonsequenz.cimcache.model.jpa.informative.infoperations;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.EnumType;
+import javax.persistence.Enumerated;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Table;
+import javax.persistence.TableGenerator;
+
+import de.openkonsequenz.cimcache.model.jpa.common.ActivityRecordJpa;
+
+/**
+ * Event recording the change in operational status of a PowerSystemResource.
+ */
+@Entity
+@Table(name = "PSR_EVENT")
+public class PsrEventJpa extends ActivityRecordJpa {
+
+ @Id
+ @TableGenerator(name = "PsrEventTableGen",
+ allocationSize = DEFAULT_ALLOCATION_SIZE,
+ table = "OPENK_STATICTOPOLOGY_SEQ_TABLE",
+ pkColumnName = "SEQ_NAME",
+ valueColumnName = "SEQ_COUNT",
+ pkColumnValue = "PSR_EVENT_SEQ")
+ @GeneratedValue(strategy = GenerationType.TABLE, generator = "PsrEventTableGen")
+ @Column(name = "ID")
+ private Long id;
+
+ /**
+ * Kind of event.
+ */
+ @Enumerated(EnumType.STRING)
+ @Column(name = "PSR_EVENT_KIND")
+ private PsrEventKindJpa psrEventKindJpa;
+
+ public PsrEventKindJpa getPsrEventKindJpa() {
+ return psrEventKindJpa;
+ }
+
+ public void setPsrEventKindJpa(final PsrEventKindJpa psrEventKindJpa) {
+ this.psrEventKindJpa = psrEventKindJpa;
+ }
+
+ @Override
+ public boolean equals(final Object o) {
+
+ if (this == o) {
+ return true;
+ }
+
+ if (!(o instanceof PsrEventJpa)) {
+ return false;
+ }
+
+ if (!super.equals(o)) {
+ return false;
+ }
+
+ final PsrEventJpa that = (PsrEventJpa) o;
+
+ boolean result = false;
+
+ if (getPsrEventKindJpa() == null && that.getPsrEventKindJpa() == null) {
+
+ result = true;
+
+ } else if (getPsrEventKindJpa() != null && that.getPsrEventKindJpa() != null) {
+
+ result = getPsrEventKindJpa().value().equals(that.getPsrEventKindJpa().value());
+ }
+
+ return result;
+ }
+
+ @Override
+ public int hashCode() {
+ int result = super.hashCode();
+ result = 31 * result + (getPsrEventKindJpa() == null ? 0 : getPsrEventKindJpa().hashCode());
+ return result;
+ }
+
+} \ No newline at end of file
diff --git a/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/informative/infoperations/PsrEventKindJpa.java b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/informative/infoperations/PsrEventKindJpa.java
new file mode 100644
index 00000000..55da0185
--- /dev/null
+++ b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/informative/infoperations/PsrEventKindJpa.java
@@ -0,0 +1,37 @@
+/**
+ ******************************************************************************
+ * Copyright © 2015-2017 BTC AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ ******************************************************************************
+ */
+package de.openkonsequenz.cimcache.model.jpa.informative.infoperations;
+
+/**
+ * Kind of power system resource event.
+ */
+public enum PsrEventKindJpa {
+
+ IN_SERVICE("inService"),
+ OUT_OF_SERVICE("outOfService"),
+ PENDING_ADD("pendingAdd"),
+ PENDING_REMOVE("pendingRemove"),
+ PENDING_REPLACE("pendingReplace"),
+ OTHER("other"),
+ UNKNOWN("unknown");
+
+ private final String value;
+
+ private PsrEventKindJpa(final String value) {
+ this.value = value;
+ }
+
+ public String value() {
+ return this.value;
+ }
+
+} \ No newline at end of file
diff --git a/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/marketcommon/RegisteredResourceJpa.java b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/marketcommon/RegisteredResourceJpa.java
new file mode 100644
index 00000000..848fe529
--- /dev/null
+++ b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/marketcommon/RegisteredResourceJpa.java
@@ -0,0 +1,23 @@
+/**
+ ******************************************************************************
+ * Copyright © 2015-2017 BTC AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ ******************************************************************************
+ */
+package de.openkonsequenz.cimcache.model.jpa.marketcommon;
+
+import de.openkonsequenz.cimcache.model.jpa.core.PowerSystemResourceJpa;
+
+/**
+ * A resource that is registered through the market participant registration
+ * system. Examples include generating unit, load, and non-physical generator or
+ * load.
+ */
+public class RegisteredResourceJpa extends PowerSystemResourceJpa {
+
+} \ No newline at end of file
diff --git a/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/marketoperations/mktdomain/UnitTypeJpa.java b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/marketoperations/mktdomain/UnitTypeJpa.java
new file mode 100644
index 00000000..eac07964
--- /dev/null
+++ b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/marketoperations/mktdomain/UnitTypeJpa.java
@@ -0,0 +1,64 @@
+/**
+ ******************************************************************************
+ * Copyright © 2015-2017 BTC AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ ******************************************************************************
+ */
+package de.openkonsequenz.cimcache.model.jpa.marketoperations.mktdomain;
+
+/**
+ * Combined Cycle
+ * Gas Turbine
+ * Hydro Turbine
+ * Other
+ * Photovoltaic
+ * Hydro Pump-Turbine
+ * Reciprocating Engine
+ * Steam Turbine
+ * Synchronous Condenser
+ * Wind Turbine
+ */
+public enum UnitTypeJpa {
+ /**
+ * Photovoltaic
+ */
+ PHOT("PHOT"),
+ /**
+ * Hydro Pump-Turbine
+ */
+ PTUR("PTUR"),
+ /**
+ * Wind Turbine
+ */
+ WIND("WIND"),
+ /**
+ * Hydro Turbine
+ */
+ HYDR("HYDR"),
+ /*
+ * Thermal Generating Unit (Blockheizkraftwert)
+ * CIM extension by Jan Krueger, April 2015
+ */
+ THER("THER"),
+ /**
+ * Biogas Thermal Generating Unit (Blockheizkraftwerk Biogas)
+ * CIM extension by Jan Krueger, April 2015
+ */
+ BIOG("BIOG");
+
+ private final String value;
+
+ private UnitTypeJpa(final String value) {
+ this.value = value;
+ }
+
+ public String value() {
+ return this.value;
+ }
+
+} \ No newline at end of file
diff --git a/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/marketoperations/referencedata/RegisteredGeneratorJpa.java b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/marketoperations/referencedata/RegisteredGeneratorJpa.java
new file mode 100644
index 00000000..31f303aa
--- /dev/null
+++ b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/marketoperations/referencedata/RegisteredGeneratorJpa.java
@@ -0,0 +1,41 @@
+/**
+ ******************************************************************************
+ * Copyright © 2015-2017 BTC AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ ******************************************************************************
+ */
+package de.openkonsequenz.cimcache.model.jpa.marketoperations.referencedata;
+
+import javax.persistence.EnumType;
+import javax.persistence.Enumerated;
+
+import de.openkonsequenz.cimcache.model.jpa.marketcommon.RegisteredResourceJpa;
+import de.openkonsequenz.cimcache.model.jpa.marketoperations.mktdomain.UnitTypeJpa;
+
+/**
+ * Model of a generator that is registered to participate in the market
+ */
+//@Embeddable
+public class RegisteredGeneratorJpa extends RegisteredResourceJpa {
+
+ /**
+ * Generating unit type: Combined Cycle, Gas Turbine, Hydro Turbine, Other,
+ * Photovoltaic, Hydro Pump-Turbine, Reciprocating Engine, Steam Turbine,
+ * Synchronous Condenser, Wind Turbine
+ */
+ @Enumerated(EnumType.STRING)
+ private UnitTypeJpa unitTypeJpa;
+
+ public UnitTypeJpa getUnitTypeJpa() {
+ return unitTypeJpa;
+ }
+
+ public void setUnitTypeJpa(final UnitTypeJpa unitTypeJpa) {
+ this.unitTypeJpa = unitTypeJpa;
+ }
+} \ No newline at end of file
diff --git a/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/meas/AnalogJpa.java b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/meas/AnalogJpa.java
new file mode 100644
index 00000000..28b04f8b
--- /dev/null
+++ b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/meas/AnalogJpa.java
@@ -0,0 +1,98 @@
+/**
+ ******************************************************************************
+ * Copyright © 2015-2017 BTC AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ ******************************************************************************
+ */
+package de.openkonsequenz.cimcache.model.jpa.meas;
+
+import java.util.List;
+
+import javax.persistence.CascadeType;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.JoinColumn;
+import javax.persistence.OneToMany;
+import javax.persistence.Table;
+import javax.persistence.TableGenerator;
+
+/**
+ * Analog represents an analog Measurement.
+ */
+@Entity
+@Table(name = "MEASUREMENT_ANALOG")
+public class AnalogJpa extends MeasurementJpa {
+
+ @Id
+ @TableGenerator(name = "AnalogTableGen",
+ allocationSize = DEFAULT_ALLOCATION_SIZE,
+ table = "OPENK_STATICTOPOLOGY_SEQ_TABLE",
+ pkColumnName = "SEQ_NAME",
+ valueColumnName = "SEQ_COUNT",
+ pkColumnValue = "MEASUREMENT_ANALOG_SEQ")
+ @GeneratedValue(strategy = GenerationType.TABLE, generator = "AnalogTableGen")
+ @Column(name = "ID")
+ private Long id;
+
+ /**
+ * The values connected to this measurement.
+ */
+ @OneToMany(targetEntity = AnalogValueJpa.class,
+ cascade = {CascadeType.PERSIST, CascadeType.MERGE})
+ @JoinColumn(name = "MEASUREMENT_ANALOG_ID")
+ private List<AnalogValueJpa> analogValueJpaList;
+
+ public List<AnalogValueJpa> getAnalogValueJpaList() {
+ return analogValueJpaList;
+ }
+
+ public void setAnalogValueJpaList(final List<AnalogValueJpa> analogValueJpaList) {
+ this.analogValueJpaList = analogValueJpaList;
+ }
+
+ @Override
+ public boolean equals(final Object o) {
+
+ if (this == o) {
+ return true;
+ }
+
+ if (!(o instanceof AnalogJpa)) {
+ return false;
+ }
+
+ if (!super.equals(o)) {
+ return false;
+ }
+
+ final AnalogJpa that = (AnalogJpa) o;
+
+ boolean result = false;
+
+ if (getAnalogValueJpaList() == null && that.getAnalogValueJpaList() == null) {
+
+ result = true;
+
+ } else if (getAnalogValueJpaList() != null && that.getAnalogValueJpaList() != null) {
+
+ result = getAnalogValueJpaList().equals(that.getAnalogValueJpaList());
+ }
+
+ return result;
+ }
+
+ @Override
+ public int hashCode() {
+ int result = super.hashCode();
+ result = 31 * result + (getAnalogValueJpaList() == null ? 0 : getAnalogValueJpaList().hashCode());
+ return result;
+ }
+} \ No newline at end of file
diff --git a/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/meas/AnalogValueJpa.java b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/meas/AnalogValueJpa.java
new file mode 100644
index 00000000..768201d7
--- /dev/null
+++ b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/meas/AnalogValueJpa.java
@@ -0,0 +1,93 @@
+/**
+ ******************************************************************************
+ * Copyright © 2015-2017 BTC AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ ******************************************************************************
+ */
+package de.openkonsequenz.cimcache.model.jpa.meas;
+
+import java.math.BigDecimal;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Table;
+import javax.persistence.TableGenerator;
+
+/**
+ * AnalogValue represents an analog MeasurementValue.
+ */
+@Entity
+@Table(name = "MEASUREMENT_ANALOG_VALUE")
+public class AnalogValueJpa extends MeasurementValueJpa {
+
+ @Id
+ @TableGenerator(name = "AnalogValueTableGen",
+ allocationSize = DEFAULT_ALLOCATION_SIZE,
+ table = "OPENK_STATICTOPOLOGY_SEQ_TABLE",
+ pkColumnName = "SEQ_NAME",
+ valueColumnName = "SEQ_COUNT",
+ pkColumnValue = "MEASUREMENT_ANALOG_VALUE_SEQ")
+ @GeneratedValue(strategy = GenerationType.TABLE, generator = "AnalogValueTableGen")
+ @Column(name = "ID")
+ private Long id;
+
+ /**
+ * The value to supervise.
+ */
+ @Column(name = "VALUE")
+ private BigDecimal value;
+
+ public BigDecimal getValue() {
+ return value;
+ }
+
+ public void setValue(final BigDecimal value) {
+ this.value = value;
+ }
+
+ @Override
+ public boolean equals(final Object o) {
+
+ if (this == o) {
+ return true;
+ }
+
+ if (!(o instanceof AnalogValueJpa)) {
+ return false;
+ }
+
+ if (!super.equals(o)) {
+ return false;
+ }
+
+ final AnalogValueJpa that = (AnalogValueJpa) o;
+
+ boolean result = false;
+
+ if (getValue() == null && that.getValue() == null) {
+
+ result = true;
+
+ } else if (getValue() != null && that.getValue() != null) {
+
+ result = getValue().equals(that.getValue());
+ }
+
+ return result;
+ }
+
+ @Override
+ public int hashCode() {
+ int result = super.hashCode();
+ result = 31 * result + (getValue() == null ? 0 : getValue().hashCode());
+ return result;
+ }
+} \ No newline at end of file
diff --git a/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/meas/MeasurementJpa.java b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/meas/MeasurementJpa.java
new file mode 100644
index 00000000..b0778b1d
--- /dev/null
+++ b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/meas/MeasurementJpa.java
@@ -0,0 +1,95 @@
+/**
+ ******************************************************************************
+ * Copyright © 2015-2017 BTC AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ ******************************************************************************
+ */
+package de.openkonsequenz.cimcache.model.jpa.meas;
+
+import javax.persistence.Column;
+import javax.persistence.EnumType;
+import javax.persistence.Enumerated;
+import javax.persistence.MappedSuperclass;
+
+import de.openkonsequenz.cimcache.model.jpa.core.IdentifiedObjectJpa;
+import de.openkonsequenz.cimcache.model.jpa.domain.UnitMultiplierJpa;
+import de.openkonsequenz.cimcache.model.jpa.domain.UnitSymbolJpa;
+
+/**
+ * A Measurement represents any measured, calculated or non-measured non-
+ * calculated quantity. Any piece of equipment may contain Measurements, e.g. a
+ * substation may have temperature measurements and door open indications, a
+ * transformer may have oil temperature and tank pressure measurements, a bay may
+ * contain a number of power flow measurements and a Breaker may contain a switch
+ * status measurement.
+ * The PSR - Measurement association is intended to capture this use of
+ * Measurement and is included in the naming hierarchy based on EquipmentContainer.
+ * The naming hierarchy typically has Measurements as leafs, e.g. Substation-
+ * VoltageLevel-Bay-Switch-Measurement.
+ * Some Measurements represent quantities related to a particular sensor location
+ * in the network, e.g. a voltage transformer (PT) at a busbar or a current
+ * transformer (CT) at the bar between a breaker and an isolator. The sensing
+ * position is not captured in the PSR - Measurement association. Instead it is
+ * captured by the Measurement - Terminal association that is used to define the
+ * sensing location in the network topology. The location is defined by the
+ * connection of the Terminal to ConductingEquipment.
+ * Two possible paths exist:
+ * 1) Measurement-Terminal- ConnectivityNode-Terminal-ConductingEquipment
+ * 2) Measurement-Terminal-ConductingEquipment
+ * Alternative 2 is the only allowed use.
+ * When the sensor location is needed both Measurement-PSR and Measurement-
+ * Terminal are used. The Measurement-Terminal association is never used alone.
+ */
+@MappedSuperclass
+public class MeasurementJpa extends IdentifiedObjectJpa {
+
+ /**
+ * Specifies the type of Measurement, e.g. IndoorTemperature, OutDoorTemperature,
+ * BusVoltage, GeneratorVoltage, LineFlow etc.
+ */
+ @Column(name = "MEASUREMENT_TYPE")
+ private String measurementType;
+
+ /**
+ * The unit multiplier of the measured quantity.
+ */
+ @Enumerated(EnumType.STRING)
+ @Column(name = "MEASUREMENT_UNIT_MULTIPLIER")
+ private UnitMultiplierJpa unitMultiplierJpa;
+
+ /**
+ * The unit of measure of the measured quantity.
+ */
+ @Enumerated(EnumType.STRING)
+ @Column(name = "MEASUREMENT_UNIT_SYMBOL")
+ private UnitSymbolJpa unitSymbolJpa;
+
+ public String getMeasurementType() {
+ return measurementType;
+ }
+
+ public void setMeasurementType(final String measurementType) {
+ this.measurementType = measurementType;
+ }
+
+ public UnitMultiplierJpa getUnitMultiplierJpa() {
+ return unitMultiplierJpa;
+ }
+
+ public void setUnitMultiplierJpa(final UnitMultiplierJpa unitMultiplierJpa) {
+ this.unitMultiplierJpa = unitMultiplierJpa;
+ }
+
+ public UnitSymbolJpa getUnitSymbolJpa() {
+ return unitSymbolJpa;
+ }
+
+ public void setUnitSymbolJpa(final UnitSymbolJpa unitSymbolJpa) {
+ this.unitSymbolJpa = unitSymbolJpa;
+ }
+} \ No newline at end of file
diff --git a/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/meas/MeasurementValueJpa.java b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/meas/MeasurementValueJpa.java
new file mode 100644
index 00000000..d30f764c
--- /dev/null
+++ b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/meas/MeasurementValueJpa.java
@@ -0,0 +1,104 @@
+/**
+ ******************************************************************************
+ * Copyright © 2015-2017 BTC AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ ******************************************************************************
+ */
+package de.openkonsequenz.cimcache.model.jpa.meas;
+
+import javax.persistence.AttributeOverride;
+import javax.persistence.Column;
+import javax.persistence.Embedded;
+import javax.persistence.MappedSuperclass;
+
+import de.openkonsequenz.cimcache.model.jpa.core.IdentifiedObjectJpa;
+import de.openkonsequenz.cimcache.model.jpa.domain.AbsoluteDateTimeJpa;
+
+/**
+ * The current state for a measurement. A state value is an instance of a
+ * measurement from a specific source. Measurements can be associated with many
+ * state values, each representing a different source for the measurement.
+ */
+@MappedSuperclass
+public class MeasurementValueJpa extends IdentifiedObjectJpa {
+
+ /**
+ * The time when the value was last updated
+ */
+ @Embedded
+ @AttributeOverride(name = "value", column = @Column(name = "TIMESTAMP_VALUE"))
+ private AbsoluteDateTimeJpa timeStamp;
+
+ /**
+ * A MeasurementValue has a MeasurementValueQuality associated with it.
+ */
+ @Embedded
+ @AttributeOverride(name = "failure", column = @Column(name = "VALUE_QUALITY_FAILURE"))
+ private MeasurementValueQualityJpa measurementValueQualityJpa;
+
+ public AbsoluteDateTimeJpa getTimeStamp() {
+ return timeStamp;
+ }
+
+ public MeasurementValueQualityJpa getMeasurementValueQualityJpa() {
+ return measurementValueQualityJpa;
+ }
+
+ public void setTimeStamp(final AbsoluteDateTimeJpa timeStamp) {
+ this.timeStamp = timeStamp;
+ }
+
+ public void setMeasurementValueQualityJpa(final MeasurementValueQualityJpa measurementValueQualityJpa) {
+ this.measurementValueQualityJpa = measurementValueQualityJpa;
+ }
+
+ @Override
+ public boolean equals(final Object o) {
+
+ if (this == o) {
+ return true;
+ }
+
+ if (!(o instanceof MeasurementValueJpa)) {
+ return false;
+ }
+
+ if (!super.equals(o)) {
+ return false;
+ }
+
+ final MeasurementValueJpa that = (MeasurementValueJpa) o;
+
+ if (getTimeStamp() == null
+ ? that.getTimeStamp() != null
+ : !getTimeStamp().equals(that.getTimeStamp())) {
+ return false;
+ }
+
+ boolean result = false;
+
+ if (getMeasurementValueQualityJpa() == null && that.getMeasurementValueQualityJpa() == null) {
+
+ result = true;
+
+ } else if (getMeasurementValueQualityJpa() != null && that.getMeasurementValueQualityJpa() != null) {
+
+ result = getMeasurementValueQualityJpa().equals(that.getMeasurementValueQualityJpa());
+ }
+
+ return result;
+ }
+
+ @Override
+ public int hashCode() {
+ int result = super.hashCode();
+ result = 31 * result + (getTimeStamp() == null ? 0 : getTimeStamp().hashCode());
+ result = 31 * result + (getMeasurementValueQualityJpa() == null ? 0 : getMeasurementValueQualityJpa().hashCode());
+ return result;
+ }
+} \ No newline at end of file
diff --git a/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/meas/MeasurementValueQualityJpa.java b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/meas/MeasurementValueQualityJpa.java
new file mode 100644
index 00000000..d53d12da
--- /dev/null
+++ b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/meas/MeasurementValueQualityJpa.java
@@ -0,0 +1,73 @@
+/**
+ ******************************************************************************
+ * Copyright © 2015-2017 BTC AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ ******************************************************************************
+ */
+package de.openkonsequenz.cimcache.model.jpa.meas;
+
+import javax.persistence.Convert;
+import javax.persistence.Embeddable;
+
+import de.openkonsequenz.cimcache.model.jpa.util.Boolean2StringConverter;
+
+/**
+ * Measurement quality flags. Bits 0-10 are defined for substation automation in
+ * draft IEC 61850 part 7-3. Bits 11-15 are reserved for future expansion by that
+ * document. Bits 16-31 are reserved for EMS applications.
+ */
+@Embeddable
+public class MeasurementValueQualityJpa {
+
+ /**
+ * This identifier indicates that a supervision function has detected an internal
+ * or external failure, e.g. communication failure.
+ */
+ @Convert(converter = Boolean2StringConverter.class)
+ private Boolean failure;
+
+ public Boolean getFailure() {
+ return failure;
+ }
+
+ public void setFailure(final Boolean failure) {
+ this.failure = failure;
+ }
+
+ @Override
+ public boolean equals(final Object o) {
+
+ if (this == o) {
+ return true;
+ }
+
+ if (!(o instanceof MeasurementValueQualityJpa)) {
+ return false;
+ }
+
+ final MeasurementValueQualityJpa that = (MeasurementValueQualityJpa) o;
+
+ boolean result = false;
+
+ if (getFailure() == null && that.getFailure() == null) {
+
+ result = true;
+
+ } else if (getFailure() != null && that.getFailure() != null) {
+
+ result = getFailure().equals(that.getFailure());
+ }
+
+ return result;
+ }
+
+ @Override
+ public int hashCode() {
+ return getFailure() == null ? 0 : getFailure().hashCode();
+ }
+}
diff --git a/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/production/GeneratingUnitJpa.java b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/production/GeneratingUnitJpa.java
new file mode 100644
index 00000000..ab8a51f1
--- /dev/null
+++ b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/production/GeneratingUnitJpa.java
@@ -0,0 +1,102 @@
+/**
+ ******************************************************************************
+ * Copyright © 2015-2017 BTC AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ ******************************************************************************
+ */
+package de.openkonsequenz.cimcache.model.jpa.production;
+
+import javax.persistence.AttributeOverride;
+import javax.persistence.AttributeOverrides;
+import javax.persistence.Column;
+import javax.persistence.Convert;
+import javax.persistence.Embedded;
+import javax.persistence.Entity;
+import javax.persistence.EnumType;
+import javax.persistence.Enumerated;
+import javax.persistence.Table;
+
+import de.openkonsequenz.cimcache.model.jpa.core.EquipmentJpa;
+import de.openkonsequenz.cimcache.model.jpa.domain.ActivePowerJpa;
+import de.openkonsequenz.cimcache.model.jpa.marketoperations.referencedata.RegisteredGeneratorJpa;
+import de.openkonsequenz.cimcache.model.jpa.util.RegisteredGenerator2StringConverter;
+
+@Entity
+@Table(name = "GENERATING_UNIT")
+public class GeneratingUnitJpa extends EquipmentJpa {
+
+ /**
+ * UnitSymbol in context of GeneratingUnit is W.
+ * Regelbare Leistung
+ */
+ @Embedded
+ @AttributeOverrides({
+ @AttributeOverride(name = "value", column = @Column(name = "HIGH_CONTROL_LIMIT_VALUE")),
+ @AttributeOverride(name = "multiplier", column = @Column(name = "HIGH_CONTROL_LIMIT_UNIT_MULTIPLIER")),
+ @AttributeOverride(name = "unit", column = @Column(name = "HIGH_CONTROL_LIMIT_UNIT_SYMBOL"))
+ })
+ private ActivePowerJpa highControlLimit;
+
+ /**
+ * UnitSymbol in context of GeneratingUnit is W.
+ * Installierte Leistung
+ */
+ @Embedded
+ @AttributeOverrides({
+ @AttributeOverride(name = "value", column = @Column(name = "MAX_OPERATING_POWER_LIMIT_VALUE")),
+ @AttributeOverride(name = "multiplier", column = @Column(name = "MAX_OPERATING_POWER_UNIT_MULTIPLIER")),
+ @AttributeOverride(name = "unit", column = @Column(name = "MAX_OPERATING_POWER_UNIT_SYMBOL"))
+ })
+ private ActivePowerJpa maxOperatingP;
+
+ /**
+ * The source of controls for a generating unit.
+ */
+ @Enumerated(EnumType.STRING)
+ @Column(name = "CONTROL_SOURCE")
+ private GeneratorControlSourceJpa generatorControlSourceJpa;
+
+ /**
+ * Kind of generator, wind, photovoltaic, wind turbine, ...
+ */
+ @Convert(converter = RegisteredGenerator2StringConverter.class)
+ @Column(name = "UNIT_TYPE")
+ private RegisteredGeneratorJpa registeredGeneratorJpa;
+
+ public ActivePowerJpa getHighControlLimit() {
+ return highControlLimit;
+ }
+
+ public void setHighControlLimit(final ActivePowerJpa highControlLimit) {
+ this.highControlLimit = highControlLimit;
+ }
+
+ public ActivePowerJpa getMaxOperatingP() {
+ return maxOperatingP;
+ }
+
+ public void setMaxOperatingP(final ActivePowerJpa maxOperatingP) {
+ this.maxOperatingP = maxOperatingP;
+ }
+
+ public GeneratorControlSourceJpa getGeneratorControlSourceJpa() {
+ return generatorControlSourceJpa;
+ }
+
+ public void setGeneratorControlSourceJpa(final GeneratorControlSourceJpa generatorControlSourceJpa) {
+ this.generatorControlSourceJpa = generatorControlSourceJpa;
+ }
+
+ public RegisteredGeneratorJpa getRegisteredGeneratorJpa() {
+ return registeredGeneratorJpa;
+ }
+
+ public void setRegisteredGeneratorJpa(final RegisteredGeneratorJpa registeredGeneratorJpa) {
+ this.registeredGeneratorJpa = registeredGeneratorJpa;
+ }
+}
diff --git a/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/production/GeneratorControlSourceJpa.java b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/production/GeneratorControlSourceJpa.java
new file mode 100644
index 00000000..5ba94dcb
--- /dev/null
+++ b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/production/GeneratorControlSourceJpa.java
@@ -0,0 +1,52 @@
+/**
+ ******************************************************************************
+ * Copyright © 2015-2017 BTC AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ ******************************************************************************
+ */
+package de.openkonsequenz.cimcache.model.jpa.production;
+
+import com.fasterxml.jackson.annotation.JsonValue;
+
+/**
+ * The source of controls for a generating unit.
+ */
+public enum GeneratorControlSourceJpa {
+ /**
+ * Is Controlable by control center.
+ * CIM extension by Jan Krueger, April 2015
+ */
+ IS_CONTROLLABLE("isControllable"),
+ /**
+ * Not available.
+ */
+ UNAVAILABLE("unavailable"),
+ /**
+ * Off of automatic generation control (AGC).
+ */
+ OFF_AGC("offAGC"),
+ /**
+ * On automatic generation control (AGC).
+ */
+ ON_AGC("onAGC"),
+ /**
+ * Plant is controlling.
+ */
+ PLANT_CONTROL("plantControl");
+
+ private final String value;
+
+ private GeneratorControlSourceJpa(final String value) {
+ this.value = value;
+ }
+
+ @JsonValue
+ public String value() {
+ return this.value;
+ }
+} \ No newline at end of file
diff --git a/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/util/Boolean2StringConverter.java b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/util/Boolean2StringConverter.java
new file mode 100644
index 00000000..41273e45
--- /dev/null
+++ b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/util/Boolean2StringConverter.java
@@ -0,0 +1,38 @@
+/**
+ ******************************************************************************
+ * Copyright © 2015-2017 BTC AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ ******************************************************************************
+ */
+package de.openkonsequenz.cimcache.model.jpa.util;
+
+import javax.persistence.AttributeConverter;
+import javax.persistence.Converter;
+
+@Converter
+public class Boolean2StringConverter implements AttributeConverter<Boolean, String> {
+
+ @Override
+ public String convertToDatabaseColumn(final Boolean value) {
+
+ if (Boolean.TRUE.equals(value)) {
+
+ return "TRUE";
+
+ } else {
+
+ return "FALSE";
+ }
+ }
+
+ @Override
+ public Boolean convertToEntityAttribute(final String value) {
+ return "TRUE".equals(value) || "true".equals(value);
+ }
+
+}
diff --git a/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/util/RegisteredGenerator2StringConverter.java b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/util/RegisteredGenerator2StringConverter.java
new file mode 100644
index 00000000..857160d4
--- /dev/null
+++ b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/util/RegisteredGenerator2StringConverter.java
@@ -0,0 +1,34 @@
+/**
+ ******************************************************************************
+ * Copyright © 2015-2017 BTC AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ ******************************************************************************
+ */
+package de.openkonsequenz.cimcache.model.jpa.util;
+
+import javax.persistence.AttributeConverter;
+import javax.persistence.Converter;
+
+import de.openkonsequenz.cimcache.model.jpa.marketoperations.mktdomain.UnitTypeJpa;
+import de.openkonsequenz.cimcache.model.jpa.marketoperations.referencedata.RegisteredGeneratorJpa;
+
+@Converter
+public class RegisteredGenerator2StringConverter implements AttributeConverter<RegisteredGeneratorJpa, String> {
+
+ @Override
+ public String convertToDatabaseColumn(final RegisteredGeneratorJpa registeredGeneratorJpa) {
+ return registeredGeneratorJpa.getUnitTypeJpa().value();
+ }
+
+ @Override
+ public RegisteredGeneratorJpa convertToEntityAttribute(final String unitType) {
+ final RegisteredGeneratorJpa registeredGeneratorJpa = new RegisteredGeneratorJpa();
+ registeredGeneratorJpa.setUnitTypeJpa(UnitTypeJpa.valueOf(unitType));
+ return registeredGeneratorJpa;
+ }
+}
diff --git a/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/util/Sequence.java b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/util/Sequence.java
new file mode 100644
index 00000000..d50798dd
--- /dev/null
+++ b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/util/Sequence.java
@@ -0,0 +1,41 @@
+/**
+ ******************************************************************************
+ * Copyright © 2015-2017 BTC AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ ******************************************************************************
+ */
+package de.openkonsequenz.cimcache.model.jpa.util;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+@Entity
+@Table(name = "OPENK_STATICTOPOLOGY_SEQ_TABLE")
+public class Sequence {
+
+ @Id
+ @Column(name = "SEQ_NAME")
+ private String sequenceName;
+
+ @Column(name = "SEQ_COUNT")
+ private Long sequenceCount;
+
+ public String getSequenceName() {
+ return sequenceName;
+ }
+
+ public Long getSequenceCount() {
+ return sequenceCount;
+ }
+
+ public void setSequenceCount(final Long sequenceCount) {
+ this.sequenceCount = sequenceCount;
+ }
+}
diff --git a/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/util/Temporal.java b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/util/Temporal.java
new file mode 100644
index 00000000..237a281e
--- /dev/null
+++ b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/util/Temporal.java
@@ -0,0 +1,30 @@
+/**
+ ******************************************************************************
+ * Copyright © 2015-2017 BTC AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ ******************************************************************************
+ */
+package de.openkonsequenz.cimcache.model.jpa.util;
+
+import java.sql.Timestamp;
+
+public interface Temporal {
+
+ Long getOid();
+
+ void setOid(final Long oid);
+
+ Timestamp getValidFrom();
+
+ void setValidFrom(final Timestamp validFrom);
+
+ Timestamp getValidTo();
+
+ void setValidTo(final Timestamp validTo);
+
+}
diff --git a/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/wires/AcLineSegmentJpa.java b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/wires/AcLineSegmentJpa.java
new file mode 100644
index 00000000..5811173d
--- /dev/null
+++ b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/wires/AcLineSegmentJpa.java
@@ -0,0 +1,57 @@
+/**
+ ******************************************************************************
+ * Copyright © 2015-2017 BTC AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ ******************************************************************************
+ */
+package de.openkonsequenz.cimcache.model.jpa.wires;
+
+import java.util.List;
+
+import javax.persistence.Access;
+import javax.persistence.AccessType;
+import javax.persistence.CascadeType;
+import javax.persistence.Entity;
+import javax.persistence.JoinColumn;
+import javax.persistence.OneToMany;
+import javax.persistence.Table;
+
+import de.openkonsequenz.cimcache.model.jpa.core.TerminalJpa;
+
+/**
+ * A wire or combination of wires, with consistent electrical characteristics, building a single
+ * electrical system, used to carry alternating current between points in the power system.
+ * For symmetrical, transposed 3ph lines, it is sufficient to use attributes of the line
+ * segment, which describe impedances and admittances for the entire length of the segment.
+ * Additionally impedances can be computed by using length and associated per length impedances.
+ * The BaseVoltage at the two ends of ACLineSegments in a Line shall have the same
+ * BaseVoltage.nominalVoltage. However, boundary lines may have slightly different
+ * BaseVoltage.nominalVoltages and variation is allowed. Larger voltage
+ * difference in general requires use of an equivalent branch.
+ * <p/>
+ * Kabel
+ */
+@Entity
+@Table(name = "AC_LINE_SEGMENT")
+@Access(AccessType.FIELD)
+public class AcLineSegmentJpa extends ConductorJpa {
+
+ @Override
+ @OneToMany(targetEntity = TerminalJpa.class, cascade = CascadeType.PERSIST)
+ @JoinColumn(name = "AC_LINE_SEGMENT_ID")
+ @Access(AccessType.PROPERTY)
+ public List<TerminalJpa> getTerminalJpaList() {
+ return super.getTerminalJpaList();
+ }
+
+ @Override
+ public void setTerminalJpaList(final List<TerminalJpa> terminalJpaList) {
+ super.setTerminalJpaList(terminalJpaList);
+ }
+
+} \ No newline at end of file
diff --git a/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/wires/BusbarSectionJpa.java b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/wires/BusbarSectionJpa.java
new file mode 100644
index 00000000..96dce118
--- /dev/null
+++ b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/wires/BusbarSectionJpa.java
@@ -0,0 +1,80 @@
+/**
+ ******************************************************************************
+ * Copyright © 2015-2017 BTC AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ ******************************************************************************
+ */
+package de.openkonsequenz.cimcache.model.jpa.wires;
+
+import java.util.List;
+
+import javax.persistence.Access;
+import javax.persistence.AccessType;
+import javax.persistence.CascadeType;
+import javax.persistence.Entity;
+import javax.persistence.JoinColumn;
+import javax.persistence.OneToMany;
+import javax.persistence.Table;
+
+import de.openkonsequenz.cimcache.model.jpa.core.TerminalJpa;
+
+/**
+ * A conductor, or group of conductors, with negligible impedance, that serve to
+ * connect other conducting equipment within a single substation.
+ * Voltage measurements are typically obtained from VoltageTransformers that are
+ * connected to busbar sections. A bus bar section may have many physical
+ * terminals but for analysis is modelled with exactly one logical terminal.
+ * <p/>
+ * Sammelschiene
+ */
+@Entity
+@Table(name = "BUSBAR_SECTION")
+@Access(AccessType.FIELD)
+public class BusbarSectionJpa extends ConnectorJpa {
+
+ @Override
+ @OneToMany(targetEntity = TerminalJpa.class, cascade = CascadeType.PERSIST)
+ @JoinColumn(name = "BUSBAR_SECTION_ID")
+ @Access(AccessType.PROPERTY)
+ public List<TerminalJpa> getTerminalJpaList() {
+ return super.getTerminalJpaList();
+ }
+
+ @Override
+ public void setTerminalJpaList(final List<TerminalJpa> terminalJpaList) {
+ super.setTerminalJpaList(terminalJpaList);
+ }
+
+// @OneToMany(targetEntity = OperatingParticipantJpa.class, cascade = CascadeType.PERSIST)
+// @JoinColumn(name = "BUSBAR_SECTION_ID")
+// private List<OperatingParticipantJpa> operatingParticipantJpaList;
+
+// @JsonView(IncludeAttribute4Json.Topology.class)
+// @OneToMany(targetEntity = TerminalJpa.class, cascade = CascadeType.PERSIST)
+// @JoinColumn(name = "BUSBAR_SECTION_ID")
+// private List<TerminalJpa> terminalJpaList;
+//
+// public List<TerminalJpa> getTerminalJpaList() {
+// return terminalJpaList;
+// }
+
+// @Override
+// @OneToMany(targetEntity = OperatingParticipantJpa.class, cascade = CascadeType.PERSIST)
+// @JoinColumn(name = "BUSBAR_SECTION_ID")
+// @Access(AccessType.PROPERTY)
+// public List<PsrEventJpa> getPsrEventJpaList() {
+// return super.getPsrEventJpaList();
+// }
+//
+// @Override
+// public void setPsrEventJpaList(final List<PsrEventJpa> psrEventJpaList) {
+// super.setPsrEventJpaList(psrEventJpaList);
+// }
+
+
+} \ No newline at end of file
diff --git a/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/wires/ConductorJpa.java b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/wires/ConductorJpa.java
new file mode 100644
index 00000000..76d52b0c
--- /dev/null
+++ b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/wires/ConductorJpa.java
@@ -0,0 +1,26 @@
+/**
+ ******************************************************************************
+ * Copyright © 2015-2017 BTC AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ ******************************************************************************
+ */
+package de.openkonsequenz.cimcache.model.jpa.wires;
+
+import javax.persistence.MappedSuperclass;
+
+import de.openkonsequenz.cimcache.model.jpa.core.ConductingEquipmentJpa;
+
+/**
+ * Combination of conducting material with consistent electrical characteristics,
+ * building a single electrical system, used to carry current between points in
+ * the power system.
+ */
+@MappedSuperclass
+public class ConductorJpa extends ConductingEquipmentJpa {
+
+} \ No newline at end of file
diff --git a/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/wires/ConnectorJpa.java b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/wires/ConnectorJpa.java
new file mode 100644
index 00000000..aafb1d8c
--- /dev/null
+++ b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/wires/ConnectorJpa.java
@@ -0,0 +1,25 @@
+/**
+ ******************************************************************************
+ * Copyright © 2015-2017 BTC AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ ******************************************************************************
+ */
+package de.openkonsequenz.cimcache.model.jpa.wires;
+
+import javax.persistence.MappedSuperclass;
+
+import de.openkonsequenz.cimcache.model.jpa.core.ConductingEquipmentJpa;
+
+/**
+ * A conductor, or group of conductors, with negligible impedance, that serve to
+ * connect other conducting equipment within a single substation and are modelled
+ * with a single logical terminal.
+ */
+@MappedSuperclass
+public class ConnectorJpa extends ConductingEquipmentJpa {
+} \ No newline at end of file
diff --git a/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/wires/PowerTransformerJpa.java b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/wires/PowerTransformerJpa.java
new file mode 100644
index 00000000..53331d29
--- /dev/null
+++ b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/wires/PowerTransformerJpa.java
@@ -0,0 +1,73 @@
+/**
+ ******************************************************************************
+ * Copyright © 2015-2017 BTC AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ ******************************************************************************
+ */
+package de.openkonsequenz.cimcache.model.jpa.wires;
+
+import java.util.List;
+
+import javax.persistence.Access;
+import javax.persistence.AccessType;
+import javax.persistence.CascadeType;
+import javax.persistence.Entity;
+import javax.persistence.JoinColumn;
+import javax.persistence.OneToMany;
+import javax.persistence.Table;
+
+import de.openkonsequenz.cimcache.model.jpa.core.ConductingEquipmentJpa;
+import de.openkonsequenz.cimcache.model.jpa.core.TerminalJpa;
+
+/**
+ * An electrical device consisting of two or more coupled windings, with or
+ * without a magnetic core, for introducing mutual coupling between electric
+ * circuits. Transformers can be used to control voltage and phase shift (active
+ * power flow).
+ * A power transformer may be composed of separate transformer tanks that need not
+ * be identical.
+ * A power transformer can be modeled with or without tanks and is intended for
+ * use in both balanced and unbalanced representations. A power transformer
+ * typically has two terminals, but may have one (grounding), three or more
+ * terminals.
+ * The inherited association ConductingEquipment.BaseVoltage should not be used.
+ * The association from TransformerEnd to BaseVoltage should be used instead.
+ */
+@Entity
+@Table(name = "POWER_TRANSFORMER")
+@Access(AccessType.FIELD)
+public class PowerTransformerJpa extends ConductingEquipmentJpa {
+
+ @Override
+ @OneToMany(targetEntity = TerminalJpa.class, cascade = CascadeType.PERSIST)
+ @JoinColumn(name = "BUSBAR_SECTION_ID")
+ @Access(AccessType.PROPERTY)
+ public List<TerminalJpa> getTerminalJpaList() {
+ return super.getTerminalJpaList();
+ }
+
+ @Override
+ public void setTerminalJpaList(final List<TerminalJpa> terminalJpaList) {
+ super.setTerminalJpaList(terminalJpaList);
+ }
+
+
+// @OneToMany(targetEntity = OperatingParticipant.class, cascade = CascadeType.PERSIST)
+// @JoinColumn(name = "POWER_TRANSFOMER_ID")
+// private List<OperatingParticipant> operatingParticipantList;
+//
+// @JsonView(IncludeAttribute4Json.Topology.class)
+// @OneToMany(targetEntity = Terminal.class, cascade = CascadeType.PERSIST)
+// @JoinColumn(name = "POWER_TRANSFORMER_ID")
+// private List<Terminal> terminalList;
+//
+// public List<Terminal> getTerminalList() {
+// return terminalList;
+// }
+
+} \ No newline at end of file
diff --git a/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/wires/RegulatingCondEqJpa.java b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/wires/RegulatingCondEqJpa.java
new file mode 100644
index 00000000..8dafa682
--- /dev/null
+++ b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/wires/RegulatingCondEqJpa.java
@@ -0,0 +1,38 @@
+/**
+ ******************************************************************************
+ * Copyright © 2015-2017 BTC AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ ******************************************************************************
+ */
+package de.openkonsequenz.cimcache.model.jpa.wires;
+
+import javax.persistence.Column;
+import javax.persistence.Convert;
+import javax.persistence.MappedSuperclass;
+
+import de.openkonsequenz.cimcache.model.jpa.core.ConductingEquipmentJpa;
+import de.openkonsequenz.cimcache.model.jpa.util.Boolean2StringConverter;
+
+@MappedSuperclass
+public class RegulatingCondEqJpa extends ConductingEquipmentJpa {
+
+ /**
+ * Specifies the regulation status of the equipment. True is regulating, false is not regulating.
+ */
+ @Convert(converter = Boolean2StringConverter.class)
+ @Column(name = "CONTROL_ENABLED")
+ private Boolean controlEnabled;
+
+ public Boolean getControlEnabled() {
+ return controlEnabled;
+ }
+
+ public void setControlEnabled(final Boolean controlEnabled) {
+ this.controlEnabled = controlEnabled;
+ }
+}
diff --git a/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/wires/RotatingMachineJpa.java b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/wires/RotatingMachineJpa.java
new file mode 100644
index 00000000..c4aa9b4b
--- /dev/null
+++ b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/wires/RotatingMachineJpa.java
@@ -0,0 +1,22 @@
+/**
+ ******************************************************************************
+ * Copyright © 2015-2017 BTC AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ ******************************************************************************
+ */
+package de.openkonsequenz.cimcache.model.jpa.wires;
+
+import javax.persistence.MappedSuperclass;
+
+/**
+ * A rotating machine which may be used as a generator or motor.
+ */
+@MappedSuperclass
+public class RotatingMachineJpa extends RegulatingCondEqJpa {
+
+} \ No newline at end of file
diff --git a/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/wires/SwitchJpa.java b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/wires/SwitchJpa.java
new file mode 100644
index 00000000..d49790e3
--- /dev/null
+++ b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/wires/SwitchJpa.java
@@ -0,0 +1,66 @@
+/**
+ ******************************************************************************
+ * Copyright © 2015-2017 BTC AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ ******************************************************************************
+ */
+package de.openkonsequenz.cimcache.model.jpa.wires;
+
+import java.util.List;
+
+import javax.persistence.Access;
+import javax.persistence.AccessType;
+import javax.persistence.CascadeType;
+import javax.persistence.Column;
+import javax.persistence.Convert;
+import javax.persistence.Entity;
+import javax.persistence.JoinColumn;
+import javax.persistence.OneToMany;
+import javax.persistence.Table;
+
+import de.openkonsequenz.cimcache.model.jpa.core.ConductingEquipmentJpa;
+import de.openkonsequenz.cimcache.model.jpa.core.TerminalJpa;
+import de.openkonsequenz.cimcache.model.jpa.util.Boolean2StringConverter;
+
+/**
+ * A generic device designed to close, or open, or both, one or more electric
+ * circuits.
+ * <p/>
+ * Schalter
+ */
+@Entity
+@Table(name = "SWITCH")
+@Access(AccessType.FIELD)
+public class SwitchJpa extends ConductingEquipmentJpa {
+
+ @Convert(converter = Boolean2StringConverter.class)
+ @Column(name = "OPEN")
+ private Boolean open;
+
+ public Boolean getOpen() {
+ return open;
+ }
+
+ public void setOpen(final Boolean open) {
+ this.open = open;
+ }
+
+ @Override
+ @OneToMany(targetEntity = TerminalJpa.class, cascade = CascadeType.PERSIST)
+ @JoinColumn(name = "SWITCH_ID")
+ @Access(AccessType.PROPERTY)
+ public List<TerminalJpa> getTerminalJpaList() {
+ return super.getTerminalJpaList();
+ }
+
+ @Override
+ public void setTerminalJpaList(final List<TerminalJpa> terminalJpaList) {
+ super.setTerminalJpaList(terminalJpaList);
+ }
+
+} \ No newline at end of file
diff --git a/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/wires/SynchronousMachineJpa.java b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/wires/SynchronousMachineJpa.java
new file mode 100644
index 00000000..cbe27238
--- /dev/null
+++ b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/wires/SynchronousMachineJpa.java
@@ -0,0 +1,301 @@
+/**
+ ******************************************************************************
+ * Copyright © 2015-2017 BTC AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ ******************************************************************************
+ */
+package de.openkonsequenz.cimcache.model.jpa.wires;
+
+import java.util.List;
+
+import javax.persistence.Access;
+import javax.persistence.AccessType;
+import javax.persistence.AttributeOverride;
+import javax.persistence.AttributeOverrides;
+import javax.persistence.CascadeType;
+import javax.persistence.Column;
+import javax.persistence.Embedded;
+import javax.persistence.Entity;
+import javax.persistence.EnumType;
+import javax.persistence.Enumerated;
+import javax.persistence.JoinColumn;
+import javax.persistence.ManyToOne;
+import javax.persistence.OneToMany;
+import javax.persistence.Table;
+import javax.persistence.Transient;
+
+import com.google.common.collect.ComparisonChain;
+
+import de.openkonsequenz.cimcache.model.jpa.core.OperatingShareJpa;
+import de.openkonsequenz.cimcache.model.jpa.core.TerminalJpa;
+import de.openkonsequenz.cimcache.model.jpa.domain.ActivePowerJpa;
+import de.openkonsequenz.cimcache.model.jpa.domain.CommunicationTypeJpa;
+import de.openkonsequenz.cimcache.model.jpa.domain.ReductionSettingJpa;
+import de.openkonsequenz.cimcache.model.jpa.domain.VoltageJpa;
+import de.openkonsequenz.cimcache.model.jpa.informative.infoperations.PsrEventJpa;
+import de.openkonsequenz.cimcache.model.jpa.meas.AnalogJpa;
+import de.openkonsequenz.cimcache.model.jpa.meas.AnalogValueJpa;
+import de.openkonsequenz.cimcache.model.jpa.production.GeneratingUnitJpa;
+
+@Entity
+@Table(name = "SYNCHRONOUS_MACHINE")
+@Access(AccessType.FIELD)
+public class SynchronousMachineJpa extends RotatingMachineJpa implements Comparable<SynchronousMachineJpa> {
+
+ /**
+ * Maximum voltage limit for the unit.
+ */
+ @Embedded
+ @AttributeOverrides({
+ @AttributeOverride(name = "value", column = @Column(name = "MAX_VOLTAGE_LIMIT_VALUE")),
+ @AttributeOverride(name = "multiplier", column = @Column(name = "MAX_VOLTAGE_LIMIT_UNIT_MULTIPLIER")),
+ @AttributeOverride(name = "unit", column = @Column(name = "MAX_VOLTAGE_LIMIT_UNIT_SYMBOL"))
+ })
+ private VoltageJpa maxU;
+
+ /**
+ * Modes that this synchronous machine can operate in.
+ */
+ @Enumerated(EnumType.STRING)
+ @Column(name = "SYNCHRONOUS_MACHINE_KIND")
+ private SynchronousMachineKindJpa synchronousMachineKindJpa;
+
+ /**
+ * The feed-in ranking of a generator (SynchronousMachine) as
+ * described by BDEW VKU
+ * BDEW/VKU-Praxis-Leitfaden für unterstützende Maßnahmen von Stromnetzbetreibern
+ * 31.10.2014
+ * CIM extension by Jan Krueger, April 2015
+ */
+ @Column(name = "FEED_IN_RANKING")
+ private Integer feedInRanking;
+
+ /**
+ * The feed-in priority of a generator (SynchronousMachine)
+ * 1 - high priority, ... 5 - low priority
+ * CIM extension by Jan Krueger, April 2015
+ */
+ @Column(name = "FEED_IN_PRIORITY")
+ private Integer feedInPriority;
+
+ /**
+ * Communication Type EFR, FWT, TRA
+ * CIM extension by Jan Krueger, April 2015
+ */
+ @Enumerated(EnumType.STRING)
+ @Column(name = "COMMUNICATION_TYPE")
+ private CommunicationTypeJpa communicationTypeJpa;
+
+ /**
+ * Communication Group
+ * CIM extension by Jan Krueger, April 2015
+ */
+ @Column(name = "COMMUNICATION_GROUP")
+ private Integer communicationGroup;
+
+ /**
+ * Referenced SynchronousMachine
+ * CIM extension by Jan Krueger, April 2015
+ */
+ @ManyToOne(cascade = {CascadeType.PERSIST, CascadeType.MERGE})
+ @JoinColumn(name = "SYNCHRONOUS_MACHINE_ID", referencedColumnName = "ID")
+ private SynchronousMachineJpa referencedSynchronousMachineJpa;
+
+ @ManyToOne(cascade = CascadeType.PERSIST)
+ @JoinColumn(name = "GENERATING_UNIT_OID", referencedColumnName = "OID")
+ private GeneratingUnitJpa generatingUnitJpa;
+
+ /**
+ * All reduction settings of a Synchronous Machine, e.g. 30%, 60% and 100%
+ * CIM extension by Jan Krueger, April 2015
+ */
+ @OneToMany(targetEntity = ReductionSettingJpa.class,
+ cascade = {CascadeType.PERSIST, CascadeType.MERGE})
+ @JoinColumn(name = "SYNCHRONOUS_MACHINE_ID")
+ private List<ReductionSettingJpa> reductionSettingJpaList;
+
+ @Override
+ @Access(AccessType.PROPERTY)
+ @OneToMany(targetEntity = AnalogJpa.class,
+ cascade = {CascadeType.PERSIST, CascadeType.MERGE})
+ @JoinColumn(name = "SYNCHRONOUS_MACHINE_ID")
+ public List<AnalogJpa> getAnalogJpaList() {
+ return super.getAnalogJpaList();
+ }
+
+ @Override
+ public void setAnalogJpaList(final List<AnalogJpa> analogJpaList) {
+ super.setAnalogJpaList(analogJpaList);
+ }
+
+ @Override
+ @OneToMany(targetEntity = OperatingShareJpa.class, cascade = CascadeType.PERSIST)
+ @JoinColumn(name = "SYNCHRONOUS_MACHINE_ID")
+ @Access(AccessType.PROPERTY)
+ public List<OperatingShareJpa> getOperatingShareJpaList() {
+ return super.getOperatingShareJpaList();
+ }
+
+ @Override
+ public void setOperatingShareJpaList(final List<OperatingShareJpa> operatingShareJpaList) {
+ super.setOperatingShareJpaList(operatingShareJpaList);
+ }
+
+ @Override
+ @OneToMany(targetEntity = PsrEventJpa.class, cascade = CascadeType.PERSIST)
+ @JoinColumn(name = "SYNCHRONOUS_MACHINE_ID")
+ @Access(AccessType.PROPERTY)
+ public List<PsrEventJpa> getPsrEventJpaList() {
+ return super.getPsrEventJpaList();
+ }
+
+ @Override
+ public void setPsrEventJpaList(final List<PsrEventJpa> psrEventJpaList) {
+ super.setPsrEventJpaList(psrEventJpaList);
+ }
+
+ @Override
+ @OneToMany(targetEntity = TerminalJpa.class, cascade = CascadeType.PERSIST)
+ @JoinColumn(name = "SYNCHRONOUS_MACHINE_ID")
+ @Access(AccessType.PROPERTY)
+ public List<TerminalJpa> getTerminalJpaList() {
+ return super.getTerminalJpaList();
+ }
+
+ @Override
+ public void setTerminalJpaList(final List<TerminalJpa> terminalJpaList) {
+ super.setTerminalJpaList(terminalJpaList);
+ }
+
+ @Transient
+ private AnalogValueJpa reductionSettingMeasured;
+
+ @Transient
+ private ActivePowerJpa generatorPowerMeasured;
+
+ /**
+ * Get ReductionSetting.
+ * A SynchronousMachine within EISMAN-App is holding one measured ReductionSetting.
+ *
+ * @return
+ */
+ public AnalogValueJpa getReductionSettingMeasured() {
+
+ for (final AnalogJpa analogJpa : getAnalogJpaList()) {
+
+ if ("ReductionSetting".equals(analogJpa.getMeasurementType())) {
+
+ reductionSettingMeasured = analogJpa.getAnalogValueJpaList().get(0);
+ }
+ }
+
+ return reductionSettingMeasured;
+ }
+
+ /**
+ * Get the power measured of the SynchronousMachine.
+ * A SynchronousMachine within EISMAN-App is holding one measured GeneratorVoltage.
+ *
+ * @return
+ */
+ public ActivePowerJpa getGeneratorPowerMeasured() {
+
+ final ActivePowerJpa newGeneratorPowerMeasured = new ActivePowerJpa();
+
+ for (final AnalogJpa analogJpa : getAnalogJpaList()) {
+
+ if ("GeneratorPower".equals(analogJpa.getMeasurementType())) {
+
+ newGeneratorPowerMeasured.setValue(analogJpa.getAnalogValueJpaList().get(0).getValue());
+ newGeneratorPowerMeasured.setMultiplier(analogJpa.getUnitMultiplierJpa());
+ newGeneratorPowerMeasured.setUnit(analogJpa.getUnitSymbolJpa());
+ }
+ }
+
+ return newGeneratorPowerMeasured;
+ }
+
+ public VoltageJpa getMaxU() {
+ return maxU;
+ }
+
+ public void setMaxU(final VoltageJpa maxU) {
+ this.maxU = maxU;
+ }
+
+ public SynchronousMachineKindJpa getSynchronousMachineKindJpa() {
+ return synchronousMachineKindJpa;
+ }
+
+ public void setSynchronousMachineKindJpa(final SynchronousMachineKindJpa synchronousMachineKindJpa) {
+ this.synchronousMachineKindJpa = synchronousMachineKindJpa;
+ }
+
+ public Integer getFeedInRanking() {
+ return feedInRanking;
+ }
+
+ public void setFeedInRanking(final Integer feedInRanking) {
+ this.feedInRanking = feedInRanking;
+ }
+
+ public Integer getFeedInPriority() {
+ return feedInPriority;
+ }
+
+ public void setFeedInPriority(final Integer feedInPriority) {
+ this.feedInPriority = feedInPriority;
+ }
+
+ public CommunicationTypeJpa getCommunicationTypeJpa() {
+ return communicationTypeJpa;
+ }
+
+ public void setCommunicationTypeJpa(final CommunicationTypeJpa communicationTypeJpa) {
+ this.communicationTypeJpa = communicationTypeJpa;
+ }
+
+ public Integer getCommunicationGroup() {
+ return communicationGroup;
+ }
+
+ public void setCommunicationGroup(final Integer communicationGroup) {
+ this.communicationGroup = communicationGroup;
+ }
+
+ public SynchronousMachineJpa getReferencedSynchronousMachineJpa() {
+ return referencedSynchronousMachineJpa;
+ }
+
+ public void setReferencedSynchronousMachineJpa(final SynchronousMachineJpa referencedSynchronousMachineJpa) {
+ this.referencedSynchronousMachineJpa = referencedSynchronousMachineJpa;
+ }
+
+ public GeneratingUnitJpa getGeneratingUnitJpa() {
+ return generatingUnitJpa;
+ }
+
+ public void setGeneratingUnitJpa(final GeneratingUnitJpa generatingUnitJpa) {
+ this.generatingUnitJpa = generatingUnitJpa;
+ }
+
+ public List<ReductionSettingJpa> getReductionSettingJpaList() {
+ return reductionSettingJpaList;
+ }
+
+ public void setReductionSettingJpaList(final List<ReductionSettingJpa> reductionSettingJpaList) {
+ this.reductionSettingJpaList = reductionSettingJpaList;
+ }
+
+ @Override
+ public int compareTo(final SynchronousMachineJpa that) {
+ return ComparisonChain.start()
+ .compare(this.mRid, that.mRid)
+ .result();
+ }
+}
diff --git a/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/wires/SynchronousMachineKindJpa.java b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/wires/SynchronousMachineKindJpa.java
new file mode 100644
index 00000000..b75a7bae
--- /dev/null
+++ b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/jpa/wires/SynchronousMachineKindJpa.java
@@ -0,0 +1,29 @@
+/**
+ ******************************************************************************
+ * Copyright © 2015-2017 BTC AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ ******************************************************************************
+ */
+package de.openkonsequenz.cimcache.model.jpa.wires;
+
+public enum SynchronousMachineKindJpa {
+ GENERATOR("GENERATOR"),
+ CONDENSER("CONDENSER"),
+ MOTOR("MOTOR");
+
+ private final String value;
+
+ private SynchronousMachineKindJpa(final String value) {
+ this.value = value;
+ }
+
+ public String value() {
+ return this.value;
+ }
+
+}
diff --git a/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/util/Abstract4Tree.java b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/util/Abstract4Tree.java
new file mode 100644
index 00000000..60dd4607
--- /dev/null
+++ b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/util/Abstract4Tree.java
@@ -0,0 +1,79 @@
+/**
+ ******************************************************************************
+ * Copyright © 2015-2017 BTC AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ ******************************************************************************
+ */
+package de.openkonsequenz.cimcache.model.util;
+
+public class Abstract4Tree {
+
+ private String oid;
+ private String name;
+ private String pv;
+ private String bio;
+ private String wind;
+ private String noBioPvWind;
+ private String sum;
+
+ public String getOid() {
+ return oid;
+ }
+
+ public void setOid(final String oid) {
+ this.oid = oid;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(final String name) {
+ this.name = name;
+ }
+
+ public String getPv() {
+ return pv;
+ }
+
+ public void setPv(final String pv) {
+ this.pv = pv;
+ }
+
+ public String getBio() {
+ return bio;
+ }
+
+ public void setBio(final String bio) {
+ this.bio = bio;
+ }
+
+ public String getWind() {
+ return wind;
+ }
+
+ public void setWind(final String wind) {
+ this.wind = wind;
+ }
+
+ public String getNoBioPvWind() {
+ return noBioPvWind;
+ }
+
+ public void setNoBioPvWind(final String noBioPvWind) {
+ this.noBioPvWind = noBioPvWind;
+ }
+
+ public String getSum() {
+ return sum;
+ }
+
+ public void setSum(final String sum) {
+ this.sum = sum;
+ }
+}
diff --git a/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/util/SubGeographicalRegion4Tree.java b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/util/SubGeographicalRegion4Tree.java
new file mode 100644
index 00000000..f9e675e5
--- /dev/null
+++ b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/util/SubGeographicalRegion4Tree.java
@@ -0,0 +1,30 @@
+/**
+ ******************************************************************************
+ * Copyright © 2015-2017 BTC AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ ******************************************************************************
+ */
+package de.openkonsequenz.cimcache.model.util;
+
+import java.util.List;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+public class SubGeographicalRegion4Tree extends Abstract4Tree {
+
+ @JsonProperty(value = "children")
+ private List<Substation4Tree> substation4TreeList;
+
+ public List<Substation4Tree> getSubstation4TreeList() {
+ return substation4TreeList;
+ }
+
+ public void setSubstation4TreeList(final List<Substation4Tree> substation4TreeList) {
+ this.substation4TreeList = substation4TreeList;
+ }
+}
diff --git a/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/util/Substation4Tree.java b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/util/Substation4Tree.java
new file mode 100644
index 00000000..a9bdabfe
--- /dev/null
+++ b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/util/Substation4Tree.java
@@ -0,0 +1,31 @@
+/**
+ ******************************************************************************
+ * Copyright © 2015-2017 BTC AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ ******************************************************************************
+ */
+package de.openkonsequenz.cimcache.model.util;
+
+import java.util.List;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+public class Substation4Tree extends Abstract4Tree {
+
+ @JsonProperty(value = "children")
+ private List<Substation4Tree> substation4TreeList;
+
+ public List<Substation4Tree> getSubstation4TreeList() {
+ return substation4TreeList;
+ }
+
+ public void setSubstation4TreeList(final List<Substation4Tree> substation4TreeList) {
+ this.substation4TreeList = substation4TreeList;
+ }
+
+}
diff --git a/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/util/SumContainer.java b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/util/SumContainer.java
new file mode 100644
index 00000000..9012d76f
--- /dev/null
+++ b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/model/util/SumContainer.java
@@ -0,0 +1,82 @@
+/**
+ ******************************************************************************
+ * Copyright © 2015-2017 BTC AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ ******************************************************************************
+ */
+package de.openkonsequenz.cimcache.model.util;
+
+import java.math.BigDecimal;
+
+public class SumContainer {
+
+ private BigDecimal pv;
+ private BigDecimal bio;
+ private BigDecimal wind;
+ private BigDecimal noBioWindPv;
+
+ public SumContainer() {
+
+ this.pv = BigDecimal.ZERO;
+ this.bio = BigDecimal.ZERO;
+ this.wind = BigDecimal.ZERO;
+ this.noBioWindPv = BigDecimal.ZERO;
+ }
+
+ public SumContainer(final BigDecimal pv,
+ final BigDecimal bio,
+ final BigDecimal wind,
+ final BigDecimal noBioWindPv) {
+
+ this.pv = pv == null ? BigDecimal.ZERO : pv;
+ this.bio = bio == null ? BigDecimal.ZERO : bio;
+ this.wind = wind == null ? BigDecimal.ZERO : wind;
+ this.noBioWindPv = noBioWindPv == null ? BigDecimal.ZERO : noBioWindPv;
+ }
+
+ public void add(final BigDecimal pv,
+ final BigDecimal bio,
+ final BigDecimal wind,
+ final BigDecimal noBioWindPv) {
+
+ this.pv = this.pv.add(pv);
+ this.bio = this.bio.add(bio);
+ this.wind = this.wind.add(wind);
+ this.noBioWindPv = this.noBioWindPv.add(noBioWindPv);
+ }
+
+ public SumContainer add(final SumContainer sumContainer) {
+
+ pv = pv.add(sumContainer.getPv());
+ bio = bio.add(sumContainer.getBio());
+ wind = wind.add(sumContainer.getWind());
+ noBioWindPv = noBioWindPv.add(sumContainer.getNoBioWindPv());
+
+ return this;
+ }
+
+ public BigDecimal getPv() {
+ return pv;
+ }
+
+ public BigDecimal getBio() {
+ return bio;
+ }
+
+ public BigDecimal getWind() {
+ return wind;
+ }
+
+ public BigDecimal getNoBioWindPv() {
+ return noBioWindPv;
+ }
+
+ public BigDecimal getSum() {
+ return pv.add(bio).add(wind).add(noBioWindPv);
+ }
+}
diff --git a/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/repository/GeneratingUnitJpaRepository.java b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/repository/GeneratingUnitJpaRepository.java
new file mode 100644
index 00000000..fa22b6ef
--- /dev/null
+++ b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/repository/GeneratingUnitJpaRepository.java
@@ -0,0 +1,22 @@
+/**
+ ******************************************************************************
+ * Copyright © 2015-2017 BTC AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ ******************************************************************************
+ */
+package de.openkonsequenz.cimcache.repository;
+
+import org.springframework.data.jpa.repository.JpaRepository;
+
+import de.openkonsequenz.cimcache.model.jpa.production.GeneratingUnitJpa;
+
+public interface GeneratingUnitJpaRepository extends JpaRepository<GeneratingUnitJpa, Long> {
+
+ GeneratingUnitJpa findGeneratingUnitJpaByMRidAndValidToNull(String mRid);
+
+}
diff --git a/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/repository/GeographicalRegionJpaRepository.java b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/repository/GeographicalRegionJpaRepository.java
new file mode 100644
index 00000000..bcd9737e
--- /dev/null
+++ b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/repository/GeographicalRegionJpaRepository.java
@@ -0,0 +1,24 @@
+/**
+ ******************************************************************************
+ * Copyright © 2015-2017 BTC AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ ******************************************************************************
+ */
+package de.openkonsequenz.cimcache.repository;
+
+import org.springframework.data.repository.PagingAndSortingRepository;
+
+import de.openkonsequenz.cimcache.model.jpa.core.GeographicalRegionJpa;
+
+public interface GeographicalRegionJpaRepository extends PagingAndSortingRepository<GeographicalRegionJpa, Long> {
+
+ GeographicalRegionJpa findGeographicalRegionByMRidAndValidToNull(String mRid);
+
+ GeographicalRegionJpa findGeographicalRegionByMRidAndName(String mRid, String name);
+
+}
diff --git a/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/repository/SequenceJpaRepository.java b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/repository/SequenceJpaRepository.java
new file mode 100644
index 00000000..26ef7565
--- /dev/null
+++ b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/repository/SequenceJpaRepository.java
@@ -0,0 +1,22 @@
+/**
+ ******************************************************************************
+ * Copyright © 2015-2017 BTC AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ ******************************************************************************
+ */
+package de.openkonsequenz.cimcache.repository;
+
+import org.springframework.data.jpa.repository.JpaRepository;
+
+import de.openkonsequenz.cimcache.model.jpa.util.Sequence;
+
+public interface SequenceJpaRepository extends JpaRepository<Sequence, String> {
+
+ Sequence findSequenceBySequenceName(String name);
+
+}
diff --git a/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/repository/SubGeographicalRegionJpaRepository.java b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/repository/SubGeographicalRegionJpaRepository.java
new file mode 100644
index 00000000..16be2e95
--- /dev/null
+++ b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/repository/SubGeographicalRegionJpaRepository.java
@@ -0,0 +1,32 @@
+/**
+ ******************************************************************************
+ * Copyright © 2015-2017 BTC AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ ******************************************************************************
+ */
+package de.openkonsequenz.cimcache.repository;
+
+import java.util.List;
+
+import org.springframework.data.jpa.repository.Query;
+import org.springframework.data.repository.PagingAndSortingRepository;
+
+import de.openkonsequenz.cimcache.model.jpa.core.SubGeographicalRegionJpa;
+
+public interface SubGeographicalRegionJpaRepository extends PagingAndSortingRepository<SubGeographicalRegionJpa, Long> {
+
+ SubGeographicalRegionJpa findSubGeographicalRegionByMRid(String mRid);
+
+ SubGeographicalRegionJpa findSubGeographicalRegionByMRidAndValidToNull(String mRid);
+
+ SubGeographicalRegionJpa findSubGeographicalRegionByOidAndValidToNull(Long oid);
+
+ @Query(value = "select * from SUBGEOGRAPHICAL_REGION", nativeQuery = true)
+ List<Object[]> findSubGeographicalRegionJpa4Lov();
+
+}
diff --git a/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/repository/SubstationJpaRepository.java b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/repository/SubstationJpaRepository.java
new file mode 100644
index 00000000..6a3c5ff3
--- /dev/null
+++ b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/repository/SubstationJpaRepository.java
@@ -0,0 +1,64 @@
+/**
+ ******************************************************************************
+ * Copyright © 2015-2017 BTC AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ ******************************************************************************
+ */
+package de.openkonsequenz.cimcache.repository;
+
+import java.sql.Timestamp;
+import java.util.List;
+
+import org.springframework.data.jpa.repository.Query;
+import org.springframework.data.repository.PagingAndSortingRepository;
+
+import de.openkonsequenz.cimcache.model.jpa.core.SubstationJpa;
+
+public interface SubstationJpaRepository extends PagingAndSortingRepository<SubstationJpa, Long> {
+
+ SubstationJpa findSubstationJpaByMRidAndValidToNull(String mRid);
+
+ SubstationJpa findSubstationJpaByOidAndValidToNull(String oid);
+
+ /**
+ * Get all Substations which are Transformer Stations.
+ *
+ * @return
+ */
+ @Query(value = "select * from equipment_container ec "
+ + "where ec.oid in "
+ + "(select equipment_container_oid from equipment_container ec1 "
+ + "where ec1.equipment_container_type = 'VoltageLevelType' "
+ + "and high_voltage_limit_value = '110' "
+ + "and high_voltage_limit_unit_multiplier = 'KILO' "
+ + "and high_voltage_limit_unit_symbol='V')",
+ nativeQuery = true)
+ List<Object[]> findSubstatioJpa4Lov();
+
+// @Query(value = "select distinct ec.* "
+// + "from equipment_container ec, synchronous_machine sm, generating_unit gu "
+// + "where ec.oid = ?1 "
+// + "and ec.valid_from < ?2 "
+// + "and (ec.valid_to is null or ec.valid_to > ?2) "
+// + "and ec.oid = sm.equipment_container_oid "
+// + "and sm.valid_from < ?2 "
+// + "and (sm.valid_to is null or sm.valid_to > ?2) "
+// + "and sm.generating_unit_oid = gu.oid "
+// + "and gu.valid_from < ?2 "
+// + "and (gu.valid_to is null or gu.valid_to > ?2)",
+// nativeQuery = true)
+// SubstationJpa findSubstationByOidAndTimestamp(final int oid, final Timestamp timestamp);
+
+ @Query(value = "select distinct ec.* "
+ + "from equipment_container ec "
+ + "where ec.oid = ?1 "
+ + "and ec.valid_from < ?2 "
+ + "and (ec.valid_to is null or ec.valid_to > ?2)",
+ nativeQuery = true)
+ SubstationJpa findSubstationByOidAndTimestamp(final int oid, final Timestamp timestamp);
+}
diff --git a/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/repository/SynchronousMachineJpaRepository.java b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/repository/SynchronousMachineJpaRepository.java
new file mode 100644
index 00000000..42e9a745
--- /dev/null
+++ b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/repository/SynchronousMachineJpaRepository.java
@@ -0,0 +1,30 @@
+/**
+ ******************************************************************************
+ * Copyright © 2015-2017 BTC AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ ******************************************************************************
+ */
+package de.openkonsequenz.cimcache.repository;
+
+import java.sql.Timestamp;
+
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.Query;
+
+import de.openkonsequenz.cimcache.model.jpa.wires.SynchronousMachineJpa;
+
+public interface SynchronousMachineJpaRepository extends JpaRepository<SynchronousMachineJpa, Long> {
+
+ SynchronousMachineJpa findSynchronousMachineJpaByMRidAndValidToNull(String mRid);
+
+ @Query(value = "select sm from SynchronousMachineJpa sm "
+ + "where sm.oid = ?1 "
+ + "and (sm.validFrom < ?2 and sm.validTo > ?2 or sm.validFrom < ?2 and sm.validTo is null)")
+ SynchronousMachineJpa findSynchronousMachineJpaByOidAndTimestamp(final Long oid, final Timestamp timestamp);
+
+}
diff --git a/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/repository/VoltageLevelJpaRepository.java b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/repository/VoltageLevelJpaRepository.java
new file mode 100644
index 00000000..1dd1f53f
--- /dev/null
+++ b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/repository/VoltageLevelJpaRepository.java
@@ -0,0 +1,22 @@
+/**
+ ******************************************************************************
+ * Copyright © 2015-2017 BTC AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ ******************************************************************************
+ */
+package de.openkonsequenz.cimcache.repository;
+
+import org.springframework.data.repository.PagingAndSortingRepository;
+
+import de.openkonsequenz.cimcache.model.jpa.core.VoltageLevelJpa;
+
+public interface VoltageLevelJpaRepository extends PagingAndSortingRepository<VoltageLevelJpa, Long> {
+
+ VoltageLevelJpa findVoltageLevelJpaByMRidAndValidToNull(String mRid);
+
+}
diff --git a/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/service/AbstractJpaService.java b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/service/AbstractJpaService.java
new file mode 100644
index 00000000..c8cabd7a
--- /dev/null
+++ b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/service/AbstractJpaService.java
@@ -0,0 +1,23 @@
+/**
+ ******************************************************************************
+ * Copyright © 2015-2017 BTC AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ ******************************************************************************
+ */
+package de.openkonsequenz.cimcache.service;
+
+import java.sql.Timestamp;
+import java.util.Calendar;
+
+public abstract class AbstractJpaService {
+
+ protected Timestamp now() {
+ return new Timestamp(Calendar.getInstance().getTime().getTime());
+ }
+
+}
diff --git a/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/service/ActivePowerJpaService.java b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/service/ActivePowerJpaService.java
new file mode 100644
index 00000000..194a7034
--- /dev/null
+++ b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/service/ActivePowerJpaService.java
@@ -0,0 +1,61 @@
+/**
+ ******************************************************************************
+ * Copyright © 2015-2017 BTC AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ ******************************************************************************
+ */
+package de.openkonsequenz.cimcache.service;
+
+import java.math.BigDecimal;
+import java.math.RoundingMode;
+
+import de.openkonsequenz.cimcache.model.jpa.domain.ActivePowerJpa;
+import de.openkonsequenz.cimcache.model.jpa.domain.UnitMultiplierJpa;
+
+public abstract class ActivePowerJpaService {
+
+ public static ActivePowerJpa addActivePowerReturnMw(final ActivePowerJpa activePowerJpa,
+ final ActivePowerJpa activePowerJpaToBeAdded) {
+
+ return addReturnMw(activePowerJpa, activePowerJpaToBeAdded);
+ }
+
+ public static ActivePowerJpa toMw(final ActivePowerJpa activePowerJpa) {
+
+ final UnitMultiplierJpa unitMultiplierJpa = activePowerJpa.getMultiplier();
+
+ switch (unitMultiplierJpa) {
+
+ case GIGA:
+ activePowerJpa.setValue(activePowerJpa.getValue().multiply(BigDecimal.valueOf(1000L)));
+ activePowerJpa.setMultiplier(UnitMultiplierJpa.MEGA);
+ break;
+
+ case MEGA:
+ break;
+
+ case KILO:
+ activePowerJpa.setValue(activePowerJpa.getValue().divide(BigDecimal.valueOf(1000L), 4, RoundingMode.HALF_UP));
+ activePowerJpa.setMultiplier(UnitMultiplierJpa.MEGA);
+ break;
+
+ default:
+ break;
+ }
+
+ return activePowerJpa;
+ }
+
+ private static ActivePowerJpa addReturnMw(final ActivePowerJpa activePowerJpa, final ActivePowerJpa activePowerJpaToBeAdded) {
+
+ final BigDecimal sum = toMw(activePowerJpa).getValue().add(toMw(activePowerJpaToBeAdded).getValue());
+ activePowerJpa.setValue(sum);
+
+ return activePowerJpa;
+ }
+}
diff --git a/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/service/AnalogJpaService.java b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/service/AnalogJpaService.java
new file mode 100644
index 00000000..29d9ce71
--- /dev/null
+++ b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/service/AnalogJpaService.java
@@ -0,0 +1,91 @@
+/**
+ ******************************************************************************
+ * Copyright © 2015-2017 BTC AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ ******************************************************************************
+ */
+package de.openkonsequenz.cimcache.service;
+
+import java.math.BigDecimal;
+import java.math.RoundingMode;
+import java.util.List;
+
+import com.google.common.collect.Ordering;
+
+import de.openkonsequenz.cimcache.model.jpa.domain.UnitMultiplierJpa;
+import de.openkonsequenz.cimcache.model.jpa.meas.AnalogJpa;
+import de.openkonsequenz.cimcache.model.jpa.meas.AnalogValueJpa;
+
+public abstract class AnalogJpaService {
+
+ public static void toMw(final AnalogJpa analogJpa) {
+
+ final UnitMultiplierJpa unitMultiplierJpa = analogJpa.getUnitMultiplierJpa();
+
+ switch (unitMultiplierJpa) {
+
+ case GIGA:
+ valueToMw(analogJpa.getAnalogValueJpaList(), unitMultiplierJpa);
+ analogJpa.setUnitMultiplierJpa(UnitMultiplierJpa.MEGA);
+ break;
+
+ case MEGA:
+ break;
+
+ case KILO:
+ valueToMw(analogJpa.getAnalogValueJpaList(), unitMultiplierJpa);
+ analogJpa.setUnitMultiplierJpa(UnitMultiplierJpa.MEGA);
+ break;
+
+ default:
+ break;
+ }
+ }
+
+ public static void setOnlyLatestValue(final List<AnalogJpa> analogJpaList) {
+
+ for (final AnalogJpa analogJpa : analogJpaList) {
+
+ final Ordering<AnalogValueJpa> ordering = new Ordering<AnalogValueJpa>() {
+ @Override
+ public int compare(final AnalogValueJpa aVJ01, final AnalogValueJpa aVJ02) {
+ return aVJ01.getTimeStamp().getValue().compareTo(aVJ02.getTimeStamp().getValue());
+ }
+ };
+
+ final AnalogValueJpa analogValueJpaLatest = ordering.max(analogJpa.getAnalogValueJpaList());
+ analogJpa.getAnalogValueJpaList().clear();
+ analogJpa.getAnalogValueJpaList().add(analogValueJpaLatest);
+ }
+
+ }
+
+ private static void valueToMw(final List<AnalogValueJpa> analogValueJpaList, final UnitMultiplierJpa unitMultiplierJpa) {
+
+ for (final AnalogValueJpa analogValueJpa : analogValueJpaList) {
+
+ switch (unitMultiplierJpa) {
+
+ case GIGA:
+ analogValueJpa.setValue(analogValueJpa.getValue().multiply(BigDecimal.valueOf(1000L)));
+ break;
+
+ case MEGA:
+ break;
+
+ case KILO:
+ analogValueJpa.setValue(analogValueJpa.getValue().divide(BigDecimal.valueOf(1000L), 4, RoundingMode.HALF_UP));
+ break;
+
+ default:
+ break;
+ }
+ }
+ }
+
+}
diff --git a/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/service/AnalogValueJpaService.java b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/service/AnalogValueJpaService.java
new file mode 100644
index 00000000..a03a5471
--- /dev/null
+++ b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/service/AnalogValueJpaService.java
@@ -0,0 +1,44 @@
+/**
+ ******************************************************************************
+ * Copyright © 2015-2017 BTC AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ ******************************************************************************
+ */
+package de.openkonsequenz.cimcache.service;
+
+import java.math.BigDecimal;
+import java.util.List;
+
+import org.springframework.stereotype.Service;
+
+import com.google.common.collect.Ordering;
+
+import de.openkonsequenz.cimcache.model.jpa.meas.AnalogValueJpa;
+
+@Service
+public class AnalogValueJpaService {
+
+ public BigDecimal getLatestValue(final List<AnalogValueJpa> analogValueJpaList) {
+
+ return getAnalogValueJpaLatestValue(analogValueJpaList).getValue();
+ }
+
+ public AnalogValueJpa getAnalogValueJpaLatestValue(final List<AnalogValueJpa> analogValueJpaList) {
+
+ final Ordering<AnalogValueJpa> ordering = new Ordering<AnalogValueJpa>() {
+
+ @Override
+ public int compare(final AnalogValueJpa aVJ01, final AnalogValueJpa aVJ02) {
+ return aVJ01.getTimeStamp().getValue().compareTo(aVJ02.getTimeStamp().getValue());
+ }
+ };
+
+ return ordering.max(analogValueJpaList);
+ }
+
+}
diff --git a/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/service/BaseMapperService.java b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/service/BaseMapperService.java
new file mode 100644
index 00000000..41bba997
--- /dev/null
+++ b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/service/BaseMapperService.java
@@ -0,0 +1,22 @@
+/**
+ ******************************************************************************
+ * Copyright © 2015-2017 BTC AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ ******************************************************************************
+ */
+package de.openkonsequenz.cimcache.service;
+
+import org.dozer.Mapper;
+import org.springframework.beans.factory.annotation.Autowired;
+
+public class BaseMapperService {
+
+ @Autowired
+ protected Mapper mapper;
+
+}
diff --git a/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/service/EquipmentService.java b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/service/EquipmentService.java
new file mode 100644
index 00000000..925c54fd
--- /dev/null
+++ b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/service/EquipmentService.java
@@ -0,0 +1,154 @@
+/**
+ ******************************************************************************
+ * Copyright © 2015-2017 BTC AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ ******************************************************************************
+ */
+package de.openkonsequenz.cimcache.service;
+
+import java.math.BigDecimal;
+import java.math.RoundingMode;
+import java.util.ArrayList;
+import java.util.List;
+
+import com.google.common.collect.Ordering;
+
+import de.openkonsequenz.cim.core.Equipment;
+import de.openkonsequenz.cim.domain.ActivePower;
+import de.openkonsequenz.cim.domain.UnitMultiplier;
+import de.openkonsequenz.cim.meas.Analog;
+import de.openkonsequenz.cim.meas.AnalogValue;
+import de.openkonsequenz.cim.meas.Measurement;
+import de.openkonsequenz.cim.production.GeneratorControlSource;
+import de.openkonsequenz.cim.wires.SynchronousMachine;
+import de.openkonsequenz.cim.wires.SynchronousMachineKind;
+
+public abstract class EquipmentService {
+
+ public static void mapActivePowerKilo2Mega(final Equipment equipment) {
+
+ if (equipment instanceof SynchronousMachine) {
+
+ final ActivePower activePowerHighControlLimit =
+ ((SynchronousMachine) equipment).getGeneratingUnit().getHighControlLimit();
+
+ if (activePowerHighControlLimit != null
+ && activePowerHighControlLimit.getMultiplier().equals(UnitMultiplier.KILO)) {
+
+ activePowerHighControlLimit.setMultiplier(UnitMultiplier.MEGA);
+ activePowerHighControlLimit.setValue(
+ new BigDecimal(
+ activePowerHighControlLimit.getValue())
+ .divide(BigDecimal.valueOf(1000L), 2, RoundingMode.HALF_UP)
+ .toString()
+ );
+ }
+
+ final ActivePower activePowerMaxOperatingP =
+ ((SynchronousMachine) equipment).getGeneratingUnit().getMaxOperatingP();
+
+ if (activePowerMaxOperatingP != null
+ && activePowerMaxOperatingP.getMultiplier().equals(UnitMultiplier.KILO)) {
+
+ activePowerMaxOperatingP.setMultiplier(UnitMultiplier.MEGA);
+ activePowerMaxOperatingP.setValue(
+ new BigDecimal(
+ activePowerMaxOperatingP.getValue())
+ .divide(BigDecimal.valueOf(1000L), 2, RoundingMode.HALF_UP)
+ .toString()
+ );
+ }
+ }
+ }
+
+ // map from kW to MW
+ public static void mapMeasurementValueKilo2Mega(final Equipment equipment) {
+
+ if (equipment.getMeasurementList() != null) {
+
+ for (final Measurement measurement : equipment.getMeasurementList()) {
+
+ if (measurement.getUnitMultiplier() != null && measurement.getUnitMultiplier().equals(UnitMultiplier.KILO)) {
+
+ measurement.setUnitMultiplier(UnitMultiplier.MEGA);
+
+ for (final AnalogValue analogValue : ((Analog) measurement).getAnalogValueList()) {
+
+ analogValue.setValue(
+ new BigDecimal(
+ analogValue.getValue())
+ .divide(BigDecimal.valueOf(1000L), 2, RoundingMode.HALF_UP)
+ .toString()
+ );
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * Set only the latest measurement by filtering out older measurements.
+ *
+ * @param equipment
+ */
+ public static void setLatestMeasurementOfEquipment(final Equipment equipment) {
+
+ final List<Measurement> measurementList = new ArrayList<>();
+
+ if (equipment instanceof SynchronousMachine && equipment.getMeasurementList() != null) {
+
+ for (final Measurement measurement : equipment.getMeasurementList()) {
+
+ if (measurement instanceof Analog) {
+
+ final Ordering<AnalogValue> ordering = new Ordering<AnalogValue>() {
+ // 0 if the two Timestamp objects are equal
+ // < 0 if this Timestamp object is before the given argument
+ // > 0 if this Timestamp object is after the given argument
+ @Override
+ public int compare(final AnalogValue aV01, final AnalogValue aV02) {
+ return aV01.getTimeStamp().getValue().compareTo(aV02.getTimeStamp().getValue());
+ }
+ };
+
+ final AnalogValue analogValueLatest = ordering.max(((Analog) measurement).getAnalogValueList());
+
+ ((Analog) measurement).getAnalogValueList().clear();
+ ((Analog) measurement).getAnalogValueList().add(analogValueLatest);
+
+ measurementList.add(measurement);
+ }
+ }
+ }
+
+ equipment.setMeasurementList(measurementList);
+ }
+
+ /**
+ * Check if the Equipment is a SynchronousMachine and if this SynchronousMachine can be used
+ * for Eisman.
+ *
+ * @param equipment
+ * @return
+ */
+ public static boolean checkEquipment4Eisman(final Equipment equipment) {
+ boolean result = false;
+ if (equipment instanceof SynchronousMachine
+ && ((SynchronousMachine) equipment).getGeneratingUnit() != null
+ && Boolean.parseBoolean(equipment.getNormallyInService())
+ && ((SynchronousMachine) equipment).getGeneratingUnit().getGeneratorControlSource()
+ == GeneratorControlSource.IS_CONTROLLABLE
+ && Boolean.parseBoolean(((SynchronousMachine) equipment).getControlEnabled())
+ && ((SynchronousMachine) equipment).getSynchronousMachineKind() == SynchronousMachineKind.GENERATOR
+ ) {
+ result = true;
+ }
+ return result;
+ }
+
+}
diff --git a/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/service/GeographicalRegionJpaService.java b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/service/GeographicalRegionJpaService.java
new file mode 100644
index 00000000..18ab65c3
--- /dev/null
+++ b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/service/GeographicalRegionJpaService.java
@@ -0,0 +1,467 @@
+/**
+ ******************************************************************************
+ * Copyright © 2015-2017 BTC AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ ******************************************************************************
+ */
+package de.openkonsequenz.cimcache.service;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.commons.collections.CollectionUtils;
+import org.apache.commons.collections.Predicate;
+import org.apache.log4j.Logger;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import com.google.common.collect.Lists;
+
+import de.openkonsequenz.cimcache.model.jpa.core.EquipmentJpa;
+import de.openkonsequenz.cimcache.model.jpa.core.GeographicalRegionJpa;
+import de.openkonsequenz.cimcache.model.jpa.core.IdentifiedObjectJpa;
+import de.openkonsequenz.cimcache.model.jpa.core.SubGeographicalRegionJpa;
+import de.openkonsequenz.cimcache.model.jpa.core.SubstationJpa;
+import de.openkonsequenz.cimcache.model.jpa.core.VoltageLevelJpa;
+import de.openkonsequenz.cimcache.model.jpa.meas.AnalogJpa;
+import de.openkonsequenz.cimcache.model.jpa.production.GeneratingUnitJpa;
+import de.openkonsequenz.cimcache.model.jpa.wires.SynchronousMachineJpa;
+import de.openkonsequenz.cimcache.repository.GeographicalRegionJpaRepository;
+import de.openkonsequenz.cimcache.repository.SubGeographicalRegionJpaRepository;
+import de.openkonsequenz.cimcache.repository.SubstationJpaRepository;
+import de.openkonsequenz.cimcache.repository.SynchronousMachineJpaRepository;
+import de.openkonsequenz.cimcache.repository.VoltageLevelJpaRepository;
+
+@Service
+public class GeographicalRegionJpaService extends AbstractJpaService {
+
+ private static final Logger LOG = Logger.getLogger(GeographicalRegionJpaService.class);
+
+ private static final String GEOGRAPHICAL_REGION_SEQ_OID = "GEOGRAPHICAL_REGION_SEQ_OID";
+ private static final String SUBGEOGRAPHICAL_REGION_SEQ_OID = "SUBGEOGRAPHICAL_REGION_SEQ_OID";
+ private static final String EQUIPMENT_CONTAINER_SEQ_OID = "EQUIPMENT_CONTAINER_SEQ_OID";
+
+ @Autowired
+ private SequenceJpaService sequenceJpaService;
+
+ @Autowired
+ private GeographicalRegionJpaRepository geographicalRegionJpaRepository;
+
+ @Autowired
+ private SubGeographicalRegionJpaRepository subGeographicalRegionJpaRepository;
+
+ @Autowired
+ private SubstationJpaRepository substationJpaRepository;
+
+ @Autowired
+ private VoltageLevelJpaRepository voltageLevelJpaRepository;
+
+ @Autowired
+ private SynchronousMachineJpaRepository synchronousMachineJpaRepository;
+
+ @Autowired
+ private SynchronousMachineJpaDiffCheckerService synchronousMachineJpaDiffCheckerService;
+
+ /**
+ * Persists a GeographicalRegion and all elements beneath the GeographicalRegion.
+ *
+ * @param geographicalRegionJpa
+ */
+ public void persist(final GeographicalRegionJpa geographicalRegionJpa) {
+
+ final List<GeographicalRegionJpa> geographicalRegionJpaList = preparePersistence(geographicalRegionJpa);
+
+ for (final GeographicalRegionJpa geoRegJpa : geographicalRegionJpaList) {
+
+ geographicalRegionJpaRepository.save(geoRegJpa);
+ }
+ }
+
+ /**
+ * Prepare the persistance of GeogrphicalRegionJpa and its Sub-Elements.
+ * <p/>
+ * The preparation includes the following steps:
+ * 1. check if there is more than one GeographicalRegion holding different MRIDs
+ * => if yes then break
+ * 2. check if there is a GeographicalRegion with same MRID
+ * => if yes and name is equal no action
+ * => if yes and name is different then close existing version by settinng validTo and
+ * create new version with same oid
+ * <p/>
+ * Do the same with entities SubGeographicalRegion, Substation, Equipment, etc.
+ *
+ * @param geographicalRegionJpa
+ * @return
+ */
+ private List<GeographicalRegionJpa> preparePersistence(final GeographicalRegionJpa geographicalRegionJpa) {
+
+ final List<GeographicalRegionJpa> geographicalRegionJpaList = new ArrayList<>();
+
+ if (singleGeographicalRegionPersisted(geographicalRegionJpa)) {
+
+ LOG.warn("Only one GeographicalRegion is allowed! GeographicalRegion with MRID: "
+ + geographicalRegionJpa.getmRid() + " cannot be persisted!");
+
+ return geographicalRegionJpaList;
+ }
+
+ final GeographicalRegionJpa geographicalRegionJpaPersisted =
+ geographicalRegionJpaRepository.findGeographicalRegionByMRidAndValidToNull(geographicalRegionJpa.getmRid());
+
+ if (geographicalRegionJpaPersisted == null) {
+
+ geographicalRegionJpa.setOid(sequenceJpaService.getNextValueFromSequence(GEOGRAPHICAL_REGION_SEQ_OID));
+ geographicalRegionJpa.setValidFrom(now());
+
+ geographicalRegionJpaList.add(geographicalRegionJpa);
+
+ } else {
+
+ if (geographicalRegionJpaPersisted.getName().equals(geographicalRegionJpa.getName())) {
+
+ geographicalRegionJpa.setId(geographicalRegionJpaPersisted.getId());
+ geographicalRegionJpa.setOid(geographicalRegionJpaPersisted.getOid());
+ geographicalRegionJpa.setValidFrom(geographicalRegionJpaPersisted.getValidFrom());
+
+ geographicalRegionJpaList.add(geographicalRegionJpa);
+
+ } else {
+
+ geographicalRegionJpaPersisted.setValidTo(now());
+
+ final GeographicalRegionJpa geographicalRegionJpaNew = new GeographicalRegionJpa();
+
+ geographicalRegionJpaNew.setOid(geographicalRegionJpaPersisted.getOid());
+ geographicalRegionJpaNew.setValidFrom(now());
+ geographicalRegionJpaNew.setmRid(geographicalRegionJpaPersisted.getmRid());
+ geographicalRegionJpaNew.setName(geographicalRegionJpa.getName());
+ geographicalRegionJpaNew.setSubGeographicalRegionJpaList(geographicalRegionJpa.getSubGeographicalRegionJpaList());
+
+ geographicalRegionJpaList.add(geographicalRegionJpaPersisted);
+ geographicalRegionJpaList.add(geographicalRegionJpaNew);
+ }
+ }
+
+ prepareSubGeographicalRegion(geographicalRegionJpaList.get(geographicalRegionJpaList.size() - 1));
+
+ return geographicalRegionJpaList;
+ }
+
+ private void prepareSubGeographicalRegion(final GeographicalRegionJpa geographicalRegionJpa) {
+
+ final List<SubGeographicalRegionJpa> subGeographicalRegionJpaList = new ArrayList<>();
+
+ for (final SubGeographicalRegionJpa subGeographicalRegionJpa : geographicalRegionJpa.getSubGeographicalRegionJpaList()) {
+
+ final SubGeographicalRegionJpa subGeographicalRegionJpaPersisted =
+ subGeographicalRegionJpaRepository.findSubGeographicalRegionByMRidAndValidToNull(
+ subGeographicalRegionJpa.getmRid());
+
+ if (subGeographicalRegionJpaPersisted == null) {
+
+ subGeographicalRegionJpa.setOid(sequenceJpaService.getNextValueFromSequence(SUBGEOGRAPHICAL_REGION_SEQ_OID));
+ subGeographicalRegionJpa.setValidFrom(now());
+
+ subGeographicalRegionJpaList.add(subGeographicalRegionJpa);
+
+ } else {
+
+ if (subGeographicalRegionJpaPersisted.getName().equals(subGeographicalRegionJpa.getName())) {
+
+ // otherwise SubGeographicalRegion will be created again
+ if (geographicalRegionJpa.getId() == null) {
+
+ subGeographicalRegionJpaList.add(subGeographicalRegionJpaPersisted);
+
+ } else {
+
+ subGeographicalRegionJpa.setId(subGeographicalRegionJpaPersisted.getId());
+ subGeographicalRegionJpa.setOid(subGeographicalRegionJpaPersisted.getOid());
+ subGeographicalRegionJpa.setValidFrom(subGeographicalRegionJpaPersisted.getValidFrom());
+
+ subGeographicalRegionJpaList.add(subGeographicalRegionJpa);
+ }
+
+ } else {
+
+ subGeographicalRegionJpaPersisted.setValidTo(now());
+
+ final SubGeographicalRegionJpa subGeographicalRegionJpaNew = new SubGeographicalRegionJpa();
+
+ subGeographicalRegionJpaNew.setOid(subGeographicalRegionJpaPersisted.getOid());
+ subGeographicalRegionJpaNew.setValidFrom(now());
+ subGeographicalRegionJpaNew.setmRid(subGeographicalRegionJpaPersisted.getmRid());
+ subGeographicalRegionJpaNew.setName(subGeographicalRegionJpa.getName());
+
+ subGeographicalRegionJpaList.add(subGeographicalRegionJpaPersisted);
+ subGeographicalRegionJpaList.add(subGeographicalRegionJpaNew);
+ }
+ }
+
+ if (subGeographicalRegionJpaList.get(subGeographicalRegionJpaList.size() - 1)
+ .getSubstationJpaList() != null) {
+
+ prepareSubstation(subGeographicalRegionJpaList.get(subGeographicalRegionJpaList.size() - 1));
+ }
+ }
+
+ geographicalRegionJpa.setSubGeographicalRegionJpaList(subGeographicalRegionJpaList);
+ }
+
+ private void prepareSubstation(final SubGeographicalRegionJpa subGeographicalRegionJpa) {
+
+ final List<SubstationJpa> substationJpaList = new ArrayList<>();
+
+ for (final SubstationJpa substationJpa : subGeographicalRegionJpa.getSubstationJpaList()) {
+
+ final SubstationJpa substationJpaPersisted =
+ substationJpaRepository.findSubstationJpaByMRidAndValidToNull(substationJpa.getmRid());
+
+ if (substationJpaPersisted == null) {
+
+ final SubstationJpa substationJpaExists = findInList(substationJpaList, substationJpa);
+
+ if (substationJpaExists == null) {
+
+ substationJpa.setOid(sequenceJpaService.getNextValueFromSequence(EQUIPMENT_CONTAINER_SEQ_OID));
+ substationJpa.setValidFrom(now());
+
+ substationJpaList.add(substationJpa);
+
+ prepareEquipmentJpa(substationJpa);
+
+ if (substationJpa.getVoltageLevelJpaList() != null) {
+
+ prepareVoltageLevelJpa(substationJpa);
+ }
+
+ } else {
+
+ substationJpaExists.getEquipmentJpaList().addAll(substationJpa.getEquipmentJpaList());
+ prepareEquipmentJpa(substationJpaExists);
+ }
+
+ } else {
+
+ final SubstationJpa substationJpaExists = findInList(substationJpaList, substationJpa);
+
+ if (substationJpaPersisted.hasEqualData(substationJpa)
+ && substationJpaExists == null) {
+
+ substationJpaList.add(substationJpaPersisted);
+
+ prepareEquipmentSubstationJpaPersisted(substationJpaPersisted,
+ substationJpa.getSynchronousMachineJpaList());
+
+ } else if (substationJpaPersisted.hasEqualData(substationJpa)) {
+
+ // 1. nicht in substationJpaList anhängen => ist da schon drin
+ // 2. Anlagen der neuen Substation mit persisted Substation vergleichen u. evtl. anhängen
+
+ prepareEquipmentSubstationJpaPersisted(substationJpaPersisted,
+ substationJpa.getSynchronousMachineJpaList());
+
+ } else {
+
+ substationJpaPersisted.setValidTo(now());
+
+ final SubstationJpa substationJpaNew = new SubstationJpa();
+
+ substationJpaNew.setOid(substationJpaPersisted.getOid());
+ substationJpaNew.setValidFrom(now());
+ substationJpaNew.setmRid(substationJpaPersisted.getmRid());
+ substationJpaNew.setName(substationJpa.getName());
+
+ substationJpaList.add(substationJpaPersisted);
+ substationJpaList.add(substationJpaNew);
+
+ prepareEquipmentJpa(substationJpaNew);
+
+ if (substationJpaPersisted.getVoltageLevelJpaList() != null) {
+
+ prepareVoltageLevelJpa(substationJpaNew);
+ }
+ }
+ }
+ }
+
+ subGeographicalRegionJpa.setSubstationJpaList(substationJpaList);
+ }
+
+ private void prepareEquipmentSubstationJpaPersisted(final SubstationJpa substationJpaPersisted,
+ final List<SynchronousMachineJpa> synchronousMachineJpaList) {
+
+ // 1. prüfe ob SynchronousMachine bereits in Substation existiert
+ // 2a. wenn nein, SynchMachine anhängen an Liste der Substation
+ // 2b. wennn ja, prüfe ob hasDifferentNetstateData
+ // 3. wenn ja, prüfe ob Analog mit Mrid existiert
+ // 3a. wenn ja, AnalogValue an diesen Analog anhängen
+ // 3b. wenn nein, Analaog an SynchMach anhängen
+
+ for (final SynchronousMachineJpa synchronousMachineJpa : synchronousMachineJpaList) {
+
+ final SynchronousMachineJpa synchronousMachineJpaExists =
+ findInList(substationJpaPersisted.getSynchronousMachineJpaList(),
+ synchronousMachineJpa);
+
+ if (synchronousMachineJpaExists == null) {
+
+ substationJpaPersisted.getSynchronousMachineJpaList().add(synchronousMachineJpa);
+
+ } else {
+
+ if (synchronousMachineJpaDiffCheckerService.hasDifferentNetstate(
+ synchronousMachineJpaExists, synchronousMachineJpa)
+ && synchronousMachineJpa.getAnalogJpaList() != null) {
+
+ for (final AnalogJpa analogJpa : synchronousMachineJpa.getAnalogJpaList()) {
+
+ final AnalogJpa analogJpaExists
+ = findInList(synchronousMachineJpaExists.getAnalogJpaList(), analogJpa);
+
+ if (analogJpaExists == null) {
+
+ synchronousMachineJpaExists.getAnalogJpaList().add(analogJpa);
+
+ } /*else {
+ // 1. find in AnalogValueList
+ // 2. wenn nicht existiert, anhängen
+ // 3. wenn existiert nichts machen!
+ for (final AnalogValueJpa analogValueJpa : analogJpa.getAnalogValueJpaList()) {
+
+ final AnalogValueJpa analogValueJpaExists
+ = findInList(analogJpaExists.getAnalogValueJpaList(), analogValueJpa);
+
+ if (analogValueJpaExists == null) {
+
+ analogJpaExists.getAnalogValueJpaList().add(analogValueJpa);
+ }
+ }
+ }*/
+ }
+ }
+ }
+ }
+ }
+
+ private void prepareEquipmentJpa(final SubstationJpa substationJpa) {
+
+ final List<EquipmentJpa> equipmentJpaList = new ArrayList<>();
+
+ for (final SynchronousMachineJpa synchronousMachineJpa : substationJpa.getSynchronousMachineJpaList()) {
+
+ final SynchronousMachineJpa synchronousMachineJpaPersisted =
+ synchronousMachineJpaRepository.findSynchronousMachineJpaByMRidAndValidToNull(
+ synchronousMachineJpa.getmRid());
+
+ if (synchronousMachineJpaPersisted == null
+ && synchronousMachineJpa.getOid() == null) {
+
+ synchronousMachineJpa.setOid(sequenceJpaService.getNextValueFromSequence(EQUIPMENT_CONTAINER_SEQ_OID));
+ synchronousMachineJpa.setValidFrom(now());
+ synchronousMachineJpa.setEquipmentContainerJpa(substationJpa);
+
+ final GeneratingUnitJpa generatingUnitJpa = synchronousMachineJpa.getGeneratingUnitJpa();
+
+ if (generatingUnitJpa != null) {
+
+ generatingUnitJpa.setOid(sequenceJpaService.getNextValueFromSequence(EQUIPMENT_CONTAINER_SEQ_OID));
+ generatingUnitJpa.setValidFrom(now());
+ generatingUnitJpa.setEquipmentContainerJpa(substationJpa);
+ }
+ }
+
+ if (synchronousMachineJpaPersisted != null
+ && synchronousMachineJpaDiffCheckerService
+ .hasDifferentNetstate(synchronousMachineJpaPersisted, synchronousMachineJpa)) {
+
+ synchronousMachineJpaPersisted.setNormallyInService(synchronousMachineJpa.getNormallyInService());
+ synchronousMachineJpaPersisted.setControlEnabled(synchronousMachineJpa.getControlEnabled());
+ synchronousMachineJpaPersisted.setAnalogJpaList(synchronousMachineJpa.getAnalogJpaList());
+ }
+ equipmentJpaList.add(synchronousMachineJpa);
+ }
+
+ substationJpa.setEquipmentJpaList(equipmentJpaList);
+ }
+
+ private void prepareVoltageLevelJpa(final SubstationJpa substationJpa) {
+
+ final List<VoltageLevelJpa> voltageLevelJpaList = new ArrayList<>();
+
+ for (final VoltageLevelJpa voltageLevelJpa : substationJpa.getVoltageLevelJpaList()) {
+
+ final VoltageLevelJpa voltageLevelJpaPersisted =
+ voltageLevelJpaRepository.findVoltageLevelJpaByMRidAndValidToNull(voltageLevelJpa.getmRid());
+
+ if (voltageLevelJpaPersisted == null) {
+
+ voltageLevelJpa.setOid(sequenceJpaService.getNextValueFromSequence(EQUIPMENT_CONTAINER_SEQ_OID));
+ voltageLevelJpa.setValidFrom(now());
+
+ voltageLevelJpaList.add(voltageLevelJpa);
+
+ } else {
+
+ if (voltageLevelJpaPersisted.getName().equals(voltageLevelJpa.getName())) {
+
+ voltageLevelJpa.setId(voltageLevelJpaPersisted.getId());
+ voltageLevelJpa.setOid(voltageLevelJpaPersisted.getOid());
+ voltageLevelJpa.setValidFrom(voltageLevelJpaPersisted.getValidFrom());
+
+ voltageLevelJpaList.add(voltageLevelJpa);
+
+ } else {
+
+ voltageLevelJpaPersisted.setValidTo(now());
+
+ final VoltageLevelJpa voltageLevelJpaNew = new VoltageLevelJpa();
+
+ voltageLevelJpaNew.setOid(voltageLevelJpaPersisted.getOid());
+ voltageLevelJpaNew.setValidFrom(now());
+ voltageLevelJpaNew.setmRid(voltageLevelJpaPersisted.getmRid());
+ voltageLevelJpaNew.setName(voltageLevelJpa.getName());
+
+ voltageLevelJpaList.add(voltageLevelJpaPersisted);
+ voltageLevelJpaList.add(voltageLevelJpaNew);
+ }
+ }
+ }
+
+ substationJpa.setVoltageLevelJpaList(voltageLevelJpaList);
+ }
+
+ private <T extends IdentifiedObjectJpa> T findInList(final List<T> list,
+ final T type) {
+
+ return (T) CollectionUtils.find(list, new Predicate() {
+ @Override
+ public boolean evaluate(final Object o) {
+
+ return ((T) o).getmRid().equals(type.getmRid());
+ }
+ });
+ }
+
+ private boolean singleGeographicalRegionPersisted(final GeographicalRegionJpa geographicalRegionJpa) {
+
+ boolean result = false;
+
+ for (final GeographicalRegionJpa geoRegJpa : Lists.newArrayList(geographicalRegionJpaRepository.findAll())) {
+
+ if (!geographicalRegionJpa.getmRid().equals(geoRegJpa.getmRid())) {
+
+ result = true;
+ }
+ }
+
+ return result;
+ }
+
+
+}
diff --git a/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/service/GeographicalRegionMapperService.java b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/service/GeographicalRegionMapperService.java
new file mode 100644
index 00000000..1923e665
--- /dev/null
+++ b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/service/GeographicalRegionMapperService.java
@@ -0,0 +1,33 @@
+/**
+ ******************************************************************************
+ * Copyright © 2015-2017 BTC AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ ******************************************************************************
+ */
+package de.openkonsequenz.cimcache.service;
+
+import org.springframework.stereotype.Service;
+
+import de.openkonsequenz.cim.core.GeographicalRegion;
+import de.openkonsequenz.cimcache.model.jpa.core.GeographicalRegionJpa;
+
+@Service
+public class GeographicalRegionMapperService extends BaseMapperService {
+
+ public GeographicalRegionJpa mapGeographicalRegion(final GeographicalRegion geographicalRegion) {
+ final GeographicalRegionJpa geographicalRegionJpa = new GeographicalRegionJpa();
+ mapper.map(geographicalRegion, geographicalRegionJpa);
+ return geographicalRegionJpa;
+ }
+
+ public GeographicalRegion mapGeographicalRegionJpa(final GeographicalRegionJpa geographicalRegionJpa) {
+ final GeographicalRegion geographicalRegion = new GeographicalRegion();
+ mapper.map(geographicalRegionJpa, geographicalRegion);
+ return geographicalRegion;
+ }
+}
diff --git a/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/service/GeographicalRegionRestConsumerService.java b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/service/GeographicalRegionRestConsumerService.java
new file mode 100644
index 00000000..46f93cc6
--- /dev/null
+++ b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/service/GeographicalRegionRestConsumerService.java
@@ -0,0 +1,71 @@
+/**
+ ******************************************************************************
+ * Copyright © 2015-2017 BTC AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ ******************************************************************************
+ */
+package de.openkonsequenz.cimcache.service;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import de.openkonsequenz.cim.core.GeographicalRegion;
+import de.openkonsequenz.cimcache.datainterchange.adapter.rest.client.GeographicalRegionProvider;
+import de.openkonsequenz.cimcache.model.jpa.core.GeographicalRegionJpa;
+
+@Service
+public class GeographicalRegionRestConsumerService
+{
+
+ @Autowired
+ private GeographicalRegionJpaService geographicalRegionJpaService;
+
+ @Autowired
+ private GeographicalRegionValidatorService geographicalRegionValidatorService;
+
+ @Autowired
+ private GeographicalRegionMapperService geographicalRegionMapperService;
+
+ @Autowired
+ private GeographicalRegionProvider geographicalRegionRestConsumer;
+
+ /**
+ * Get GeographicalRegion with topology data from REST-Service and persist the data.
+ *
+ * @return
+ */
+ public void getGeographicalRegionTopology()
+ {
+
+ final GeographicalRegion geographicalRegion = geographicalRegionRestConsumer.getGeographicalRegionTopology();
+
+ final GeographicalRegionJpa geographicalRegionJpa = geographicalRegionMapperService.mapGeographicalRegion(geographicalRegion);
+
+ geographicalRegionValidatorService.validate(geographicalRegionJpa);
+
+ geographicalRegionJpaService.persist(geographicalRegionJpa);
+ }
+
+ /**
+ * Get GeographicalRegion with topology data from REST-Service and persist the data.
+ *
+ * @return
+ */
+ public void getGeographicalRegionNetstate()
+ {
+
+ final GeographicalRegion geographicalRegion = geographicalRegionRestConsumer.getGeographicalRegionNetstate();
+
+ final GeographicalRegionJpa geographicalRegionJpa = geographicalRegionMapperService.mapGeographicalRegion(geographicalRegion);
+
+ geographicalRegionValidatorService.validate(geographicalRegionJpa);
+
+ geographicalRegionJpaService.persist(geographicalRegionJpa);
+ }
+
+}
diff --git a/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/service/GeographicalRegionValidatorService.java b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/service/GeographicalRegionValidatorService.java
new file mode 100644
index 00000000..a7ac32d7
--- /dev/null
+++ b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/service/GeographicalRegionValidatorService.java
@@ -0,0 +1,42 @@
+/**
+ ******************************************************************************
+ * Copyright © 2015-2017 BTC AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ ******************************************************************************
+ */
+package de.openkonsequenz.cimcache.service;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import de.openkonsequenz.cimcache.model.jpa.core.GeographicalRegionJpa;
+import de.openkonsequenz.cimcache.model.jpa.core.SubGeographicalRegionJpa;
+import de.openkonsequenz.cimcache.model.jpa.core.SubstationJpa;
+
+@Service
+public class GeographicalRegionValidatorService {
+
+ @Autowired
+ private SynchronousMachineValidatorService synchronousMachineValidatorService;
+
+ public GeographicalRegionJpa validate(final GeographicalRegionJpa geographicalRegionJpa) {
+
+ for (final SubGeographicalRegionJpa subGeographicalRegionJpa : geographicalRegionJpa.getSubGeographicalRegionJpaList()) {
+
+ if (subGeographicalRegionJpa.getSubstationJpaList() != null) {
+
+ for (final SubstationJpa substationJpa : subGeographicalRegionJpa.getSubstationJpaList()) {
+
+ synchronousMachineValidatorService.validate(substationJpa.getSynchronousMachineJpaList());
+ }
+ }
+ }
+
+ return geographicalRegionJpa;
+ }
+}
diff --git a/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/service/JsonFileRestConsumerService.java b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/service/JsonFileRestConsumerService.java
new file mode 100644
index 00000000..b2bdf048
--- /dev/null
+++ b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/service/JsonFileRestConsumerService.java
@@ -0,0 +1,49 @@
+/**
+ ******************************************************************************
+ * Copyright © 2015-2017 BTC AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ ******************************************************************************
+ */
+package de.openkonsequenz.cimcache.service;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.web.client.HttpClientErrorException;
+
+import de.openkonsequenz.cim.core.GeographicalRegion;
+import de.openkonsequenz.cimcache.datainterchange.adapter.rest.client.JsonFileProvider;
+import de.openkonsequenz.cimcache.model.jpa.core.GeographicalRegionJpa;
+
+@Service
+public class JsonFileRestConsumerService
+{
+
+ @Autowired
+ private JsonFileProvider jsonFileRestConsumer;
+
+ @Autowired
+ private GeographicalRegionValidatorService geographicalRegionValidatorService;
+
+ @Autowired
+ private GeographicalRegionMapperService geographicalRegionMapperService;
+
+ @Autowired
+ private GeographicalRegionJpaService geographicalRegionJpaService;
+
+ public void getGeographicalRegion() throws HttpClientErrorException
+ {
+
+ final GeographicalRegion geographicalRegion = jsonFileRestConsumer.getGeographicalRegion();
+
+ final GeographicalRegionJpa geographicalRegionJpa = geographicalRegionMapperService.mapGeographicalRegion(geographicalRegion);
+
+ geographicalRegionValidatorService.validate(geographicalRegionJpa);
+
+ geographicalRegionJpaService.persist(geographicalRegionJpa);
+ }
+}
diff --git a/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/service/NetworkTraceService.java b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/service/NetworkTraceService.java
new file mode 100644
index 00000000..37c1b931
--- /dev/null
+++ b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/service/NetworkTraceService.java
@@ -0,0 +1,148 @@
+/**
+ ******************************************************************************
+ * Copyright © 2015-2017 BTC AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ ******************************************************************************
+ */
+package de.openkonsequenz.cimcache.service;
+
+import java.math.BigDecimal;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.log4j.Logger;
+import org.springframework.stereotype.Service;
+
+import de.openkonsequenz.cimcache.model.jpa.core.EquipmentContainerJpa;
+import de.openkonsequenz.cimcache.model.jpa.core.EquipmentJpa;
+import de.openkonsequenz.cimcache.model.jpa.core.SubstationJpa;
+import de.openkonsequenz.cimcache.model.jpa.core.TerminalJpa;
+import de.openkonsequenz.cimcache.model.jpa.core.VoltageLevelJpa;
+import de.openkonsequenz.cimcache.model.jpa.domain.UnitMultiplierJpa;
+import de.openkonsequenz.cimcache.model.jpa.domain.VoltageJpa;
+import de.openkonsequenz.cimcache.model.jpa.wires.AcLineSegmentJpa;
+import de.openkonsequenz.cimcache.model.jpa.wires.SwitchJpa;
+
+@Service
+public class NetworkTraceService {
+
+ private static final Logger LOG = Logger.getLogger(NetworkTraceService.class);
+
+ public List<SubstationJpa> getLocalNetworStationListOfTransformerStation(final SubstationJpa transformerStation) {
+
+ LOG.debug("Trace on Substation (Transformer Station): " + transformerStation.getName());
+
+ final List<SubstationJpa> localNetworkStationList = new ArrayList<>();
+ final List<EquipmentJpa> equipmentJpaList = new ArrayList<>();
+
+ for (final VoltageLevelJpa voltageLevelJpa : transformerStation.getVoltageLevelJpaList()) {
+
+ final VoltageJpa voltageJpa = voltageLevelJpa.getHighVoltageJpaLimit();
+
+ final VoltageJpa voltage20kV = new VoltageJpa();
+ voltage20kV.setMultiplier(UnitMultiplierJpa.KILO);
+ voltage20kV.setValue(BigDecimal.valueOf(20L));
+
+ if (voltageJpa.getValue().compareTo(voltage20kV.getValue()) == 0
+ && voltageJpa.getMultiplier().equals(voltage20kV.getMultiplier())
+ && voltageJpa.getUnit().equals(voltage20kV.getUnit())) {
+
+ LOG.debug("Trace on VoltageLevel: " + voltageLevelJpa.getName() + ", " + voltageJpa.getValue() + "kV");
+
+ for (final EquipmentJpa equipmentJpa : voltageLevelJpa.getEquipmentJpaList()) {
+
+ traceNetworkAndFindLocalNetworkStation(equipmentJpa, equipmentJpaList, localNetworkStationList);
+ }
+ }
+ }
+
+ return localNetworkStationList;
+ }
+
+ private void traceNetworkAndFindLocalNetworkStation(
+ final EquipmentJpa equipmentJpa,
+ final List<EquipmentJpa> equipmentJpaList,
+ final List<SubstationJpa> localNetworkStationList) {
+
+ List<TerminalJpa> terminalJpaList = new ArrayList<>();
+
+ if (equipmentJpa instanceof SwitchJpa
+ && !((SwitchJpa) equipmentJpa).getOpen()
+ && ((SwitchJpa) equipmentJpa).getTerminalJpaList() != null) {
+
+ LOG.debug("Trace on Switch: " + equipmentJpa.getName());
+ terminalJpaList = ((SwitchJpa) equipmentJpa).getTerminalJpaList();
+ equipmentJpaList.add(equipmentJpa);
+
+ } else if (equipmentJpa instanceof AcLineSegmentJpa
+ && ((AcLineSegmentJpa) equipmentJpa).getTerminalJpaList() != null) {
+
+ LOG.debug("Trace on AcLineSegment: " + equipmentJpa.getName());
+ terminalJpaList = ((AcLineSegmentJpa) equipmentJpa).getTerminalJpaList();
+ equipmentJpaList.add(equipmentJpa);
+ }
+
+ for (final TerminalJpa terminalJpa : terminalJpaList) {
+
+ LOG.debug("Start Trace on Terminal: " + terminalJpa.getName());
+
+ for (final TerminalJpa terminalJpaOfConnectivityNode :
+ terminalJpa.getConnectivityNodeJpa().getTerminalJpaList()) {
+
+ LOG.debug("Trace on ConnectivityNode: " + terminalJpa.getConnectivityNodeJpa().getName()
+ + ", Terminal: " + terminalJpaOfConnectivityNode.getName());
+
+ EquipmentContainerJpa equipmentContainerJpa = null;// =
+
+ if (terminalJpaOfConnectivityNode.getAcLineSegmentJpa() != null) {
+
+ equipmentContainerJpa = terminalJpaOfConnectivityNode.getAcLineSegmentJpa().getEquipmentContainerJpa();
+
+ }
+ if (terminalJpaOfConnectivityNode.getSwitchJpa() != null) {
+
+ equipmentContainerJpa = terminalJpaOfConnectivityNode.getSwitchJpa().getEquipmentContainerJpa();
+ }
+
+ if (!terminalJpaOfConnectivityNode.equals(terminalJpa)) {
+
+ if (equipmentContainerJpa instanceof SubstationJpa
+ && !((SubstationJpa) equipmentContainerJpa).isTransformerStation()
+ && !localNetworkStationList.contains(equipmentContainerJpa)) {
+
+ LOG.debug("Add to LocalNetworkList: " + equipmentContainerJpa.getName());
+ localNetworkStationList.add((SubstationJpa) equipmentContainerJpa);
+ }
+
+ if (terminalJpaOfConnectivityNode.getAcLineSegmentJpa() != null
+ && !equipmentJpaList.contains(terminalJpaOfConnectivityNode.getAcLineSegmentJpa())) {
+
+ traceNetworkAndFindLocalNetworkStation(
+ terminalJpaOfConnectivityNode.getAcLineSegmentJpa(),
+ equipmentJpaList,
+ localNetworkStationList);
+ }
+
+ if (terminalJpaOfConnectivityNode.getSwitchJpa() != null
+ && !terminalJpaOfConnectivityNode.getSwitchJpa().getOpen()
+ && !equipmentJpaList.contains(terminalJpaOfConnectivityNode.getSwitchJpa())) {
+
+ traceNetworkAndFindLocalNetworkStation(
+ terminalJpaOfConnectivityNode.getSwitchJpa(),
+ equipmentJpaList,
+ localNetworkStationList);
+ }
+ }
+ }
+
+ LOG.debug("End Trace on Terminal: " + terminalJpa.getName());
+ }
+ }
+}
+
+
diff --git a/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/service/SequenceJpaService.java b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/service/SequenceJpaService.java
new file mode 100644
index 00000000..17082b91
--- /dev/null
+++ b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/service/SequenceJpaService.java
@@ -0,0 +1,33 @@
+/**
+ ******************************************************************************
+ * Copyright © 2015-2017 BTC AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ ******************************************************************************
+ */
+package de.openkonsequenz.cimcache.service;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import de.openkonsequenz.cimcache.model.jpa.util.Sequence;
+import de.openkonsequenz.cimcache.repository.SequenceJpaRepository;
+
+@Service
+public class SequenceJpaService {
+
+ @Autowired
+ private SequenceJpaRepository sequenceJpaRepository;
+
+ public Long getNextValueFromSequence(final String sequenceName) {
+ final Sequence sequence = sequenceJpaRepository.findSequenceBySequenceName(sequenceName);
+ sequence.setSequenceCount(sequence.getSequenceCount() + 1);
+ sequenceJpaRepository.save(sequence);
+ return sequence.getSequenceCount();
+ }
+
+}
diff --git a/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/service/SignumService.java b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/service/SignumService.java
new file mode 100644
index 00000000..ffdd7ae2
--- /dev/null
+++ b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/service/SignumService.java
@@ -0,0 +1,31 @@
+/**
+ ******************************************************************************
+ * Copyright © 2015-2017 BTC AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ ******************************************************************************
+ */
+package de.openkonsequenz.cimcache.service;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import de.openkonsequenz.cimcache.CimCache;
+
+@Service
+public class SignumService
+{
+ // Attributes
+ @Autowired
+ private CimCache module;
+
+ // Properties
+ public int getSignum()
+ {
+ return Integer.parseInt(module.getSetting("eisman.measurement.signum.default"));
+ }
+} \ No newline at end of file
diff --git a/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/service/SubGeographicalRegion4TreeService.java b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/service/SubGeographicalRegion4TreeService.java
new file mode 100644
index 00000000..5b5bd7b5
--- /dev/null
+++ b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/service/SubGeographicalRegion4TreeService.java
@@ -0,0 +1,211 @@
+/**
+ ******************************************************************************
+ * Copyright © 2015-2017 BTC AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ ******************************************************************************
+ */
+package de.openkonsequenz.cimcache.service;
+
+import java.math.BigDecimal;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.commons.collections.CollectionUtils;
+import org.apache.commons.collections.Predicate;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import de.openkonsequenz.cimcache.model.jpa.core.SubGeographicalRegionJpa;
+import de.openkonsequenz.cimcache.model.jpa.core.SubstationJpa;
+import de.openkonsequenz.cimcache.model.jpa.domain.CommunicationTypeJpa;
+import de.openkonsequenz.cimcache.model.jpa.marketoperations.mktdomain.UnitTypeJpa;
+import de.openkonsequenz.cimcache.model.util.SubGeographicalRegion4Tree;
+import de.openkonsequenz.cimcache.model.util.Substation4Tree;
+import de.openkonsequenz.cimcache.model.util.SumContainer;
+
+@Service
+public class SubGeographicalRegion4TreeService {
+
+ @Autowired
+ private SubGeographicalRegionJpaService subGeographicalRegionJpaService;
+
+ @Autowired
+ private NetworkTraceService networkTraceService;
+
+ @Autowired
+ private SubstationJpaService substationJpaService;
+
+ private static final CommunicationTypeJpa CT_EFR = CommunicationTypeJpa.EFR;
+ private static final CommunicationTypeJpa CT_FWT = CommunicationTypeJpa.FWT;
+ private static final String VIRT_TS = "VirtualTransformerStationEFR";
+
+ /**
+ * Creates the tree, the hierarchy and data, for the Web-User-Interface.
+ *
+ * @return List<SubGeographicalRegion4Tree>
+ */
+ public List<SubGeographicalRegion4Tree> getTree() {
+
+ final List<SubGeographicalRegion4Tree> subGeographicalRegion4TreeList = new ArrayList<>();
+
+ for (final SubGeographicalRegionJpa subGeographicalRegionJpa : subGeographicalRegionJpaService.findAll()) {
+
+ final SumContainer sumContainerSubGeographicalRegion = new SumContainer();
+
+ final List<Substation4Tree> transformerStation4TreeList = new ArrayList<>();
+
+ for (final SubstationJpa transformerStation : subGeographicalRegionJpa.getTransformerStationList()) {
+
+ final SumContainer sumContainerTransformerStationEfr = createSumContainer(transformerStation, CT_EFR);
+ final SumContainer sumContainerTransformerStationFwt = createSumContainer(transformerStation, CT_FWT);
+
+ final List<Substation4Tree> localNetworkStation4TreeList = new ArrayList<>();
+
+ for (final SubstationJpa localNetworkStation :
+ networkTraceService.getLocalNetworStationListOfTransformerStation(transformerStation)) {
+
+ final SumContainer sumContainerLocalNetworkStationEfr = createSumContainer(localNetworkStation, CT_EFR);
+ sumContainerTransformerStationEfr.add(sumContainerLocalNetworkStationEfr);
+
+ final SumContainer sumContainerLocalNetworkStationFwt = createSumContainer(localNetworkStation, CT_FWT);
+ sumContainerTransformerStationFwt.add(sumContainerLocalNetworkStationFwt);
+
+ localNetworkStation4TreeList.add(
+ createSubstation4Tree(
+ localNetworkStation,
+ sumContainerLocalNetworkStationFwt));
+ }
+
+ if (sumContainerTransformerStationEfr.getSum().compareTo(BigDecimal.ZERO) == 1) {
+
+ Substation4Tree virtualTransformerStationEfr
+ = findInList(transformerStation4TreeList, VIRT_TS);
+
+ if (virtualTransformerStationEfr == null) {
+
+ virtualTransformerStationEfr
+ = createVirtualTransformerstation(sumContainerTransformerStationEfr,
+ subGeographicalRegionJpa.getOid());
+ transformerStation4TreeList.add(virtualTransformerStationEfr);
+ }
+
+ sumContainerSubGeographicalRegion.add(sumContainerTransformerStationEfr);
+ }
+
+ final Substation4Tree transformerStation4Tree = createSubstation4Tree(
+ transformerStation,
+ sumContainerTransformerStationFwt);
+ transformerStation4Tree.setSubstation4TreeList(localNetworkStation4TreeList);
+
+ transformerStation4TreeList.add(transformerStation4Tree);
+
+ sumContainerSubGeographicalRegion.add(sumContainerTransformerStationFwt);
+ }
+
+ final SubGeographicalRegion4Tree subGeographicalRegion4Tree =
+ createSubGeographicalRegion4Tree(
+ subGeographicalRegionJpa,
+ sumContainerSubGeographicalRegion);
+
+ subGeographicalRegion4Tree.setSubstation4TreeList(transformerStation4TreeList);
+ subGeographicalRegion4TreeList.add(subGeographicalRegion4Tree);
+ }
+
+ return subGeographicalRegion4TreeList;
+ }
+
+ private SumContainer createSumContainer(final SubstationJpa substationJpa,
+ final CommunicationTypeJpa communicationTypeJpa) {
+
+ return new SumContainer(
+ getSum(substationJpa, UnitTypeJpa.PHOT, communicationTypeJpa),
+ getSum(substationJpa, UnitTypeJpa.BIOG, communicationTypeJpa),
+ getSum(substationJpa, UnitTypeJpa.WIND, communicationTypeJpa),
+ getSum(substationJpa, null, communicationTypeJpa)
+ );
+ }
+
+ private SubGeographicalRegion4Tree createSubGeographicalRegion4Tree(
+ final SubGeographicalRegionJpa subGeographicalRegionJpa,
+ final SumContainer sumContainer) {
+
+ final SubGeographicalRegion4Tree subGeographicalRegion4Tree = new SubGeographicalRegion4Tree();
+
+ subGeographicalRegion4Tree.setName(subGeographicalRegionJpa.getName());
+ subGeographicalRegion4Tree.setOid(subGeographicalRegionJpa.getOid().toString());
+ subGeographicalRegion4Tree.setPv(roundAndFormat(sumContainer.getPv()));
+ subGeographicalRegion4Tree.setBio(roundAndFormat(sumContainer.getBio()));
+ subGeographicalRegion4Tree.setWind(roundAndFormat(sumContainer.getWind()));
+ subGeographicalRegion4Tree.setNoBioPvWind(roundAndFormat(sumContainer.getNoBioWindPv()));
+ subGeographicalRegion4Tree.setSum(roundAndFormat(sumContainer.getSum()));
+
+ return subGeographicalRegion4Tree;
+ }
+
+ private Substation4Tree createSubstation4Tree(
+ final SubstationJpa substationJpa,
+ final SumContainer sumContainer) {
+
+ final Substation4Tree localNetworkStation4Tree = new Substation4Tree();
+
+ localNetworkStation4Tree.setOid(substationJpa.getOid().toString());
+ localNetworkStation4Tree.setName(substationJpa.getName());
+ localNetworkStation4Tree.setPv(roundAndFormat(sumContainer.getPv()));
+ localNetworkStation4Tree.setBio(roundAndFormat(sumContainer.getBio()));
+ localNetworkStation4Tree.setWind(roundAndFormat(sumContainer.getWind()));
+ localNetworkStation4Tree.setNoBioPvWind(roundAndFormat(sumContainer.getNoBioWindPv()));
+ localNetworkStation4Tree.setSum(roundAndFormat(sumContainer.getSum()));
+
+ return localNetworkStation4Tree;
+ }
+
+ private BigDecimal getSum(
+ final SubstationJpa transformerStation,
+ final UnitTypeJpa unitTypeJpa,
+ final CommunicationTypeJpa communicationTypeJpa) {
+
+ return substationJpaService.getSumOfSynchronousMachineJpaListByUnitTypeJpa(
+ transformerStation, unitTypeJpa, communicationTypeJpa);
+ }
+
+ private String roundAndFormat(final BigDecimal bigDecimal) {
+
+ return bigDecimal.setScale(2, BigDecimal.ROUND_HALF_UP).toString();
+ }
+
+ private Substation4Tree createVirtualTransformerstation(
+ final SumContainer sumContainer,
+ final long subGeographicalRegionOid) {
+
+ final Substation4Tree virtualTransformerStation = new Substation4Tree();
+
+ virtualTransformerStation.setName(VIRT_TS);
+ virtualTransformerStation.setOid(Long.toString(subGeographicalRegionOid * -1L));
+ virtualTransformerStation.setPv(roundAndFormat(sumContainer.getPv()));
+ virtualTransformerStation.setBio(roundAndFormat(sumContainer.getBio()));
+ virtualTransformerStation.setWind(roundAndFormat(sumContainer.getWind()));
+ virtualTransformerStation.setNoBioPvWind(roundAndFormat(sumContainer.getNoBioWindPv()));
+ virtualTransformerStation.setSum(roundAndFormat(sumContainer.getSum()));
+
+ return virtualTransformerStation;
+ }
+
+ private Substation4Tree findInList(final List<Substation4Tree> substation4TreeList,
+ final String virtualTransformerStationName) {
+
+ return (Substation4Tree) CollectionUtils.find(substation4TreeList, new Predicate() {
+
+ @Override
+ public boolean evaluate(final Object o) {
+
+ return ((Substation4Tree) o).getName().equals(virtualTransformerStationName);
+ }
+ });
+ }
+
+}
diff --git a/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/service/SubGeographicalRegionJpaService.java b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/service/SubGeographicalRegionJpaService.java
new file mode 100644
index 00000000..2d62525c
--- /dev/null
+++ b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/service/SubGeographicalRegionJpaService.java
@@ -0,0 +1,97 @@
+/**
+ ******************************************************************************
+ * Copyright © 2015-2017 BTC AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ ******************************************************************************
+ */
+package de.openkonsequenz.cimcache.service;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import com.google.common.collect.Lists;
+
+import de.openkonsequenz.cimcache.model.jpa.core.SubGeographicalRegionJpa;
+import de.openkonsequenz.cimcache.model.jpa.core.SubstationJpa;
+import de.openkonsequenz.cimcache.model.jpa.core.VoltageLevelJpa;
+import de.openkonsequenz.cimcache.model.jpa.domain.CommunicationTypeJpa;
+import de.openkonsequenz.cimcache.repository.SubGeographicalRegionJpaRepository;
+
+@Service
+public class SubGeographicalRegionJpaService extends AbstractJpaService {
+
+ @Autowired
+ private SubGeographicalRegionJpaRepository subGeographicalRegionJpaRepository;
+
+ public List<SubGeographicalRegionJpa> findAll() {
+ return Lists.newArrayList(subGeographicalRegionJpaRepository.findAll());
+ }
+
+ public List<SubGeographicalRegionJpa> findSubGeographicalRegionJpa4Lov() {
+
+ final List<SubGeographicalRegionJpa> subGeographicalRegionJpaList = new ArrayList<>();
+
+ for (final Object[] object : subGeographicalRegionJpaRepository.findSubGeographicalRegionJpa4Lov()) {
+
+ final SubGeographicalRegionJpa subGeographicalRegionJpa = new SubGeographicalRegionJpa();
+
+ subGeographicalRegionJpa.setId(Long.parseLong(object[0].toString()));
+ subGeographicalRegionJpa.setOid(Long.parseLong(object[1].toString()));
+ subGeographicalRegionJpa.setmRid((String) object[2]);
+ subGeographicalRegionJpa.setName((String) object[3]);
+
+ subGeographicalRegionJpaList.add(subGeographicalRegionJpa);
+ }
+
+ return subGeographicalRegionJpaList;
+ }
+
+ /**
+ * Gets the SubGeographicalRegion with every Substation and their SynchronousMachines.
+ *
+ * @return
+ */
+ public SubGeographicalRegionJpa getSubGeographicalRegionJpa(final Long oid, final CommunicationTypeJpa communicationTypeJpa) {
+
+ final SubGeographicalRegionJpa subGeographicalRegionJpa =
+ subGeographicalRegionJpaRepository.findSubGeographicalRegionByOidAndValidToNull(oid);
+
+ if (subGeographicalRegionJpa == null) {
+
+ return null;
+ }
+
+ final List<SubstationJpa> newSubstationJpaList = new ArrayList<>();
+
+ for (final SubstationJpa substationJpa : subGeographicalRegionJpa.getSubstationJpaList()) {
+
+ if (substationJpa.getValidTo() == null) {
+
+ newSubstationJpaList.add(substationJpa);
+ }
+
+ substationJpa.setEquipmentJpaList(
+ substationJpa.getEquipmentJpaListWithTimestampOnlySynchronousMachineJpa(now(), communicationTypeJpa));
+
+ for (final VoltageLevelJpa voltageLevelJpa : substationJpa.getVoltageLevelJpaList()) {
+
+ voltageLevelJpa.setEquipmentJpaList(
+ voltageLevelJpa.getEquipmentJpaListWithTimestampOnlySynchronousMachineJpa(now(), communicationTypeJpa));
+ }
+
+ }
+
+ subGeographicalRegionJpa.setSubstationJpaList(newSubstationJpaList);
+
+ return subGeographicalRegionJpa;
+ }
+
+}
diff --git a/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/service/SubGeographicalRegionMapperService.java b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/service/SubGeographicalRegionMapperService.java
new file mode 100644
index 00000000..915e93ed
--- /dev/null
+++ b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/service/SubGeographicalRegionMapperService.java
@@ -0,0 +1,46 @@
+/**
+ ******************************************************************************
+ * Copyright © 2015-2017 BTC AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ ******************************************************************************
+ */
+package de.openkonsequenz.cimcache.service;
+
+import org.springframework.stereotype.Service;
+
+import de.openkonsequenz.cim.core.SubGeographicalRegion;
+import de.openkonsequenz.cimcache.model.jpa.core.SubGeographicalRegionJpa;
+
+@Service
+public class SubGeographicalRegionMapperService extends BaseMapperService {
+
+ public SubGeographicalRegion mapSubGeographicalRegionJpa(final SubGeographicalRegionJpa subGeographicalRegionJpa) {
+
+ final SubGeographicalRegion subGeographicalRegion = new SubGeographicalRegion();
+ mapper.map(subGeographicalRegionJpa, subGeographicalRegion);
+ return subGeographicalRegion;
+
+ }
+
+// public List<SubGeographicalRegion> mapSubGeographicalRegionList(
+// final List<SubGeographicalRegionJpa> subGeographicalRegionJpaList) {
+// final List<SubGeographicalRegion> subGeographicalRegionList = new ArrayList<>();
+// mapper.map(subGeographicalRegionList, subGeographicalRegionJpaList);
+//// mapper.map(subGeographicalRegionJpaList, subGeographicalRegionList);
+// return subGeographicalRegionList;
+// }
+//
+// public SubGeographicalRegionJpa mapSubGeographicalRegion(final SubGeographicalRegion subGeographicalRegion) {
+//
+// final SubGeographicalRegionJpa subGeographicalRegionJpa = new SubGeographicalRegionJpa();
+// mapper.map(subGeographicalRegion, subGeographicalRegionJpa);
+// return subGeographicalRegionJpa;
+//
+// }
+
+}
diff --git a/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/service/SubGeographicalRegionService.java b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/service/SubGeographicalRegionService.java
new file mode 100644
index 00000000..ec3af31d
--- /dev/null
+++ b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/service/SubGeographicalRegionService.java
@@ -0,0 +1,80 @@
+/**
+ ******************************************************************************
+ * Copyright © 2015-2017 BTC AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ ******************************************************************************
+ */
+package de.openkonsequenz.cimcache.service;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.springframework.stereotype.Service;
+
+import de.openkonsequenz.cim.core.Equipment;
+import de.openkonsequenz.cim.core.SubGeographicalRegion;
+import de.openkonsequenz.cim.core.Substation;
+
+@Service
+public class SubGeographicalRegionService {
+
+ /**
+ * Gets the list of all Substations and their SynchronousMachine.
+ * 
Only those SynchronousMachine will be includes which are
+ * working normally (a), which are controlable (in general) (b),
+ * for which the control is enabled (c) and
 which are Generators (d).
+ * (a) SynchronousMachine.normallyInService is true
+ * (b) GeneratingUnit.generatorControlSource is true
+ * (c) SynchronousMachine.controlEnabled is true
+ * (d) SynchronousMachine.synchronousMachineKind == GENERATOR
+ * <p/>
+ *
+ * @param subGeographicalRegion
+ * @return
+ */
+ public SubGeographicalRegion createSubGeographicalRegion4Eisman(final SubGeographicalRegion subGeographicalRegion) {
+
+ final SubGeographicalRegion newSubGeographicalRegion = new SubGeographicalRegion();
+ newSubGeographicalRegion.setName(subGeographicalRegion.getName());
+ newSubGeographicalRegion.setOid(subGeographicalRegion.getOid());
+ newSubGeographicalRegion.setmRid(subGeographicalRegion.getmRid());
+ newSubGeographicalRegion.setSubstationList(new ArrayList<Substation>());
+
+ for (final Substation substation : subGeographicalRegion.getSubstationList()) {
+
+ if (substation.getValidTo() == null && substation.getEquipmentList() != null) {
+
+ final List<Equipment> newEquipmentList = new ArrayList<>();
+
+ for (final Equipment equipment : substation.getEquipmentList()) {
+
+ if (EquipmentService.checkEquipment4Eisman(equipment)) {
+
+ EquipmentService.mapActivePowerKilo2Mega(equipment);
+
+ EquipmentService.setLatestMeasurementOfEquipment(equipment);
+
+ EquipmentService.mapMeasurementValueKilo2Mega(equipment);
+
+ newEquipmentList.add(equipment);
+ }
+ }
+
+ // add to list when SynchronousMachine exists in EquipmentList
+ if (!newEquipmentList.isEmpty()) {
+
+ substation.setEquipmentList(newEquipmentList);
+ newSubGeographicalRegion.getSubstationList().add(substation);
+ }
+ }
+ }
+
+ return newSubGeographicalRegion;
+ }
+
+}
diff --git a/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/service/SubstationJpaService.java b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/service/SubstationJpaService.java
new file mode 100644
index 00000000..2d52b235
--- /dev/null
+++ b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/service/SubstationJpaService.java
@@ -0,0 +1,334 @@
+/**
+ ******************************************************************************
+ * Copyright © 2015-2017 BTC AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ ******************************************************************************
+ */
+package de.openkonsequenz.cimcache.service;
+
+import java.math.BigDecimal;
+import java.math.RoundingMode;
+import java.sql.Timestamp;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.commons.collections.CollectionUtils;
+import org.apache.commons.collections.Predicate;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import de.openkonsequenz.cimcache.model.jpa.core.EquipmentJpa;
+import de.openkonsequenz.cimcache.model.jpa.core.SubGeographicalRegionJpa;
+import de.openkonsequenz.cimcache.model.jpa.core.SubstationJpa;
+import de.openkonsequenz.cimcache.model.jpa.core.VoltageLevelJpa;
+import de.openkonsequenz.cimcache.model.jpa.domain.ActivePowerJpa;
+import de.openkonsequenz.cimcache.model.jpa.domain.CommunicationTypeJpa;
+import de.openkonsequenz.cimcache.model.jpa.domain.UnitMultiplierJpa;
+import de.openkonsequenz.cimcache.model.jpa.marketoperations.mktdomain.UnitTypeJpa;
+import de.openkonsequenz.cimcache.model.jpa.meas.AnalogJpa;
+import de.openkonsequenz.cimcache.model.jpa.meas.AnalogValueJpa;
+import de.openkonsequenz.cimcache.model.jpa.wires.SynchronousMachineJpa;
+import de.openkonsequenz.cimcache.model.jpa.wires.SynchronousMachineKindJpa;
+import de.openkonsequenz.cimcache.repository.SubstationJpaRepository;
+
+@Service
+public class SubstationJpaService extends AbstractJpaService {
+
+ @Autowired
+ private SubstationJpaRepository substationJpaRepository;
+
+ @Autowired
+ private SubGeographicalRegionJpaService subGeographicalRegionJpaService;
+
+ @Autowired
+ private AnalogValueJpaService analogValueJpaService;
+
+ /**
+ * Creates the sum over all SynchronousMachines of a Substation specified by
+ * an UnitType (Photovoltaic, Wind, Biogas). If no UnitType is defined it creates
+ * the sum of SynchronousMachines which are none of Photovoltaic, Biogas or Wind.
+ *
+ * @param substationJpa
+ * @param unitTypeJpa
+ * @return
+ */
+ public BigDecimal getSumOfSynchronousMachineJpaListByUnitTypeJpa(
+ final SubstationJpa substationJpa,
+ final UnitTypeJpa unitTypeJpa,
+ final CommunicationTypeJpa communicationTypeJpa) {
+
+ BigDecimal sum = BigDecimal.ZERO;
+
+ for (final SynchronousMachineJpa synchronousMachineJpa : substationJpa.getSynchronousMachineJpaList()) {
+
+ UnitTypeJpa unitTypeJpaSynchMach = null;
+
+ if (synchronousMachineJpa.getGeneratingUnitJpa() != null) {
+
+ unitTypeJpaSynchMach =
+ synchronousMachineJpa.getGeneratingUnitJpa().getRegisteredGeneratorJpa().getUnitTypeJpa();
+ }
+
+ if (unitTypeJpaSynchMach != null
+ && unitTypeJpaSynchMach.equals(unitTypeJpa)
+ && synchronousMachineJpa.getCommunicationTypeJpa().equals(communicationTypeJpa)) {
+
+ sum = getSumOfMeas(sum, synchronousMachineJpa);
+
+ } else if (unitTypeJpa == null
+ && unitTypeJpaSynchMach != UnitTypeJpa.BIOG
+ && unitTypeJpaSynchMach != UnitTypeJpa.PHOT
+ && unitTypeJpaSynchMach != UnitTypeJpa.WIND
+ && synchronousMachineJpa.getCommunicationTypeJpa() != null
+ && synchronousMachineJpa.getCommunicationTypeJpa().equals(communicationTypeJpa)) {
+
+ sum = getSumOfMeas(sum, synchronousMachineJpa);
+ }
+ }
+
+ return sum;
+ }
+
+ /**
+ * Gets all Substations, which are valid for this moment.
+ *
+ * @param oid
+ * @return
+ */
+ public SubstationJpa findSubstationJpaByOidAndValidToNull(final String oid) {
+
+ return substationJpaRepository.findSubstationJpaByOidAndValidToNull(oid);
+ }
+
+ /**
+ * Gets all Substations, which are valid for a specific timestamp.
+ *
+ * @param oid
+ * @param timestamp
+ * @return
+ */
+ public SubstationJpa getSubstationByOidAndTimestampWithSynchronousMachineList(final String oid, final Timestamp timestamp) {
+
+ final Timestamp timestampSearch = timestamp == null ? now() : timestamp;
+
+ if (Long.parseLong(oid) < 0) {
+
+ return createVirtualTransformerStation(oid);
+
+ } else {
+
+ final SubstationJpa substationJpa =
+ substationJpaRepository.findSubstationByOidAndTimestamp(Integer.parseInt(oid), timestampSearch);
+
+ substationJpa.setEquipmentJpaList(
+ substationJpa.getEquipmentJpaListWithTimestampOnlySynchronousMachineJpa(
+ timestampSearch, CommunicationTypeJpa.FWT));
+
+ for (final VoltageLevelJpa voltageLevelJpa : substationJpa.getVoltageLevelJpaList()) {
+
+ voltageLevelJpa.setEquipmentJpaList(
+ voltageLevelJpa.getEquipmentJpaListWithTimestampOnlySynchronousMachineJpa(
+ timestampSearch, CommunicationTypeJpa.FWT));
+ }
+
+ return substationJpa;
+ }
+ }
+
+ public SubstationJpa createVirtualTransformerStation(final String oid) {
+
+ // create virtual TransformerStation
+ final SubstationJpa virtualTransformerStation = new SubstationJpa();
+ virtualTransformerStation.setOid(0L);
+ virtualTransformerStation.setmRid("VirtualTS");
+
+ final long subGeographicalRegionJpaOid = Long.parseLong(oid) * -1L;
+
+ final SubGeographicalRegionJpa subGeographicalRegionJpa
+ = subGeographicalRegionJpaService.getSubGeographicalRegionJpa(
+ subGeographicalRegionJpaOid, CommunicationTypeJpa.EFR);
+
+ if (subGeographicalRegionJpa == null) {
+
+ return null;
+ }
+
+ final List<EquipmentJpa> synchronousMachineJpaList = new ArrayList<>();
+
+ for (final SubstationJpa substationJpa : subGeographicalRegionJpa.getSubstationJpaList()) {
+
+ for (final SynchronousMachineJpa synchronousMachineJpa
+ : substationJpa.getSynchronousMachineJpaList()) {
+
+ if (synchronousMachineJpa.getCommunicationTypeJpa() != null
+ && synchronousMachineJpa.getCommunicationGroup() == null) {
+
+ synchronousMachineJpaList.add(synchronousMachineJpa);
+
+ } else if (synchronousMachineJpa.getCommunicationGroup() != null) {
+
+ SynchronousMachineJpa virtualSynchronousMachineJpa = null;
+
+ virtualSynchronousMachineJpa
+ = findInList(synchronousMachineJpaList, synchronousMachineJpa);
+
+ if (virtualSynchronousMachineJpa == null) {
+
+ virtualSynchronousMachineJpa = createVirtualSynchronousMachine(synchronousMachineJpa);
+ synchronousMachineJpaList.add(virtualSynchronousMachineJpa);
+
+ } else {
+
+ addValues(virtualSynchronousMachineJpa, synchronousMachineJpa);
+ }
+ }
+ }
+ }
+
+ virtualTransformerStation.setEquipmentJpaList(synchronousMachineJpaList);
+
+ return virtualTransformerStation;
+ }
+
+ private SynchronousMachineJpa createVirtualSynchronousMachine(final SynchronousMachineJpa synchronousMachineJpa) {
+
+ final SynchronousMachineJpa virtualSynchronousMachineJpa = new SynchronousMachineJpa();
+
+ virtualSynchronousMachineJpa.setName("VirtualSynchronousMachine" + synchronousMachineJpa.getCommunicationGroup());
+ virtualSynchronousMachineJpa.setCommunicationTypeJpa(synchronousMachineJpa.getCommunicationTypeJpa());
+ virtualSynchronousMachineJpa.setCommunicationGroup(synchronousMachineJpa.getCommunicationGroup());
+ virtualSynchronousMachineJpa.setGeneratingUnitJpa(synchronousMachineJpa.getGeneratingUnitJpa());
+ virtualSynchronousMachineJpa.getGeneratingUnitJpa().setRegisteredGeneratorJpa(null);
+ virtualSynchronousMachineJpa.setReductionSettingJpaList(synchronousMachineJpa.getReductionSettingJpaList());
+ virtualSynchronousMachineJpa.setFeedInRanking(synchronousMachineJpa.getFeedInRanking());
+ virtualSynchronousMachineJpa.setFeedInPriority(synchronousMachineJpa.getFeedInPriority());
+ virtualSynchronousMachineJpa.setNormallyInService(synchronousMachineJpa.getNormallyInService());
+ virtualSynchronousMachineJpa.setControlEnabled(synchronousMachineJpa.getControlEnabled());
+ virtualSynchronousMachineJpa.setSynchronousMachineKindJpa(SynchronousMachineKindJpa.GENERATOR);
+ virtualSynchronousMachineJpa.setmRid(synchronousMachineJpa.getmRid());
+ virtualSynchronousMachineJpa.setOid(0L);
+
+ AnalogJpaService.setOnlyLatestValue(synchronousMachineJpa.getAnalogJpaList());
+ virtualSynchronousMachineJpa.setAnalogJpaList(synchronousMachineJpa.getAnalogJpaList());
+
+ return virtualSynchronousMachineJpa;
+ }
+
+ /**
+ * Add maxOperatingP (installierte Leistung) and GeneratorPower (Wirkleisutng)
+ *
+ * @param virtualSynchronousMachineJpa
+ * @param synchronousMachineJpa
+ */
+ private void addValues(final SynchronousMachineJpa virtualSynchronousMachineJpa,
+ final SynchronousMachineJpa synchronousMachineJpa) {
+
+ ActivePowerJpaService.addActivePowerReturnMw(
+ virtualSynchronousMachineJpa.getGeneratingUnitJpa().getMaxOperatingP(),
+ synchronousMachineJpa.getGeneratingUnitJpa().getMaxOperatingP());
+
+ addAnalogJpa(virtualSynchronousMachineJpa, synchronousMachineJpa);
+
+ }
+
+ private void addAnalogJpa(final SynchronousMachineJpa virtualSynchronousMachineJpa,
+ final SynchronousMachineJpa synchronousMachineJpa) {
+
+ if (virtualSynchronousMachineJpa.getAnalogJpaList() == null
+ || virtualSynchronousMachineJpa.getAnalogJpaList().isEmpty()) {
+
+ virtualSynchronousMachineJpa.setAnalogJpaList(synchronousMachineJpa.getAnalogJpaList());
+
+ } else {
+
+ final ActivePowerJpa activePowerJpaMw =
+ ActivePowerJpaService.toMw(synchronousMachineJpa.getGeneratorPowerMeasured());
+
+ for (final AnalogJpa analogJpa : virtualSynchronousMachineJpa.getAnalogJpaList()) {
+
+ if ("GeneratorPower".equals(analogJpa.getMeasurementType())) {
+
+ AnalogJpaService.toMw(analogJpa);
+
+ final AnalogValueJpa analogValueJpaLatestValue
+ = analogValueJpaService.getAnalogValueJpaLatestValue(analogJpa.getAnalogValueJpaList());
+
+ analogValueJpaLatestValue.setValue(analogValueJpaLatestValue.getValue().add(activePowerJpaMw.getValue()));
+ }
+ }
+ }
+ }
+
+ private SynchronousMachineJpa findInList(final List<EquipmentJpa> synchronousMachineJpaList,
+ final SynchronousMachineJpa synchronousMachineJpaToBeFind) {
+
+ final List<EquipmentJpa> synchronousMachineJpaListCorrect = new ArrayList<>();
+
+ for (final EquipmentJpa equipmentJpaCorrect : synchronousMachineJpaList) {
+
+ if (((SynchronousMachineJpa) equipmentJpaCorrect).getCommunicationTypeJpa() != null
+ && ((SynchronousMachineJpa) equipmentJpaCorrect).getCommunicationGroup() != null) {
+
+ synchronousMachineJpaListCorrect.add(equipmentJpaCorrect);
+
+ }
+ }
+
+ return (SynchronousMachineJpa) CollectionUtils.find(synchronousMachineJpaListCorrect, new Predicate() {
+ @Override
+ public boolean evaluate(final Object o) {
+
+ return ((SynchronousMachineJpa) o).getCommunicationTypeJpa().equals(CommunicationTypeJpa.EFR)
+ && ((SynchronousMachineJpa) o).getCommunicationGroup().compareTo(
+ synchronousMachineJpaToBeFind.getCommunicationGroup()) == 0;
+ }
+ });
+ }
+
+
+ public List<SubstationJpa> getSubstationJpa4Lov() {
+
+ final List<SubstationJpa> substationJpaList = new ArrayList<>();
+
+ for (final Object[] object : substationJpaRepository.findSubstatioJpa4Lov()) {
+
+ final SubstationJpa substationJpa = new SubstationJpa();
+
+ substationJpa.setOid(Long.parseLong(object[1].toString()));
+ substationJpa.setmRid((String) object[2]);
+ substationJpa.setName((String) object[3]);
+
+ substationJpaList.add(substationJpa);
+ }
+
+ return substationJpaList;
+ }
+
+ private BigDecimal getSumOfMeas(final BigDecimal value, final SynchronousMachineJpa synchronousMachineJpa) {
+
+ BigDecimal sum = value;
+
+ for (final AnalogJpa analogJpa : synchronousMachineJpa.getAnalogJpaList()) {
+
+ if ("GeneratorPower".equals(analogJpa.getMeasurementType())) {
+
+ BigDecimal valueToAdd = analogValueJpaService.getLatestValue(analogJpa.getAnalogValueJpaList());
+
+ if (analogJpa.getUnitMultiplierJpa().equals(UnitMultiplierJpa.KILO)) {
+
+ valueToAdd = valueToAdd.divide(BigDecimal.valueOf(1000L), 2, RoundingMode.HALF_UP);
+ }
+
+ sum = sum.add(valueToAdd);
+ }
+ }
+
+ return sum;
+ }
+
+}
diff --git a/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/service/SubstationMapperService.java b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/service/SubstationMapperService.java
new file mode 100644
index 00000000..ccb12b77
--- /dev/null
+++ b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/service/SubstationMapperService.java
@@ -0,0 +1,45 @@
+/**
+ ******************************************************************************
+ * Copyright © 2015-2017 BTC AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ ******************************************************************************
+ */
+package de.openkonsequenz.cimcache.service;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.springframework.stereotype.Service;
+
+import de.openkonsequenz.cim.core.Substation;
+import de.openkonsequenz.cimcache.model.jpa.core.SubstationJpa;
+
+@Service
+public class SubstationMapperService extends BaseMapperService {
+
+ public Substation mapSubstationJpa(final SubstationJpa substationJpa) {
+
+ final Substation substation = new Substation();
+ mapper.map(substationJpa, substation);
+
+ return substation;
+ }
+
+ public List<Substation> mapSubstationList(final List<SubstationJpa> substationJpaList) {
+
+ final List<Substation> substationList = new ArrayList<>();
+
+ for (final SubstationJpa substationJpa : substationJpaList) {
+
+ substationList.add(mapSubstationJpa(substationJpa));
+ }
+
+ return substationList;
+ }
+
+}
diff --git a/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/service/SubstationService.java b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/service/SubstationService.java
new file mode 100644
index 00000000..2825d5ba
--- /dev/null
+++ b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/service/SubstationService.java
@@ -0,0 +1,39 @@
+/**
+ ******************************************************************************
+ * Copyright © 2015-2017 BTC AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ ******************************************************************************
+ */
+package de.openkonsequenz.cimcache.service;
+
+import org.springframework.stereotype.Service;
+
+import de.openkonsequenz.cim.core.Equipment;
+import de.openkonsequenz.cim.core.Substation;
+
+@Service
+public class SubstationService {
+
+ public Substation prepare4Eisman(final Substation substation) {
+
+ for (final Equipment equipment : substation.getEquipmentList()) {
+
+ if (EquipmentService.checkEquipment4Eisman(equipment)) {
+
+ EquipmentService.mapActivePowerKilo2Mega(equipment);
+
+ EquipmentService.setLatestMeasurementOfEquipment(equipment);
+
+ EquipmentService.mapMeasurementValueKilo2Mega(equipment);
+ }
+ }
+
+ return substation;
+ }
+
+}
diff --git a/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/service/SynchronousMachineJpaDiffCheckerService.java b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/service/SynchronousMachineJpaDiffCheckerService.java
new file mode 100644
index 00000000..8cccc878
--- /dev/null
+++ b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/service/SynchronousMachineJpaDiffCheckerService.java
@@ -0,0 +1,185 @@
+/**
+ ******************************************************************************
+ * Copyright © 2015-2017 BTC AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ ******************************************************************************
+ */
+package de.openkonsequenz.cimcache.service;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.springframework.stereotype.Service;
+
+import de.openkonsequenz.cimcache.model.jpa.domain.ReductionSettingJpa;
+import de.openkonsequenz.cimcache.model.jpa.production.GeneratingUnitJpa;
+import de.openkonsequenz.cimcache.model.jpa.wires.SynchronousMachineJpa;
+
+@Service
+public class SynchronousMachineJpaDiffCheckerService {
+
+ /**
+ * Check if Synchronous Machine has different data for these attributes:
+ * normallyInService
+ * controlEnabled
+ * analogJpaList
+ *
+ * @param s1
+ * @param s2
+ * @return
+ */
+ public boolean hasDifferentNetstate(final SynchronousMachineJpa s1, final SynchronousMachineJpa s2) {
+
+ boolean result = false;
+
+ if (hasDifferentValue(s1.getNormallyInService(), s2.getNormallyInService())
+ || hasDifferentValue(s1.getControlEnabled(), s2.getControlEnabled())
+ || hasDifferentList(s1.getAnalogJpaList(), s2.getAnalogJpaList())) {
+
+ result = true;
+ }
+
+ return result;
+ }
+
+ /**
+ * Check if Synchronous Machine has different data for these attributes:
+ * name
+ * communication group
+ * communication type
+ * feed-in priority
+ * feed-in ranking
+ * max voltage limit (maxU)
+ * operating share
+ * psr event
+ * reduction setting list
+ * referenced synchronous machine
+ * kind of SynchronousMachine
+ * high-control limit
+ * max operating power
+ * location
+ *
+ * @param s1 SynchronousMachine
+ * @param s2 SynchronousMachine
+ * @return boolean
+ */
+ public boolean hasDifferentData(final SynchronousMachineJpa s1, final SynchronousMachineJpa s2) {
+
+ boolean result = false;
+
+ if (hasDifferentAttributes(s1, s2)
+ || hasDifferentValue(s1.getMaxU(), s2.getMaxU())
+ || hasDifferentList(s1.getOperatingShareJpaList(),s2.getOperatingShareJpaList())
+ || hasDifferentList(s1.getPsrEventJpaList(), s2.getPsrEventJpaList())
+ || hasDifferentList(
+ sortReductionSettingJpaList(s1.getReductionSettingJpaList()),
+ sortReductionSettingJpaList(s2.getReductionSettingJpaList()))
+ || hasDifferentRefSynchronousMachine(
+ s1.getReferencedSynchronousMachineJpa(), s2.getReferencedSynchronousMachineJpa())
+ || hasDifferentGeneratingUnitData(s1.getGeneratingUnitJpa(), s2.getGeneratingUnitJpa())
+ || hasDifferentValue(s1.getLocationJpa(), s2.getLocationJpa())
+ ) {
+
+ result = true;
+ }
+
+ return result;
+ }
+
+ private boolean hasDifferentAttributes(final SynchronousMachineJpa s1, final SynchronousMachineJpa s2) {
+
+ boolean result = false;
+
+ if (hasDifferentValue(s1.getName(), s2.getName())
+ || hasDifferentValue(s1.getFeedInPriority(), s2.getFeedInPriority())
+ || hasDifferentValue(s1.getFeedInRanking(), s2.getFeedInRanking())
+ || hasDifferentValue(s1.getCommunicationGroup(), s2.getCommunicationGroup())
+ || hasDifferentValue(s1.getCommunicationTypeJpa(), s2.getCommunicationTypeJpa())
+ || hasDifferentValue(s1.getSynchronousMachineKindJpa(), s2.getSynchronousMachineKindJpa())
+ ) {
+
+ result = true;
+ }
+
+ return result;
+ }
+
+ private List<ReductionSettingJpa> sortReductionSettingJpaList(final List<ReductionSettingJpa> reductionSettingJpaList) {
+
+ if (reductionSettingJpaList != null) {
+ Collections.sort(reductionSettingJpaList);
+ }
+ return reductionSettingJpaList;
+ }
+
+ private boolean hasDifferentGeneratingUnitData(final GeneratingUnitJpa g1, final GeneratingUnitJpa g2) {
+
+ boolean result = true;
+
+ if (g1 == null && g2 == null) {
+
+ result = false;
+
+ } else if (g1 != null && g2 != null) {
+
+ result = hasDifferentValue(g1.getHighControlLimit(), g2.getHighControlLimit())
+ || hasDifferentValue(g1.getMaxOperatingP(), g2.getMaxOperatingP());
+ }
+
+ return result;
+ }
+
+ private boolean hasDifferentRefSynchronousMachine(final SynchronousMachineJpa s1, final SynchronousMachineJpa s2) {
+
+ boolean result = true;
+
+ if (s1 == null && s2 == null) {
+
+ result = false;
+
+ } else if (s1 != null && s2 != null) {
+
+ result = s1.compareTo(s2) != 0;
+ }
+
+ return result;
+ }
+
+ private boolean hasDifferentList(final List<?> p1, final List<?> p2) {
+
+ boolean result = true;
+
+ if (p1 == null && p2 == null) {
+
+ result = false;
+
+ } else if (p1 != null && p2 != null) {
+
+ result = !p1.equals(p2);
+ }
+
+ return result;
+ }
+
+ private boolean hasDifferentValue(final Object s1, final Object s2) {
+
+ boolean result = true;
+
+ if (s1 == null && s2 == null) {
+
+ result = false;
+
+ } else if (s1 != null && s2 != null) {
+
+ result = !s1.equals(s2);
+ }
+
+ return result;
+ }
+
+}
diff --git a/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/service/SynchronousMachineJpaService.java b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/service/SynchronousMachineJpaService.java
new file mode 100644
index 00000000..cb103955
--- /dev/null
+++ b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/service/SynchronousMachineJpaService.java
@@ -0,0 +1,193 @@
+/**
+ ******************************************************************************
+ * Copyright © 2015-2017 BTC AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ ******************************************************************************
+ */
+package de.openkonsequenz.cimcache.service;
+
+import java.sql.Timestamp;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.List;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import de.openkonsequenz.cimcache.model.jpa.meas.AnalogJpa;
+import de.openkonsequenz.cimcache.model.jpa.meas.AnalogValueJpa;
+import de.openkonsequenz.cimcache.model.jpa.production.GeneratingUnitJpa;
+import de.openkonsequenz.cimcache.model.jpa.wires.SynchronousMachineJpa;
+import de.openkonsequenz.cimcache.repository.SynchronousMachineJpaRepository;
+
+@Service
+public class SynchronousMachineJpaService extends AbstractJpaService {
+
+ private static final String EQUIPMENT_CONTAINER_SEQ_OID = "EQUIPMENT_CONTAINER_SEQ_OID";
+
+ @Autowired
+ private SynchronousMachineJpaRepository synchronousMachineJpaRepository;
+
+ @Autowired
+ private SequenceJpaService sequenceJpaService;
+
+ @Autowired
+ private SynchronousMachineJpaDiffCheckerService synchronousMachineJpaDiffCheckerService;
+
+ public void setRefSynchronousMachine(final SynchronousMachineJpa synchronousMachineJpa,
+ final String refSynchronousMachineMRid) {
+
+ final SynchronousMachineJpa refSynchronousMachineJpaPersisted =
+ synchronousMachineJpaRepository.findSynchronousMachineJpaByMRidAndValidToNull(refSynchronousMachineMRid);
+
+ if (refSynchronousMachineJpaPersisted != null) {
+
+ // a referenced Synchronous Machine must not own a referenced Synchronous Machine itsself
+ refSynchronousMachineJpaPersisted.setReferencedSynchronousMachineJpa(null);
+ synchronousMachineJpa.setReferencedSynchronousMachineJpa(refSynchronousMachineJpaPersisted);
+ }
+ }
+
+ /**
+ * Check if SynchronousMachine exists.
+ * If exists and data changed, then create new SynchronousMachine with same oid and persist.
+ * If exists and netstate data is different, then update SynchronousMachine.
+ * If does not exists, then do not persist.
+ *
+ * @param synchronousMachineJpa
+ * @return
+ */
+ public void save(final SynchronousMachineJpa synchronousMachineJpa) {
+
+ final SynchronousMachineJpa synchronousMachineJpaPersisted =
+ synchronousMachineJpaRepository.findSynchronousMachineJpaByMRidAndValidToNull(
+ synchronousMachineJpa.getmRid());
+
+ // only netstate data already imported
+ // 1. hasDifferentNetstate AND
+ // 2. hasDifferentData AND
+ // 3. persisted Synchronous Machine has no data but only netstate data
+ if (synchronousMachineJpaPersisted != null
+// && synchronousMachineJpaPersisted.getFeedInRanking() == null
+// && synchronousMachineJpaPersisted.getFeedInPriority() == null
+ && synchronousMachineJpaDiffCheckerService
+ .hasDifferentData(synchronousMachineJpa, synchronousMachineJpaPersisted)
+ && synchronousMachineJpaDiffCheckerService
+ .hasDifferentNetstate(synchronousMachineJpa, synchronousMachineJpaPersisted)) {
+
+ synchronousMachineJpaPersisted.setName(synchronousMachineJpa.getName());
+ synchronousMachineJpaPersisted.setMaxU(synchronousMachineJpa.getMaxU());
+ synchronousMachineJpaPersisted.setLocationJpa(synchronousMachineJpa.getLocationJpa());
+ synchronousMachineJpaPersisted.setFeedInRanking(synchronousMachineJpa.getFeedInRanking());
+ synchronousMachineJpaPersisted.setFeedInPriority(synchronousMachineJpa.getFeedInPriority());
+ synchronousMachineJpaPersisted.setSynchronousMachineKindJpa(synchronousMachineJpa.getSynchronousMachineKindJpa());
+ synchronousMachineJpaPersisted.setCommunicationTypeJpa(synchronousMachineJpa.getCommunicationTypeJpa());
+ synchronousMachineJpaPersisted.setCommunicationGroup(synchronousMachineJpa.getCommunicationGroup());
+ synchronousMachineJpaPersisted.getReductionSettingJpaList().addAll(
+ synchronousMachineJpa.getReductionSettingJpaList());
+ synchronousMachineJpaPersisted.setOperatingShareJpaList(
+ synchronousMachineJpa.getOperatingShareJpaList());
+ synchronousMachineJpaPersisted.setPsrEventJpaList(synchronousMachineJpa.getPsrEventJpaList());
+
+ final GeneratingUnitJpa generatingUnitJpa = synchronousMachineJpa.getGeneratingUnitJpa();
+ generatingUnitJpa.setOid(sequenceJpaService.getNextValueFromSequence(EQUIPMENT_CONTAINER_SEQ_OID));
+ generatingUnitJpa.setValidFrom(now());
+ generatingUnitJpa.setNormallyInService(synchronousMachineJpaPersisted.getNormallyInService());
+ synchronousMachineJpaPersisted.setGeneratingUnitJpa(generatingUnitJpa);
+
+ if (synchronousMachineJpa.getReferencedSynchronousMachineJpa() != null) {
+
+ synchronousMachineJpaPersisted.setReferencedSynchronousMachineJpa(
+ synchronousMachineJpa.getReferencedSynchronousMachineJpa());
+ }
+
+ synchronousMachineJpaRepository.save(synchronousMachineJpaPersisted);
+
+ // only data of SynchronousMachine changed
+ // 1. hasDifferentData AND
+ // 2. Synchronous Machine data to be imported has data (no netstate data)
+ } else if (synchronousMachineJpaPersisted != null
+// && synchronousMachineJpa.getFeedInRanking() != null
+// && synchronousMachineJpa.getFeedInPriority() != null
+ && synchronousMachineJpaDiffCheckerService
+ .hasDifferentData(synchronousMachineJpa, synchronousMachineJpaPersisted)) {
+
+ synchronousMachineJpaPersisted.setValidTo(now());
+
+ if (synchronousMachineJpaPersisted.getGeneratingUnitJpa() != null) {
+
+ synchronousMachineJpaPersisted.getGeneratingUnitJpa().setValidTo(now());
+ }
+
+ synchronousMachineJpaRepository.save(synchronousMachineJpaPersisted);
+
+ synchronousMachineJpa.setOid(synchronousMachineJpaPersisted.getOid());
+ synchronousMachineJpa.setValidFrom(now());
+
+ synchronousMachineJpa.getGeneratingUnitJpa().setOid(
+ synchronousMachineJpaPersisted.getGeneratingUnitJpa().getOid());
+ synchronousMachineJpa.getGeneratingUnitJpa().setValidFrom(now());
+
+ synchronousMachineJpaRepository.save(synchronousMachineJpa);
+
+ // only netstate data of Synchronous Machine changed
+ // 1. hasDifferentNetstate AND
+ // 2. Synchronous Machine data to be imported is netstate data
+ } /*else if (synchronousMachineJpaPersisted != null
+ && synchronousMachineJpa.getNormallyInService() != null
+ && synchronousMachineJpa.getControlEnabled() != null
+ && synchronousMachineJpaDiffCheckerService
+ .hasDifferentNetstate(synchronousMachineJpa, synchronousMachineJpaPersisted)) {
+
+ synchronousMachineJpaPersisted.setNormallyInService(synchronousMachineJpa.getNormallyInService());
+ synchronousMachineJpaPersisted.setControlEnabled(synchronousMachineJpa.getControlEnabled());
+ synchronousMachineJpaPersisted.getAnalogJpaList().addAll(synchronousMachineJpa.getAnalogJpaList());
+
+ synchronousMachineJpaRepository.save(synchronousMachineJpaPersisted);
+ }*/
+ }
+
+ public SynchronousMachineJpa findSynchronousMachineJpaByOidAndTimestamp(final Long oid, final Timestamp timestamp) {
+
+ final SynchronousMachineJpa synchronousMachineJpa =
+ synchronousMachineJpaRepository.findSynchronousMachineJpaByOidAndTimestamp(oid, timestamp);
+
+ for (final AnalogJpa analogJpa : synchronousMachineJpa.getAnalogJpaList()) {
+
+ if ("ReductionSetting".equals(analogJpa.getMeasurementType())) {
+
+ final List<AnalogValueJpa> analogValueJpaList = analogJpa.getAnalogValueJpaList();
+
+ Collections.sort(analogValueJpaList, new Comparator<AnalogValueJpa>() {
+ // sort: youngest timestamp comes first
+ @Override
+ public int compare(final AnalogValueJpa aV01, final AnalogValueJpa aV02) {
+ return aV02.getTimeStamp().getValue().compareTo(aV01.getTimeStamp().getValue());
+ }
+ });
+
+ AnalogValueJpa analogValueJpaMatchingTimestamp = new AnalogValueJpa();
+
+ for (final AnalogValueJpa analogValueJpa : analogValueJpaList) {
+
+ if (timestamp.after(analogValueJpa.getTimeStamp().getValue())) {
+
+ analogValueJpaMatchingTimestamp = analogValueJpa;
+ break;
+ }
+ }
+
+ analogJpa.getAnalogValueJpaList().clear();
+ analogJpa.getAnalogValueJpaList().add(analogValueJpaMatchingTimestamp);
+ }
+ }
+
+ return synchronousMachineJpa;
+ }
+
+}
diff --git a/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/service/SynchronousMachineMapperService.java b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/service/SynchronousMachineMapperService.java
new file mode 100644
index 00000000..ad3378af
--- /dev/null
+++ b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/service/SynchronousMachineMapperService.java
@@ -0,0 +1,47 @@
+/**
+ ******************************************************************************
+ * Copyright © 2015-2017 BTC AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ ******************************************************************************
+ */
+package de.openkonsequenz.cimcache.service;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.springframework.stereotype.Service;
+
+import de.openkonsequenz.cim.wires.SynchronousMachine;
+import de.openkonsequenz.cimcache.model.jpa.wires.SynchronousMachineJpa;
+
+@Service
+public class SynchronousMachineMapperService extends BaseMapperService {
+
+ public SynchronousMachineJpa mapSynchronousMachine(final SynchronousMachine synchronousMachine) {
+
+ final SynchronousMachineJpa synchronousMachineJpa = new SynchronousMachineJpa();
+ mapper.map(synchronousMachine, synchronousMachineJpa);
+ return synchronousMachineJpa;
+ }
+
+ public SynchronousMachine mapSynchronousMachineJpa(final SynchronousMachineJpa synchronousMachineJpa) {
+
+ final SynchronousMachine synchronousMachine = new SynchronousMachine();
+ mapper.map(synchronousMachineJpa, synchronousMachine);
+ return synchronousMachine;
+ }
+
+ public List<SynchronousMachine> mapSynchronousMachineJpaList(final List<SynchronousMachineJpa> synchronousMachineJpaList) {
+
+ final List<SynchronousMachine> synchronousMachineList = new ArrayList<>();
+
+ mapper.map(synchronousMachineJpaList, synchronousMachineList);
+
+ return synchronousMachineList;
+ }
+}
diff --git a/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/service/SynchronousMachineRestConsumerService.java b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/service/SynchronousMachineRestConsumerService.java
new file mode 100644
index 00000000..c38ae488
--- /dev/null
+++ b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/service/SynchronousMachineRestConsumerService.java
@@ -0,0 +1,64 @@
+/**
+ ******************************************************************************
+ * Copyright © 2015-2017 BTC AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ ******************************************************************************
+ */
+package de.openkonsequenz.cimcache.service;
+
+import java.util.List;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import de.openkonsequenz.cim.wires.SynchronousMachine;
+import de.openkonsequenz.cimcache.datainterchange.adapter.rest.client.SynchronousMachineProvider;
+import de.openkonsequenz.cimcache.model.jpa.wires.SynchronousMachineJpa;
+
+@Service
+public class SynchronousMachineRestConsumerService
+{
+
+ @Autowired
+ private SynchronousMachineProvider synchronousMachineRestConsumer;
+
+ @Autowired
+ private SynchronousMachineValidatorService synchronousMachineValidatorService;
+
+ @Autowired
+ private SynchronousMachineMapperService synchronousMachineMapperService;
+
+ @Autowired
+ private SynchronousMachineJpaService synchronousMachineJpaService;
+
+ /**
+ * Gets a list of SynchronousMachine and persists the data.
+ */
+ public void getSynchronousMachineList()
+ {
+
+ final List<SynchronousMachine> synchronousMachineList = synchronousMachineRestConsumer.getSynchronousMachineList();
+
+ for(final SynchronousMachine synchronousMachine : synchronousMachineList)
+ {
+
+ final SynchronousMachineJpa synchronousMachineJpa = synchronousMachineMapperService.mapSynchronousMachine(synchronousMachine);
+
+ synchronousMachineValidatorService.validateSynchronousMachine(synchronousMachineJpa);
+
+ if(synchronousMachine.getReferencedSynchronousMachineMrid() != null)
+ {
+
+ synchronousMachineJpaService.setRefSynchronousMachine(synchronousMachineJpa, synchronousMachine.getReferencedSynchronousMachineMrid());
+ }
+
+ synchronousMachineJpaService.save(synchronousMachineJpa);
+ }
+ }
+
+}
diff --git a/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/service/SynchronousMachineValidatorService.java b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/service/SynchronousMachineValidatorService.java
new file mode 100644
index 00000000..b27be887
--- /dev/null
+++ b/dev/de.openkonsequenz.cimcache/src/main/java/de/openkonsequenz/cimcache/service/SynchronousMachineValidatorService.java
@@ -0,0 +1,249 @@
+/**
+ ******************************************************************************
+ * Copyright © 2015-2017 BTC AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ ******************************************************************************
+ */
+package de.openkonsequenz.cimcache.service;
+
+import java.math.BigDecimal;
+import java.util.List;
+
+import org.apache.log4j.Logger;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import com.google.common.base.Predicate;
+import com.google.common.collect.Collections2;
+
+import de.openkonsequenz.cimcache.model.jpa.informative.infoperations.PsrEventJpa;
+import de.openkonsequenz.cimcache.model.jpa.informative.infoperations.PsrEventKindJpa;
+import de.openkonsequenz.cimcache.model.jpa.meas.AnalogJpa;
+import de.openkonsequenz.cimcache.model.jpa.meas.AnalogValueJpa;
+import de.openkonsequenz.cimcache.model.jpa.production.GeneratingUnitJpa;
+import de.openkonsequenz.cimcache.model.jpa.wires.SynchronousMachineJpa;
+import de.openkonsequenz.date.DateDefaults;
+
+@Service
+public class SynchronousMachineValidatorService {
+
+ private static final Logger LOG = Logger.getLogger(SynchronousMachineValidatorService.class);
+
+ @Autowired
+ private AnalogValueJpaService analogValueJpaService;
+
+ @Autowired
+ private SignumService signumService;
+
+ @Autowired
+ private TimePeriodPassedService timePeriodPassedService;
+
+ public List<SynchronousMachineJpa> validate(final List<SynchronousMachineJpa> synchronousMachineJpaList) {
+
+ for(final SynchronousMachineJpa synchronousMachineJpa : synchronousMachineJpaList) {
+
+ validateSynchronousMachine(synchronousMachineJpa);
+ }
+
+ return synchronousMachineJpaList;
+ }
+
+