Salome HOME
Remove the scenario functionality is implemented
[tools/siman.git] / Workspace / Siman / src / org / splat / simer / StartAction.java
1 package org.splat.simer;
2
3 import java.util.Map;
4
5 import org.splat.som.ApplicationRights;
6 import org.splat.wapp.Constants;
7
8 /**
9  * Start application action. Initializes application settings.
10  */
11 public class StartAction extends Action {
12         /**
13          * Serial version ID.
14          */
15         private static final long serialVersionUID = 5875058140682652964L;
16
17         // ==============================================================================================================================
18         // Action execution
19         // ==============================================================================================================================
20
21         /**
22          * Initialize application.
23          * 
24          * @return SUCCESS if succeeded, ERROR - if exception is caught
25          */
26         public String doInitialize() {
27                 StringBuffer wappurl = getServletRequest().getRequestURL(); // "http://{server}:{port}/{webapp}/", including the leading '/'
28                 String res = SUCCESS;
29
30                 LOG.info(new StringBuffer("Initializing ").append(wappurl)
31                                 .append("...").toString());
32                 try {
33                         ApplicationSettings wapp = getApplicationSettings();
34                         wapp.setLocale(this.getLocale());
35                         String root = ApplicationSettings.getApplicationRootPath();
36                         LOG.debug("Application root: " + root);
37
38                         // Configure menus for the current user
39                         wapp.configure();
40
41                         // Initialization of the user session
42                         Map<String, Object> session = getSession();
43
44                         session.put("user.rights", new ApplicationRights(null)); // No user connected yet
45                         session.put("study.filter", wapp.getFilter(Constants.STUDY_MENU));
46                         session.put("knowledge.filter", wapp
47                                         .getFilter(Constants.KNOWLEDGE_MENU));
48
49                         initializationScreenContext(Constants.NONE);
50
51                 } catch (Exception error) {
52                         LOG.fatal("Reason:", error);
53
54                         initializationFullScreenContext(Constants.STUDY_MENU,
55                                         Constants.STUDY_MENU, Constants.TRUE, Constants.NONE,
56                                         Constants.STUDY_MENU);
57
58                         res = ERROR;
59                 }
60                 return res;
61         }
62 }