Salome HOME
app.root property is removed.
[tools/siman.git] / Workspace / Siman / src / org / splat / simer / Action.java
index 000d511d70f36d410cd95f880f809e9f52d0333c..74517cd57e92daf89ed2701c9d8610e74b355b66 100644 (file)
@@ -9,7 +9,6 @@ import javax.servlet.http.HttpServletRequest;
 
 import com.opensymphony.xwork2.ActionSupport;
 
-import org.apache.struts2.ServletActionContext;
 import org.apache.struts2.interceptor.ServletRequestAware;
 import org.apache.struts2.interceptor.SessionAware;
 import org.apache.log4j.Logger;
@@ -22,13 +21,42 @@ import org.splat.dal.bo.som.DocumentType;
 import org.splat.wapp.Menu;
 
 
+/**
+ * Base Siman action.
+ */
 public class Action extends ActionSupport implements ServletRequestAware, SessionAware {
 
+       /**
+        * Serial version ID.
+        */
+       private   static final long    serialVersionUID = -895295026709526501L;
+       /**
+        * Action logger.
+        */
+    protected static final Logger  logger           = Logger.getLogger(Action.class);
+
+       /**
+        * Http servlet request.
+        */
+       private HttpServletRequest  request;
+       /**
+        * Http session container.
+        */
        private   Map<String, Object>  session;
+       /**
+        * Error code.
+        */
        private   String               mercode;
+       /**
+        * Current open study facade object.
+        */
        private OpenStudy _openStudy;
+       /**
+        * Current open knowledge facade object.
+        */
        private OpenKnowledge _openKnowledge;
        
+       
        /**
         * MenuBarSettings bean.
         */
@@ -38,20 +66,12 @@ public class Action extends ActionSupport implements ServletRequestAware, Sessio
         * TitleBarSettings bean.
         */
        private TitleBarSettings _titleBarSettings;
-
-       private HttpServletRequest  request;
-
-       /**
-        * Serial version ID.
-        */
-       private   static final long    serialVersionUID = -895295026709526501L;
        /**
-        * Action logger.
+        * Injected application settings bean.
         */
-    protected static final Logger  logger           = Logger.getLogger(Action.class);
+       private ApplicationSettings _applicationSettings;
 
     public class DocumentTypeComparator implements Comparator<DocumentType> {
-//  -----------------------------------------------------------------------
       public int compare(DocumentType t1, DocumentType t2)
       {
         ResourceBundle       locale = ResourceBundle.getBundle("som", ApplicationSettings.getCurrentLocale());
@@ -64,7 +84,6 @@ public class Action extends ActionSupport implements ServletRequestAware, Sessio
       }
     }
     public class ContextTypeComparator  implements Comparator<SimulationContextType> {
-//  --------------------------------------------------------------------------------
       public int compare(SimulationContextType t1, SimulationContextType t2)
       {
         ResourceBundle       locale = ResourceBundle.getBundle("som", ApplicationSettings.getCurrentLocale());
@@ -82,21 +101,18 @@ public class Action extends ActionSupport implements ServletRequestAware, Sessio
 //  ==============================================================================================================================
 
     protected void closeKnowledge () {
-//  --------------------------------
       OpenObject open = (OpenObject)session.remove("knowledge.open");
       if (open != null) {
         if (session.get("study.open") == null) open.clearFacades();      // For eventually reopening the knowledge from a fresh context
       }
     }
     protected void closeStudy () {
-//  ----------------------------
       OpenObject open = (OpenObject)session.remove("study.open");
       if (open != null) {
         if (session.get("knowledge.open") == null) open.clearFacades();  // For eventually reopening the study from a fresh context
       }
     }
     protected void connect (LoginContext context, User user) {
-//  --------------------------------------------------------
       OpenStudy  open = getOpenStudy();
       if (open != null) {
           open.changeUser(user);
@@ -105,7 +121,6 @@ public class Action extends ActionSupport implements ServletRequestAware, Sessio
       session.put("login.context", context);                             // For executing the deconnection, when requested
     }
     protected void disconnect () {
-//  ----------------------------
       OpenStudy  open = getOpenStudy();
       if (open != null) {
           open.changeUser(null);
@@ -114,12 +129,10 @@ public class Action extends ActionSupport implements ServletRequestAware, Sessio
       session.remove("login.context");
     }
     protected User getConnectedUser () {
-//  ----------------------------------
       ApplicationRights  rights = (ApplicationRights)session.get("user.rights");
       return rights.getUser();                                           // May be null
     }
     protected Menu getMenu (String name) {
-//  ------------------------------------
       return (Menu)session.get("menu." + name);
     }
     public void setOpenKnowledge (OpenKnowledge kelm) {
@@ -137,7 +150,6 @@ public class Action extends ActionSupport implements ServletRequestAware, Sessio
           return _openStudy;                       // May be null
         }
     protected OpenKnowledge open (KnowledgeElement kelm) {
-//  ----------------------------------------------------
       OpenKnowledge open = _openKnowledge.open(kelm);
 
       closeKnowledge();   // Just in case
@@ -145,8 +157,7 @@ public class Action extends ActionSupport implements ServletRequestAware, Sessio
          return open;
     }
     protected OpenStudy open (Study study) {
-//  --------------------------------------
-         OpenStudy open = _openStudy.open(getConnectedUser(), study);         // The connected user may be null
+         OpenStudy open = _openStudy.open(getConnectedUser(), study);         // The connected user may be null
 
       closeStudy();       // Just in case
          session.put("study.open", open);
@@ -243,20 +254,16 @@ public class Action extends ActionSupport implements ServletRequestAware, Sessio
        }
 
     public String getErrorCode () {
-//  -----------------------------
       return mercode;
     }
     public Map<String, Object> getSession () {
-//  ----------------------------------------
       return session;
     }
 
     public void setErrorCode (String code) {
-//  --------------------------------------
       this.mercode = code;
     }
        public void setSession (Map<String, Object> session) {
-//  ----------------------------------------------------               
          this.session = session;
        }
        
@@ -290,4 +297,18 @@ public class Action extends ActionSupport implements ServletRequestAware, Sessio
        public void setTitleBarSettings(TitleBarSettings titleBarSettings) {
                _titleBarSettings = titleBarSettings;
        }
+       /**
+        * Get the applicationSettings.
+        * @return the applicationSettings
+        */
+       public ApplicationSettings getApplicationSettings() {
+               return _applicationSettings;
+       }
+       /**
+        * Set the applicationSettings.
+        * @param applicationSettings the applicationSettings to set
+        */
+       public void setApplicationSettings(ApplicationSettings applicationSettings) {
+               _applicationSettings = applicationSettings;
+       }
 }
\ No newline at end of file