diff --git a/src/main/java/ch/ethz/seb/sebserver/gui/GuiServiceInfo.java b/src/main/java/ch/ethz/seb/sebserver/gui/GuiServiceInfo.java index b45c66c5..48a46e95 100644 --- a/src/main/java/ch/ethz/seb/sebserver/gui/GuiServiceInfo.java +++ b/src/main/java/ch/ethz/seb/sebserver/gui/GuiServiceInfo.java @@ -19,6 +19,7 @@ import ch.ethz.seb.sebserver.gbl.profile.GuiProfile; @GuiProfile public class GuiServiceInfo { + private final String sebServerVersion; private final String externalScheme; private final String internalServer; private final String externalServer; @@ -29,8 +30,10 @@ public class GuiServiceInfo { private final UriComponentsBuilder internalServerURIBuilder; private final UriComponentsBuilder externalServerURIBuilder; private final boolean distributedSetup; + private final boolean multilingualGUI; public GuiServiceInfo( + @Value("${sebserver.version:--}") final String sebServerVersion, @Value("${server.address}") final String internalServer, @Value("${server.port}") final String internalPort, @Value("${sebserver.gui.http.external.scheme}") final String externalScheme, @@ -38,7 +41,8 @@ public class GuiServiceInfo { @Value("${sebserver.gui.http.external.port}") final String externalPort, @Value("${sebserver.gui.entrypoint:/gui}") final String entryPoint, @Value("${server.servlet.context-path:/}") final String contextPath, - @Value("${sebserver.webservice.distributed:false}") final boolean distributedSetup) { + @Value("${sebserver.webservice.distributed:false}") final boolean distributedSetup, + @Value("${sebserver.gui.multilingual:false}") final boolean multilingualGUI) { if (StringUtils.isBlank(externalScheme)) { throw new RuntimeException("Missing mandatory inital parameter sebserver.gui.http.external.servername"); @@ -48,6 +52,7 @@ public class GuiServiceInfo { throw new RuntimeException("Missing mandatory inital parameter sebserver.gui.http.external.servername"); } + this.sebServerVersion = sebServerVersion; this.externalScheme = externalScheme; this.internalServer = internalServer; this.externalServer = externalServer; @@ -73,6 +78,7 @@ public class GuiServiceInfo { } this.distributedSetup = distributedSetup; + this.multilingualGUI = multilingualGUI; } public String getExternalScheme() { @@ -115,4 +121,12 @@ public class GuiServiceInfo { return this.distributedSetup; } + public String getSebServerVersion() { + return this.sebServerVersion; + } + + public boolean isMultilingualGUI() { + return this.multilingualGUI; + } + } diff --git a/src/main/java/ch/ethz/seb/sebserver/gui/service/page/impl/DefaultPageLayout.java b/src/main/java/ch/ethz/seb/sebserver/gui/service/page/impl/DefaultPageLayout.java index 8c67a1e2..53e5f7fd 100644 --- a/src/main/java/ch/ethz/seb/sebserver/gui/service/page/impl/DefaultPageLayout.java +++ b/src/main/java/ch/ethz/seb/sebserver/gui/service/page/impl/DefaultPageLayout.java @@ -12,7 +12,6 @@ import java.io.ByteArrayInputStream; import java.nio.charset.StandardCharsets; import org.apache.commons.codec.binary.Base64InputStream; -import org.apache.commons.lang3.BooleanUtils; import org.apache.commons.lang3.StringUtils; import org.eclipse.rap.rwt.RWT; import org.eclipse.rap.rwt.client.service.UrlLauncher; @@ -31,11 +30,10 @@ import org.eclipse.swt.widgets.MessageBox; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.context.annotation.Lazy; -import org.springframework.core.env.Environment; import org.springframework.stereotype.Component; -import ch.ethz.seb.sebserver.gbl.Constants; import ch.ethz.seb.sebserver.gbl.api.API; +import ch.ethz.seb.sebserver.gui.GuiServiceInfo; import ch.ethz.seb.sebserver.gui.service.i18n.I18nSupport; import ch.ethz.seb.sebserver.gui.service.i18n.LocTextKey; import ch.ethz.seb.sebserver.gui.service.i18n.PolyglotPageService; @@ -70,19 +68,17 @@ public class DefaultPageLayout implements TemplateComposer { private final PolyglotPageService polyglotPageService; private final AuthorizationContextHolder authorizationContextHolder; private final PageService pageService; - private final String sebServerVersion; - private final boolean multilingual; + private final GuiServiceInfo guiServiceInfo; public DefaultPageLayout( final PageService pageService, - final Environment environment) { + final GuiServiceInfo guiServiceInfo) { this.widgetFactory = pageService.getWidgetFactory(); this.polyglotPageService = pageService.getPolyglotPageService(); this.authorizationContextHolder = pageService.getAuthorizationContextHolder(); this.pageService = pageService; - this.sebServerVersion = environment.getProperty("sebserver.version", Constants.EMPTY_NOTE); - this.multilingual = BooleanUtils.toBoolean(environment.getProperty("sebserver.gui.multilingual", "false")); + this.guiServiceInfo = guiServiceInfo; } @Override @@ -198,7 +194,7 @@ public class DefaultPageLayout implements TemplateComposer { rowLayout.marginRight = 70; langSupport.setLayout(rowLayout); - if (this.multilingual) { + if (this.guiServiceInfo.isMultilingualGUI()) { this.polyglotPageService.createLanguageSelector(pageContext.copyOf(langSupport)); } } @@ -332,7 +328,7 @@ public class DefaultPageLayout implements TemplateComposer { this.widgetFactory.labelLocalized( footerRight, CustomVariant.FOOTER, - new LocTextKey("sebserver.overall.version", this.sebServerVersion)); + new LocTextKey("sebserver.overall.version", this.guiServiceInfo.getSebServerVersion())); } private void loadInstitutionalLogo(final PageContext pageContext, final Composite logo) { diff --git a/src/main/java/ch/ethz/seb/sebserver/webservice/WebserviceInfo.java b/src/main/java/ch/ethz/seb/sebserver/webservice/WebserviceInfo.java index ed47e517..3e2860ea 100644 --- a/src/main/java/ch/ethz/seb/sebserver/webservice/WebserviceInfo.java +++ b/src/main/java/ch/ethz/seb/sebserver/webservice/WebserviceInfo.java @@ -77,7 +77,6 @@ public class WebserviceInfo { final Environment environment) { this.webserviceInfoDAO = webserviceInfoDAO; - this.webserviceUUID = UUID.randomUUID().toString(); this.sebServerVersion = environment.getRequiredProperty(VERSION_KEY); this.testProperty = environment.getProperty(WEB_SERVICE_TEST_PROPERTY, "NOT_AVAILABLE"); this.httpScheme = environment.getRequiredProperty(WEB_SERVICE_HTTP_SCHEME_KEY); @@ -87,6 +86,9 @@ public class WebserviceInfo { this.webserverPort = environment.getProperty(WEB_SERVICE_HTTP_PORT); this.discoveryEndpoint = environment.getRequiredProperty(WEB_SERVICE_EXAM_API_DISCOVERY_ENDPOINT_KEY); this.contextPath = environment.getProperty(WEB_SERVICE_CONTEXT_PATH, ""); + this.webserviceUUID = UUID.randomUUID().toString() + + Constants.UNDERLINE + + this.getSEBServerVersion(); this.distributedUpdateInterval = environment.getProperty( "sebserver.webservice.distributed.updateInterval", diff --git a/src/main/java/ch/ethz/seb/sebserver/webservice/WebserviceInit.java b/src/main/java/ch/ethz/seb/sebserver/webservice/WebserviceInit.java index 029da1e2..f3a3de58 100644 --- a/src/main/java/ch/ethz/seb/sebserver/webservice/WebserviceInit.java +++ b/src/main/java/ch/ethz/seb/sebserver/webservice/WebserviceInit.java @@ -91,7 +91,6 @@ public class WebserviceInit implements ApplicationListener "); this.registerWebservice(); - } SEBServerInit.INIT_LOGGER.info("----> ");