Mentions légales du service

Skip to content
Snippets Groups Projects
Commit cd1e61c2 authored by Guillaume Thomazon's avatar Guillaume Thomazon
Browse files

fix javadoc

git-svn-id: https://scm.gforge.inria.fr/authscm/ycadoret/svn/gazelle/Maven/gazelle-proxy/trunk@56179 356b4b1a-1d2b-0410-8bf1-ffa24008f01e
parent 0d6d0ab2
No related branches found
No related tags found
No related merge requests found
...@@ -14,8 +14,6 @@ import javax.ejb.Remove; ...@@ -14,8 +14,6 @@ import javax.ejb.Remove;
* *
* @author Cédric Eoche-Duval / KEREVAL Rennes IHE development Project * @author Cédric Eoche-Duval / KEREVAL Rennes IHE development Project
* @version 1.0 - 2015, October 23th * @version 1.0 - 2015, October 23th
* @class AbstractApplicationConfigurationManager.java
* @package net.ihe.gazelle.proxy.admin.gui
*/ */
public abstract class AbstractApplicationConfigurationManager { public abstract class AbstractApplicationConfigurationManager {
...@@ -33,6 +31,15 @@ public abstract class AbstractApplicationConfigurationManager { ...@@ -33,6 +31,15 @@ public abstract class AbstractApplicationConfigurationManager {
private String ipLoginAdmin; private String ipLoginAdmin;
private Boolean jmsCommunicationEnabled; private Boolean jmsCommunicationEnabled;
protected static String getApplicationProperty(String inPropertyKey) {
String value = ApplicationConfiguration.getValueOfVariable(inPropertyKey);
if (value == null) {
AbstractApplicationConfigurationManager.log.error(
"Variable '" + inPropertyKey + "' is missing in 'app_configuration' table.");
}
return value;
}
@Remove @Remove
@Destroy @Destroy
public void destroy() { public void destroy() {
...@@ -52,15 +59,6 @@ public abstract class AbstractApplicationConfigurationManager { ...@@ -52,15 +59,6 @@ public abstract class AbstractApplicationConfigurationManager {
ipLoginAdmin = null; ipLoginAdmin = null;
} }
protected static String getApplicationProperty(String inPropertyKey) {
String value = ApplicationConfiguration.getValueOfVariable(inPropertyKey);
if (value == null) {
AbstractApplicationConfigurationManager.log.error(
"Variable '" + inPropertyKey + "' is missing in 'app_configuration' table.");
}
return value;
}
public String getReleaseNoteUrl() { public String getReleaseNoteUrl() {
if (releaseNoteUrl == null) { if (releaseNoteUrl == null) {
releaseNoteUrl = getApplicationProperty("application_release_notes_url"); releaseNoteUrl = getApplicationProperty("application_release_notes_url");
...@@ -101,7 +99,7 @@ public abstract class AbstractApplicationConfigurationManager { ...@@ -101,7 +99,7 @@ public abstract class AbstractApplicationConfigurationManager {
* Returns true if the logged in user has role "admin_role" or if the * Returns true if the logged in user has role "admin_role" or if the
* application works without cas * application works without cas
* *
* @return * @return true if the logged in user has role "admin_role" or if the application works without cas
*/ */
public boolean isUserAllowedAsAdmin() { public boolean isUserAllowedAsAdmin() {
return Identity.instance().isLoggedIn() && Identity.instance().hasRole("admin_role"); return Identity.instance().isLoggedIn() && Identity.instance().hasRole("admin_role");
......
...@@ -35,9 +35,6 @@ import java.io.Serializable; ...@@ -35,9 +35,6 @@ import java.io.Serializable;
* *
* @author Anne-Gaëlle Bergé / INRIA Rennes IHE development Project * @author Anne-Gaëlle Bergé / INRIA Rennes IHE development Project
* @version 2.0 - 2015, October 23th, (by Cédric Eoche-Duval) * @version 2.0 - 2015, October 23th, (by Cédric Eoche-Duval)
* @class ApplicationConfigurationManager.java
* @package net.ihe.gazelle.simulator.common.action
* @see > Anne-Gaelle.Berge@inria.fr - http://www.ihe-europe.org
*/ */
@Name("applicationConfigurationManager") @Name("applicationConfigurationManager")
...@@ -58,6 +55,10 @@ public class ApplicationConfigurationManager extends AbstractApplicationConfigur ...@@ -58,6 +55,10 @@ public class ApplicationConfigurationManager extends AbstractApplicationConfigur
private String casUrl; private String casUrl;
private String dcmDumpPath; private String dcmDumpPath;
public static ApplicationConfigurationManager instance() {
return (ApplicationConfigurationManager) Component.getInstance("applicationConfigurationManager");
}
@Remove @Remove
@Destroy @Destroy
public void destroy() { public void destroy() {
...@@ -72,10 +73,6 @@ public class ApplicationConfigurationManager extends AbstractApplicationConfigur ...@@ -72,10 +73,6 @@ public class ApplicationConfigurationManager extends AbstractApplicationConfigur
casUrl = null; casUrl = null;
} }
public static ApplicationConfigurationManager instance() {
return (ApplicationConfigurationManager) Component.getInstance("applicationConfigurationManager");
}
public String getProxyIpAddresses() { public String getProxyIpAddresses() {
if (proxyIpAddresses == null) { if (proxyIpAddresses == null) {
proxyIpAddresses = getApplicationProperty("proxy_ip_addresses"); proxyIpAddresses = getApplicationProperty("proxy_ip_addresses");
......
package net.ihe.gazelle.proxy.admin.model; package net.ihe.gazelle.proxy.admin.model;
import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EntityManager;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import net.ihe.gazelle.hql.HQLQueryBuilder; import net.ihe.gazelle.hql.HQLQueryBuilder;
import javax.validation.constraints.NotNull;
import org.jboss.seam.Component; import org.jboss.seam.Component;
import org.jboss.seam.annotations.Name; import org.jboss.seam.annotations.Name;
import org.jboss.seam.security.Identity;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
/** import javax.persistence.*;
* @author Abderrazek Boufahja > INRIA Rennes IHE development Project import javax.validation.constraints.NotNull;
*/ import java.io.Serializable;
@Entity @Entity
@Name("applicationConfiguration") @Name("applicationConfiguration")
@Table(name = "app_configuration", schema = "public") @Table(name = "app_configuration", schema = "public")
...@@ -70,6 +56,45 @@ public class ApplicationConfiguration implements Serializable { ...@@ -70,6 +56,45 @@ public class ApplicationConfiguration implements Serializable {
// getters and setters // getters and setters
// ////////////////////////////////////////////////////////////////////// // //////////////////////////////////////////////////////////////////////
public static String getValueOfVariable(String variable) {
EntityManager entityManager = (EntityManager) Component.getInstance("entityManager");
return getValueOfVariable(variable, entityManager);
}
public static String getValueOfVariable(String variable, EntityManager entityManager) {
ApplicationConfigurationQuery query = new ApplicationConfigurationQuery(
new HQLQueryBuilder<ApplicationConfiguration>(entityManager, ApplicationConfiguration.class));
query.variable().eq(variable);
ApplicationConfiguration conf = query.getUniqueResult();
if (conf == null) {
return null;
} else {
return conf.getValue();
}
}
public static ApplicationConfiguration getApplicationConfigurationByVariable(String variable) {
ApplicationConfigurationQuery query = new ApplicationConfigurationQuery();
query.variable().eq(variable);
return query.getUniqueResult();
}
/**
* @param variable : string
* @return true only if the value of the variable fixed to "true"
*/
public static Boolean getBooleanValue(String variable) {
String val = getValueOfVariable(variable);
if (val == null) {
return false;
}
try {
return Boolean.valueOf(val);
} catch (Exception e) {
return false;
}
}
public Integer getId() { public Integer getId() {
return id; return id;
} }
...@@ -78,6 +103,9 @@ public class ApplicationConfiguration implements Serializable { ...@@ -78,6 +103,9 @@ public class ApplicationConfiguration implements Serializable {
this.id = id; this.id = id;
} }
// hashcode and equals
// //////////////////////////////////////////////////////////////////////
public String getVariable() { public String getVariable() {
return variable; return variable;
} }
...@@ -86,6 +114,9 @@ public class ApplicationConfiguration implements Serializable { ...@@ -86,6 +114,9 @@ public class ApplicationConfiguration implements Serializable {
this.variable = variable; this.variable = variable;
} }
// methods
// ///////////////////////////////////////////////////////////////////////////////////
public String getValue() { public String getValue() {
return value; return value;
} }
...@@ -94,9 +125,6 @@ public class ApplicationConfiguration implements Serializable { ...@@ -94,9 +125,6 @@ public class ApplicationConfiguration implements Serializable {
this.value = value; this.value = value;
} }
// hashcode and equals
// //////////////////////////////////////////////////////////////////////
public int hashCode() { public int hashCode() {
final int prime = 31; final int prime = 31;
int result = 1; int result = 1;
...@@ -133,46 +161,4 @@ public class ApplicationConfiguration implements Serializable { ...@@ -133,46 +161,4 @@ public class ApplicationConfiguration implements Serializable {
return true; return true;
} }
// methods
// ///////////////////////////////////////////////////////////////////////////////////
public static String getValueOfVariable(String variable) {
EntityManager entityManager = (EntityManager) Component.getInstance("entityManager");
return getValueOfVariable(variable, entityManager);
}
public static String getValueOfVariable(String variable, EntityManager entityManager) {
ApplicationConfigurationQuery query = new ApplicationConfigurationQuery(
new HQLQueryBuilder<ApplicationConfiguration>(entityManager, ApplicationConfiguration.class));
query.variable().eq(variable);
ApplicationConfiguration conf = query.getUniqueResult();
if (conf == null) {
return null;
} else {
return conf.getValue();
}
}
public static ApplicationConfiguration getApplicationConfigurationByVariable(String variable) {
ApplicationConfigurationQuery query = new ApplicationConfigurationQuery();
query.variable().eq(variable);
return query.getUniqueResult();
}
/**
* @param variable
* @return true only if the value of the variable fixed to "true"
*/
public static Boolean getBooleanValue(String variable) {
String val = getValueOfVariable(variable);
if (val == null) {
return false;
}
try {
return Boolean.valueOf(val);
} catch (Exception e) {
return false;
}
}
} }
package net.ihe.gazelle.proxy.admin.model; package net.ihe.gazelle.proxy.admin.model;
import java.io.Serializable;
import java.util.List;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EntityManager;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Lob;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;
import net.ihe.gazelle.hql.HQLQueryBuilder; import net.ihe.gazelle.hql.HQLQueryBuilder;
import javax.validation.constraints.NotNull;
import org.hibernate.annotations.Type; import org.hibernate.annotations.Type;
import org.jboss.seam.Component; import org.jboss.seam.Component;
import org.jboss.seam.annotations.Name; import org.jboss.seam.annotations.Name;
import org.jboss.seam.web.Locale; import org.jboss.seam.web.Locale;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.List;
@Entity @Entity
@Name("home") @Name("home")
@Table(name = "cmn_home", schema = "public", uniqueConstraints = @UniqueConstraint(columnNames = "iso3_language")) @Table(name = "cmn_home", schema = "public", uniqueConstraints = @UniqueConstraint(columnNames = "iso3_language"))
...@@ -59,6 +47,26 @@ public class Home implements Serializable { ...@@ -59,6 +47,26 @@ public class Home implements Serializable {
this.iso3Language = iso3Language; this.iso3Language = iso3Language;
} }
/**
* @return home
*/
public static Home getHomeForSelectedLanguage() {
String language = Locale.instance().getISO3Language();
if (language != null && !language.isEmpty()) {
EntityManager entityManager = (EntityManager) Component.getInstance("entityManager");
HQLQueryBuilder<Home> queryBuilder = new HQLQueryBuilder<Home>(entityManager, Home.class);
queryBuilder.addEq("iso3Language", language);
List<Home> homes = queryBuilder.getList();
if (homes != null && !homes.isEmpty()) {
return homes.get(0);
} else {
return new Home(language);
}
} else {
return null;
}
}
public Integer getId() { public Integer getId() {
return id; return id;
} }
...@@ -92,7 +100,7 @@ public class Home implements Serializable { ...@@ -92,7 +100,7 @@ public class Home implements Serializable {
} }
/** /**
* @return * @return home
*/ */
public Home save() { public Home save() {
EntityManager entityManager = (EntityManager) Component.getInstance("entityManager"); EntityManager entityManager = (EntityManager) Component.getInstance("entityManager");
...@@ -100,24 +108,4 @@ public class Home implements Serializable { ...@@ -100,24 +108,4 @@ public class Home implements Serializable {
entityManager.flush(); entityManager.flush();
return home; return home;
} }
/**
* @return
*/
public static Home getHomeForSelectedLanguage() {
String language = Locale.instance().getISO3Language();
if (language != null && !language.isEmpty()) {
EntityManager entityManager = (EntityManager) Component.getInstance("entityManager");
HQLQueryBuilder<Home> queryBuilder = new HQLQueryBuilder<Home>(entityManager, Home.class);
queryBuilder.addEq("iso3Language", language);
List<Home> homes = queryBuilder.getList();
if (homes != null && !homes.isEmpty()) {
return homes.get(0);
} else {
return new Home(language);
}
} else {
return null;
}
}
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment