Merge branch 'DEVELOP' of ssh://git.eclipse.org:29418/openk-usermodules/org.eclipse.openk-usermodules.gridFailureInformation.backend into SI-379_ImportAdressen
diff --git a/addressImport/src/main/java/org/eclipse/openk/gridfailureinformation/importadresses/AddressImportApplication.java b/addressImport/src/main/java/org/eclipse/openk/gridfailureinformation/importadresses/AddressImportApplication.java
index 390eeb1..212780f 100644
--- a/addressImport/src/main/java/org/eclipse/openk/gridfailureinformation/importadresses/AddressImportApplication.java
+++ b/addressImport/src/main/java/org/eclipse/openk/gridfailureinformation/importadresses/AddressImportApplication.java
@@ -9,7 +9,9 @@
public class AddressImportApplication {
public static void main(String[] args) {
- SpringApplication.run(AddressImportApplication.class, args);
+ // passing through args is a security issue at sonar. As long as we don't know what for, we won't passthrough
+ // any arg
+ SpringApplication.run(AddressImportApplication.class, new String[0]);
}
}
diff --git a/addressImport/src/main/java/org/eclipse/openk/gridfailureinformation/importadresses/service/AddressService.java b/addressImport/src/main/java/org/eclipse/openk/gridfailureinformation/importadresses/service/AddressService.java
index 1b18272..d54d3fc 100644
--- a/addressImport/src/main/java/org/eclipse/openk/gridfailureinformation/importadresses/service/AddressService.java
+++ b/addressImport/src/main/java/org/eclipse/openk/gridfailureinformation/importadresses/service/AddressService.java
@@ -72,6 +72,7 @@
} catch (Exception ex) {
+ log.error(ex);
log.warn("Adresse [sdo_x1= " + addressDto.getSdox1()
+ ", sdo_y1= " + addressDto.getSdoy1()
+ ", g3e_fid=" + addressDto.getG3efid()
diff --git a/gfsBackendService/src/main/java/org/eclipse/openk/gridfailureinformation/controller/FailureInformationController.java b/gfsBackendService/src/main/java/org/eclipse/openk/gridfailureinformation/controller/FailureInformationController.java
index d3ae4a0..852161a 100644
--- a/gfsBackendService/src/main/java/org/eclipse/openk/gridfailureinformation/controller/FailureInformationController.java
+++ b/gfsBackendService/src/main/java/org/eclipse/openk/gridfailureinformation/controller/FailureInformationController.java
@@ -34,6 +34,7 @@
import java.net.URI;
import java.util.List;
+import java.util.Optional;
import java.util.UUID;
@Log4j2
@@ -111,7 +112,7 @@
})
public ResponseEntity<FailureInformationDto> condenseFailureInfos(@ApiParam("Liste UUIDs der zu verdichtenden Störungen")
@RequestBody List<UUID> listUuids) {
- FailureInformationDto condensedGfDto = failureInformationService.condenseFailureInfos(listUuids);
+ FailureInformationDto condensedGfDto = failureInformationService.condenseFailureInfos(listUuids, Optional.empty());
URI location = ServletUriComponentsBuilder
.fromCurrentRequestUri()
.path("/{uuid}")
@@ -120,5 +121,26 @@
return ResponseEntity.created(location).body(condensedGfDto);
}
+ @GetMapping("/condensed/{uuid}")
+ @ApiOperation(value = "Anzeigen von Störungsinformationen, die einer Verdichtung zuzuordnen sind")
+ @ApiResponses(value = { @ApiResponse(code = 200, message = "Erfolgreich durchgeführt"),
+ @ApiResponse(code = 404, message = "Störungsinformationen wurden nicht gefunden")})
+ @ResponseStatus(HttpStatus.OK)
+ public List<FailureInformationDto> getFailureInformations(@PathVariable UUID uuid) {
+ return failureInformationService.findFailureInformationsByCondensedUuid(uuid);
+ }
+
+ @PutMapping("/{failureInfoUuid}/condense")
+ @ApiOperation(value = "Update einer verdichteten Störungsinfo")
+ @ApiResponses(value = { @ApiResponse(code = 200, message = "Erfolgreich durchgeführt"),
+ @ApiResponse(code = 404, message = "Störungsinformationen wurden nicht gefunden")})
+ @ResponseStatus(HttpStatus.OK)
+ public FailureInformationDto updateSubordinatedFailureInformations(
+ @ApiParam(name="failureInfoUuid", value= "Liste UUIDs der zu verdichtenden Störungen", required = true)
+ @PathVariable UUID failureInfoUuid,
+ @RequestBody List<UUID> listSubordinatedUuids) {
+
+ return failureInformationService.updateSubordinatedFailureInfos(failureInfoUuid, listSubordinatedUuids);
+ }
}
diff --git a/gfsBackendService/src/main/java/org/eclipse/openk/gridfailureinformation/repository/FailureInformationRepository.java b/gfsBackendService/src/main/java/org/eclipse/openk/gridfailureinformation/repository/FailureInformationRepository.java
index f17b062..41e693b 100644
--- a/gfsBackendService/src/main/java/org/eclipse/openk/gridfailureinformation/repository/FailureInformationRepository.java
+++ b/gfsBackendService/src/main/java/org/eclipse/openk/gridfailureinformation/repository/FailureInformationRepository.java
@@ -18,7 +18,9 @@
import org.eclipse.openk.gridfailureinformation.model.TblFailureInformation;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
+import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
+import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;
import java.util.List;
@@ -33,4 +35,7 @@
Optional<TblFailureInformation> findByUuid(UUID uuid);
List<TblFailureInformation> findByUuidIn(List<UUID> uuidList);
+
+ @Query("select fi from TblFailureInformation fi where fi.tblFailureInformationCondensed.uuid = :uuid")
+ List<TblFailureInformation> findByFailureInformationCondensedUuid(@Param("uuid") UUID uuid);
}
diff --git a/gfsBackendService/src/main/java/org/eclipse/openk/gridfailureinformation/service/FailureInformationService.java b/gfsBackendService/src/main/java/org/eclipse/openk/gridfailureinformation/service/FailureInformationService.java
index e579625..bd2b83e 100644
--- a/gfsBackendService/src/main/java/org/eclipse/openk/gridfailureinformation/service/FailureInformationService.java
+++ b/gfsBackendService/src/main/java/org/eclipse/openk/gridfailureinformation/service/FailureInformationService.java
@@ -37,10 +37,7 @@
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
-import java.util.Comparator;
-import java.util.Date;
-import java.util.List;
-import java.util.UUID;
+import java.util.*;
import java.util.stream.Collectors;
@Log4j2
@@ -90,6 +87,15 @@
return failureInformationRepository.findByTblFailureInformationCondensedIdIsNull(pageable).map(failureInformationMapper::toFailureInformationDto);
}
+ public List <FailureInformationDto> findFailureInformationsByCondensedUuid(UUID uuid) {
+
+ List<TblFailureInformation> fiList = failureInformationRepository.findByFailureInformationCondensedUuid(uuid);
+ return fiList.stream()
+ .map(failureInformationMapper::toFailureInformationDto)
+ .collect(Collectors.toList());
+ }
+
+ @Transactional
public FailureInformationDto insertFailureInfo(FailureInformationDto failureInfoDto) {
failureInfoDto.setUuid(null); // force null here
return processGrid(
@@ -225,47 +231,116 @@
}
}
- @Transactional
- public FailureInformationDto condenseFailureInfos(List<UUID> listUuids){
+ public FailureInformationDto updateSubordinatedFailureInfos(UUID condensedUuid, List<UUID> subordinatedUuidList){
- if(listUuids.isEmpty()){
- throw new BadRequestException("empty.array");
+ //find condensed FailureInfo:
+ TblFailureInformation existingFailureInfoCondensed = failureInformationRepository
+ .findByUuid(condensedUuid)
+ .orElseThrow(() -> new NotFoundException("failure.info.uuid.not.existing"));
+
+ // pruefen, ob in der uebergebenen Liste unterzuordnender FailureInfos Teile einer anderen Verdichtung sind
+ if (containsAlienSubordinatedFailureInfos(condensedUuid, subordinatedUuidList)) {
+ throw new BadRequestException("failure.info.already.subordinated");
}
+ //alle bislang untergeordneten failureInfos finden und Fremdschluessel loeschen
+ List<TblFailureInformation> subordinatedFailureInfosList = failureInformationRepository.findByFailureInformationCondensedUuid(condensedUuid);
+ subordinatedFailureInfosList
+ .stream()
+ .forEach(x -> x.setTblFailureInformationCondensed(null));
+
+ //condenseFailureInfos fuer existierende FailureInfo aufrufen
+ return condenseFailureInfos(subordinatedUuidList, Optional.of(condensedUuid));
+ }
+
+ private boolean containsAlienSubordinatedFailureInfos(UUID condensedUuid, List<UUID> subordinatedUuidList){
+
+ List<TblFailureInformation> futureSubordinateFailureInfoList = failureInformationRepository
+ .findByUuidIn(subordinatedUuidList);
+
+ List filteredList = futureSubordinateFailureInfoList.stream()
+ .filter(x->x.getTblFailureInformationCondensed() == null || x.getTblFailureInformationCondensed().getUuid() != condensedUuid )
+ .collect(Collectors.toList());
+
+ if(filteredList.size() == futureSubordinateFailureInfoList.size()){
+ return false;
+ }
+ else{
+ return true;
+ }
+ }
+
+ private boolean containsSubordinatedFailureInfos(List<UUID> subordinatedUuidList){
+
+ List<TblFailureInformation> futureSubordinateFailureInfoList = failureInformationRepository
+ .findByUuidIn(subordinatedUuidList);
+
+ List filteredList = futureSubordinateFailureInfoList.stream()
+ .filter(x->x.getTblFailureInformationCondensed() == null)
+ .collect(Collectors.toList());
+
+ if(filteredList.size() == futureSubordinateFailureInfoList.size()){
+ return false;
+ }
+ else{
+ return true;
+ }
+ }
+
+ @Transactional
+ public FailureInformationDto condenseFailureInfos(List<UUID> listUuids, Optional<UUID> condensedUuid){
+
+ TblFailureInformation condensedFailureInformation;
TblFailureInformation condensedFailureInformationSaved;
- List<TblFailureInformation> listFailureInfos= failureInformationRepository.findByUuidIn(listUuids);
- if(checkSameBranch(listFailureInfos)){
- TblFailureInformation condensedFailureInformationToSave = new TblFailureInformation();
- condensedFailureInformationToSave.setRefBranch(listFailureInfos.get(0).getRefBranch());
+ if(listUuids.isEmpty()){
+ throw new BadRequestException("empty.array.for.subordinated.failure.infos");
+ }
- setVoltageLevel(listFailureInfos, condensedFailureInformationToSave);
- setEarliestStartdate(listFailureInfos, condensedFailureInformationToSave);
- setLatestEnddate(listFailureInfos, condensedFailureInformationToSave);
- setExpectedReason(listFailureInfos, condensedFailureInformationToSave);
- setCity(listFailureInfos, condensedFailureInformationToSave);
- setStreet(listFailureInfos, condensedFailureInformationToSave);
- setDistrict(listFailureInfos, condensedFailureInformationToSave);
- setRadius(listFailureInfos, condensedFailureInformationToSave);
+ // pruefen, ob in der uebergebenen Liste unterzuordnender FailureInfos Teile einer anderen Verdichtung sind
+ if (containsSubordinatedFailureInfos(listUuids)) {
+ throw new BadRequestException("failure.info.already.subordinated");
+ }
- //setze restliche Felder und speichere condensed failureInfo
- condensedFailureInformationToSave.setUuid(UUID.randomUUID());
- condensedFailureInformationToSave.setVersionNumber(1L);
+ if(condensedUuid.isPresent()){
+ condensedFailureInformation = failureInformationRepository
+ .findByUuid(condensedUuid.get())
+ .orElseThrow(() -> new NotFoundException("failure.info.uuid.not.existing"));
+ }
+ else{
+ condensedFailureInformation = new TblFailureInformation();
+ condensedFailureInformation.setUuid(UUID.randomUUID());
+ }
+
+ List<TblFailureInformation> listSubordinatedFailureInfos= failureInformationRepository.findByUuidIn(listUuids);
+
+ if(checkSameBranch(listSubordinatedFailureInfos)){
+
+ condensedFailureInformation.setRefBranch(listSubordinatedFailureInfos.get(0).getRefBranch());
+
+ setVoltageLevel(listSubordinatedFailureInfos, condensedFailureInformation);
+ setEarliestStartdate(listSubordinatedFailureInfos, condensedFailureInformation);
+ setLatestEnddate(listSubordinatedFailureInfos, condensedFailureInformation);
+ setExpectedReason(listSubordinatedFailureInfos, condensedFailureInformation);
+ setCity(listSubordinatedFailureInfos, condensedFailureInformation);
+ setStreet(listSubordinatedFailureInfos, condensedFailureInformation);
+ setDistrict(listSubordinatedFailureInfos, condensedFailureInformation);
+ setRadius(listSubordinatedFailureInfos, condensedFailureInformation);
//TODO: welche Status sollen hier eingesetzt werden? Bislang wird "neu" gesetzt
RefStatus refStatusNew = statusRepository
- .findByStatus("neu")
- .orElseThrow(() -> new NotFoundException("status.not.existing"));
+ .findByStatus("neu")
+ .orElseThrow(() -> new NotFoundException("status.not.existing"));
- condensedFailureInformationToSave.setRefStatusIntern(refStatusNew);
- condensedFailureInformationToSave.setRefStatusExtern(refStatusNew);
- condensedFailureInformationToSave.setCondensed(true);
- condensedFailureInformationToSave.setCondensedCount(listFailureInfos.size());
+ condensedFailureInformation.setRefStatusIntern(refStatusNew);
+ condensedFailureInformation.setRefStatusExtern(refStatusNew);
+ condensedFailureInformation.setCondensed(true);
+ condensedFailureInformation.setCondensedCount(listSubordinatedFailureInfos.size());
- condensedFailureInformationSaved = failureInformationRepository.save(condensedFailureInformationToSave);
+ condensedFailureInformationSaved = failureInformationRepository.save(condensedFailureInformation);
//kennzeichne die Ursprungs-FailureInfos und speichere
- for( TblFailureInformation tblFailureInformation: listFailureInfos )
+ for( TblFailureInformation tblFailureInformation: listSubordinatedFailureInfos )
{
tblFailureInformation.setCondensed(false);
tblFailureInformation.setTblFailureInformationCondensed(condensedFailureInformationSaved);
@@ -313,6 +388,9 @@
if (listFailureInfos.size() == filteredList.size()) {
condensedFailureInformation.setStreet(firstStreet);
}
+ else{
+ condensedFailureInformation.setStreet(null);
+ }
}
private void setDistrict(List<TblFailureInformation> listFailureInfos, TblFailureInformation condensedFailureInformation){
@@ -328,6 +406,9 @@
if (listFailureInfos.size() == filteredList.size()) {
condensedFailureInformation.setDistrict(firstDistrict);
}
+ else{
+ condensedFailureInformation.setDistrict(null);
+ }
}
private void setCity(List<TblFailureInformation> listFailureInfos, TblFailureInformation condensedFailureInformation){
@@ -343,6 +424,9 @@
if (listFailureInfos.size() == filteredList.size()) {
condensedFailureInformation.setCity(firstCity);
}
+ else{
+ condensedFailureInformation.setCity(null);
+ }
}
private void setExpectedReason(List<TblFailureInformation> listFailureInfos, TblFailureInformation condensedFailureInformation){
@@ -358,6 +442,9 @@
if (listFailureInfos.size() == filteredList.size()) {
condensedFailureInformation.setRefExpectedReason(listFailureInfos.get(0).getRefExpectedReason());
}
+ else{
+ condensedFailureInformation.setRefExpectedReason(null);
+ }
}
private void setLatestEnddate(List<TblFailureInformation> listFailureInfos, TblFailureInformation condensedFailureInformation){
@@ -403,6 +490,9 @@
if (listFailureInfos.size() == filteredList.size()) {
condensedFailureInfo.setVoltageLevel(firstVoltageLevel);
}
+ else{
+ condensedFailureInfo.setVoltageLevel(null);
+ }
}
}
diff --git a/gfsBackendService/src/main/resources/db/migration/V0_13__CREATE_GFI_DB.sql b/gfsBackendService/src/main/resources/db/migration/V0_13__CREATE_GFI_DB.sql
index bebb124..aa04979 100644
--- a/gfsBackendService/src/main/resources/db/migration/V0_13__CREATE_GFI_DB.sql
+++ b/gfsBackendService/src/main/resources/db/migration/V0_13__CREATE_GFI_DB.sql
@@ -83,15 +83,13 @@
OWNER TO GFI_SERVICE;
GRANT ALL ON TABLE public.REF_STATUS TO GFI_SERVICE;
-INSERT INTO public.REF_STATUS (UUID, STATUS, IS_INTERNAL, IS_EXTERNAL) VALUES ( 'acabc8f6-2cf3-485a-a4f8-68d178c7df45', 'neu', TRUE, TRUE );
-INSERT INTO public.REF_STATUS (UUID, STATUS, IS_INTERNAL, IS_EXTERNAL) VALUES ( 'a6cda99d-9f41-4637-9d9b-04f95ea352ec', 'bestätigt', TRUE, TRUE );
-INSERT INTO public.REF_STATUS (UUID, STATUS, IS_INTERNAL, IS_EXTERNAL) VALUES ( '23fc0254-cc3d-4371-97ad-54ef733008ae', 'aktiv', TRUE, FALSE );
-INSERT INTO public.REF_STATUS (UUID, STATUS, IS_INTERNAL, IS_EXTERNAL) VALUES ( '9374219a-7419-4b72-899d-cd0576d85cdb', 'geschlossen', TRUE, TRUE );
-INSERT INTO public.REF_STATUS (UUID, STATUS, IS_INTERNAL, IS_EXTERNAL) VALUES ( '74a4ca78-7268-11ea-bc55-0242ac130003', 'storniert', TRUE, FALSE );
-INSERT INTO public.REF_STATUS (UUID, STATUS, IS_INTERNAL, IS_EXTERNAL) VALUES ( '95bc40ba-7268-11ea-bc55-0242ac130003', 'qualifiziert', TRUE, FALSE );
-INSERT INTO public.REF_STATUS (UUID, STATUS, IS_INTERNAL, IS_EXTERNAL) VALUES ( '0c2e5c36-733d-11ea-bc55-0242ac130003', 'angelegt', TRUE, FALSE );
-INSERT INTO public.REF_STATUS (UUID, STATUS, IS_INTERNAL, IS_EXTERNAL) VALUES ( '0c2e5f74-733d-11ea-bc55-0242ac130003', 'aktualisiert', TRUE, FALSE );
-INSERT INTO public.REF_STATUS (UUID, STATUS, IS_INTERNAL, IS_EXTERNAL) VALUES ( '0c2e606e-733d-11ea-bc55-0242ac130003', 'geplant', TRUE, FALSE );
+INSERT INTO public.REF_STATUS (ID, UUID, STATUS, IS_INTERNAL, IS_EXTERNAL) VALUES (1, 'acabc8f6-2cf3-485a-a4f8-68d178c7df45', 'neu', TRUE, FALSE );
+INSERT INTO public.REF_STATUS (ID, UUID, STATUS, IS_INTERNAL, IS_EXTERNAL) VALUES (2, 'f2e44dc5-d30c-4128-86bb-d3d5fc766b61', 'geplant', TRUE, TRUE );
+INSERT INTO public.REF_STATUS (ID, UUID, STATUS, IS_INTERNAL, IS_EXTERNAL) VALUES (3, '23fc0254-cc3d-4371-97ad-54ef733008ae', 'angelegt', TRUE, FALSE );
+INSERT INTO public.REF_STATUS (ID, UUID, STATUS, IS_INTERNAL, IS_EXTERNAL) VALUES (4, '74a4ca78-7268-11ea-bc55-0242ac130003', 'storniert', TRUE, FALSE );
+INSERT INTO public.REF_STATUS (ID, UUID, STATUS, IS_INTERNAL, IS_EXTERNAL) VALUES (5, '7264e572-eae9-4cca-be05-af6b0d081247', 'qualifiziert', TRUE, FALSE );
+INSERT INTO public.REF_STATUS (ID, UUID, STATUS, IS_INTERNAL, IS_EXTERNAL) VALUES (6, '9374219a-7419-4b72-899d-cd0576d85cdb', 'aktualisiert', TRUE, TRUE );
+INSERT INTO public.REF_STATUS (ID, UUID, STATUS, IS_INTERNAL, IS_EXTERNAL) VALUES (7, '8c333345-5c3c-41ed-9de4-323045f64259', 'abgeschlossen', TRUE, TRUE );
-- ---------------------------------------------
@@ -283,7 +281,6 @@
FAILURE_BEGIN timestamp NOT NULL,
FAILURE_END_PLANNED timestamp,
FAILURE_END_RESUPPLIED timestamp,
- PROBABLE_REASON character varying(1024),
INTERNAL_REMARK character varying(1024),
POSTCODE character varying(30),
CITY character varying(255),
@@ -313,11 +310,11 @@
OWNER TO GFI_SERVICE;
GRANT ALL ON TABLE public.TBL_FAILURE_INFORMATION TO GFI_SERVICE;
-INSERT INTO public.tbl_failure_information(UUID, VERSION_NUMBER, FK_REF_FAILURE_CLASSIFICATION, FK_REF_FAILURE_TYPE, TITLE, DESCRIPTION, RESPONSIBILITY, INTERN_EXTERN, FK_REF_STATUS_INTERN, FK_REF_STATUS_EXTERN, FK_REF_BRANCH, VOLTAGE_LEVEL, PRESSURE_LEVEL, FAILURE_BEGIN, FAILURE_END_PLANNED, FAILURE_END_RESUPPLIED, PROBABLE_REASON, INTERNAL_REMARK, POSTCODE, CITY, DISTRICT, STREET, HOUSENUMBER, STATION_ID, STATION_DESCRIPTION, STATION_COORDS, FK_REF_RADIUS, LONGITUDE, LATITUDE, OBJECT_REFERENCE_EXTERNAL_SYSTEM, PUBLICATION_STATUS, PUBLICATION_FREETEXT, FK_REF_EXPECTED_REASON, CONDENSED, FK_TBL_FAILURE_INFORMATION_CONDENSED, CREATE_DATE, CREATE_USER, MOD_DATE, MOD_USER)
-VALUES ('6432a9c9-0384-44af-9bb8-34f2878d7b49',3, 1, 1, 'Stromausfall Murr', 'Es gibt einen Stromausfall im Bereich Murr/Westbezirk', 'Rolf Rudis', 'I', 1, 1, 1, 'NS', null, '2021-01-19 00:00:00', '2021-01-22 00:00:00', '2021-01-22 12:00:00', 'Stromausfall durch Bagger', 'Der Bagger grub zu tief', '71711', 'Murr', 'Westbezirk', 'Ferdinand-Porsche-Straße', '2', '52863a', 'Trafo 1', '124,2323', 2, 9.247952, 48.955700, 'Link - extenes System', 'veröffentlicht', 'Freitext für die Veröffentlichung: Defekt an Trafostation', 1, false, null, '2020-01-22 15:32:15', 'schmidth', '2020-01-24 08:02:44', 'meyers');
+INSERT INTO public.tbl_failure_information(UUID, VERSION_NUMBER, FK_REF_FAILURE_CLASSIFICATION, FK_REF_FAILURE_TYPE, TITLE, DESCRIPTION, RESPONSIBILITY, INTERN_EXTERN, FK_REF_STATUS_INTERN, FK_REF_STATUS_EXTERN, FK_REF_BRANCH, VOLTAGE_LEVEL, PRESSURE_LEVEL, FAILURE_BEGIN, FAILURE_END_PLANNED, FAILURE_END_RESUPPLIED, INTERNAL_REMARK, POSTCODE, CITY, DISTRICT, STREET, HOUSENUMBER, STATION_ID, STATION_DESCRIPTION, STATION_COORDS, FK_REF_RADIUS, LONGITUDE, LATITUDE, OBJECT_REFERENCE_EXTERNAL_SYSTEM, PUBLICATION_STATUS, PUBLICATION_FREETEXT, FK_REF_EXPECTED_REASON, CONDENSED, FK_TBL_FAILURE_INFORMATION_CONDENSED, CREATE_DATE, CREATE_USER, MOD_DATE, MOD_USER)
+VALUES ('6432a9c9-0384-44af-9bb8-34f2878d7b49',3, 1, 1, 'Stromausfall Murr', 'Es gibt einen Stromausfall im Bereich Murr/Westbezirk', 'Rolf Rudis', 'I', 1, 1, 1, 'NS', null, '2021-01-19 00:00:00', '2021-01-22 00:00:00', '2021-01-22 12:00:00', 'Der Bagger grub zu tief', '71711', 'Murr', 'Westbezirk', 'Ferdinand-Porsche-Straße', '2', '52863a', 'Trafo 1', '124,2323', 2, 9.247952, 48.955700, 'Link - extenes System', 'veröffentlicht', 'Freitext für die Veröffentlichung: Defekt an Trafostation', 1, false, null, '2020-01-22 15:32:15', 'schmidth', '2020-01-24 08:02:44', 'meyers');
-INSERT INTO public.tbl_failure_information(UUID, VERSION_NUMBER, FK_REF_FAILURE_CLASSIFICATION, FK_REF_FAILURE_TYPE, TITLE, DESCRIPTION, RESPONSIBILITY, INTERN_EXTERN, FK_REF_STATUS_INTERN, FK_REF_STATUS_EXTERN, FK_REF_BRANCH, VOLTAGE_LEVEL, PRESSURE_LEVEL, FAILURE_BEGIN, FAILURE_END_PLANNED, FAILURE_END_RESUPPLIED, PROBABLE_REASON, INTERNAL_REMARK, POSTCODE, CITY, DISTRICT, STREET, HOUSENUMBER, STATION_ID, STATION_DESCRIPTION, STATION_COORDS, FK_REF_RADIUS, LONGITUDE, LATITUDE, OBJECT_REFERENCE_EXTERNAL_SYSTEM, PUBLICATION_STATUS, PUBLICATION_FREETEXT, FK_REF_EXPECTED_REASON, CONDENSED, FK_TBL_FAILURE_INFORMATION_CONDENSED, CREATE_DATE, CREATE_USER, MOD_DATE, MOD_USER)
-VALUES ('37aef635-d0d4-4c47-ac25-c0d16c29e35c', 1,2, 2, 'Gasleck Oldenburg', 'Es gibt ein Gasleck in Oldenburg', 'Bernd Britzel', 'E', 2, 2, 3, null, 'HD', '2021-05-19 00:00:00', '2021-05-22 00:00:00', '2021-05-22 12:00:00', 'Leck in Gasleitung', 'HD betroffen', '26133', 'Oldenburg', null, 'Cloppenburger Str.', '302', '1234863-b234', 'ertf', '124,2323', 4, 8.210150, 53.111820, 'Link - extenes System', 'nicht veröffentlicht', 'Freitext: Eine Gasleitung wurde beschädigt', 4, false, null, '2020-02-03 15:15:15', 'schulzek', '2020-02-24 20:08:41', 'muellert');
+INSERT INTO public.tbl_failure_information(UUID, VERSION_NUMBER, FK_REF_FAILURE_CLASSIFICATION, FK_REF_FAILURE_TYPE, TITLE, DESCRIPTION, RESPONSIBILITY, INTERN_EXTERN, FK_REF_STATUS_INTERN, FK_REF_STATUS_EXTERN, FK_REF_BRANCH, VOLTAGE_LEVEL, PRESSURE_LEVEL, FAILURE_BEGIN, FAILURE_END_PLANNED, FAILURE_END_RESUPPLIED, INTERNAL_REMARK, POSTCODE, CITY, DISTRICT, STREET, HOUSENUMBER, STATION_ID, STATION_DESCRIPTION, STATION_COORDS, FK_REF_RADIUS, LONGITUDE, LATITUDE, OBJECT_REFERENCE_EXTERNAL_SYSTEM, PUBLICATION_STATUS, PUBLICATION_FREETEXT, FK_REF_EXPECTED_REASON, CONDENSED, FK_TBL_FAILURE_INFORMATION_CONDENSED, CREATE_DATE, CREATE_USER, MOD_DATE, MOD_USER)
+VALUES ('37aef635-d0d4-4c47-ac25-c0d16c29e35c', 1,2, 2, 'Gasleck Oldenburg', 'Es gibt ein Gasleck in Oldenburg', 'Bernd Britzel', 'E', 2, 2, 3, null, 'HD', '2021-05-19 00:00:00', '2021-05-22 00:00:00', '2021-05-22 12:00:00', 'HD betroffen', '26133', 'Oldenburg', null, 'Cloppenburger Str.', '302', '1234863-b234', 'ertf', '124,2323', 4, 8.210150, 53.111820, 'Link - extenes System', 'nicht veröffentlicht', 'Freitext: Eine Gasleitung wurde beschädigt', 4, false, null, '2020-02-03 15:15:15', 'schulzek', '2020-02-24 20:08:41', 'muellert');
-- ---------------------------------------------
-- TABLE TBL_IMPORT_DATA
@@ -403,7 +400,6 @@
FAILURE_BEGIN timestamp without time zone,
FAILURE_END_PLANNED timestamp without time zone,
FAILURE_END_RESUPPLIED timestamp without time zone,
- PROBABLE_REASON character varying (1024),
INTERNAL_REMARK character varying (1024),
POSTCODE character varying (30),
CITY character varying (255),
@@ -436,17 +432,115 @@
OWNER TO gfi_service;
GRANT ALL ON TABLE PUBLIC.HTBL_FAILURE_INFORMATION TO gfi_service;
-INSERT INTO public.htbl_failure_information(HACTION, HDATE, HUSER, ID, UUID, VERSION_NUMBER, FK_REF_FAILURE_CLASSIFICATION, FK_REF_FAILURE_TYPE, TITLE, DESCRIPTION, RESPONSIBILITY, INTERN_EXTERN, FK_REF_STATUS_INTERN, FK_REF_STATUS_EXTERN, FK_REF_BRANCH, VOLTAGE_LEVEL, PRESSURE_LEVEL, FAILURE_BEGIN, FAILURE_END_PLANNED, FAILURE_END_RESUPPLIED, PROBABLE_REASON, INTERNAL_REMARK, POSTCODE, CITY, DISTRICT, STREET, HOUSENUMBER, STATION_ID, STATION_DESCRIPTION, STATION_COORDS, FK_REF_RADIUS, LONGITUDE, LATITUDE, OBJECT_REFERENCE_EXTERNAL_SYSTEM, PUBLICATION_STATUS, PUBLICATION_FREETEXT, FK_REF_EXPECTED_REASON, FK_TBL_FAILURE_INFORMATION_CONDENSED, CONDENSED, CREATE_DATE, CREATE_USER, MOD_DATE, MOD_USER)
-VALUES (1, '2020-03-13 00:00:00', 'SCRIPT', 1, '6432a9c9-0384-44af-9bb8-34f2878d7b49', 1, 1, 1, 'Stromausfall Murr', 'Es gibt einen Stromausfall im Bereich Murr/Westbezirk', 'Rolf Rudis', 'I', 1, 1, 1, 'NS', null, '2021-01-19 00:00:00', '2021-01-22 00:00:00', '2021-01-22 12:00:00', 'Stromausfall durch Bagger', 'Der Bagger grub zu tief', '71711', 'Murr', 'Westbezirk', 'Ferdinand-Porsche-Straße', '2', '52863a', 'Trafo 1', '124,2323', 2, 9.247952, 48.955700, 'Link - extenes System', 'veröffentlicht', 'Freitext für die Veröffentlichung: Defekt an Trafostation', 1, null, false, '2020-01-22 15:32:15', 'schmidth', '2020-01-24 08:02:44', 'meyers');
+INSERT INTO public.htbl_failure_information(HACTION, HDATE, HUSER, ID, UUID, VERSION_NUMBER, FK_REF_FAILURE_CLASSIFICATION, FK_REF_FAILURE_TYPE, TITLE, DESCRIPTION, RESPONSIBILITY, INTERN_EXTERN, FK_REF_STATUS_INTERN, FK_REF_STATUS_EXTERN, FK_REF_BRANCH, VOLTAGE_LEVEL, PRESSURE_LEVEL, FAILURE_BEGIN, FAILURE_END_PLANNED, FAILURE_END_RESUPPLIED, INTERNAL_REMARK, POSTCODE, CITY, DISTRICT, STREET, HOUSENUMBER, STATION_ID, STATION_DESCRIPTION, STATION_COORDS, FK_REF_RADIUS, LONGITUDE, LATITUDE, OBJECT_REFERENCE_EXTERNAL_SYSTEM, PUBLICATION_STATUS, PUBLICATION_FREETEXT, FK_REF_EXPECTED_REASON, FK_TBL_FAILURE_INFORMATION_CONDENSED, CONDENSED, CREATE_DATE, CREATE_USER, MOD_DATE, MOD_USER)
+VALUES (1, '2020-03-13 00:00:00', 'SCRIPT', 1, '6432a9c9-0384-44af-9bb8-34f2878d7b49', 1, 1, 1, 'Stromausfall Murr', 'Es gibt einen Stromausfall im Bereich Murr/Westbezirk', 'Rolf Rudis', 'I', 1, 1, 1, 'NS', null, '2021-01-19 00:00:00', '2021-01-22 00:00:00', '2021-01-22 12:00:00', 'Der Bagger grub zu tief', '71711', 'Murr', 'Westbezirk', 'Ferdinand-Porsche-Straße', '2', '52863a', 'Trafo 1', '124,2323', 2, 9.247952, 48.955700, 'Link - extenes System', 'veröffentlicht', 'Freitext für die Veröffentlichung: Defekt an Trafostation', 1, null, false, '2020-01-22 15:32:15', 'schmidth', '2020-01-24 08:02:44', 'meyers');
-INSERT INTO public.htbl_failure_information(HACTION, HDATE, HUSER, ID, UUID, VERSION_NUMBER, FK_REF_FAILURE_CLASSIFICATION, FK_REF_FAILURE_TYPE, TITLE, DESCRIPTION, RESPONSIBILITY, INTERN_EXTERN, FK_REF_STATUS_INTERN, FK_REF_STATUS_EXTERN, FK_REF_BRANCH, VOLTAGE_LEVEL, PRESSURE_LEVEL, FAILURE_BEGIN, FAILURE_END_PLANNED, FAILURE_END_RESUPPLIED, PROBABLE_REASON, INTERNAL_REMARK, POSTCODE, CITY, DISTRICT, STREET, HOUSENUMBER, STATION_ID, STATION_DESCRIPTION, STATION_COORDS, FK_REF_RADIUS, LONGITUDE, LATITUDE, OBJECT_REFERENCE_EXTERNAL_SYSTEM, PUBLICATION_STATUS, PUBLICATION_FREETEXT, FK_REF_EXPECTED_REASON, FK_TBL_FAILURE_INFORMATION_CONDENSED, CONDENSED, CREATE_DATE, CREATE_USER, MOD_DATE, MOD_USER)
-VALUES (2, '2020-03-13 00:00:00', 'SCRIPT', 1, '6432a9c9-0384-44af-9bb8-34f2878d7b49', 2, 1, 1, 'Stromausfall Murr', 'Es gibt einen Stromausfall im Bereich Murr/Westbezirk', 'Rolf Rudis', 'I', 1, 1, 1, 'NS', null, '2021-01-19 00:00:00', '2021-01-22 00:00:00', '2021-01-22 12:00:00', 'Stromausfall durch Bagger', 'Der Bagger grub tiefer', '71711', 'Murr', 'Westbezirk', 'Ferdinand-Porsche-Straße', '2', '52863a', 'Trafo 1', '124,2323', 2, 9.247952, 48.955700, 'Link - extenes System', 'veröffentlicht', 'Freitext für die Veröffentlichung: Defekt an Trafostation', 1, null, false, '2020-01-22 15:32:15', 'schmidth', '2020-01-24 08:02:44', 'meyers');
+INSERT INTO public.htbl_failure_information(HACTION, HDATE, HUSER, ID, UUID, VERSION_NUMBER, FK_REF_FAILURE_CLASSIFICATION, FK_REF_FAILURE_TYPE, TITLE, DESCRIPTION, RESPONSIBILITY, INTERN_EXTERN, FK_REF_STATUS_INTERN, FK_REF_STATUS_EXTERN, FK_REF_BRANCH, VOLTAGE_LEVEL, PRESSURE_LEVEL, FAILURE_BEGIN, FAILURE_END_PLANNED, FAILURE_END_RESUPPLIED, INTERNAL_REMARK, POSTCODE, CITY, DISTRICT, STREET, HOUSENUMBER, STATION_ID, STATION_DESCRIPTION, STATION_COORDS, FK_REF_RADIUS, LONGITUDE, LATITUDE, OBJECT_REFERENCE_EXTERNAL_SYSTEM, PUBLICATION_STATUS, PUBLICATION_FREETEXT, FK_REF_EXPECTED_REASON, FK_TBL_FAILURE_INFORMATION_CONDENSED, CONDENSED, CREATE_DATE, CREATE_USER, MOD_DATE, MOD_USER)
+VALUES (2, '2020-03-13 00:00:00', 'SCRIPT', 1, '6432a9c9-0384-44af-9bb8-34f2878d7b49', 2, 1, 1, 'Stromausfall Murr', 'Es gibt einen Stromausfall im Bereich Murr/Westbezirk', 'Rolf Rudis', 'I', 1, 1, 1, 'NS', null, '2021-01-19 00:00:00', '2021-01-22 00:00:00', '2021-01-22 12:00:00', 'Der Bagger grub tiefer', '71711', 'Murr', 'Westbezirk', 'Ferdinand-Porsche-Straße', '2', '52863a', 'Trafo 1', '124,2323', 2, 9.247952, 48.955700, 'Link - extenes System', 'veröffentlicht', 'Freitext für die Veröffentlichung: Defekt an Trafostation', 1, null, false, '2020-01-22 15:32:15', 'schmidth', '2020-01-24 08:02:44', 'meyers');
-INSERT INTO public.htbl_failure_information(HACTION, HDATE, HUSER, ID, UUID, VERSION_NUMBER, FK_REF_FAILURE_CLASSIFICATION, FK_REF_FAILURE_TYPE, TITLE, DESCRIPTION, RESPONSIBILITY, INTERN_EXTERN, FK_REF_STATUS_INTERN, FK_REF_STATUS_EXTERN, FK_REF_BRANCH, VOLTAGE_LEVEL, PRESSURE_LEVEL, FAILURE_BEGIN, FAILURE_END_PLANNED, FAILURE_END_RESUPPLIED, PROBABLE_REASON, INTERNAL_REMARK, POSTCODE, CITY, DISTRICT, STREET, HOUSENUMBER, STATION_ID, STATION_DESCRIPTION, STATION_COORDS, FK_REF_RADIUS, LONGITUDE, LATITUDE, OBJECT_REFERENCE_EXTERNAL_SYSTEM, PUBLICATION_STATUS, PUBLICATION_FREETEXT, FK_REF_EXPECTED_REASON, FK_TBL_FAILURE_INFORMATION_CONDENSED, CONDENSED, CREATE_DATE, CREATE_USER, MOD_DATE, MOD_USER)
-VALUES (1, '2020-03-13 00:00:00', 'SCRIPT', 1, '6432a9c9-0384-44af-9bb8-34f2878d7b49', 3, 1, 1, 'Stromausfall Murr', 'Es gibt einen Stromausfall im Bereich Murr/Westbezirk', 'Rolf Rudis', 'I', 1, 1, 1, 'NS', null, '2021-01-19 00:00:00', '2021-01-22 00:00:00', '2021-01-22 12:00:00', 'Stromausfall durch Bagger', 'Der Bagger grub noch tiefer', '71711', 'Murr', 'Westbezirk', 'Ferdinand-Porsche-Straße', '52863a', '2', 'Trafo 1', '124,2323', 2, 9.247952, 48.955700, 'Link - extenes System', 'veröffentlicht', 'Freitext für die Veröffentlichung: Defekt an Trafostation', 1, null, false, '2020-01-22 15:32:15', 'schmidth', '2020-01-24 08:02:44', 'meyers');
+INSERT INTO public.htbl_failure_information(HACTION, HDATE, HUSER, ID, UUID, VERSION_NUMBER, FK_REF_FAILURE_CLASSIFICATION, FK_REF_FAILURE_TYPE, TITLE, DESCRIPTION, RESPONSIBILITY, INTERN_EXTERN, FK_REF_STATUS_INTERN, FK_REF_STATUS_EXTERN, FK_REF_BRANCH, VOLTAGE_LEVEL, PRESSURE_LEVEL, FAILURE_BEGIN, FAILURE_END_PLANNED, FAILURE_END_RESUPPLIED, INTERNAL_REMARK, POSTCODE, CITY, DISTRICT, STREET, HOUSENUMBER, STATION_ID, STATION_DESCRIPTION, STATION_COORDS, FK_REF_RADIUS, LONGITUDE, LATITUDE, OBJECT_REFERENCE_EXTERNAL_SYSTEM, PUBLICATION_STATUS, PUBLICATION_FREETEXT, FK_REF_EXPECTED_REASON, FK_TBL_FAILURE_INFORMATION_CONDENSED, CONDENSED, CREATE_DATE, CREATE_USER, MOD_DATE, MOD_USER)
+VALUES (1, '2020-03-13 00:00:00', 'SCRIPT', 1, '6432a9c9-0384-44af-9bb8-34f2878d7b49', 3, 1, 1, 'Stromausfall Murr', 'Es gibt einen Stromausfall im Bereich Murr/Westbezirk', 'Rolf Rudis', 'I', 1, 1, 1, 'NS', null, '2021-01-19 00:00:00', '2021-01-22 00:00:00', '2021-01-22 12:00:00', 'Der Bagger grub noch tiefer', '71711', 'Murr', 'Westbezirk', 'Ferdinand-Porsche-Straße', '52863a', '2', 'Trafo 1', '124,2323', 2, 9.247952, 48.955700, 'Link - extenes System', 'veröffentlicht', 'Freitext für die Veröffentlichung: Defekt an Trafostation', 1, null, false, '2020-01-22 15:32:15', 'schmidth', '2020-01-24 08:02:44', 'meyers');
-INSERT INTO public.htbl_failure_information(HACTION, HDATE, HUSER, ID, UUID, VERSION_NUMBER, FK_REF_FAILURE_CLASSIFICATION, FK_REF_FAILURE_TYPE, TITLE, DESCRIPTION, RESPONSIBILITY, INTERN_EXTERN, FK_REF_STATUS_INTERN, FK_REF_STATUS_EXTERN, FK_REF_BRANCH, VOLTAGE_LEVEL, PRESSURE_LEVEL, FAILURE_BEGIN, FAILURE_END_PLANNED, FAILURE_END_RESUPPLIED, PROBABLE_REASON, INTERNAL_REMARK, POSTCODE, CITY, DISTRICT, STREET, HOUSENUMBER, STATION_ID, STATION_DESCRIPTION, STATION_COORDS, FK_REF_RADIUS, LONGITUDE, LATITUDE, OBJECT_REFERENCE_EXTERNAL_SYSTEM, PUBLICATION_STATUS, PUBLICATION_FREETEXT, FK_REF_EXPECTED_REASON, FK_TBL_FAILURE_INFORMATION_CONDENSED, CONDENSED, CREATE_DATE, CREATE_USER, MOD_DATE, MOD_USER)
-VALUES (2, '2020-03-13 00:00:00', 'SCRIPT', 2, '37aef635-d0d4-4c47-ac25-c0d16c29e35c', 1,2, 2, 'Gasleck Oldenburg', 'Es gibt ein Gasleck in Oldenburg', 'Bernd Britzel', 'E', 2, 2, 3, null, 'HD', '2021-05-19 00:00:00', '2021-05-22 00:00:00', '2021-05-22 12:00:00', 'Leck in Gasleitung', 'HD betroffen', '26133', 'Oldenburg', null, 'Cloppenburger Str.', '302', '1234863-b234', 'ertf', '124,2323', 4, 8.210150, 53.111820, 'Link - extenes System', 'nicht veröffentlicht', 'Freitext: Eine Gasleitung wurde beschädigt', 4, null, false, '2020-02-03 15:15:15', 'schulzek', '2020-02-24 20:08:41', 'muellert');
+INSERT INTO public.htbl_failure_information(HACTION, HDATE, HUSER, ID, UUID, VERSION_NUMBER, FK_REF_FAILURE_CLASSIFICATION, FK_REF_FAILURE_TYPE, TITLE, DESCRIPTION, RESPONSIBILITY, INTERN_EXTERN, FK_REF_STATUS_INTERN, FK_REF_STATUS_EXTERN, FK_REF_BRANCH, VOLTAGE_LEVEL, PRESSURE_LEVEL, FAILURE_BEGIN, FAILURE_END_PLANNED, FAILURE_END_RESUPPLIED, INTERNAL_REMARK, POSTCODE, CITY, DISTRICT, STREET, HOUSENUMBER, STATION_ID, STATION_DESCRIPTION, STATION_COORDS, FK_REF_RADIUS, LONGITUDE, LATITUDE, OBJECT_REFERENCE_EXTERNAL_SYSTEM, PUBLICATION_STATUS, PUBLICATION_FREETEXT, FK_REF_EXPECTED_REASON, FK_TBL_FAILURE_INFORMATION_CONDENSED, CONDENSED, CREATE_DATE, CREATE_USER, MOD_DATE, MOD_USER)
+VALUES (2, '2020-03-13 00:00:00', 'SCRIPT', 2, '37aef635-d0d4-4c47-ac25-c0d16c29e35c', 1,3, 2, 'Gasleck Oldenburg', 'Es gibt ein Gasleck in Oldenburg', 'Bernd Britzel', 'E', 2, 2, 3, null, 'HD', '2021-05-19 00:00:00', '2021-05-22 00:00:00', '2021-05-22 12:00:00', 'HD betroffen', '26133', 'Oldenburg', null, 'Cloppenburger Str.', '302', '1234863-b234', 'ertf', '124,2323', 4, 8.210150, 53.111820, 'Link - extenes System', 'nicht veröffentlicht', 'Freitext: Eine Gasleitung wurde beschädigt', 4, null, false, '2020-02-03 15:15:15', 'schulzek', '2020-02-24 20:08:41', 'muellert');
+
+
+
+-- ----------------------------------------------------------------------------
+-- ----------------------------------------------------------------------------
+-- Tables ADDRESSIMPORT
+-- ----------------------------------------------------------------------------
+-- ----------------------------------------------------------------------------
+
+DROP TABLE IF EXISTS public.TBL_ADDRESS CASCADE;
+DROP SEQUENCE IF EXISTS public.TBL_ADDRESS_ID_SEQ;
+
+-- ---------------------------------------------
+-- TABLE TBL_ADDRESS
+-- ---------------------------------------------
+CREATE SEQUENCE public.TBL_ADDRESS_ID_SEQ
+ INCREMENT 1
+ MINVALUE 1
+ MAXVALUE 9223372036854775807
+ START 1
+ CACHE 1;
+ALTER TABLE public.TBL_ADDRESS_ID_SEQ
+ OWNER TO GFI_SERVICE;
+
+CREATE TABLE public.TBL_ADDRESS
+(
+ ID integer NOT NULL DEFAULT nextval('TBL_ADDRESS_ID_SEQ'::regclass),
+ UUID uuid NOT NULL,
+ SDOX1 numeric(9,2) NOT NULL,
+ SDOY1 numeric(10,2) NOT NULL,
+ G3EFID numeric,
+ POSTCODE character varying(30),
+ COMMUNITY character varying(255),
+ DISTRICT character varying(255),
+ STREET character varying(255),
+ HOUSENUMBER character varying(30),
+ WATER_CONNECTION boolean,
+ WATER_GROUP character varying(255),
+ GAS_CONNECTION boolean,
+ GAS_GROUP character varying(255),
+ POWER_CONNECTION boolean,
+ STATION_ID character varying(30),
+ LONGITUDE numeric(9,6),
+ LATITUDE numeric(9,6),
+ CONSTRAINT TBL_ADDRESS_PKEY PRIMARY KEY (id)
+);
+
+ALTER TABLE public.TBL_ADDRESS
+ OWNER TO GFI_SERVICE;
+GRANT ALL ON TABLE public.TBL_ADDRESS TO GFI_SERVICE;
+
+CREATE INDEX idx_tbl_address_g3efid ON public.TBL_ADDRESS ( G3EFID );
+CREATE INDEX idx_tbl_address_postcode ON public.TBL_ADDRESS ( POSTCODE );
+CREATE INDEX idx_tbl_address_community ON public.TBL_ADDRESS ( COMMUNITY );
+CREATE INDEX idx_tbl_address_district ON public.TBL_ADDRESS ( DISTRICT );
+CREATE INDEX idx_tbl_address_street ON public.TBL_ADDRESS ( STREET );
+
+
+-- ---------------------------------------------
+-- TABLE TBL_STATION
+-- ---------------------------------------------
+
+DROP TABLE IF EXISTS public.TBL_STATION CASCADE;
+DROP SEQUENCE IF EXISTS public.TBL_STATION_ID_SEQ;
+
+CREATE SEQUENCE public.TBL_STATION_ID_SEQ
+ INCREMENT 1
+ MINVALUE 1
+ MAXVALUE 9223372036854775807
+ START 1
+ CACHE 1;
+ALTER TABLE public.TBL_STATION_ID_SEQ
+ OWNER TO GFI_SERVICE;
+
+CREATE TABLE public.TBL_STATION
+(
+ ID integer NOT NULL DEFAULT nextval('TBL_STATION_ID_SEQ'::regclass),
+ UUID uuid NOT NULL,
+ SDOX1 numeric(9,2) NOT NULL,
+ SDOY1 numeric(10,2) NOT NULL,
+ G3EFID numeric,
+ STATION_ID character varying(30),
+ STATION_NAME character varying(255),
+ LONGITUDE numeric(9,6),
+ LATITUDE numeric(9,6),
+ CONSTRAINT TBL_STATION_PKEY PRIMARY KEY (id)
+);
+
+ALTER TABLE public.TBL_STATION
+ OWNER TO GFI_SERVICE;
+GRANT ALL ON TABLE public.TBL_STATION TO GFI_SERVICE;
+
+CREATE INDEX idx_tbl_station_g3efid ON public.TBL_STATION ( G3EFID );
+CREATE INDEX idx_tbl_station_postcode ON public.TBL_ADDRESS ( POSTCODE );
+CREATE INDEX idx_tbl_station_community ON public.TBL_ADDRESS ( COMMUNITY );
+CREATE INDEX idx_tbl_station_district ON public.TBL_ADDRESS ( DISTRICT );
+CREATE INDEX idx_tbl_station_street ON public.TBL_ADDRESS ( STREET );
+
-- ----------------------------------------------------------------------------
-- ----------------------------------------------------------------------------
@@ -462,7 +556,7 @@
$BODY$
BEGIN
INSERT INTO HTBL_FAILURE_INFORMATION (
- ID,UUID,VERSION_NUMBER,FK_REF_FAILURE_CLASSIFICATION,FK_REF_FAILURE_TYPE,TITLE, DESCRIPTION,RESPONSIBILITY,INTERN_EXTERN,FK_REF_STATUS_INTERN,FK_REF_STATUS_EXTERN,FK_REF_BRANCH,VOLTAGE_LEVEL,PRESSURE_LEVEL,FAILURE_BEGIN,FAILURE_END_PLANNED,FAILURE_END_RESUPPLIED,PROBABLE_REASON,INTERNAL_REMARK,POSTCODE,CITY,DISTRICT,STREET,HOUSENUMBER,STATION_ID,STATION_DESCRIPTION,STATION_COORDS,FK_REF_RADIUS,LONGITUDE,LATITUDE,OBJECT_REFERENCE_EXTERNAL_SYSTEM,PUBLICATION_STATUS,PUBLICATION_FREETEXT,FK_REF_EXPECTED_REASON,CREATE_DATE,CREATE_USER,MOD_DATE,MOD_USER,
+ ID,UUID,VERSION_NUMBER,FK_REF_FAILURE_CLASSIFICATION,FK_REF_FAILURE_TYPE,TITLE, DESCRIPTION,RESPONSIBILITY,INTERN_EXTERN,FK_REF_STATUS_INTERN,FK_REF_STATUS_EXTERN,FK_REF_BRANCH,VOLTAGE_LEVEL,PRESSURE_LEVEL,FAILURE_BEGIN,FAILURE_END_PLANNED,FAILURE_END_RESUPPLIED,INTERNAL_REMARK,POSTCODE,CITY,DISTRICT,STREET,HOUSENUMBER,STATION_ID,STATION_DESCRIPTION,STATION_COORDS,FK_REF_RADIUS,LONGITUDE,LATITUDE,OBJECT_REFERENCE_EXTERNAL_SYSTEM,PUBLICATION_STATUS,PUBLICATION_FREETEXT,FK_REF_EXPECTED_REASON,FK_TBL_FAILURE_INFORMATION_CONDENSED, CONDENSED,CREATE_DATE,CREATE_USER,MOD_DATE,MOD_USER,
HACTION,
HDATE,
@@ -470,7 +564,7 @@
)
VALUES (
- NEW.ID,NEW.UUID,NEW.VERSION_NUMBER,NEW.FK_REF_FAILURE_CLASSIFICATION,NEW.FK_REF_FAILURE_TYPE,NEW.TITLE,NEW.DESCRIPTION,NEW.RESPONSIBILITY,NEW.INTERN_EXTERN,NEW.FK_REF_STATUS_INTERN,NEW.FK_REF_STATUS_EXTERN,NEW.FK_REF_BRANCH,NEW.VOLTAGE_LEVEL,NEW.PRESSURE_LEVEL,NEW.FAILURE_BEGIN,NEW.FAILURE_END_PLANNED,NEW.FAILURE_END_RESUPPLIED,NEW.PROBABLE_REASON,NEW.INTERNAL_REMARK,NEW.POSTCODE,NEW.CITY,NEW.DISTRICT,NEW.STREET,NEW.HOUSENUMBER,NEW.STATION_ID,NEW.STATION_DESCRIPTION,NEW.STATION_COORDS,NEW.FK_REF_RADIUS,NEW.LONGITUDE,NEW.LATITUDE,NEW.OBJECT_REFERENCE_EXTERNAL_SYSTEM,NEW.PUBLICATION_STATUS,NEW.PUBLICATION_FREETEXT,NEW.FK_REF_EXPECTED_REASON,NEW.CREATE_DATE,NEW.CREATE_USER,NEW.MOD_DATE,NEW.MOD_USER,
+ NEW.ID,NEW.UUID,NEW.VERSION_NUMBER,NEW.FK_REF_FAILURE_CLASSIFICATION,NEW.FK_REF_FAILURE_TYPE,NEW.TITLE,NEW.DESCRIPTION,NEW.RESPONSIBILITY,NEW.INTERN_EXTERN,NEW.FK_REF_STATUS_INTERN,NEW.FK_REF_STATUS_EXTERN,NEW.FK_REF_BRANCH,NEW.VOLTAGE_LEVEL,NEW.PRESSURE_LEVEL,NEW.FAILURE_BEGIN,NEW.FAILURE_END_PLANNED,NEW.FAILURE_END_RESUPPLIED,NEW.INTERNAL_REMARK,NEW.POSTCODE,NEW.CITY,NEW.DISTRICT,NEW.STREET,NEW.HOUSENUMBER,NEW.STATION_ID,NEW.STATION_DESCRIPTION,NEW.STATION_COORDS,NEW.FK_REF_RADIUS,NEW.LONGITUDE,NEW.LATITUDE,NEW.OBJECT_REFERENCE_EXTERNAL_SYSTEM,NEW.PUBLICATION_STATUS,NEW.PUBLICATION_FREETEXT,NEW.FK_REF_EXPECTED_REASON,NEW.FK_TBL_FAILURE_INFORMATION_CONDENSED, NEW.CONDENSED,NEW.CREATE_DATE,NEW.CREATE_USER,NEW.MOD_DATE,NEW.MOD_USER,
1,
current_timestamp,
@@ -503,14 +597,14 @@
$BODY$
BEGIN
INSERT INTO HTBL_FAILURE_INFORMATION (
- ID,UUID,VERSION_NUMBER,FK_REF_FAILURE_CLASSIFICATION,FK_REF_FAILURE_TYPE,RESPONSIBILITY,INTERN_EXTERN,FK_REF_STATUS_INTERN,FK_REF_STATUS_EXTERN,FK_REF_BRANCH,VOLTAGE_LEVEL,PRESSURE_LEVEL,FAILURE_BEGIN,FAILURE_END_PLANNED,FAILURE_END_RESUPPLIED,PROBABLE_REASON,INTERNAL_REMARK,POSTCODE,CITY,DISTRICT,STREET,HOUSENUMBER,STATION_ID,STATION_DESCRIPTION,STATION_COORDS,FK_REF_RADIUS,LONGITUDE,LATITUDE,OBJECT_REFERENCE_EXTERNAL_SYSTEM,PUBLICATION_STATUS,PUBLICATION_FREETEXT,FK_REF_EXPECTED_REASON,CREATE_DATE,CREATE_USER,MOD_DATE,MOD_USER,
+ ID,UUID,VERSION_NUMBER,FK_REF_FAILURE_CLASSIFICATION,FK_REF_FAILURE_TYPE,RESPONSIBILITY,INTERN_EXTERN,FK_REF_STATUS_INTERN,FK_REF_STATUS_EXTERN,FK_REF_BRANCH,VOLTAGE_LEVEL,PRESSURE_LEVEL,FAILURE_BEGIN,FAILURE_END_PLANNED,FAILURE_END_RESUPPLIED,INTERNAL_REMARK,POSTCODE,CITY,DISTRICT,STREET,HOUSENUMBER,STATION_ID,STATION_DESCRIPTION,STATION_COORDS,FK_REF_RADIUS,LONGITUDE,LATITUDE,OBJECT_REFERENCE_EXTERNAL_SYSTEM,PUBLICATION_STATUS,PUBLICATION_FREETEXT,FK_REF_EXPECTED_REASON,FK_TBL_FAILURE_INFORMATION_CONDENSED, CONDENSED,CREATE_DATE,CREATE_USER,MOD_DATE,MOD_USER,
HACTION,
HDATE,
HUSER
)
VALUES (
- NEW.ID,NEW.UUID,NEW.VERSION_NUMBER,NEW.FK_REF_FAILURE_CLASSIFICATION,NEW.FK_REF_FAILURE_TYPE,NEW.RESPONSIBILITY,NEW.INTERN_EXTERN,NEW.FK_REF_STATUS_INTERN,NEW.FK_REF_STATUS_EXTERN,NEW.FK_REF_BRANCH,NEW.VOLTAGE_LEVEL,NEW.PRESSURE_LEVEL,NEW.FAILURE_BEGIN,NEW.FAILURE_END_PLANNED,NEW.FAILURE_END_RESUPPLIED,NEW.PROBABLE_REASON,NEW.INTERNAL_REMARK,NEW.POSTCODE,NEW.CITY,NEW.DISTRICT,NEW.STREET,NEW.HOUSENUMBER,NEW.STATION_ID,NEW.STATION_DESCRIPTION,NEW.STATION_COORDS,NEW.FK_REF_RADIUS,NEW.LONGITUDE,NEW.LATITUDE,NEW.OBJECT_REFERENCE_EXTERNAL_SYSTEM,NEW.PUBLICATION_STATUS,NEW.PUBLICATION_FREETEXT,NEW.FK_REF_EXPECTED_REASON,NEW.CREATE_DATE,NEW.CREATE_USER,NEW.MOD_DATE,NEW.MOD_USER,
+ NEW.ID,NEW.UUID,NEW.VERSION_NUMBER,NEW.FK_REF_FAILURE_CLASSIFICATION,NEW.FK_REF_FAILURE_TYPE,NEW.RESPONSIBILITY,NEW.INTERN_EXTERN,NEW.FK_REF_STATUS_INTERN,NEW.FK_REF_STATUS_EXTERN,NEW.FK_REF_BRANCH,NEW.VOLTAGE_LEVEL,NEW.PRESSURE_LEVEL,NEW.FAILURE_BEGIN,NEW.FAILURE_END_PLANNED,NEW.FAILURE_END_RESUPPLIED,NEW.INTERNAL_REMARK,NEW.POSTCODE,NEW.CITY,NEW.DISTRICT,NEW.STREET,NEW.HOUSENUMBER,NEW.STATION_ID,NEW.STATION_DESCRIPTION,NEW.STATION_COORDS,NEW.FK_REF_RADIUS,NEW.LONGITUDE,NEW.LATITUDE,NEW.OBJECT_REFERENCE_EXTERNAL_SYSTEM,NEW.PUBLICATION_STATUS,NEW.PUBLICATION_FREETEXT,NEW.FK_REF_EXPECTED_REASON,NEW.FK_TBL_FAILURE_INFORMATION_CONDENSED, NEW.CONDENSED,NEW.CREATE_DATE,NEW.CREATE_USER,NEW.MOD_DATE,NEW.MOD_USER,
2,
current_timestamp,
NEW.MOD_USER
@@ -544,14 +638,14 @@
IF TG_OP = 'DELETE' THEN
INSERT INTO HTBL_FAILURE_INFORMATION (
- ID,UUID,VERSION_NUMBER,FK_REF_FAILURE_CLASSIFICATION,FK_REF_FAILURE_TYPE,RESPONSIBILITY,INTERN_EXTERN,FK_REF_STATUS_INTERN,FK_REF_STATUS_EXTERN,FK_REF_BRANCH,VOLTAGE_LEVEL,PRESSURE_LEVEL,FAILURE_BEGIN,FAILURE_END_PLANNED,FAILURE_END_RESUPPLIED,PROBABLE_REASON,INTERNAL_REMARK,POSTCODE,CITY,DISTRICT,STREET,HOUSENUMBER,STATION_ID,STATION_DESCRIPTION,STATION_COORDS,FK_REF_RADIUS,LONGITUDE,LATITUDE,OBJECT_REFERENCE_EXTERNAL_SYSTEM,PUBLICATION_STATUS,PUBLICATION_FREETEXT,FK_REF_EXPECTED_REASON,CREATE_DATE,CREATE_USER,MOD_DATE,MOD_USER,
+ ID,UUID,VERSION_NUMBER,FK_REF_FAILURE_CLASSIFICATION,FK_REF_FAILURE_TYPE,RESPONSIBILITY,INTERN_EXTERN,FK_REF_STATUS_INTERN,FK_REF_STATUS_EXTERN,FK_REF_BRANCH,VOLTAGE_LEVEL,PRESSURE_LEVEL,FAILURE_BEGIN,FAILURE_END_PLANNED,FAILURE_END_RESUPPLIED,INTERNAL_REMARK,POSTCODE,CITY,DISTRICT,STREET,HOUSENUMBER,STATION_ID,STATION_DESCRIPTION,STATION_COORDS,FK_REF_RADIUS,LONGITUDE,LATITUDE,OBJECT_REFERENCE_EXTERNAL_SYSTEM,PUBLICATION_STATUS,PUBLICATION_FREETEXT,FK_REF_EXPECTED_REASON,FK_TBL_FAILURE_INFORMATION_CONDENSED, CONDENSED,CREATE_DATE,CREATE_USER,MOD_DATE,MOD_USER,
HACTION,
HDATE,
HUSER
)
VALUES (
- OLD.ID,OLD.UUID,OLD.VERSION_NUMBER,OLD.FK_REF_FAILURE_CLASSIFICATION,OLD.FK_REF_FAILURE_TYPE,OLD.RESPONSIBILITY,OLD.INTERN_EXTERN,OLD.FK_REF_STATUS_INTERN,OLD.FK_REF_STATUS_EXTERN,OLD.FK_REF_BRANCH,OLD.VOLTAGE_LEVEL,OLD.PRESSURE_LEVEL,OLD.FAILURE_BEGIN,OLD.FAILURE_END_PLANNED,OLD.FAILURE_END_RESUPPLIED,OLD.PROBABLE_REASON,OLD.INTERNAL_REMARK,OLD.POSTCODE,OLD.CITY,OLD.DISTRICT,OLD.STREET,OLD.HOUSENUMBER,OLD.STATION_ID,OLD.STATION_DESCRIPTION,OLD.STATION_COORDS,OLD.FK_REF_RADIUS,OLD.LONGITUDE,OLD.LATITUDE,OLD.OBJECT_REFERENCE_EXTERNAL_SYSTEM,OLD.PUBLICATION_STATUS,OLD.PUBLICATION_FREETEXT,OLD.FK_REF_EXPECTED_REASON,OLD.CREATE_DATE,OLD.CREATE_USER,OLD.MOD_DATE,OLD.MOD_USER,
+ OLD.ID,OLD.UUID,OLD.VERSION_NUMBER,OLD.FK_REF_FAILURE_CLASSIFICATION,OLD.FK_REF_FAILURE_TYPE,OLD.RESPONSIBILITY,OLD.INTERN_EXTERN,OLD.FK_REF_STATUS_INTERN,OLD.FK_REF_STATUS_EXTERN,OLD.FK_REF_BRANCH,OLD.VOLTAGE_LEVEL,OLD.PRESSURE_LEVEL,OLD.FAILURE_BEGIN,OLD.FAILURE_END_PLANNED,OLD.FAILURE_END_RESUPPLIED,OLD.INTERNAL_REMARK,OLD.POSTCODE,OLD.CITY,OLD.DISTRICT,OLD.STREET,OLD.HOUSENUMBER,OLD.STATION_ID,OLD.STATION_DESCRIPTION,OLD.STATION_COORDS,OLD.FK_REF_RADIUS,OLD.LONGITUDE,OLD.LATITUDE,OLD.OBJECT_REFERENCE_EXTERNAL_SYSTEM,OLD.PUBLICATION_STATUS,OLD.PUBLICATION_FREETEXT,OLD.FK_REF_EXPECTED_REASON,OLD.FK_TBL_FAILURE_INFORMATION_CONDENSED, OLD.CONDENSED,OLD.CREATE_DATE,OLD.CREATE_USER,OLD.MOD_DATE,OLD.MOD_USER,
3,
current_timestamp,
diff --git a/gfsBackendService/src/main/resources/db/migration/V0_19__CREATE_GFI_DB.sql b/gfsBackendService/src/main/resources/db/migration/V0_19__CREATE_GFI_DB.sql
new file mode 100644
index 0000000..bdfdd85
--- /dev/null
+++ b/gfsBackendService/src/main/resources/db/migration/V0_19__CREATE_GFI_DB.sql
@@ -0,0 +1,682 @@
+-----------------------------------------------------------------------------------
+-- *******************************************************************************
+-- * Copyright (c) 2019 Contributors to the Eclipse Foundation
+-- *
+-- * See the NOTICE file(s) distributed with this work for additional
+-- * information regarding copyright ownership.
+-- *
+-- * This program and the accompanying materials are made available under the
+-- * terms of the Eclipse Public License v. 2.0 which is available at
+-- * http://www.eclipse.org/legal/epl-2.0.
+-- *
+-- * SPDX-License-Identifier: EPL-2.0
+-- *******************************************************************************
+-----------------------------------------------------------------------------------
+-- CREATE ROLE GFI_SERVICE LOGIN
+-- NOSUPERUSER INHERIT NOCREATEDB NOCREATEROLE NOREPLICATION;
+-- ALTER ROLE GFI_SERVICE with password 'gfi_service';
+
+DROP TABLE IF EXISTS public.VERSION CASCADE;
+DROP TABLE IF EXISTS public.TBL_FAILURE_INFORMATION CASCADE;
+DROP SEQUENCE IF EXISTS public.TBL_FAILURE_INFORMATION_ID_SEQ;
+
+DROP TABLE IF EXISTS public.REF_STATUS CASCADE;
+DROP SEQUENCE IF EXISTS public.REF_STATUS_ID_SEQ;
+
+DROP TABLE IF EXISTS public.REF_BRANCH CASCADE;
+DROP SEQUENCE IF EXISTS public.REF_BRANCH_ID_SEQ;
+
+DROP TABLE IF EXISTS public.REF_FAILURE_CLASSIFICATION CASCADE;
+DROP SEQUENCE IF EXISTS public.REF_FAILURE_CLASSIFICATION_ID_SEQ;
+
+DROP TABLE IF EXISTS public.REF_FAILURE_TYPE CASCADE;
+DROP SEQUENCE IF EXISTS public.REF_FAILURE_TYPE_ID_SEQ;
+
+DROP TABLE IF EXISTS public.REF_RADIUS CASCADE;
+DROP SEQUENCE IF EXISTS public.REF_RADIUS_ID_SEQ;
+
+DROP TABLE IF EXISTS public.REF_EXPECTED_REASON CASCADE;
+DROP SEQUENCE IF EXISTS public.REF_EXPECTED_REASON_ID_SEQ;
+
+DROP TABLE IF EXISTS public.TBL_IMPORT_DATA CASCADE;
+DROP SEQUENCE IF EXISTS public.TBL_IMPORT_DATA_ID_SEQ;
+
+-- ---------------------------------------------
+-- TABLE VERSION
+-- ---------------------------------------------
+CREATE TABLE public.VERSION
+(
+ ID integer NOT NULL,
+ VERSION character varying(50) NOT NULL,
+ CONSTRAINT REF_VERSION_PKEY PRIMARY KEY (id)
+);
+
+ALTER TABLE public.VERSION
+ OWNER TO GFI_SERVICE;
+GRANT ALL ON TABLE public.VERSION TO GFI_SERVICE;
+
+INSERT INTO public.VERSION (ID, VERSION) VALUES ( 1, '00-DEV' );
+
+-- ---------------------------------------------
+-- TABLE REF_STATUS
+-- ---------------------------------------------
+CREATE SEQUENCE public.ref_status_id_seq
+ INCREMENT 1
+ MINVALUE 1
+ MAXVALUE 9223372036854775807
+ START 1
+ CACHE 1;
+ALTER TABLE public.ref_status_id_seq
+ OWNER TO GFI_SERVICE;
+
+CREATE TABLE public.REF_STATUS
+(
+ ID integer NOT NULL DEFAULT nextval('REF_STATUS_ID_SEQ'::regclass),
+ UUID uuid NOT NULL,
+ STATUS character varying(50) NOT NULL,
+ IS_INTERNAL boolean NOT NULL,
+ IS_EXTERNAL boolean NOT NULL,
+ CONSTRAINT REF_STATUS_PKEY PRIMARY KEY (id)
+);
+
+ALTER TABLE public.REF_STATUS
+ OWNER TO GFI_SERVICE;
+GRANT ALL ON TABLE public.REF_STATUS TO GFI_SERVICE;
+
+INSERT INTO public.REF_STATUS (ID, UUID, STATUS, IS_INTERNAL, IS_EXTERNAL) VALUES (1, 'acabc8f6-2cf3-485a-a4f8-68d178c7df45', 'neu', TRUE, FALSE );
+INSERT INTO public.REF_STATUS (ID, UUID, STATUS, IS_INTERNAL, IS_EXTERNAL) VALUES (2, 'f2e44dc5-d30c-4128-86bb-d3d5fc766b61', 'geplant', TRUE, TRUE );
+INSERT INTO public.REF_STATUS (ID, UUID, STATUS, IS_INTERNAL, IS_EXTERNAL) VALUES (3, '23fc0254-cc3d-4371-97ad-54ef733008ae', 'angelegt', TRUE, FALSE );
+INSERT INTO public.REF_STATUS (ID, UUID, STATUS, IS_INTERNAL, IS_EXTERNAL) VALUES (4, '74a4ca78-7268-11ea-bc55-0242ac130003', 'storniert', TRUE, FALSE );
+INSERT INTO public.REF_STATUS (ID, UUID, STATUS, IS_INTERNAL, IS_EXTERNAL) VALUES (5, '7264e572-eae9-4cca-be05-af6b0d081247', 'qualifiziert', TRUE, FALSE );
+INSERT INTO public.REF_STATUS (ID, UUID, STATUS, IS_INTERNAL, IS_EXTERNAL) VALUES (6, '9374219a-7419-4b72-899d-cd0576d85cdb', 'aktualisiert', TRUE, TRUE );
+INSERT INTO public.REF_STATUS (ID, UUID, STATUS, IS_INTERNAL, IS_EXTERNAL) VALUES (7, '8c333345-5c3c-41ed-9de4-323045f64259', 'abgeschlossen', TRUE, TRUE );
+
+
+-- ---------------------------------------------
+-- TABLE REF_FAILURE_CLASSIFICATION
+-- ---------------------------------------------
+CREATE SEQUENCE public.ref_failure_classification_id_seq
+ INCREMENT 1
+ MINVALUE 1
+ MAXVALUE 9223372036854775807
+ START 1
+ CACHE 1;
+ALTER TABLE public.ref_failure_classification_id_seq
+ OWNER TO GFI_SERVICE;
+
+CREATE TABLE public.REF_FAILURE_CLASSIFICATION
+(
+ ID integer NOT NULL DEFAULT nextval('REF_FAILURE_CLASSIFICATION_ID_SEQ'::regclass),
+ UUID uuid NOT NULL,
+ CLASSIFICATION character varying(50) NOT NULL,
+ DESCRIPTION character varying(255) NULL,
+ CONSTRAINT REF_FAILURE_CLASSIFICATION_PKEY PRIMARY KEY (id)
+);
+
+ALTER TABLE public.REF_FAILURE_CLASSIFICATION
+ OWNER TO GFI_SERVICE;
+GRANT ALL ON TABLE public.REF_FAILURE_CLASSIFICATION TO GFI_SERVICE;
+
+INSERT INTO public.REF_FAILURE_CLASSIFICATION (UUID, CLASSIFICATION, DESCRIPTION) VALUES ( '9255fb79-c57a-4448-a69c-5d57994f0c91', 'Störung', NULL );
+INSERT INTO public.REF_FAILURE_CLASSIFICATION (UUID, CLASSIFICATION, DESCRIPTION) VALUES ( '8ec1e144-5230-4d43-a3df-f62dd64bb855', 'geplante Maßnahme', NULL );
+
+
+-- ---------------------------------------------
+-- TABLE REF_FAILURE_TYPE
+-- ---------------------------------------------
+CREATE SEQUENCE public.ref_failure_type_id_seq
+ INCREMENT 1
+ MINVALUE 1
+ MAXVALUE 9223372036854775807
+ START 1
+ CACHE 1;
+ALTER TABLE public.ref_failure_type_id_seq
+ OWNER TO GFI_SERVICE;
+
+CREATE TABLE public.REF_FAILURE_TYPE
+(
+ ID integer NOT NULL DEFAULT nextval('REF_FAILURE_TYPE_ID_SEQ'::regclass),
+ UUID uuid NOT NULL,
+ TYPE character varying(50) NOT NULL,
+ DESCRIPTION character varying(255) NULL,
+ CONSTRAINT REF_FAILURE_TYPE_PKEY PRIMARY KEY (id)
+);
+
+ALTER TABLE public.REF_FAILURE_TYPE
+ OWNER TO GFI_SERVICE;
+GRANT ALL ON TABLE public.REF_FAILURE_TYPE TO GFI_SERVICE;
+
+
+INSERT INTO public.REF_FAILURE_TYPE (UUID, TYPE, DESCRIPTION) VALUES ( '44a2aaed-8910-4116-b0c4-0855f8d3c28d', 'Information', NULL );
+INSERT INTO public.REF_FAILURE_TYPE (UUID, TYPE, DESCRIPTION) VALUES ( '94e880c4-3127-47d5-aaee-5f778462ab0c', 'zu veröffentlichende Meldung', 'Standardwert' );
+INSERT INTO public.REF_FAILURE_TYPE (UUID, TYPE, DESCRIPTION) VALUES ( '658245bd-bdc4-47dd-bc90-0336f9471410', 'unterlagerte Störung', 'nicht zu veröffentlichen' );
+
+-- ---------------------------------------------
+-- TABLE REF_BRANCH
+-- ---------------------------------------------
+CREATE SEQUENCE public.ref_branch_id_seq
+ INCREMENT 1
+ MINVALUE 1
+ MAXVALUE 9223372036854775807
+ START 1
+ CACHE 1;
+ALTER TABLE public.ref_branch_id_seq
+ OWNER TO GFI_SERVICE;
+
+CREATE TABLE public.REF_BRANCH
+(
+ ID integer NOT NULL DEFAULT nextval('REF_BRANCH_ID_SEQ'::regclass),
+ UUID uuid NOT NULL,
+ NAME character varying(50) NOT NULL,
+ DESCRIPTION character varying(255),
+ COLOR_CODE character varying(20),
+ CONSTRAINT REF_BRANCH_PKEY PRIMARY KEY (id)
+);
+
+ALTER TABLE public.REF_BRANCH
+ OWNER TO GFI_SERVICE;
+GRANT ALL ON TABLE public.REF_BRANCH TO GFI_SERVICE;
+
+INSERT INTO public.ref_branch(uuid, name, description, color_code) VALUES ('535b4beb-9b17-4247-bb8b-26bd01b48f9a', 'S', 'Strom', '#fc6042');
+INSERT INTO public.ref_branch(uuid, name, description, color_code) VALUES ('d41f54e5-c4df-440e-b334-40e8f3a6854a', 'G', 'Gas', '#fdea64');
+INSERT INTO public.ref_branch(uuid, name, description, color_code) VALUES ('62c6d361-96a0-41cc-bda1-4e58ad16f21a', 'F', 'Fernwärme', '#2cc990');
+INSERT INTO public.ref_branch(uuid, name, description, color_code) VALUES ('d8d93e0e-5c8c-4ab8-9625-f820de55ee7c', 'W', 'Wasser', '#2c82c9');
+INSERT INTO public.ref_branch(uuid, name, description, color_code) VALUES ('7d4907fb-cb3f-4a4f-93e9-839052e76894', 'TK', 'Telekommunikation', '#ff33cc');
+INSERT INTO public.ref_branch(uuid, name, description, color_code) VALUES ('014c4a2a-3cf1-4d28-af70-4573722bceb0', 'ST', 'Sekundärtechnik', '#9933ff');
+
+
+-- ---------------------------------------------
+-- TABLE REF_EXPECTED_REASON
+-- ---------------------------------------------
+CREATE SEQUENCE public.ref_expected_reason_id_seq
+ INCREMENT 1
+ MINVALUE 1
+ MAXVALUE 9223372036854775807
+ START 1
+ CACHE 1;
+ALTER TABLE public.ref_expected_reason_id_seq
+ OWNER TO GFI_SERVICE;
+
+CREATE TABLE public.REF_EXPECTED_REASON
+(
+ ID integer NOT NULL DEFAULT nextval('REF_EXPECTED_REASON_ID_SEQ'::regclass),
+ UUID uuid NOT NULL,
+ TEXT character varying(100) NOT NULL,
+ DESCRIPTION character varying(255) NULL,
+ CONSTRAINT REF_EXPECTED_REASON_PKEY PRIMARY KEY (id)
+);
+
+ALTER TABLE public.REF_EXPECTED_REASON
+ OWNER TO GFI_SERVICE;
+GRANT ALL ON TABLE public.REF_EXPECTED_REASON TO GFI_SERVICE;
+
+INSERT INTO public.ref_expected_reason(uuid, text, description) VALUES ('27a07918-6aa0-11ea-bc55-0242ac130003', 'Defekt technische Anlage', 'Dies ist die Beschreibung für: Defekt technische Anlage');
+INSERT INTO public.ref_expected_reason(uuid, text, description) VALUES ('27a07c42-6aa0-11ea-bc55-0242ac130003', 'Kabelfehler Mittelspannung', 'Dies ist die Beschreibung für: Kabelfehler Mittelspannung');
+INSERT INTO public.ref_expected_reason(uuid, text, description) VALUES ('27a07d50-6aa0-11ea-bc55-0242ac130003', 'Kabelfehler Niederspannung', 'Dies ist die Beschreibung für: Kabelfehler Niederspannung');
+INSERT INTO public.ref_expected_reason(uuid, text, description) VALUES ('27a07e22-6aa0-11ea-bc55-0242ac130003', 'Leitung beschädigt', 'Dies ist die Beschreibung für: Leitung beschädigt');
+INSERT INTO public.ref_expected_reason(uuid, text, description) VALUES ('27a07eea-6aa0-11ea-bc55-0242ac130003', 'noch nicht bekannt', 'Dies ist die Beschreibung für: noch nicht bekannt');
+INSERT INTO public.ref_expected_reason(uuid, text, description) VALUES ('27a07fbc-6aa0-11ea-bc55-0242ac130003', 'Wasserrohrbruch', 'Dies ist die Beschreibung für: Wasserrohrbruch');
+INSERT INTO public.ref_expected_reason(uuid, text, description) VALUES ('27a08160-6aa0-11ea-bc55-0242ac130003', 'Überregionale Störung', 'Dies ist die Beschreibung für: Überregionale Störung');
+
+-- ---------------------------------------------
+-- TABLE REF_RADIUS
+-- ---------------------------------------------
+CREATE SEQUENCE public.ref_radius_id_seq
+ INCREMENT 1
+ MINVALUE 1
+ MAXVALUE 9223372036854775807
+ START 1
+ CACHE 1;
+ALTER TABLE public.ref_radius_id_seq
+ OWNER TO GFI_SERVICE;
+
+CREATE TABLE public.REF_RADIUS
+(
+ ID integer NOT NULL DEFAULT nextval('REF_RADIUS_ID_SEQ'::regclass),
+ UUID uuid NOT NULL,
+ RADIUS character varying(20) NOT NULL,
+ CONSTRAINT REF_RADIUS_PKEY PRIMARY KEY (id)
+);
+
+ALTER TABLE public.REF_RADIUS
+ OWNER TO GFI_SERVICE;
+GRANT ALL ON TABLE public.REF_RADIUS TO GFI_SERVICE;
+
+INSERT INTO public.REF_RADIUS(uuid, radius) VALUES ('36671000-6aa6-11ea-bc55-0242ac130003', '50m');
+INSERT INTO public.REF_RADIUS(uuid, radius) VALUES ('366712a8-6aa6-11ea-bc55-0242ac130003', '100m');
+INSERT INTO public.REF_RADIUS(uuid, radius) VALUES ('366713c0-6aa6-11ea-bc55-0242ac130003', '250m');
+INSERT INTO public.REF_RADIUS(uuid, radius) VALUES ('3667150a-6aa6-11ea-bc55-0242ac130003', '500m');
+INSERT INTO public.REF_RADIUS(uuid, radius) VALUES ('36671780-6aa6-11ea-bc55-0242ac130003', '1000m');
+INSERT INTO public.REF_RADIUS(uuid, radius) VALUES ('3667187a-6aa6-11ea-bc55-0242ac130003', '1500m');
+INSERT INTO public.REF_RADIUS(uuid, radius) VALUES ('36671ad2-6aa6-11ea-bc55-0242ac130003', '2000m');
+
+-- ---------------------------------------------
+-- TABLE TBL_FAILURE_INFORMATION
+-- ---------------------------------------------
+CREATE SEQUENCE public.tbl_failure_information_id_seq
+ INCREMENT 1
+ MINVALUE 1
+ MAXVALUE 9223372036854775807
+ START 1
+ CACHE 1;
+ALTER TABLE public.tbl_failure_information_id_seq
+ OWNER TO GFI_SERVICE;
+
+CREATE TABLE public.TBL_FAILURE_INFORMATION
+(
+ ID integer NOT NULL DEFAULT nextval('TBL_FAILURE_INFORMATION_ID_SEQ'::regclass),
+ UUID uuid NOT NULL,
+ VERSION_NUMBER integer NOT NULL,
+ FK_REF_FAILURE_CLASSIFICATION integer,
+ FK_REF_FAILURE_TYPE integer,
+ TITLE character varying(255) NULL,
+ DESCRIPTION character varying(255) NULL,
+ RESPONSIBILITY character varying(255),
+ INTERN_EXTERN character varying(1),
+ FK_REF_STATUS_INTERN integer NOT NULL,
+ FK_REF_STATUS_EXTERN integer NOT NULL,
+ FK_REF_BRANCH integer NOT NULL,
+ VOLTAGE_LEVEL character varying(2),
+ PRESSURE_LEVEL character varying(2),
+ FAILURE_BEGIN timestamp NOT NULL,
+ FAILURE_END_PLANNED timestamp,
+ FAILURE_END_RESUPPLIED timestamp,
+ INTERNAL_REMARK character varying(1024),
+ POSTCODE character varying(30),
+ CITY character varying(255),
+ DISTRICT character varying(255),
+ STREET character varying(255),
+ HOUSENUMBER character varying(30),
+ STATION_ID character varying (30),
+ STATION_DESCRIPTION character varying (255),
+ STATION_COORDS character varying (255),
+ FK_REF_RADIUS integer NOT NULL,
+ LONGITUDE numeric(9,6),
+ LATITUDE numeric(9,6),
+ FK_TBL_FAILURE_INFORMATION_CONDENSED integer,
+ CONDENSED boolean,
+ CONDENSED_COUNT integer,
+ OBJECT_REFERENCE_EXTERNAL_SYSTEM character varying (255),
+ PUBLICATION_STATUS character varying (40),
+ PUBLICATION_FREETEXT character varying (1024),
+ FK_REF_EXPECTED_REASON integer,
+ CREATE_DATE timestamp without time zone NOT NULL,
+ CREATE_USER character varying(100) NOT NULL,
+ MOD_DATE timestamp without time zone NOT NULL,
+ MOD_USER character varying(100),
+ CONSTRAINT TBL_FAILURE_INFORMATION_PKEY PRIMARY KEY (id),
+ CONSTRAINT TBL_FAIL_INF__FCLASS_FKEY FOREIGN KEY (FK_REF_FAILURE_CLASSIFICATION)
+ REFERENCES public.REF_FAILURE_CLASSIFICATION (ID) MATCH SIMPLE
+ ON UPDATE NO ACTION ON DELETE NO ACTION,
+ CONSTRAINT TBL_FAIL_INF_FTYPE_FKEY FOREIGN KEY (FK_REF_FAILURE_TYPE)
+ REFERENCES public.REF_FAILURE_TYPE (ID) MATCH SIMPLE
+ ON UPDATE NO ACTION ON DELETE NO ACTION,
+ CONSTRAINT TBL_FAIL_INF_STATUSINT_FKEY FOREIGN KEY (FK_REF_STATUS_INTERN)
+ REFERENCES public.REF_STATUS (ID) MATCH SIMPLE
+ ON UPDATE NO ACTION ON DELETE NO ACTION,
+ CONSTRAINT TBL_FAIL_INF__STATUSEXT_FKEY FOREIGN KEY (FK_REF_STATUS_EXTERN)
+ REFERENCES public.REF_STATUS (ID) MATCH SIMPLE
+ ON UPDATE NO ACTION ON DELETE NO ACTION,
+ CONSTRAINT TBL_FAIL_INF__BRANCH_ID_FKEY FOREIGN KEY (FK_REF_BRANCH)
+ REFERENCES public.REF_BRANCH (ID) MATCH SIMPLE
+ ON UPDATE NO ACTION ON DELETE NO ACTION,
+ CONSTRAINT TBL_FAIL_INF__EXPREASON_FKEY FOREIGN KEY (FK_REF_EXPECTED_REASON)
+ REFERENCES public.REF_EXPECTED_REASON (ID) MATCH SIMPLE
+ ON UPDATE NO ACTION ON DELETE NO ACTION
+);
+
+ALTER TABLE public.TBL_FAILURE_INFORMATION
+ OWNER TO GFI_SERVICE;
+GRANT ALL ON TABLE public.TBL_FAILURE_INFORMATION TO GFI_SERVICE;
+
+INSERT INTO public.tbl_failure_information(UUID, VERSION_NUMBER, FK_REF_FAILURE_CLASSIFICATION, FK_REF_FAILURE_TYPE, TITLE, DESCRIPTION, RESPONSIBILITY, INTERN_EXTERN, FK_REF_STATUS_INTERN, FK_REF_STATUS_EXTERN, FK_REF_BRANCH, VOLTAGE_LEVEL, PRESSURE_LEVEL, FAILURE_BEGIN, FAILURE_END_PLANNED, FAILURE_END_RESUPPLIED, INTERNAL_REMARK, POSTCODE, CITY, DISTRICT, STREET, HOUSENUMBER, STATION_ID, STATION_DESCRIPTION, STATION_COORDS, FK_REF_RADIUS, LONGITUDE, LATITUDE, OBJECT_REFERENCE_EXTERNAL_SYSTEM, PUBLICATION_STATUS, PUBLICATION_FREETEXT, FK_REF_EXPECTED_REASON, CONDENSED, CONDENSED_COUNT, FK_TBL_FAILURE_INFORMATION_CONDENSED, CREATE_DATE, CREATE_USER, MOD_DATE, MOD_USER)
+VALUES ('6432a9c9-0384-44af-9bb8-34f2878d7b49',3, 1, 1, 'Stromausfall Murr', 'Es gibt einen Stromausfall im Bereich Murr/Westbezirk', 'Rolf Rudis', 'I', 1, 1, 1, 'NS', null, '2021-01-19 00:00:00', '2021-01-22 00:00:00', '2021-01-22 12:00:00', 'Der Bagger grub zu tief', '71711', 'Murr', 'Westbezirk', 'Ferdinand-Porsche-Straße', '2', '52863a', 'Trafo 1', '124,2323', 2, 9.247952, 48.955700, 'Link - extenes System', 'veröffentlicht', 'Freitext für die Veröffentlichung: Defekt an Trafostation', 1, false, 0, null, '2020-01-22 15:32:15', 'SCRIPT', '2020-01-24 08:02:44', 'SCRIPT');
+
+INSERT INTO public.tbl_failure_information(UUID, VERSION_NUMBER, FK_REF_FAILURE_CLASSIFICATION, FK_REF_FAILURE_TYPE, TITLE, DESCRIPTION, RESPONSIBILITY, INTERN_EXTERN, FK_REF_STATUS_INTERN, FK_REF_STATUS_EXTERN, FK_REF_BRANCH, VOLTAGE_LEVEL, PRESSURE_LEVEL, FAILURE_BEGIN, FAILURE_END_PLANNED, FAILURE_END_RESUPPLIED, INTERNAL_REMARK, POSTCODE, CITY, DISTRICT, STREET, HOUSENUMBER, STATION_ID, STATION_DESCRIPTION, STATION_COORDS, FK_REF_RADIUS, LONGITUDE, LATITUDE, OBJECT_REFERENCE_EXTERNAL_SYSTEM, PUBLICATION_STATUS, PUBLICATION_FREETEXT, FK_REF_EXPECTED_REASON, CONDENSED, CONDENSED_COUNT, FK_TBL_FAILURE_INFORMATION_CONDENSED, CREATE_DATE, CREATE_USER, MOD_DATE, MOD_USER)
+VALUES ('37aef635-d0d4-4c47-ac25-c0d16c29e35c', 1, 2, 2, 'Gasleck Oldenburg', 'Es gibt ein Gasleck in Oldenburg', 'Bernd Britzel', 'E', 2, 2, 3, 'NS', 'HD', '2021-05-19 00:00:00', '2021-05-22 00:00:00', '2021-05-22 12:00:00', 'HD betroffen', '26133', 'Oldenburg', null, 'Cloppenburger Str.', '302', '1234863-b234', 'ertf', '124,2323', 4, 8.210150, 53.111820, 'Link - extenes System', 'nicht veröffentlicht', 'Freitext: Eine Gasleitung wurde beschädigt', 4, false, 0, null, '2020-02-03 15:15:15', 'SCRIPT', '2020-02-24 20:08:41', 'SCRIPT');
+
+-- ---------------------------------------------
+-- TABLE TBL_IMPORT_DATA
+-- ---------------------------------------------
+CREATE SEQUENCE public.tbl_import_data_id_seq
+ INCREMENT 1
+ MINVALUE 1
+ MAXVALUE 9223372036854775807
+ START 1
+ CACHE 1;
+ALTER TABLE public.tbl_import_data_id_seq
+ OWNER TO GFI_SERVICE;
+
+CREATE TABLE public.TBL_IMPORT_DATA
+(
+ ID integer NOT NULL DEFAULT nextval('TBL_IMPORT_DATA_ID_SEQ'::regclass),
+ UUID uuid NOT NULL,
+ META_ID character varying(255) NOT NULL,
+ DESCRIPTION character varying(255) NULL,
+ SOURCE character varying(255) NULL,
+ MESSAGE_CONTENT character varying(1024) NOT NULL,
+ CONSTRAINT TBL_IMPORT_DATA_PKEY PRIMARY KEY (id)
+);
+
+ALTER TABLE public.TBL_IMPORT_DATA
+ OWNER TO GFI_SERVICE;
+GRANT ALL ON TABLE public.TBL_IMPORT_DATA TO GFI_SERVICE;
+
+INSERT INTO public.tbl_import_data(uuid, meta_id, description, source, message_content)
+VALUES ('355b4beb-9b17-4247-bb8b-36bd01b48f9a', 'StoeDE_10.03.2020 10:31:000 XYZ', 'Gasleck im Haus', 'Stoerungen.de', '{ "Quelle": "Stoerungen.de", "Eigenschaften": {"Branch": "Gas", "Ort": "Worms", "Datum": "2020-03-10T10:31.000Z"}}');
+INSERT INTO public.tbl_import_data(uuid, meta_id, description, source, message_content)
+VALUES ('d61f54e5-c4df-440e-b334-22e8f3a6854a', 'StoeDE_10.03.2020 10:31:000 XYZ', 'Gasleck im Haus', 'Stoerungen.de', '{ "Quelle": "Stoerungen.de", "Eigenschaften": {"Branch": "Gas", "Ort": "Worms", "Datum": "2020-03-10T10:31.000Z"}}');
+INSERT INTO public.tbl_import_data(uuid, meta_id, description, source, message_content)
+VALUES ('26c6d361-96a0-41cc-bda1-4e85ad16f21a', 'email_10.03.2020 23:45:000 ABC', 'Stromausfall im Haus', 'email', '{ "Quelle": "email", "Eigenschaften": {"Branch": "Strom", "Ort": "Kassel", "Datum": "2020-06-11T23:45.000Z"}}');
+INSERT INTO public.tbl_import_data(uuid, meta_id, description, source, message_content)
+VALUES ('d7d93e0e-5c8c-4ab8-9625-f910de55ee7c', 'Intern_04.09.2020 13:12:110 BLA', 'Wasserrohrbruch in der Straße', 'Intern', '{ "Quelle": "Intern", "Eigenschaften": {"Branch": "Wasser", "Ort": "Kassel", "Datum": "2020-09-04T13:12.110Z"}}');
+
+
+-- ----------------------------------------------------------------------------
+-- ----------------------------------------------------------------------------
+-- HISTORY-TABLES
+-- ----------------------------------------------------------------------------
+-- ----------------------------------------------------------------------------
+
+
+-- PUBLIC.HTBL_FAILURE_INFORMATION Automatic generanted History Table DDL --
+-- <GENERATED CODE!>
+
+DROP TABLE IF EXISTS PUBLIC.HTBL_FAILURE_INFORMATION;
+DROP SEQUENCE IF EXISTS PUBLIC.HTBL_FAILURE_INFORMATION_ID_SEQ;
+
+CREATE SEQUENCE PUBLIC.HTBL_FAILURE_INFORMATION_ID_SEQ
+ INCREMENT 1
+ MINVALUE 1
+ MAXVALUE 9223372036854775807
+ START 1
+ CACHE 1;
+
+ALTER TABLE PUBLIC.HTBL_FAILURE_INFORMATION_ID_SEQ
+ OWNER TO gfi_service;
+
+CREATE TABLE PUBLIC.HTBL_FAILURE_INFORMATION
+(
+ HID integer NOT NULL DEFAULT nextval('HTBL_FAILURE_INFORMATION_ID_SEQ'::regclass),
+ HACTION integer NOT NULL,
+ HDATE timestamp without time zone NOT NULL,
+ HUSER character varying(100),
+
+ ID integer,
+ UUID uuid,
+ VERSION_NUMBER integer,
+ FK_REF_FAILURE_CLASSIFICATION integer,
+ FK_REF_FAILURE_TYPE integer,
+ TITLE character varying(255) NULL,
+ DESCRIPTION character varying(255) NULL,
+ RESPONSIBILITY character varying (255),
+ INTERN_EXTERN character varying (1),
+ FK_REF_STATUS_INTERN integer,
+ FK_REF_STATUS_EXTERN integer,
+ FK_REF_BRANCH integer,
+ VOLTAGE_LEVEL character varying (2),
+ PRESSURE_LEVEL character varying (2),
+ FAILURE_BEGIN timestamp without time zone,
+ FAILURE_END_PLANNED timestamp without time zone,
+ FAILURE_END_RESUPPLIED timestamp without time zone,
+ INTERNAL_REMARK character varying (1024),
+ POSTCODE character varying (30),
+ CITY character varying (255),
+ DISTRICT character varying (255),
+ STREET character varying (255),
+ HOUSENUMBER character varying (30),
+ STATION_ID character varying (30),
+ STATION_DESCRIPTION character varying (255),
+ STATION_COORDS character varying (255),
+ FK_REF_RADIUS integer,
+ LONGITUDE numeric(9,6),
+ LATITUDE numeric(9,6),
+ FK_TBL_FAILURE_INFORMATION_CONDENSED integer,
+ CONDENSED boolean,
+ CONDENSED_COUNT integer,
+ OBJECT_REFERENCE_EXTERNAL_SYSTEM character varying (255),
+ PUBLICATION_STATUS character varying (40),
+ PUBLICATION_FREETEXT character varying (1024),
+ FK_REF_EXPECTED_REASON integer,
+ CREATE_USER character varying(100),
+ CREATE_DATE timestamp without time zone,
+ MOD_USER character varying(100),
+ MOD_DATE timestamp without time zone,
+ CONSTRAINT HTBL_FAILURE_INFORMATION_PKEY PRIMARY KEY (HID)
+)
+WITH (
+ OIDS=FALSE
+);
+
+ALTER TABLE PUBLIC.HTBL_FAILURE_INFORMATION
+ OWNER TO gfi_service;
+GRANT ALL ON TABLE PUBLIC.HTBL_FAILURE_INFORMATION TO gfi_service;
+
+INSERT INTO public.htbl_failure_information(HACTION, HDATE, HUSER, ID, UUID, VERSION_NUMBER, FK_REF_FAILURE_CLASSIFICATION, FK_REF_FAILURE_TYPE, TITLE, DESCRIPTION, RESPONSIBILITY, INTERN_EXTERN, FK_REF_STATUS_INTERN, FK_REF_STATUS_EXTERN, FK_REF_BRANCH, VOLTAGE_LEVEL, PRESSURE_LEVEL, FAILURE_BEGIN, FAILURE_END_PLANNED, FAILURE_END_RESUPPLIED, INTERNAL_REMARK, POSTCODE, CITY, DISTRICT, STREET, HOUSENUMBER, STATION_ID, STATION_DESCRIPTION, STATION_COORDS, FK_REF_RADIUS, LONGITUDE, LATITUDE, OBJECT_REFERENCE_EXTERNAL_SYSTEM, PUBLICATION_STATUS, PUBLICATION_FREETEXT, FK_REF_EXPECTED_REASON, FK_TBL_FAILURE_INFORMATION_CONDENSED, CONDENSED, CONDENSED_COUNT, CREATE_DATE, CREATE_USER, MOD_DATE, MOD_USER)
+VALUES (1, '2020-03-13 00:00:00', 'SCRIPT', 1, '6432a9c9-0384-44af-9bb8-34f2878d7b49', 1, 1, 1, 'Stromausfall Murr', 'Es gibt einen Stromausfall im Bereich Murr/Westbezirk', 'Rolf Rudis', 'I', 1, 1, 1, 'NS', null, '2021-01-19 00:00:00', '2021-01-22 00:00:00', '2021-01-22 12:00:00', 'Der Bagger grub zu tief', '71711', 'Murr', 'Westbezirk', 'Ferdinand-Porsche-Straße', '2', '52863a', 'Trafo 1', '124,2323', 2, 9.247952, 48.955700, 'Link - extenes System', 'veröffentlicht', 'Freitext für die Veröffentlichung: Defekt an Trafostation', 1, null, false, 0, '2020-01-22 15:32:15', 'SCRIPT', '2020-01-24 08:02:44', 'SCRIPT');
+
+INSERT INTO public.htbl_failure_information(HACTION, HDATE, HUSER, ID, UUID, VERSION_NUMBER, FK_REF_FAILURE_CLASSIFICATION, FK_REF_FAILURE_TYPE, TITLE, DESCRIPTION, RESPONSIBILITY, INTERN_EXTERN, FK_REF_STATUS_INTERN, FK_REF_STATUS_EXTERN, FK_REF_BRANCH, VOLTAGE_LEVEL, PRESSURE_LEVEL, FAILURE_BEGIN, FAILURE_END_PLANNED, FAILURE_END_RESUPPLIED, INTERNAL_REMARK, POSTCODE, CITY, DISTRICT, STREET, HOUSENUMBER, STATION_ID, STATION_DESCRIPTION, STATION_COORDS, FK_REF_RADIUS, LONGITUDE, LATITUDE, OBJECT_REFERENCE_EXTERNAL_SYSTEM, PUBLICATION_STATUS, PUBLICATION_FREETEXT, FK_REF_EXPECTED_REASON, FK_TBL_FAILURE_INFORMATION_CONDENSED, CONDENSED, CONDENSED_COUNT, CREATE_DATE, CREATE_USER, MOD_DATE, MOD_USER)
+VALUES (2, '2020-03-13 00:00:00', 'SCRIPT', 2, '37aef635-d0d4-4c47-ac25-c0d16c29e35c', 1, 2, 2, 'Gasleck Oldenburg', 'Es gibt ein Gasleck in Oldenburg', 'Bernd Britzel', 'E', 2, 2, 3, 'NS', 'HD', '2021-05-19 00:00:00', '2021-05-22 00:00:00', '2021-05-22 12:00:00', 'HD betroffen', '26133', 'Oldenburg', null, 'Cloppenburger Str.', '302', '1234863-b234', 'ertf', '124,2323', 4, 8.210150, 53.111820, 'Link - extenes System', 'nicht veröffentlicht', 'Freitext: Eine Gasleitung wurde beschädigt', 4, null, false, 0, '2020-02-03 15:15:15', 'SCRIPT', '2020-02-24 20:08:41', 'SCRIPT');
+
+
+-- ----------------------------------------------------------------------------
+-- ----------------------------------------------------------------------------
+-- Tables ADDRESSIMPORT
+-- ----------------------------------------------------------------------------
+-- ----------------------------------------------------------------------------
+
+/*DROP TABLE IF EXISTS public.TBL_ADDRESS CASCADE;
+DROP SEQUENCE IF EXISTS public.TBL_ADDRESS_ID_SEQ;*/
+
+-- ---------------------------------------------
+-- TABLE TBL_ADDRESS
+-- ---------------------------------------------
+/*CREATE SEQUENCE public.TBL_ADDRESS_ID_SEQ
+ INCREMENT 1
+ MINVALUE 1
+ MAXVALUE 9223372036854775807
+ START 1
+ CACHE 1;
+ALTER TABLE public.TBL_ADDRESS_ID_SEQ
+ OWNER TO GFI_SERVICE;
+
+CREATE TABLE public.TBL_ADDRESS
+(
+ ID integer NOT NULL DEFAULT nextval('TBL_ADDRESS_ID_SEQ'::regclass),
+ UUID uuid NOT NULL,
+ SDOX1 numeric(9,2) NOT NULL,
+ SDOY1 numeric(10,2) NOT NULL,
+ G3EFID numeric,
+ POSTCODE character varying(30),
+ COMMUNITY character varying(255),
+ DISTRICT character varying(255),
+ STREET character varying(255),
+ HOUSENUMBER character varying(30),
+ WATER_CONNECTION boolean,
+ WATER_GROUP character varying(255),
+ GAS_CONNECTION boolean,
+ GAS_GROUP character varying(255),
+ POWER_CONNECTION boolean,
+ STATION_ID character varying(30),
+ LONGITUDE numeric(9,6),
+ LATITUDE numeric(9,6),
+ CONSTRAINT TBL_ADDRESS_PKEY PRIMARY KEY (id)
+);
+
+ALTER TABLE public.TBL_ADDRESS
+ OWNER TO GFI_SERVICE;
+GRANT ALL ON TABLE public.TBL_ADDRESS TO GFI_SERVICE;
+
+CREATE INDEX idx_tbl_address_g3efid ON public.TBL_ADDRESS ( G3EFID );
+CREATE INDEX idx_tbl_address_postcode ON public.TBL_ADDRESS ( POSTCODE );
+CREATE INDEX idx_tbl_address_community ON public.TBL_ADDRESS ( COMMUNITY );
+CREATE INDEX idx_tbl_address_district ON public.TBL_ADDRESS ( DISTRICT );
+CREATE INDEX idx_tbl_address_street ON public.TBL_ADDRESS ( STREET );*/
+
+
+-- ---------------------------------------------
+-- TABLE TBL_STATION
+-- ---------------------------------------------
+
+/*DROP TABLE IF EXISTS public.TBL_STATION CASCADE;
+DROP SEQUENCE IF EXISTS public.TBL_STATION_ID_SEQ;
+
+CREATE SEQUENCE public.TBL_STATION_ID_SEQ
+ INCREMENT 1
+ MINVALUE 1
+ MAXVALUE 9223372036854775807
+ START 1
+ CACHE 1;
+ALTER TABLE public.TBL_STATION_ID_SEQ
+ OWNER TO GFI_SERVICE;
+
+CREATE TABLE public.TBL_STATION
+(
+ ID integer NOT NULL DEFAULT nextval('TBL_STATION_ID_SEQ'::regclass),
+ UUID uuid NOT NULL,
+ SDOX1 numeric(9,2) NOT NULL,
+ SDOY1 numeric(10,2) NOT NULL,
+ G3EFID numeric,
+ STATION_ID character varying(30),
+ STATION_NAME character varying(255),
+ LONGITUDE numeric(9,6),
+ LATITUDE numeric(9,6),
+ CONSTRAINT TBL_STATION_PKEY PRIMARY KEY (id)
+);
+
+ALTER TABLE public.TBL_STATION
+ OWNER TO GFI_SERVICE;
+GRANT ALL ON TABLE public.TBL_STATION TO GFI_SERVICE;
+
+CREATE INDEX idx_tbl_station_g3efid ON public.TBL_STATION ( G3EFID );
+CREATE INDEX idx_tbl_station_postcode ON public.TBL_ADDRESS ( POSTCODE );
+CREATE INDEX idx_tbl_station_community ON public.TBL_ADDRESS ( COMMUNITY );
+CREATE INDEX idx_tbl_station_district ON public.TBL_ADDRESS ( DISTRICT );
+CREATE INDEX idx_tbl_station_street ON public.TBL_ADDRESS ( STREET );*/
+
+-- ----------------------------------------------------------------------------
+-- ----------------------------------------------------------------------------
+-- TRIGGER
+-- ----------------------------------------------------------------------------
+-- ----------------------------------------------------------------------------
+
+
+-- PUBLIC.TBL_FAILURE_INFORMATION INSERT TRIGGER --
+-- <GENERATED CODE!>
+CREATE OR REPLACE FUNCTION PUBLIC.TBL_FAILURE_INFORMATION_INSERT_TRG()
+ RETURNS trigger AS
+$BODY$
+ BEGIN
+ INSERT INTO HTBL_FAILURE_INFORMATION (
+ ID,UUID,VERSION_NUMBER,FK_REF_FAILURE_CLASSIFICATION,FK_REF_FAILURE_TYPE,TITLE,DESCRIPTION,RESPONSIBILITY,INTERN_EXTERN,FK_REF_STATUS_INTERN,FK_REF_STATUS_EXTERN,FK_REF_BRANCH,VOLTAGE_LEVEL,PRESSURE_LEVEL,FAILURE_BEGIN,FAILURE_END_PLANNED,FAILURE_END_RESUPPLIED,INTERNAL_REMARK,POSTCODE,CITY,DISTRICT,STREET,HOUSENUMBER,STATION_ID,STATION_DESCRIPTION,STATION_COORDS,FK_REF_RADIUS,LONGITUDE,LATITUDE,FK_TBL_FAILURE_INFORMATION_CONDENSED,CONDENSED,CONDENSED_COUNT,OBJECT_REFERENCE_EXTERNAL_SYSTEM,PUBLICATION_STATUS,PUBLICATION_FREETEXT,FK_REF_EXPECTED_REASON,CREATE_DATE,CREATE_USER,MOD_DATE,MOD_USER,
+
+ HACTION,
+ HDATE,
+ HUSER
+ )
+ VALUES (
+
+ NEW.ID,NEW.UUID,NEW.VERSION_NUMBER,NEW.FK_REF_FAILURE_CLASSIFICATION,NEW.FK_REF_FAILURE_TYPE,NEW.TITLE,NEW.DESCRIPTION,NEW.RESPONSIBILITY,NEW.INTERN_EXTERN,NEW.FK_REF_STATUS_INTERN,NEW.FK_REF_STATUS_EXTERN,NEW.FK_REF_BRANCH,NEW.VOLTAGE_LEVEL,NEW.PRESSURE_LEVEL,NEW.FAILURE_BEGIN,NEW.FAILURE_END_PLANNED,NEW.FAILURE_END_RESUPPLIED,NEW.INTERNAL_REMARK,NEW.POSTCODE,NEW.CITY,NEW.DISTRICT,NEW.STREET,NEW.HOUSENUMBER,NEW.STATION_ID,NEW.STATION_DESCRIPTION,NEW.STATION_COORDS,NEW.FK_REF_RADIUS,NEW.LONGITUDE,NEW.LATITUDE,NEW.FK_TBL_FAILURE_INFORMATION_CONDENSED,NEW.CONDENSED,NEW.CONDENSED_COUNT,NEW.OBJECT_REFERENCE_EXTERNAL_SYSTEM,NEW.PUBLICATION_STATUS,NEW.PUBLICATION_FREETEXT,NEW.FK_REF_EXPECTED_REASON,NEW.CREATE_DATE,NEW.CREATE_USER,NEW.MOD_DATE,NEW.MOD_USER,
+
+ 1,
+ current_timestamp,
+ NEW.CREATE_USER );
+
+ RETURN NEW;
+ END;
+$BODY$
+ LANGUAGE plpgsql VOLATILE
+ COST 100;
+ALTER FUNCTION PUBLIC.TBL_FAILURE_INFORMATION_INSERT_TRG()
+ OWNER TO gfi_service;
+
+
+DROP TRIGGER IF EXISTS TBL_FAILURE_INFORMATION_INSERT_TRG ON PUBLIC.TBL_FAILURE_INFORMATION;
+
+CREATE TRIGGER TBL_FAILURE_INFORMATION_INSERT_TRG
+ BEFORE INSERT
+ ON PUBLIC.TBL_FAILURE_INFORMATION
+ FOR EACH ROW
+ EXECUTE PROCEDURE PUBLIC.TBL_FAILURE_INFORMATION_INSERT_TRG();
+
+
+
+-- PUBLIC.TBL_FAILURE_INFORMATION UPDATE TRIGGER --
+-- <GENERATED CODE!>
+
+CREATE OR REPLACE FUNCTION PUBLIC.TBL_FAILURE_INFORMATION_UPDATE_TRG()
+ RETURNS trigger AS
+$BODY$
+ BEGIN
+ INSERT INTO HTBL_FAILURE_INFORMATION (
+ ID,UUID,VERSION_NUMBER,FK_REF_FAILURE_CLASSIFICATION,FK_REF_FAILURE_TYPE,TITLE,DESCRIPTION,RESPONSIBILITY,INTERN_EXTERN,FK_REF_STATUS_INTERN,FK_REF_STATUS_EXTERN,FK_REF_BRANCH,VOLTAGE_LEVEL,PRESSURE_LEVEL,FAILURE_BEGIN,FAILURE_END_PLANNED,FAILURE_END_RESUPPLIED,INTERNAL_REMARK,POSTCODE,CITY,DISTRICT,STREET,HOUSENUMBER,STATION_ID,STATION_DESCRIPTION,STATION_COORDS,FK_REF_RADIUS,LONGITUDE,LATITUDE,FK_TBL_FAILURE_INFORMATION_CONDENSED,CONDENSED,CONDENSED_COUNT,OBJECT_REFERENCE_EXTERNAL_SYSTEM,PUBLICATION_STATUS,PUBLICATION_FREETEXT,FK_REF_EXPECTED_REASON,CREATE_DATE,CREATE_USER,MOD_DATE,MOD_USER,
+
+ HACTION,
+ HDATE,
+ HUSER
+ )
+ VALUES (
+ NEW.ID,NEW.UUID,NEW.VERSION_NUMBER,NEW.FK_REF_FAILURE_CLASSIFICATION,NEW.FK_REF_FAILURE_TYPE,NEW.TITLE,NEW.DESCRIPTION,NEW.RESPONSIBILITY,NEW.INTERN_EXTERN,NEW.FK_REF_STATUS_INTERN,NEW.FK_REF_STATUS_EXTERN,NEW.FK_REF_BRANCH,NEW.VOLTAGE_LEVEL,NEW.PRESSURE_LEVEL,NEW.FAILURE_BEGIN,NEW.FAILURE_END_PLANNED,NEW.FAILURE_END_RESUPPLIED,NEW.INTERNAL_REMARK,NEW.POSTCODE,NEW.CITY,NEW.DISTRICT,NEW.STREET,NEW.HOUSENUMBER,NEW.STATION_ID,NEW.STATION_DESCRIPTION,NEW.STATION_COORDS,NEW.FK_REF_RADIUS,NEW.LONGITUDE,NEW.LATITUDE,NEW.FK_TBL_FAILURE_INFORMATION_CONDENSED,NEW.CONDENSED,NEW.CONDENSED_COUNT,NEW.OBJECT_REFERENCE_EXTERNAL_SYSTEM,NEW.PUBLICATION_STATUS,NEW.PUBLICATION_FREETEXT,NEW.FK_REF_EXPECTED_REASON,NEW.CREATE_DATE,NEW.CREATE_USER,NEW.MOD_DATE,NEW.MOD_USER,
+ 2,
+ current_timestamp,
+ NEW.MOD_USER
+ );
+
+ RETURN NEW;
+ END;
+$BODY$
+ LANGUAGE plpgsql VOLATILE
+ COST 100;
+ALTER FUNCTION PUBLIC.TBL_FAILURE_INFORMATION_UPDATE_TRG()
+ OWNER TO gfi_service;
+
+DROP TRIGGER IF EXISTS TBL_FAILURE_INFORMATION_UPDATE_TRG ON PUBLIC.TBL_FAILURE_INFORMATION;
+
+CREATE TRIGGER TBL_FAILURE_INFORMATION_UPDATE_TRG
+ BEFORE UPDATE
+ ON PUBLIC.TBL_FAILURE_INFORMATION
+ FOR EACH ROW
+ EXECUTE PROCEDURE PUBLIC.TBL_FAILURE_INFORMATION_UPDATE_TRG();
+
+
+
+-- PUBLIC.TBL_FAILURE_INFORMATION DELETE TRIGGER --
+-- <GENERATED CODE!>
+
+CREATE OR REPLACE FUNCTION PUBLIC.TBL_FAILURE_INFORMATION_DELETE_TRG()
+ RETURNS trigger AS
+$BODY$
+ BEGIN
+ IF TG_OP = 'DELETE' THEN
+ INSERT INTO HTBL_FAILURE_INFORMATION (
+
+ ID,UUID,VERSION_NUMBER,FK_REF_FAILURE_CLASSIFICATION,FK_REF_FAILURE_TYPE,TITLE,DESCRIPTION,RESPONSIBILITY,INTERN_EXTERN,FK_REF_STATUS_INTERN,FK_REF_STATUS_EXTERN,FK_REF_BRANCH,VOLTAGE_LEVEL,PRESSURE_LEVEL,FAILURE_BEGIN,FAILURE_END_PLANNED,FAILURE_END_RESUPPLIED,INTERNAL_REMARK,POSTCODE,CITY,DISTRICT,STREET,HOUSENUMBER,STATION_ID,STATION_DESCRIPTION,STATION_COORDS,FK_REF_RADIUS,LONGITUDE,LATITUDE,FK_TBL_FAILURE_INFORMATION_CONDENSED,CONDENSED,CONDENSED_COUNT,OBJECT_REFERENCE_EXTERNAL_SYSTEM,PUBLICATION_STATUS,PUBLICATION_FREETEXT,FK_REF_EXPECTED_REASON,CREATE_DATE,CREATE_USER,MOD_DATE,MOD_USER,
+
+ HACTION,
+ HDATE,
+ HUSER
+ )
+ VALUES (
+ OLD.ID,OLD.UUID,OLD.VERSION_NUMBER,OLD.FK_REF_FAILURE_CLASSIFICATION,OLD.FK_REF_FAILURE_TYPE,OLD.TITLE,OLD.DESCRIPTION,OLD.RESPONSIBILITY,OLD.INTERN_EXTERN,OLD.FK_REF_STATUS_INTERN,OLD.FK_REF_STATUS_EXTERN,OLD.FK_REF_BRANCH,OLD.VOLTAGE_LEVEL,OLD.PRESSURE_LEVEL,OLD.FAILURE_BEGIN,OLD.FAILURE_END_PLANNED,OLD.FAILURE_END_RESUPPLIED,OLD.INTERNAL_REMARK,OLD.POSTCODE,OLD.CITY,OLD.DISTRICT,OLD.STREET,OLD.HOUSENUMBER,OLD.STATION_ID,OLD.STATION_DESCRIPTION,OLD.STATION_COORDS,OLD.FK_REF_RADIUS,OLD.LONGITUDE,OLD.LATITUDE,OLD.FK_TBL_FAILURE_INFORMATION_CONDENSED,OLD.CONDENSED,OLD.CONDENSED_COUNT,OLD.OBJECT_REFERENCE_EXTERNAL_SYSTEM,OLD.PUBLICATION_STATUS,OLD.PUBLICATION_FREETEXT,OLD.FK_REF_EXPECTED_REASON,OLD.CREATE_DATE,OLD.CREATE_USER,OLD.MOD_DATE,OLD.MOD_USER,
+
+ 3,
+ current_timestamp,
+ OLD.MOD_USER );
+ END IF;
+
+ RETURN OLD;
+ END;
+$BODY$
+ LANGUAGE plpgsql VOLATILE
+ COST 100;
+ALTER FUNCTION PUBLIC.TBL_FAILURE_INFORMATION_DELETE_TRG()
+ OWNER TO gfi_service;
+
+DROP TRIGGER IF EXISTS TBL_FAILURE_INFORMATION_DELETE_TRG ON PUBLIC.TBL_FAILURE_INFORMATION;
+
+CREATE TRIGGER TBL_FAILURE_INFORMATION_DELETE_TRG
+ BEFORE DELETE
+ ON PUBLIC.TBL_FAILURE_INFORMATION
+ FOR EACH ROW
+ EXECUTE PROCEDURE PUBLIC.TBL_FAILURE_INFORMATION_DELETE_TRG();
+
diff --git a/gfsBackendService/src/main/resources/messages.properties b/gfsBackendService/src/main/resources/messages.properties
index 518fa52..f71538b 100644
--- a/gfsBackendService/src/main/resources/messages.properties
+++ b/gfsBackendService/src/main/resources/messages.properties
@@ -6,7 +6,8 @@
status.not.existing=Die \u00fcbergebene Beschreibung eines Status existiert nicht.
radius.not.existing=Die \u00fcbergebene Beschreibung eines Radius existiert nicht.
failure.info.uuid.not.existing=Die \u00fcbergebene UUID einer Störungsmeldung existiert nicht.
-failure.infos.have.different.branches=Die \u00fcbergebenen Störungsinformationen haben unterschiedliche Sparten.
-empty.array=Der \u00fcbergebene Array ist leer.
+failure.infos.have.different.branches=Die \u00fcbergebenen unterlagerten Störungsinformationen haben unterschiedliche Sparten.
+empty.array.for.subordinated.failure.infos=Der \u00fcbergebene Array für unterlagerte Störungsmeldungen ist leer.
+failure.info.already.subordinated=Mindestens eine der \u00fcbergebenen unterlagerten Störungsinformationen ist bereits Teil einer anderen Verdichtung.
diff --git a/gfsBackendService/src/test/java/org/eclipse/openk/gridfailureinformation/controller/FailureInformationControllerTest.java b/gfsBackendService/src/test/java/org/eclipse/openk/gridfailureinformation/controller/FailureInformationControllerTest.java
index 2c2aa48..0832fe5 100644
--- a/gfsBackendService/src/test/java/org/eclipse/openk/gridfailureinformation/controller/FailureInformationControllerTest.java
+++ b/gfsBackendService/src/test/java/org/eclipse/openk/gridfailureinformation/controller/FailureInformationControllerTest.java
@@ -33,6 +33,7 @@
import java.util.ArrayList;
import java.util.List;
+import java.util.Optional;
import java.util.UUID;
import static org.hamcrest.Matchers.is;
@@ -40,6 +41,7 @@
import static org.mockito.Mockito.when;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*;
+import static org.springframework.web.servlet.function.RequestPredicates.contentType;
@SpringBootTest(classes = GridFailureInformationApplication.class)
@AutoConfigureMockMvc
@@ -162,7 +164,7 @@
FailureInformationDto failureInformationDto = MockDataHelper.mockFailureInformationDto();
- when (failureInformationService.condenseFailureInfos(any(List.class))).thenReturn(failureInformationDto);
+ when (failureInformationService.condenseFailureInfos(any(List.class), any(Optional.class))).thenReturn(failureInformationDto);
mockMvc.perform(post("/grid-failure-informations/condense")
.contentType(MediaType.APPLICATION_JSON)
@@ -170,4 +172,15 @@
.andExpect(status().is2xxSuccessful());
}
+ @Test
+ public void shouldFindSubordinateFailureInfosByCondensedUuid() throws Exception{
+
+ List<FailureInformationDto> fiList = MockDataHelper.mockGridFailureInformationDtos();
+ when (failureInformationService.findFailureInformationsByCondensedUuid(any(UUID.class))).thenReturn(fiList);
+
+ mockMvc.perform(get("/grid-failure-informations/condensed/{uuid}", UUID.randomUUID().toString()))
+ .andExpect(status().is2xxSuccessful())
+ .andExpect(content().contentType(MediaType.APPLICATION_JSON));
+ }
+
}
\ No newline at end of file
diff --git a/gfsBackendService/src/test/java/org/eclipse/openk/gridfailureinformation/service/FailureInformationServiceTest.java b/gfsBackendService/src/test/java/org/eclipse/openk/gridfailureinformation/service/FailureInformationServiceTest.java
index 1cffcba..d0a39ec 100644
--- a/gfsBackendService/src/test/java/org/eclipse/openk/gridfailureinformation/service/FailureInformationServiceTest.java
+++ b/gfsBackendService/src/test/java/org/eclipse/openk/gridfailureinformation/service/FailureInformationServiceTest.java
@@ -478,7 +478,7 @@
when(failureInformationRepository.findByUuidIn(any(List.class))).thenReturn(listFailureInfos);
- assertThrows(OperationDeniedException.class, () -> failureInformationService.condenseFailureInfos(uuidList));
+ assertThrows(OperationDeniedException.class, () -> failureInformationService.condenseFailureInfos(uuidList, Optional.empty()));
}
@Test
@@ -506,10 +506,10 @@
return (TblFailureInformation) args[0];
});
- FailureInformationDto savedCondensedFailureInfoDto = failureInformationService.condenseFailureInfos(uuidList);
+ FailureInformationDto savedCondensedFailureInfoDto = failureInformationService.condenseFailureInfos(uuidList, Optional.empty());
assertNotNull(savedCondensedFailureInfoDto.getUuid());
- assertEquals(1L, savedCondensedFailureInfoDto.getVersionNumber());
+ //assertEquals(1L, savedCondensedFailureInfoDto.getVersionNumber());
//TODO: status (2x) und radius überprüfen
assertEquals(tblFailureInformation1.getStreet(), savedCondensedFailureInfoDto.getStreet());
assertEquals(tblFailureInformation1.getDistrict(), savedCondensedFailureInfoDto.getDistrict());
@@ -553,10 +553,10 @@
return (TblFailureInformation) args[0];
});
- FailureInformationDto savedCondensedFailureInfoDto = failureInformationService.condenseFailureInfos(uuidList);
+ FailureInformationDto savedCondensedFailureInfoDto = failureInformationService.condenseFailureInfos(uuidList, Optional.empty());
assertNotNull(savedCondensedFailureInfoDto.getUuid());
- assertEquals(1L, savedCondensedFailureInfoDto.getVersionNumber());
+ //assertEquals(1L, savedCondensedFailureInfoDto.getVersionNumber());
//TODO: status (2x) und radius überprüfen
assertEquals(null, savedCondensedFailureInfoDto.getStreet());
assertEquals(null, savedCondensedFailureInfoDto.getDistrict());
@@ -568,4 +568,20 @@
}
+ @Test
+ public void shouldReturnSubordinateFailureInfos(){
+
+ List<TblFailureInformation> fiMockList = MockDataHelper.mockTblFailureInformationList();
+ when(failureInformationRepository.findByFailureInformationCondensedUuid(any(UUID.class))).thenReturn(fiMockList);
+
+ List<FailureInformationDto> fiDtoList = failureInformationService.findFailureInformationsByCondensedUuid(UUID.randomUUID());
+
+ assertEquals( fiDtoList.size(), fiMockList.size() );
+ assertEquals( fiDtoList.get(0).getResponsibility(), fiMockList .get(0).getResponsibility());
+
+
+ }
+
+
+
}
diff --git a/gfsBackendService/src/test/java/org/eclipse/openk/gridfailureinformation/support/MockDataHelper.java b/gfsBackendService/src/test/java/org/eclipse/openk/gridfailureinformation/support/MockDataHelper.java
index 57afada..de3ecf2 100644
--- a/gfsBackendService/src/test/java/org/eclipse/openk/gridfailureinformation/support/MockDataHelper.java
+++ b/gfsBackendService/src/test/java/org/eclipse/openk/gridfailureinformation/support/MockDataHelper.java
@@ -159,6 +159,7 @@
obj.setFailureEndPlanned(Date.valueOf("2022-09-02"));
obj.setFailureEndResupplied(Date.valueOf("2022-09-03"));
+
obj.setStreet("Hügelpfad");
obj.setDistrict("Süd");
obj.setCity("Schlumpfhausen");
@@ -189,6 +190,7 @@
return obj;
}
+
public static Page<TblFailureInformation> mockTblFailureInformationPage() {
List<TblFailureInformation> retList = new LinkedList<>();
retList.add( mockTblFailureInformation() );
@@ -197,6 +199,8 @@
return new PageImpl<>(retList, Pageable.unpaged(), retList.size());
}
+
+
public static List<FailureInformationDto> mockGridFailureInformationDtos() {
List<FailureInformationDto> retList = new LinkedList<>();
retList.add( mockFailureInformationDto() );