Commit 6870daee authored by Simon Reis's avatar Simon Reis
Browse files

SI-2433 Verheiraten von FE und BE

parent 078a6d05
......@@ -15,6 +15,7 @@
package org.eclipse.openk.gridfailureinformation.api;
import org.eclipse.openk.gridfailureinformation.viewmodel.FESettingsDto;
import org.eclipse.openk.gridfailureinformation.viewmodel.FailureInformationDto;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
......@@ -29,4 +30,8 @@ public interface SitCacheApi {
public void postPublicFailureInfos(
@RequestBody List<FailureInformationDto> failureInfoToPublish);
@PostMapping("/fe-settings")
public void postFeSettings(
@RequestBody FESettingsDto feSettings);
}
......@@ -31,8 +31,12 @@ public class DmzExportSchedulerConfig {
@Scheduled(cron = "${export-to-dmz.cron}")
public void scheduleTaskDmzExport() {
log.info("Executing" + SCHEDULER_NAME + " task: Exporting FailureInformations with Status 'published' to DMZ" );
log.debug("Executing" + SCHEDULER_NAME + " task: Exporting FailureInformations with Status 'published' to DMZ" );
exportService.exportFailureInformationsToDMZ();
log.info("Finished " + SCHEDULER_NAME + " task: Exporting FailureInformations with Status 'published' to DMZ");
log.debug("Finished " + SCHEDULER_NAME + " task: Exporting FailureInformations with Status 'published' to DMZ");
log.debug("Executing" + SCHEDULER_NAME + " task: Exporting FE-Settings to DMZ" );
exportService.exportFeSettingsToDMZ();
log.debug("Finished " + SCHEDULER_NAME + " task: Exporting FE-Settings to DMZ");
}
}
......@@ -22,6 +22,10 @@ public class FESettings {
public String overviewMapInitialZoom;
@Value("${spring.settings.detailMapInitialZoom}")
public String detailMapInitialZoom;
@Value("${spring.settings.overviewMapInitialLatitude}")
public String overviewMapInitialLatitude;
@Value("${spring.settings.overviewMapInitialLongitude}")
public String overviewMapInitialLongitude;
}
......
......@@ -92,7 +92,7 @@ public class DistributionGroupController {
distributionGroupService.deleteDistributionGroup(groupUuid);
}
catch ( Exception e ) {
log.info("Exception in delete distribution group: ", e);
log.error("Exception in delete distribution group: ", e);
throw new ConflictException("distribution.group.still.in.use");
}
}
......
......@@ -102,6 +102,9 @@ public class ExportService {
@Autowired
private SitCacheApi sitCacheApi;
@Autowired
private SettingsService settingsService;
private static final String SUBJECT_DATE_PATTERN_APPLIED = "EEEE', den' dd.MM.yy 'um' HH:mm:ss";
protected Map<String,String> contentReplaceMap;
protected int countExportedMessages;
......@@ -215,12 +218,19 @@ public class ExportService {
.collect(Collectors.toList());
try{
try {
sitCacheApi.postPublicFailureInfos(failureInfoDtossVeroeffentlicht);
}
catch(Exception e){
} catch (Exception e) {
log.error("error.exporting.published.failure.infos", e);
}
}
}
public void exportFeSettingsToDMZ(){
try {
sitCacheApi.postFeSettings(settingsService.getFESettings());
} catch (Exception e) {
log.error("error.exporting.feSettings.to.DMZ", e);
}
}
private boolean isChannelAlreadyPublished(String targetChannel, TblFailureInformation existingTblFailureInfo) {
......@@ -349,7 +359,7 @@ public class ExportService {
log.info("RabbitMq: Successfully sent msg: Export-Exchange: " + rabbitMqProperties.getExportExchange() + " Export-Queue: " + rabbitMqChannel.getExportQueue()
+ " Export-Key: " + rabbitMqChannel.getExportKey());
} catch (Exception e) {
log.debug(e.getMessage(), e);
log.error(e.getMessage(), e);
throw new InternalServerErrorException("could.not.push.rabbitMqMessage");
}
}
......
......@@ -31,9 +31,13 @@ public class SettingsService {
@Autowired
private FESettings feSettings;
private FESettingsDto feSettingsDto;
public FESettingsDto getFESettings(){
FESettingsDto feSettingsDto = new FESettingsDto();
if (feSettingsDto != null) return feSettingsDto;
feSettingsDto = new FESettingsDto();
List<RabbitMqChannel> rabbitMqChannels = feSettings.getChannels();
List<String> channelNames = new LinkedList();
......@@ -44,6 +48,8 @@ public class SettingsService {
feSettingsDto.setExportChannels(channelNames);
feSettingsDto.setDetailMapInitialZoom(feSettings.getDetailMapInitialZoom());
feSettingsDto.setOverviewMapInitialZoom(feSettings.getOverviewMapInitialZoom());
feSettingsDto.setOverviewMapInitialLatitude(feSettings.getOverviewMapInitialLatitude());
feSettingsDto.setOverviewMapInitialLongitude(feSettings.getOverviewMapInitialLongitude());
return feSettingsDto;
}
......
......@@ -25,4 +25,7 @@ public class FESettingsDto implements Serializable {
public String overviewMapInitialZoom;
public String detailMapInitialZoom;
public String overviewMapInitialLatitude;
public String overviewMapInitialLongitude;
}
......@@ -45,6 +45,8 @@ spring:
settings:
overviewMapInitialZoom: 10
detailMapInitialZoom: 10
overviewMapInitialLatitude: 49.656634
overviewMapInitialLongitude: 8.423207
jpa:
show-sql: false
......
......@@ -46,6 +46,8 @@ spring:
settings:
overviewMapInitialZoom: 10
detailMapInitialZoom: 10
overviewMapInitialLatitude: 49.656634
overviewMapInitialLongitude: 8.423207
jpa:
show-sql: false
......@@ -87,6 +89,7 @@ services:
portalFeLoginURL: http://entopkon:8880/portalFE/#/login
portalFeModulename: SIT DEV
authNAuthService:
ribbon:
listOfServers: http://entopkon:8880
......@@ -95,6 +98,10 @@ contactService:
ribbon:
listOfServers: http://entdockergss:9156
sitCacheService:
ribbon:
listOfServers: http://localhost:3000
cors:
corsEnabled: true
......
......@@ -47,5 +47,7 @@ public class SettingsServiceTest {
assertFalse(feSettingsDto.getDetailMapInitialZoom() == null);
assertFalse(feSettingsDto.getOverviewMapInitialZoom()== null);
assertFalse(feSettingsDto.getExportChannels() == null);
assertFalse(feSettingsDto.getOverviewMapInitialLatitude() == null);
assertFalse(feSettingsDto.getOverviewMapInitialLongitude() == null);
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment