diff --git a/gazelle-tm-ear/pom.xml b/gazelle-tm-ear/pom.xml index 30da14f9586c482ae9a04318e1cdf4f542817f4e..d0e84cea8a2f51e1a557f0f1e922766065fe7459 100644 --- a/gazelle-tm-ear/pom.xml +++ b/gazelle-tm-ear/pom.xml @@ -3,7 +3,7 @@ <parent> <groupId>net.ihe.gazelle.tm</groupId> <artifactId>gazelle-tm</artifactId> - <version>10.0.0-NPD-834-SNAPSHOT</version> + <version>10.0.0-GZL-5400-SNAPSHOT</version> <relativePath>../pom.xml</relativePath> </parent> <modelVersion>4.0.0</modelVersion> diff --git a/gazelle-tm-ejb/pom.xml b/gazelle-tm-ejb/pom.xml index 874c6cf3b280bee1441a24cc25b47402b09dbd62..dffe3415e465a81d0ced17e2fe0cb1694d3920b0 100644 --- a/gazelle-tm-ejb/pom.xml +++ b/gazelle-tm-ejb/pom.xml @@ -3,7 +3,7 @@ <parent> <groupId>net.ihe.gazelle.tm</groupId> <artifactId>gazelle-tm</artifactId> - <version>10.0.0-NPD-834-SNAPSHOT</version> + <version>10.0.0-GZL-5400-SNAPSHOT</version> <relativePath>../pom.xml</relativePath> </parent> <modelVersion>4.0.0</modelVersion> diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/application/client/GumConfigClient.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/application/client/GumConfigClient.java deleted file mode 100644 index c6de8ea79500a96bad921bd30837b19fa0d7b8d5..0000000000000000000000000000000000000000 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/application/client/GumConfigClient.java +++ /dev/null @@ -1,64 +0,0 @@ -package net.ihe.gazelle.tm.application.client; - -import org.apache.http.HttpStatus; -import org.apache.http.client.methods.CloseableHttpResponse; -import org.apache.http.client.methods.HttpGet; -import org.apache.http.impl.client.CloseableHttpClient; -import org.apache.http.impl.client.HttpClients; -import org.apache.http.util.EntityUtils; -import org.codehaus.jackson.JsonNode; -import org.codehaus.jackson.map.ObjectMapper; - -import java.io.IOException; -import java.io.InputStream; - -public class GumConfigClient { - - private String configurationsJson; - - - public boolean getUserRegistrationEnabled() { - if (configurationsJson == null) { - try (CloseableHttpClient httpClient = HttpClients.createDefault()) { - HttpGet getGumConfigurationsRequest = new HttpGet(System.getenv("GUM_REST_API_URL") + "/rest/configurations"); - try (CloseableHttpResponse response = httpClient.execute(getGumConfigurationsRequest)) { - assertNoErrorStatus(response); - InputStream responseContent = response.getEntity().getContent(); - setConfigurationJson(responseContent); - } - } catch (IOException e) { - throw new GumConfigClientException("Could not get configurations", e); - } - } - return extractFieldValueFromJson("userRegistrationEnabled", configurationsJson); - } - - private void setConfigurationJson(InputStream responseContent) throws IOException { - JsonNode jsonNode = new ObjectMapper().readTree(responseContent); - configurationsJson = jsonNode.toString(); - } - - private void assertNoErrorStatus(CloseableHttpResponse response) { - if (response.getStatusLine().getStatusCode() >= HttpStatus.SC_BAD_REQUEST) { - String message = response.getStatusLine().getStatusCode() + " " + - response.getStatusLine().getReasonPhrase(); - try { - String body = EntityUtils.toString(response.getEntity()); - if (body != null) - throw new GumConfigClientException(message + " with body: " + body); - throw new GumConfigClientException(message); - } catch (IOException e) { - throw new GumConfigClientException(message); - } - } - } - - private boolean extractFieldValueFromJson(String fieldName, String json) { - try { - JsonNode jsonNode = new ObjectMapper().readTree(json); - return jsonNode.get(fieldName).asBoolean(); - } catch (IOException e) { - throw new GumConfigClientException(e); - } - } -} diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/application/client/GumConfigClientException.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/application/client/GumConfigClientException.java deleted file mode 100644 index a2ebe1a14a03ec560cf1628ba00f63921520650d..0000000000000000000000000000000000000000 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/application/client/GumConfigClientException.java +++ /dev/null @@ -1,20 +0,0 @@ -package net.ihe.gazelle.tm.application.client; - -public class GumConfigClientException extends RuntimeException{ - - public GumConfigClientException() { - super(); - } - - public GumConfigClientException(String message) { - super(message); - } - - public GumConfigClientException(String message, Throwable cause) { - super(message, cause); - } - - public GumConfigClientException(Throwable cause) { - super(cause); - } -} diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/application/services/ApplicationConfigurationService.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/application/services/ApplicationConfigurationService.java deleted file mode 100644 index 57e4a05d00596c6d9a79e0815b809cacef593c99..0000000000000000000000000000000000000000 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/application/services/ApplicationConfigurationService.java +++ /dev/null @@ -1,10 +0,0 @@ -package net.ihe.gazelle.tm.application.services; - -public interface ApplicationConfigurationService { - - /** - * Get if user registration is enabled - * @return true if user registration is enabled, false otherwise - */ - boolean isUserRegistrationEnabled(); -} diff --git a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/application/services/ApplicationConfigurationServiceImpl.java b/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/application/services/ApplicationConfigurationServiceImpl.java deleted file mode 100644 index 4010c4a49f8874f54847fd1cdc4d30957ce45b99..0000000000000000000000000000000000000000 --- a/gazelle-tm-ejb/src/main/java/net/ihe/gazelle/tm/application/services/ApplicationConfigurationServiceImpl.java +++ /dev/null @@ -1,28 +0,0 @@ -package net.ihe.gazelle.tm.application.services; - -import net.ihe.gazelle.tm.application.client.GumConfigClient; -import net.ihe.gazelle.tm.application.client.GumConfigClientException; -import org.jboss.seam.ScopeType; -import org.jboss.seam.annotations.AutoCreate; -import org.jboss.seam.annotations.Name; -import org.jboss.seam.annotations.Scope; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -@Scope(ScopeType.EVENT) -@AutoCreate -@Name("applicationConfigurationService") -public class ApplicationConfigurationServiceImpl implements ApplicationConfigurationService { - private static final Logger LOG = LoggerFactory.getLogger(ApplicationConfigurationServiceImpl.class); - - GumConfigClient gumConfigClient = new GumConfigClient(); - @Override - public boolean isUserRegistrationEnabled() { - try { - return gumConfigClient.getUserRegistrationEnabled(); - }catch (GumConfigClientException e){ - LOG.error("Could not determine if user registration is enabled. See following error:", e); - return false; - } - } -} diff --git a/gazelle-tm-ejb/src/main/resources/db/migration/V10_0_0_1__Remove_gum_front_url.sql b/gazelle-tm-ejb/src/main/resources/db/migration/V10_0_0_1__Remove_gum_front_url.sql new file mode 100644 index 0000000000000000000000000000000000000000..b6b63744b9cf5844717336c97f4aecb70e755c5d --- /dev/null +++ b/gazelle-tm-ejb/src/main/resources/db/migration/V10_0_0_1__Remove_gum_front_url.sql @@ -0,0 +1 @@ +DELETE FROM cmn_application_preference WHERE preference_name = 'gum_front_url'; diff --git a/gazelle-tm-ejb/src/main/resources/db/migration/afterMigrate.sql b/gazelle-tm-ejb/src/main/resources/db/migration/afterMigrate.sql index 6c81be5f557829c466fa18fa11b239ce17ee6b80..61e2a683da1a1d81c8507f9857a4d5a452f3f311 100644 --- a/gazelle-tm-ejb/src/main/resources/db/migration/afterMigrate.sql +++ b/gazelle-tm-ejb/src/main/resources/db/migration/afterMigrate.sql @@ -25,7 +25,6 @@ UPDATE cmn_application_preference SET preference_value = '${gazelle_proxy_oid}' UPDATE cmn_application_preference SET preference_value = '${gazelle_proxy_url}' WHERE preference_name = 'gazelle_proxy_url' ; UPDATE cmn_application_preference SET preference_value = '${gazelle_proxy_webservice_endpoint}' WHERE preference_name = 'gazelle_proxy_webservice_endpoint' ; UPDATE cmn_application_preference SET preference_value = '${google_analytics_code}' WHERE preference_name = 'google_analytics_code' ; -UPDATE cmn_application_preference SET preference_value = '${gum_front_url}' WHERE preference_name = 'gum_front_url' ; UPDATE cmn_application_preference SET preference_value = '${gwt_url}' WHERE preference_name = 'gwt_url' ; UPDATE cmn_application_preference SET preference_value = '${ip_login}' WHERE preference_name = 'ip_login' ; UPDATE cmn_application_preference SET preference_value = '${ip_login_admin}' WHERE preference_name = 'ip_login_admin' ; diff --git a/gazelle-tm-war/pom.xml b/gazelle-tm-war/pom.xml index c4f9298afd2e9e352b70967200db1c87863a5c06..7e975b9dd44592c7f3b639a2df4a1e31a0e07460 100644 --- a/gazelle-tm-war/pom.xml +++ b/gazelle-tm-war/pom.xml @@ -3,7 +3,7 @@ <parent> <groupId>net.ihe.gazelle.tm</groupId> <artifactId>gazelle-tm</artifactId> - <version>10.0.0-NPD-834-SNAPSHOT</version> + <version>10.0.0-GZL-5400-SNAPSHOT</version> <relativePath>../pom.xml</relativePath> </parent> <modelVersion>4.0.0</modelVersion> diff --git a/gazelle-tm-war/src/main/webapp/install/installation.xhtml b/gazelle-tm-war/src/main/webapp/install/installation.xhtml index dea962b666fe63b1475e6deb567f0042e6958295..57d2c7bbe0ef94d69880ff63df616476e75a71dd 100644 --- a/gazelle-tm-war/src/main/webapp/install/installation.xhtml +++ b/gazelle-tm-war/src/main/webapp/install/installation.xhtml @@ -14,7 +14,7 @@ <br/> <br/> <h:outputLink id="redirectToGum" styleClass="gzl-btn-green" - value="#{preferenceProvider.getString('gum_front_url')}"> + value="#{applicationConfigurationBean.getUserRegistrationUrl()}"> <h:outputText value="#{messages['gazelle.users.user.button.CreateFirstAdminUser']}"/> </h:outputLink> </ui:define> diff --git a/gazelle-tm-war/src/main/webapp/layout/menu/_menu.xhtml b/gazelle-tm-war/src/main/webapp/layout/menu/_menu.xhtml index 2f226bdba3086f0070a419f6dcb6e361c2914233..57c7acf0a31d4947ed8f3f42e357686eb1a46972 100644 --- a/gazelle-tm-war/src/main/webapp/layout/menu/_menu.xhtml +++ b/gazelle-tm-war/src/main/webapp/layout/menu/_menu.xhtml @@ -106,14 +106,6 @@ </li> </h:panelGroup> </h:panelGroup> - <!-- Sign up menu --> - <h:panelGroup rendered="#{!identity.loggedIn and applicationConfigurationService.isUserRegistrationEnabled()}"> - <li> - <h:outputLink value="#{applicationPreferenceManager.getGumFrontUrl()}"> - <h:outputText value="#{messages['net.ihe.gazelle.tm.SignUp']}"/> - </h:outputLink> - </li> - </h:panelGroup> <!-- Login menu from cas-client-ui-v7 --> <ui:decorate template="/layout/_login_menu.xhtml"> </ui:decorate> diff --git a/pom.xml b/pom.xml index f18ac50a620fa98c07075d62ef63adbf00257a3c..2842b065cc684b7743e76902e1970da5ac539c71 100644 --- a/pom.xml +++ b/pom.xml @@ -8,7 +8,7 @@ <modelVersion>4.0.0</modelVersion> <groupId>net.ihe.gazelle.tm</groupId> <artifactId>gazelle-tm</artifactId> - <version>10.0.0-NPD-834-SNAPSHOT</version> + <version>10.0.0-GZL-5400-SNAPSHOT</version> <packaging>pom</packaging> <modules> @@ -284,13 +284,13 @@ <dependency> <groupId>net.ihe.gazelle.tm</groupId> <artifactId>gazelle-tm-ejb</artifactId> - <version>10.0.0-NPD-834-SNAPSHOT</version> + <version>10.0.0-GZL-5400-SNAPSHOT</version> <type>ejb</type> </dependency> <dependency> <groupId>net.ihe.gazelle.tm</groupId> <artifactId>gazelle-tm-war</artifactId> - <version>10.0.0-NPD-834-SNAPSHOT</version> + <version>10.0.0-GZL-5400-SNAPSHOT</version> <type>war</type> </dependency> <dependency>