import javax.security.auth.login.LoginContext;
import javax.servlet.http.HttpServletRequest;
-import org.apache.log4j.Logger;
import org.apache.struts2.interceptor.ServletRequestAware;
import org.apache.struts2.interceptor.SessionAware;
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.StudyRights;
/**
* Action logger.
*/
- protected static final Logger LOG = Logger.getLogger(Action.class);
+ protected static final AppLogger LOG = AppLogger.getLogger(Action.class);
/**
* Open knowledge key in 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.
*/
* MenuBarSettings bean.
*/
private MenuBarSettings _menuBarSettings;
+ /**
+ * Action context key. It is used at least in building a context help URL.
+ */
+ protected String _simanContext = "";
/**
* TitleBarSettings bean.
* Injected application settings bean.
*/
private ApplicationSettings _applicationSettings;
-
/**
- * Will be removed!!! It's temporary solution for menuitem.jsp
+ * Value of the menu property. It can be: none, create, open, study, knowledge, sysadmin, help.
*/
- private static Menu staticMenu;
+ 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 int compare(final DocumentType t1, final DocumentType t2) {
ResourceBundle locale = ResourceBundle.getBundle("som",
- ApplicationSettings.getCurrentLocale());
+ getApplicationSettings().getCurrentLocale());
String name1 = t1.getName();
if (t1.isApproved()) {
name1 = locale.getString("type.document." + name1);
public int compare(final SimulationContextType t1,
final SimulationContextType t2) {
ResourceBundle locale = ResourceBundle.getBundle("som",
- ApplicationSettings.getCurrentLocale());
+ getApplicationSettings().getCurrentLocale());
String name1 = t1.getName();
if (t1.isApproved()) {
name1 = locale.getString("type.context." + name1);
* Remove the currently open knowledge from the session.
*/
protected void closeKnowledge() {
- OpenObject open = (OpenObject) _session.remove(KNOWLEDGE_OPEN);
+ 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() {
- OpenObject open = (OpenObject) _session.remove(STUDY_OPEN);
+ 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
}
Menu menu = (Menu) _session.get("menu." + leftMenuProperty);
getLeftMenuSettings().setMenu(menu);
- setStaticMenu(menu);
- getLeftMenuSettings().setMenuName(menu.getName());
- getLeftMenuSettings().setMenuNamespace(menu.getNamespace());
+ if (menu != null) {
+ getLeftMenuSettings().setMenuName(menu.getName());
+ getLeftMenuSettings().setMenuNamespace(menu.getNamespace());
+ }
}
/**
initializationContext();
- OpenObject entity = (OpenObject) _session.get(titleProperty + ".open");
+ AbstractOpenObject entity = (AbstractOpenObject) _session
+ .get(titleProperty + ".open");
- getTitleBarSettings().setProgressState(
- entity.getProgressState().toString());
- getTitleBarSettings().setSelectionState(entity.getSelection());
- getTitleBarSettings().setEntryType(entity.getType().toLowerCase());
- getTitleBarSettings().setEntryTypeTitle(entity.getType());
- getTitleBarSettings().setEntryTitle(entity.getTitle());
+ 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);
}
public void initializationScreenContext(final String menuProperty) {
initializationContext();
+ setMenuProperty(menuProperty);
getMenuBarSettings().intializeMenuBar(menuProperty);
}
final String titleProperty, final String editDisabledProperty) {
initializationContext(titleProperty, editDisabledProperty);
+ setMenuProperty(menuProperty);
getMenuBarSettings().intializeMenuBar(menuProperty);
}
final String toolProperty) {
initializationContext();
+ setMenuProperty(menuProperty);
getMenuBarSettings().intializeMenuBar(menuProperty);
getToolBarSettings().intializeMenuBar(toolProperty);
}
initializationContext();
initializationContextLeftMenus(leftMenuProperty);
+ setMenuProperty(menuProperty);
getMenuBarSettings().intializeMenuBar(menuProperty);
getToolBarSettings().intializeMenuBar(toolProperty);
}
*/
public void setErrorCode(final String code) {
this._errorCode = code;
+ this.setMessage(getText(code));
}
/**
}
/**
- * Get the staticMenu.
+ * Set the leftMenuSettings.
*
- * @return the staticMenu
+ * @param leftMenuSettings
+ * the leftMenuSettings to set
*/
- public static Menu getStaticMenu() {
- return staticMenu;
+ public void setLeftMenuSettings(final LeftMenuSettings leftMenuSettings) {
+ _leftMenuSettings = leftMenuSettings;
}
/**
- * Set the staticMenu.
+ * Get the actionType.
*
- * @param staticMenu
- * the staticMenu to set
+ * @return the actionType
*/
- public static void setStaticMenu(final Menu staticMenu) {
- Action.staticMenu = staticMenu;
+ public String getActionType() {
+ return _actionType;
}
/**
- * Set the leftMenuSettings.
+ * Set the actionType.
*
- * @param leftMenuSettings
- * the leftMenuSettings to set
+ * @param actionType
+ * the actionType to set
*/
- public void setLeftMenuSettings(final LeftMenuSettings leftMenuSettings) {
- _leftMenuSettings = leftMenuSettings;
+ 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;
+ }
+
+ /**
+ * Set the simanContext.
+ * @param simanContext the simanContext to set
+ */
+ public void setSimanContext(final String simanContext) {
+ _simanContext = simanContext;
+ }
}
\ No newline at end of file