package org.splat.simer;
-import java.util.Map;
import java.util.Comparator;
+import java.util.Map;
import java.util.ResourceBundle;
import javax.security.auth.login.LoginContext;
+import javax.servlet.http.HttpServletRequest;
-import com.opensymphony.xwork2.ActionSupport;
-
+import org.apache.struts2.interceptor.ServletRequestAware;
import org.apache.struts2.interceptor.SessionAware;
-import org.apache.log4j.Logger;
-import org.splat.kernel.User;
+import org.splat.dal.bo.kernel.User;
+import org.splat.dal.bo.som.DocumentType;
+import org.splat.dal.bo.som.SimulationContextType;
+import org.splat.dal.bo.som.Study;
+import org.splat.log.AppLogger;
+import org.splat.service.dto.KnowledgeElementDTO;
import org.splat.som.ApplicationRights;
-import org.splat.som.KnowledgeElement;
-import org.splat.som.SimulationContextType;
-import org.splat.som.Study;
-import org.splat.som.DocumentType;
+import org.splat.som.StudyRights;
import org.splat.wapp.Menu;
+import org.splat.wapp.PopupMenu;
+
+import com.opensymphony.xwork2.ActionSupport;
+
+/**
+ * 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 AppLogger LOG = AppLogger.getLogger(Action.class);
+
+ /**
+ * Open knowledge key in session.
+ */
+ public static final String KNOWLEDGE_OPEN = "knowledge.open";
+
+ /**
+ * Open study key in session.
+ */
+ public static final String STUDY_OPEN = "study.open";
+
+ /**
+ * User rights key in session.
+ */
+ public static final String USER_RIGHTS = "user.rights";
+
+ /**
+ * Login context key in session.
+ */
+ public static final String LOGIN_CONTEXT = "login.context";
+
+ /**
+ * Http servlet request.
+ */
+ private HttpServletRequest _servletRequest;
+ /**
+ * Http session container.
+ */
+ private Map<String, Object> _session;
+ /**
+ * Error code.
+ */
+ private String _errorCode;
+ /**
+ * The message to show when the page is loaded.
+ */
+ private String _message = "";
+ /**
+ * ActionType for specifying the type of the operaion.
+ */
+ private String _actionType;
+ /**
+ * Current open study facade object.
+ */
+ private OpenStudy _openStudy;
+ /**
+ * Current open knowledge facade object.
+ */
+ private OpenKnowledge _openKnowledge;
+
+ /**
+ * MenuBarSettings bean.
+ */
+ private MenuBarSettings _menuBarSettings;
+ /**
+ * Action context key. It is used at least in building a context help URL.
+ */
+ protected String _simanContext = "";
+
+ /**
+ * TitleBarSettings bean.
+ */
+ private TitleBarSettings _titleBarSettings;
+ /**
+ * ToolBarSettings bean.
+ */
+ private ToolBarSettings _toolBarSettings;
+
+ /**
+ * LeftMenuSettings bean.
+ */
+ private LeftMenuSettings _leftMenuSettings;
+
+ /**
+ * Injected application settings bean.
+ */
+ private ApplicationSettings _applicationSettings;
+ /**
+ * Value of the menu property. It can be: none, create, open, study, knowledge, sysadmin, help.
+ */
+ private String _menuProperty;
+ /**
+ * Value of the tool bar property. It can be: none, standard, study, back.
+ */
+ private String _toolProperty;
+
+ /**
+ * Comparator for sorting document types with localized names.
+ */
+ public class DocumentTypeComparator implements Comparator<DocumentType> {
+ /**
+ * {@inheritDoc}
+ *
+ * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
+ */
+ public int compare(final DocumentType t1, final DocumentType t2) {
+ ResourceBundle locale = ResourceBundle.getBundle("som",
+ getApplicationSettings().getCurrentLocale());
+ String name1 = t1.getName();
+ if (t1.isApproved()) {
+ name1 = locale.getString("type.document." + name1);
+ }
+ String name2 = t2.getName();
+ if (t2.isApproved()) {
+ name2 = locale.getString("type.document." + name2);
+ }
+
+ return name1.compareToIgnoreCase(name2);
+ }
+ }
+
+ /**
+ * Comparator for sorting simulation context types with localized names.
+ */
+ public class ContextTypeComparator implements
+ Comparator<SimulationContextType> {
+ /**
+ * {@inheritDoc}
+ *
+ * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
+ */
+ public int compare(final SimulationContextType t1,
+ final SimulationContextType t2) {
+ ResourceBundle locale = ResourceBundle.getBundle("som",
+ getApplicationSettings().getCurrentLocale());
+ String name1 = t1.getName();
+ if (t1.isApproved()) {
+ name1 = locale.getString("type.context." + name1);
+ }
+ String name2 = t2.getName();
+ if (t2.isApproved()) {
+ name2 = locale.getString("type.context." + name2);
+ }
+
+ return name1.compareToIgnoreCase(name2);
+ }
+ }
+
+ // ==============================================================================================================================
+ // Session services
+ // ==============================================================================================================================
+
+ /**
+ * Remove the currently open knowledge from the session.
+ */
+ protected void closeKnowledge() {
+ AbstractOpenObject open = (AbstractOpenObject) _session
+ .remove(KNOWLEDGE_OPEN);
+ if ((open != null) && (_session.get(STUDY_OPEN) == null)) {
+ open.clearFacades(); // For eventually reopening the knowledge from a fresh context
+ }
+ }
+
+ /**
+ * Remove the currently open study from the session.
+ */
+ protected void closeStudy() {
+ AbstractOpenObject open = (AbstractOpenObject) _session
+ .remove(STUDY_OPEN);
+ if ((open != null) && (_session.get(KNOWLEDGE_OPEN) == null)) {
+ open.clearFacades(); // For eventually reopening the study from a fresh context
+ }
+ }
+
+ /**
+ * Connect the given user to SIMAN. Store his rights and login context in HTTP session.
+ *
+ * @param context
+ * login context
+ * @param user
+ * the user to connect
+ */
+ protected void connect(final LoginContext context, final User user) {
+ OpenStudy open = getOpenStudy();
+ if (open != null) {
+ open.changeUser(user);
+ }
+ _session.put(USER_RIGHTS, new ApplicationRights(user));
+ _session.put(LOGIN_CONTEXT, context); // For executing the deconnection, when requested
+ }
+
+ /**
+ * Disconnect the currently connected user from SIMAN. Remove his rihgts and login context from the session.
+ */
+ protected void disconnect() {
+ OpenStudy open = getOpenStudy();
+ if (open != null) {
+ open.changeUser(null);
+ }
+ _session.put(USER_RIGHTS, new ApplicationRights(null)); // Disables user rights
+ _session.remove(LOGIN_CONTEXT);
+ }
+
+ /**
+ * Get the currently connected user from HTTP session.
+ *
+ * @return the user
+ */
+ public User getConnectedUser() {
+ ApplicationRights rights = (ApplicationRights) _session
+ .get(USER_RIGHTS);
+ User connected = null;
+ if (rights != null) {
+ connected = rights.getUser();
+ }
+ return connected; // May be null
+ }
+
+ /**
+ * Get a menu named as "menu." with the given suffix from HTTP session.
+ *
+ * @param name
+ * the menu name suffix
+ * @return the menu
+ */
+ protected Menu getMenu(final String name) {
+ return (Menu) _session.get("menu." + name);
+ }
+
+ /**
+ * Open knowledge setter.
+ *
+ * @param kelm
+ * the OpenKnowledge to set
+ */
+ public void setOpenKnowledge(final OpenKnowledge kelm) {
+ _openKnowledge = kelm;
+ }
+
+ /**
+ * Open knowledge getter.
+ *
+ * @return the currently open knowledge wrapper. May be null
+ */
+ protected OpenKnowledge getOpenKnowledge() {
+ // _openKnowledge = (OpenKnowledge)session.get(KNOWLEDGE_OPEN); // May be null
+ return _openKnowledge;
+ }
+
+ /**
+ * Open study setter.
+ *
+ * @param aStudy
+ * the OpenStudy to set
+ */
+ public void setOpenStudy(final OpenStudy aStudy) {
+ _openStudy = aStudy;
+ }
+
+ /**
+ * Open study getter.
+ *
+ * @return the currently open stydy wrapper. May be null.
+ */
+ public OpenStudy getOpenStudy() {
+ // _openStudy = (OpenStudy)session.get(STUDY_OPEN);
+ return _openStudy; // May be null
+ }
+
+ /**
+ * Open the given knowledge in the current HTTP session. Replace the previose one in the session if any.
+ *
+ * @param kelm
+ * the knowledge element to open
+ * @return OpenKnowledge wrapper object
+ */
+ protected OpenKnowledge open(final KnowledgeElementDTO kelm) {
+ OpenKnowledge open = _openKnowledge.open(kelm);
+
+ closeKnowledge(); // Just in case
+ _session.put(KNOWLEDGE_OPEN, open);
+ return open;
+ }
+
+ /**
+ * Open the given study in the current HTTP session. Replace the previose one in the session if any.
+ *
+ * @param study
+ * the study to open
+ * @return OpenStudy wrapper object
+ */
+ protected OpenStudy open(final Study study) {
+ OpenStudy open = _openStudy.open(getConnectedUser(), study); // The connected user may be null
+
+ closeStudy(); // Just in case
+ _session.put(STUDY_OPEN, open);
+ return open;
+ }
+
+ /**
+ * Initialization the Context for menubar and toolbar.
+ */
+ public void initializationContext() {
+ getMenuBarSettings().initializeInitialMenuProperties();
+
+ if (_session.get(STUDY_OPEN) == null) {
+ getMenuBarSettings().setIsStudyNull(true);
+ } else {
+ getMenuBarSettings().setIsStudyNull(false);
+
+ // for initialization ToolBarSettings.canUserEdit property
+ // and ToolBarSettings.isEnabledScript property.
+ OpenStudy currentStudy = (OpenStudy) _session.get(STUDY_OPEN);
+ PopupMenu popup = currentStudy.getPopup();
+ StudyRights user = currentStudy.getStudyRights();
+
+ if (user.canEditProperties()) {
+ getToolBarSettings().setCanUserEdit(true);
+ } else {
+ getToolBarSettings().setCanUserEdit(false);
+ }
+
+ if (popup == null) {
+ getToolBarSettings().setIsEnabledScript(false);
+ } else if (popup.isEnabled("script")) {
+ getToolBarSettings().setIsEnabledScript(true);
+ } else {
+ getToolBarSettings().setIsEnabledScript(false);
+ }
+ }
+
+ if (_session.get(KNOWLEDGE_OPEN) == null) {
+ getMenuBarSettings().setIsKnowledgeNull(true);
+ } else {
+ getMenuBarSettings().setIsKnowledgeNull(false);
+ }
+
+ ApplicationRights userRights = (ApplicationRights) _session
+ .get(USER_RIGHTS);
+
+ if ((userRights != null) && userRights.canCreateStudy()) {
+ getMenuBarSettings().setCanUserCreateStudy(true);
+ } else {
+ getMenuBarSettings().setCanUserCreateStudy(false);
+ }
+
+ if ((userRights != null) && userRights.canManageDatabase()) {
+ getMenuBarSettings().setCanUserManageDatabase(true);
+ } else {
+ getMenuBarSettings().setCanUserManageDatabase(false);
+ }
+
+ }
+
+ /**
+ * Initialization the Context for left menu.
+ *
+ * @param leftMenuProperty -
+ * the property of the left menu.
+ */
+ public void initializationContextLeftMenus(final String leftMenuProperty) {
+
+ Menu menu = (Menu) _session.get("menu." + leftMenuProperty);
+
+ getLeftMenuSettings().setMenu(menu);
+ if (menu != null) {
+ getLeftMenuSettings().setMenuName(menu.getName());
+ getLeftMenuSettings().setMenuNamespace(menu.getNamespace());
+ }
+ }
+
+ /**
+ * Initialization the Context for Menu Bar and Tool Bar.
+ *
+ * @param titleProperty -
+ * The title of the open study/knowledge.
+ * @param editDisabledProperty -
+ * Property that indicates whether the current open study is editable or not.
+ */
+ public void initializationContext(final String titleProperty,
+ final String editDisabledProperty) {
+
+ initializationContext();
+
+ AbstractOpenObject entity = (AbstractOpenObject) _session
+ .get(titleProperty + ".open");
+
+ if (entity != null) {
+ getTitleBarSettings().setProgressState(
+ entity.getProgressState().toString());
+ getTitleBarSettings().setSelectionState(entity.getSelection());
+ getTitleBarSettings().setEntryType(entity.getType().toLowerCase());
+ getTitleBarSettings().setEntryTypeTitle(entity.getTypeName());
+ getTitleBarSettings().setEntryTitle(entity.getTitle());
+ }
+ getTitleBarSettings().setEditDisabledProperty(editDisabledProperty);
+ }
+
+ /**
+ * Initialization of the screen context for menu bar.
+ *
+ * @param menuProperty -
+ * the property of the menu bar.
+ */
+ public void initializationScreenContext(final String menuProperty) {
+
+ initializationContext();
+ setMenuProperty(menuProperty);
+ getMenuBarSettings().intializeMenuBar(menuProperty);
+ }
+
+ /**
+ * Initialization of the screen context for menu bar and title bar.
+ *
+ * @param menuProperty -
+ * the property of the menu bar.
+ * @param titleProperty -
+ * The title of the open study/knowledge.
+ * @param editDisabledProperty -
+ * Property that indicates whether the current open study is editable or not.
+ */
+ public void initializationScreenContext(final String menuProperty,
+ final String titleProperty, final String editDisabledProperty) {
+
+ initializationContext(titleProperty, editDisabledProperty);
+ setMenuProperty(menuProperty);
+ getMenuBarSettings().intializeMenuBar(menuProperty);
+ }
+
+ /**
+ * Initialization of the screen context for menu bar, title bar and tool bar.
+ *
+ * @param menuProperty -
+ * the property of the menu bar.
+ * @param titleProperty -
+ * The title of the open study/knowledge.
+ * @param editDisabledProperty -
+ * Property that indicates whether the current open study is editable or not.
+ * @param toolProperty -
+ * the property of the tool bar.
+ */
+ public void initializationScreenContext(final String menuProperty,
+ final String titleProperty, final String editDisabledProperty,
+ final String toolProperty) {
+
+ initializationScreenContext(menuProperty, titleProperty,
+ editDisabledProperty);
+ getToolBarSettings().intializeMenuBar(toolProperty);
+ }
+
+ /**
+ * Initialization of the screen context for menu bar and tool bar.
+ *
+ * @param menuProperty -
+ * the property of the menu bar.
+ * @param toolProperty -
+ * the property of the tool bar.
+ */
+ public void initializationScreenContext(final String menuProperty,
+ final String toolProperty) {
+
+ initializationContext();
+ setMenuProperty(menuProperty);
+ getMenuBarSettings().intializeMenuBar(menuProperty);
+ getToolBarSettings().intializeMenuBar(toolProperty);
+ }
+
+ /**
+ * Initialization of the screen context for menu bar, title bar and tool bar.
+ *
+ * @param menuProperty -
+ * the property of the menu bar.
+ * @param titleProperty -
+ * The title of the open study/knowledge.
+ * @param editDisabledProperty -
+ * Property that indicates whether the current open study is editable or not.
+ * @param toolProperty -
+ * the property of the tool bar.
+ * @param leftMenuProperty -
+ * the property of the left menu.
+ */
+ public void initializationFullScreenContext(final String menuProperty,
+ final String titleProperty, final String editDisabledProperty,
+ final String toolProperty, final String leftMenuProperty) {
+
+ initializationScreenContext(menuProperty, titleProperty,
+ editDisabledProperty);
+ initializationContextLeftMenus(leftMenuProperty);
+ getToolBarSettings().intializeMenuBar(toolProperty);
+ }
+
+ /**
+ * Initialization of the screen context for menu bar and tool bar.
+ *
+ * @param menuProperty -
+ * the property of the menu bar.
+ * @param toolProperty -
+ * the property of the tool bar.
+ * @param leftMenuProperty -
+ * the property of the left menu.
+ */
+ public void initializationFullScreenContext(final String menuProperty,
+ final String toolProperty, final String leftMenuProperty) {
+
+ initializationContext();
+ initializationContextLeftMenus(leftMenuProperty);
+ setMenuProperty(menuProperty);
+ getMenuBarSettings().intializeMenuBar(menuProperty);
+ getToolBarSettings().intializeMenuBar(toolProperty);
+ }
+
+ // ==============================================================================================================================
+ // Getters and setters
+ // ==============================================================================================================================
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.apache.struts2.interceptor.ServletRequestAware#setServletRequest(javax.servlet.http.HttpServletRequest)
+ */
+ public void setServletRequest(final HttpServletRequest request) {
+ this._servletRequest = request;
+ }
+
+ /**
+ * Get current HTTP request.
+ *
+ * @return HTTP request
+ */
+ public HttpServletRequest getServletRequest() {
+ return _servletRequest;
+ }
+
+ /**
+ * Get current error code.
+ *
+ * @return error code
+ */
+ public String getErrorCode() {
+ return _errorCode;
+ }
+
+ /**
+ * Get session map.
+ *
+ * @return session map
+ */
+ public Map<String, Object> getSession() {
+ return _session;
+ }
+
+ /**
+ * Set error code.
+ *
+ * @param code
+ * the error code to set
+ */
+ public void setErrorCode(final String code) {
+ this._errorCode = code;
+ this.setMessage(getText(code));
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.apache.struts2.interceptor.SessionAware#setSession(java.util.Map)
+ */
+ public void setSession(final Map<String, Object> session) {
+ this._session = session;
+ }
+
+ /**
+ * Get the menuBarSettings.
+ *
+ * @return the menuBarSettings
+ */
+ public MenuBarSettings getMenuBarSettings() {
+ return _menuBarSettings;
+ }
+
+ /**
+ * Set the menuBarSettings.
+ *
+ * @param menuBarSettings
+ * the menuBarSettings to set
+ */
+ public void setMenuBarSettings(final MenuBarSettings menuBarSettings) {
+ _menuBarSettings = menuBarSettings;
+ }
+
+ /**
+ * Get the _titleBarSettings.
+ *
+ * @return the _titleBarSettings
+ */
+ public TitleBarSettings getTitleBarSettings() {
+ return _titleBarSettings;
+ }
+
+ /**
+ * Set the titleBarSettings.
+ *
+ * @param titleBarSettings
+ * the titleBarSettings to set
+ */
+ public void setTitleBarSettings(final TitleBarSettings titleBarSettings) {
+ _titleBarSettings = titleBarSettings;
+ }
+
+ /**
+ * Get the toolBarSettings.
+ *
+ * @return the toolBarSettings
+ */
+ public final ToolBarSettings getToolBarSettings() {
+ return _toolBarSettings;
+ }
+
+ /**
+ * Set the toolBarSettings.
+ *
+ * @param toolBarSettings
+ * the toolBarSettings to set
+ */
+ public final void setToolBarSettings(final ToolBarSettings toolBarSettings) {
+ _toolBarSettings = toolBarSettings;
+ }
+
+ /**
+ * Get the applicationSettings.
+ *
+ * @return the applicationSettings
+ */
+ public ApplicationSettings getApplicationSettings() {
+ return _applicationSettings;
+ }
+
+ /**
+ * Set the applicationSettings.
+ *
+ * @param applicationSettings
+ * the applicationSettings to set
+ */
+ public void setApplicationSettings(
+ final ApplicationSettings applicationSettings) {
+ _applicationSettings = applicationSettings;
+ }
+
+ /**
+ * Get the leftMenuSettings.
+ *
+ * @return the leftMenuSettings
+ */
+ public LeftMenuSettings getLeftMenuSettings() {
+ return _leftMenuSettings;
+ }
+
+ /**
+ * Set the leftMenuSettings.
+ *
+ * @param leftMenuSettings
+ * the leftMenuSettings to set
+ */
+ public void setLeftMenuSettings(final LeftMenuSettings leftMenuSettings) {
+ _leftMenuSettings = leftMenuSettings;
+ }
+
+ /**
+ * Get the actionType.
+ *
+ * @return the actionType
+ */
+ public String getActionType() {
+ return _actionType;
+ }
+
+ /**
+ * Set the actionType.
+ *
+ * @param actionType
+ * the actionType to set
+ */
+ public void setActionType(final String actionType) {
+ _actionType = actionType;
+ }
+
+ /**
+ * Get the message.
+ *
+ * @return the message
+ */
+ public String getMessage() {
+ return _message;
+ }
+
+ /**
+ * Set the message.
+ *
+ * @param message
+ * the message to set
+ */
+ public void setMessage(final String message) {
+ _message = message;
+ }
+
+ /**
+ * Get the menuProperty.
+ *
+ * @return the menuProperty
+ */
+ public String getMenuProperty() {
+ return _menuProperty;
+ }
+
+ /**
+ * Get the toolProperty.
+ *
+ * @return the toolProperty
+ */
+ public String getToolProperty() {
+ return _toolProperty;
+ }
+
+ /**
+ * Set the menuProperty.
+ *
+ * @param menuProperty
+ * the menuProperty to set
+ */
+ public void setMenuProperty(final String menuProperty) {
+ this._menuProperty = menuProperty;
+ }
+
+ /**
+ * Set the toolProperty.
+ *
+ * @param toolProperty
+ * the toolProperty to set
+ */
+ public void setToolProperty(final String toolProperty) {
+ _toolProperty = toolProperty;
+ }
+
+ /**
+ * Get the simanContext.
+ * @return the simanContext
+ */
+ public String getSimanContext() {
+ return _simanContext;
+ }
-public class Action extends ActionSupport implements SessionAware {
-
- private Map<String, Object> session;
- private String mercode;
-
- private static final long serialVersionUID = -895295026709526501L;
- protected static final Logger logger = Logger.getLogger(Action.class);
-
- public class DocumentTypeComparator implements Comparator<DocumentType> {
-// -----------------------------------------------------------------------
- public int compare(DocumentType t1, DocumentType t2)
- {
- ResourceBundle locale = ResourceBundle.getBundle("som", ApplicationSettings.getCurrentLocale());
- String name1 = t1.getName();
- if (t1.isApproved()) name1 = locale.getString("type.document." + name1);
- String name2 = t2.getName();
- if (t2.isApproved()) name2 = locale.getString("type.document." + name2);
-
- return name1.compareToIgnoreCase(name2);
- }
- }
- public class ContextTypeComparator implements Comparator<SimulationContextType> {
-// --------------------------------------------------------------------------------
- public int compare(SimulationContextType t1, SimulationContextType t2)
- {
- ResourceBundle locale = ResourceBundle.getBundle("som", ApplicationSettings.getCurrentLocale());
- String name1 = t1.getName();
- if (t1.isApproved()) name1 = locale.getString("type.context." + name1);
- String name2 = t2.getName();
- if (t2.isApproved()) name2 = locale.getString("type.context." + name2);
-
- return name1.compareToIgnoreCase(name2);
- }
- }
-
-// ==============================================================================================================================
-// Session services
-// ==============================================================================================================================
-
- 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);
- }
- session.put("user.rights", new ApplicationRights(user) );
- session.put("login.context", context); // For executing the deconnection, when requested
- }
- protected void disconnect () {
-// ----------------------------
- OpenStudy open = getOpenStudy();
- if (open != null) {
- open.changeUser(null);
- }
- session.put("user.rights", new ApplicationRights(null) ); // Disables user rights
- 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);
- }
- protected OpenKnowledge getOpenKnowledge () {
-// -------------------------------------------
- return (OpenKnowledge)session.get("knowledge.open"); // May be null
- }
- protected OpenStudy getOpenStudy () {
-// -----------------------------------
- return (OpenStudy)session.get("study.open"); // May be null
- }
- protected OpenKnowledge open (KnowledgeElement kelm) {
-// ----------------------------------------------------
- OpenKnowledge open = new OpenKnowledge(kelm);
-
- closeKnowledge(); // Just in case
- session.put("knowledge.open", open);
- return open;
- }
- protected OpenStudy open (Study study) {
-// --------------------------------------
- OpenStudy open = new OpenStudy(getConnectedUser(), study); // The connected user may be null
-
- closeStudy(); // Just in case
- session.put("study.open", open);
- return open;
- }
-// ==============================================================================================================================
-// Getters and setters
-// ==============================================================================================================================
-
- 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;
+ /**
+ * Set the simanContext.
+ * @param simanContext the simanContext to set
+ */
+ public void setSimanContext(final String simanContext) {
+ _simanContext = simanContext;
}
}
\ No newline at end of file