From: mka Date: Thu, 25 Oct 2012 07:33:44 +0000 (+0000) Subject: Menus are improved X-Git-Tag: Root_Delivery1_2012_12_06~119 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=e1c69954887ca568f8d4556cb9249404e359d566;p=tools%2Fsiman.git Menus are improved --- diff --git a/Workspace/Siman/WebContent/WEB-INF/tiles/tiles-defs.xml b/Workspace/Siman/WebContent/WEB-INF/tiles/tiles-defs.xml index d17a6ae..7a322b3 100644 --- a/Workspace/Siman/WebContent/WEB-INF/tiles/tiles-defs.xml +++ b/Workspace/Siman/WebContent/WEB-INF/tiles/tiles-defs.xml @@ -6,7 +6,7 @@ - + diff --git a/Workspace/Siman/WebContent/home.jsp b/Workspace/Siman/WebContent/home.jsp index a845242..456ca4d 100644 --- a/Workspace/Siman/WebContent/home.jsp +++ b/Workspace/Siman/WebContent/home.jsp @@ -21,10 +21,9 @@ - - - + + <%=reason%> diff --git a/Workspace/Siman/WebContent/jsp/menubar.jsp b/Workspace/Siman/WebContent/jsp/menubar.jsp index c9f862e..62d9adb 100644 --- a/Workspace/Siman/WebContent/jsp/menubar.jsp +++ b/Workspace/Siman/WebContent/jsp/menubar.jsp @@ -9,28 +9,22 @@ <%@ taglib prefix="s" uri="/struts-tags" %> -<%! private enum Menu { none, create, open, study, knowledge, datadmin, sysadmin, help }; -%> + <% String login = request.getParameter("login"); // Null or disabled - String selection = request.getParameter("menu"); // Active menu - - Menu selected = Menu.valueOf(selection); - - ApplicationRights user = (ApplicationRights)session.getAttribute("user.rights"); // Active user rights - Object study = (Object)session.getAttribute("study.open"); // Active study, if exists - Object known = (Object)session.getAttribute("knowledge.open"); // Active knowledge, if exists + + ApplicationRights user = (ApplicationRights)session.getAttribute("user.rights"); // Active user rights + %> -<%=ApplicationSettings.getWebSiteURL()%> -<%=ApplicationSettings.getHelpURL()%> + - <%=selection%> + - <%=selection%> + create @@ -46,8 +40,8 @@ sysadmin - - + + @@ -58,55 +52,59 @@ + + " border="none" title="" /> + + + " border="none" title="" /> + + + " border="none" /> + + + + " border="none" title="" /> + + + " border="none" title="" /> + + + + " border="none" /> + + + " border="none" /> + + + " border="none" title="" /> + + + + " border="none" /> + + + " border="none" /> + + + " border="none" title="" /> + + + + " border="none" /> + + + " border="none" title="" /> + + + + " border="none" /> + + + " border="none" title="" /> + + + <%if (login == null) { // That is, not disabled (yes, null means enabled!) diff --git a/Workspace/Siman/WebContent/layout/layoutLogin.jsp b/Workspace/Siman/WebContent/layout/layoutLogin.jsp index beb86c3..8bd8119 100644 --- a/Workspace/Siman/WebContent/layout/layoutLogin.jsp +++ b/Workspace/Siman/WebContent/layout/layoutLogin.jsp @@ -1,6 +1,7 @@ <%@ taglib uri="http://tiles.apache.org/tags-tiles" prefix="tiles"%> <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> <%@ taglib prefix="s" uri="/struts-tags"%> +<%@ taglib prefix="tiles" uri="http://tiles.apache.org/tags-tiles"%> @@ -17,9 +18,7 @@ - - - +
diff --git a/Workspace/Siman/WebContent/menu.jsp b/Workspace/Siman/WebContent/menu.jsp index 4b90ed5..cecaa5b 100644 --- a/Workspace/Siman/WebContent/menu.jsp +++ b/Workspace/Siman/WebContent/menu.jsp @@ -22,9 +22,7 @@ - - - +
- - - +
- - - +
- - - +
- - - + +
- - - +
- - - + - - - + - - - + - - - + - - - + - - - + - - - + - - - + - - - + - - - +
- - - +
- - - +
- - - + - - - + - - - - + + +
diff --git a/Workspace/Siman/src/org/splat/simer/Action.java b/Workspace/Siman/src/org/splat/simer/Action.java index cf3137d..57f8406 100644 --- a/Workspace/Siman/src/org/splat/simer/Action.java +++ b/Workspace/Siman/src/org/splat/simer/Action.java @@ -5,9 +5,12 @@ import java.util.Comparator; import java.util.ResourceBundle; import javax.security.auth.login.LoginContext; +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; import org.splat.dal.bo.kernel.User; @@ -19,12 +22,16 @@ import org.splat.dal.bo.som.DocumentType; import org.splat.wapp.Menu; -public class Action extends ActionSupport implements SessionAware { +public class Action extends ActionSupport implements ServletRequestAware, SessionAware { private Map session; private String mercode; private OpenStudy _openStudy; private OpenKnowledge _openKnowledge; + + private MenuBarSettings _menuBarSettings; + + private HttpServletRequest request; /** * Serial version ID. @@ -137,9 +144,64 @@ public class Action extends ActionSupport implements SessionAware { session.put("study.open", open); return open; } + + /** + * Initialization the Context for menubar. + */ + public void initializationContext() { + getMenuBarSettings().initializeInitialMenuProperties(); + + if (session.get("study.open") == null) { + getMenuBarSettings().setIsStudyNull(true); + logger.debug("MKA: setIsStudyNull = true"); + } else { + getMenuBarSettings().setIsStudyNull(false); + logger.debug("MKA: setIsStudyNull = false"); + } + + if (session.get("knowledge.open") == null) { + getMenuBarSettings().setIsKnowledgeNull(true); + logger.debug("MKA: setIsKnowledgeNull = true"); + } else { + getMenuBarSettings().setIsKnowledgeNull(false); + logger.debug("MKA: setIsKnowledgeNull = false"); + } + + ApplicationRights userRights = (ApplicationRights)session.get("user.rights"); + + if (userRights.canCreateStudy()) { + getMenuBarSettings().setCanUserCreateStudy(true); + } else { + getMenuBarSettings().setCanUserCreateStudy(false); + } + + if (userRights.canManageDatabase()) { + getMenuBarSettings().setCanUserManageDatabase(true); + } else { + getMenuBarSettings().setCanUserManageDatabase(false); + } + + } + + /** + * Initialization of the screen context for menu bar. + */ + public void initializationScreenContext(final String menuProperty) { + + initializationContext(); + getMenuBarSettings().intializeMenuBar(menuProperty); + } // ============================================================================================================================== // Getters and setters // ============================================================================================================================== + + public void setServletRequest (HttpServletRequest request) { + this.request = request; + } + + public HttpServletRequest getServletRequest() { + return request; + } public String getErrorCode () { // ----------------------------- @@ -158,4 +220,20 @@ public class Action extends ActionSupport implements SessionAware { // ---------------------------------------------------- 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; + } } \ No newline at end of file diff --git a/Workspace/Siman/src/org/splat/simer/ConnectionAction.java b/Workspace/Siman/src/org/splat/simer/ConnectionAction.java index e3114f7..d588d94 100644 --- a/Workspace/Siman/src/org/splat/simer/ConnectionAction.java +++ b/Workspace/Siman/src/org/splat/simer/ConnectionAction.java @@ -18,6 +18,8 @@ public class ConnectionAction extends Action { private String username = null; private String password = null; private String backmenu = null; + + private String _menuProperty; /** * Serial version ID. @@ -86,6 +88,10 @@ public class ConnectionAction extends Action { sfilter.put("author", String.valueOf(user.getIndex())); } this.connect(context, user); // Updates the session context + + setMenuProperty("none"); + initializationScreenContext(_menuProperty); + return backmenu; } catch (FailedLoginException error) { setErrorCode("message.error.login." + error.getMessage()); @@ -96,6 +102,7 @@ public class ConnectionAction extends Action { } } + @SuppressWarnings("unchecked") public String doLogout() { // ------------------------- @@ -115,6 +122,10 @@ public class ConnectionAction extends Action { sfilter.put("author", "0"); this.disconnect(); // Updates the session context + + setMenuProperty("none"); + initializationScreenContext(_menuProperty); + return backmenu; } catch (Exception error) { logger.error("Reason:", error); @@ -122,32 +133,45 @@ public class ConnectionAction extends Action { } } - // ============================================================================================================================== - // Getters and setters - // ============================================================================================================================== - - public String getUsername() { - // ---------------------------- - return username; - } - - public String getPassword() { - // ---------------------------- - return password; - } - - public void setUsername(String value) { - // -------------------------------------- - this.username = value; - } - - public void setPassword(String value) { - // -------------------------------------- - this.password = value; +// ============================================================================================================================== +// Getters and setters +// ============================================================================================================================== + + public String getUsername () { +// ---------------------------- + return username; + } + public String getPassword () { +// ---------------------------- + return password; + } + + public void setUsername (String value) { +// -------------------------------------- + this.username = value; + } + public void setPassword (String value) { +// -------------------------------------- + this.password = value; + } + public void setBackMenu (String menu) { +// ------------------------------------- + this.backmenu = menu; + } + + /** + * Get the menuProperty. + * @return the menuProperty + */ + public String getMenuProperty() { + return _menuProperty; } - public void setBackMenu(String menu) { - // ------------------------------------- - this.backmenu = menu; + /** + * Set the menuProperty. + * @param menuProperty the menuProperty to set + */ + public void setMenuProperty(String menuProperty) { + this._menuProperty = menuProperty; } } \ No newline at end of file diff --git a/Workspace/Siman/src/org/splat/simer/DisplayKnowledgeAction.java b/Workspace/Siman/src/org/splat/simer/DisplayKnowledgeAction.java index eb21c3d..d6c6c3d 100644 --- a/Workspace/Siman/src/org/splat/simer/DisplayKnowledgeAction.java +++ b/Workspace/Siman/src/org/splat/simer/DisplayKnowledgeAction.java @@ -22,6 +22,12 @@ public class DisplayKnowledgeAction extends DisplayBaseAction { * Injected knowledge element service. */ private KnowledgeElementService _knowledgeElementService; + + /** + * Value of the menu property. + * It can be: none, create, open, study, knowledge, sysadmin, help. + */ + private String _menuProperty; // ============================================================================================================================== // Action methods @@ -51,6 +57,9 @@ public class DisplayKnowledgeAction extends DisplayBaseAction { myknelm.setSelection(selection); } getSession().put("menu.knowledge", myknelm.getMenu()); + + setMenuProperty("knowledge"); + initializationScreenContext(_menuProperty); return SUCCESS; } @@ -63,6 +72,10 @@ public class DisplayKnowledgeAction extends DisplayBaseAction { } else { // Selection of a step of current study myknelm.setSelection(selection); } + + setMenuProperty("knowledge"); + initializationScreenContext(_menuProperty); + return SUCCESS; } @@ -75,6 +88,10 @@ public class DisplayKnowledgeAction extends DisplayBaseAction { myknelm.reduceHistory(myindex); else if (todo == Execute.reduceall) myknelm.reduceDocument(myindex); + + setMenuProperty("knowledge"); + initializationScreenContext(_menuProperty); + return SUCCESS; } @@ -85,11 +102,19 @@ public class DisplayKnowledgeAction extends DisplayBaseAction { myknelm.developKnowledge(myindex); else if (todo == Execute.reduce) myknelm.reduceKnowledge(myindex); + + setMenuProperty("knowledge"); + initializationScreenContext(_menuProperty); + return SUCCESS; } public String doClose() { closeKnowledge(); + + setMenuProperty("none"); + initializationScreenContext(_menuProperty); + return SUCCESS; } @@ -136,4 +161,20 @@ public class DisplayKnowledgeAction extends DisplayBaseAction { KnowledgeElementService knowledgeElementService) { _knowledgeElementService = knowledgeElementService; } + + /** + * Get the menuProperty. + * @return the menuProperty + */ + public String getMenuProperty() { + return _menuProperty; + } + + /** + * Set the menuProperty. + * @param menuProperty the menuProperty to set + */ + public void setMenuProperty(String menuProperty) { + this._menuProperty = menuProperty; + } } \ No newline at end of file diff --git a/Workspace/Siman/src/org/splat/simer/DisplayStudyStepAction.java b/Workspace/Siman/src/org/splat/simer/DisplayStudyStepAction.java index a7cf86a..88603ff 100644 --- a/Workspace/Siman/src/org/splat/simer/DisplayStudyStepAction.java +++ b/Workspace/Siman/src/org/splat/simer/DisplayStudyStepAction.java @@ -26,6 +26,12 @@ public class DisplayStudyStepAction extends DisplayBaseAction { * Injected study service. */ private StudyService _studyService; + + /** + * Value of the menu property. + * It can be: none, create, open, study, knowledge, sysadmin, help. + */ + private String _menuProperty; // ============================================================================================================================== // Action methods @@ -74,6 +80,9 @@ public class DisplayStudyStepAction extends DisplayBaseAction { menu.selects("prop-general"); } getSession().put("menu.study", mystudy.getMenu()); + + setMenuProperty("study"); + initializationScreenContext(_menuProperty); return SUCCESS; } @@ -96,6 +105,10 @@ public class DisplayStudyStepAction extends DisplayBaseAction { menu.disables("prop-scenario"); menu.selects("prop-general"); } + + setMenuProperty("study"); + initializationScreenContext(_menuProperty); + return SUCCESS; } @@ -108,6 +121,10 @@ public class DisplayStudyStepAction extends DisplayBaseAction { mystudy.reduceHistory(myindex); else if (todo == Execute.reduceall) mystudy.reduceDocument(myindex); + + setMenuProperty("study"); + initializationScreenContext(_menuProperty); + return SUCCESS; } @@ -118,11 +135,19 @@ public class DisplayStudyStepAction extends DisplayBaseAction { mystudy.developKnowledge(myindex); else if (todo == Execute.reduce) mystudy.reduceKnowledge(myindex); + + setMenuProperty("study"); + initializationScreenContext(_menuProperty); + return SUCCESS; } public String doClose() { closeStudy(); + + setMenuProperty("none"); + initializationScreenContext(_menuProperty); + return SUCCESS; } @@ -195,4 +220,20 @@ public class DisplayStudyStepAction extends DisplayBaseAction { super.setOpenStudy(study); mystudy = study; } + + /** + * Get the menuProperty. + * @return the menuProperty + */ + public String getMenuProperty() { + return _menuProperty; + } + + /** + * Set the menuProperty. + * @param menuProperty the menuProperty to set + */ + public void setMenuProperty(String menuProperty) { + this._menuProperty = menuProperty; + } } \ No newline at end of file diff --git a/Workspace/Siman/src/org/splat/simer/EditDocumentAction.java b/Workspace/Siman/src/org/splat/simer/EditDocumentAction.java index ca7baa1..f936204 100644 --- a/Workspace/Siman/src/org/splat/simer/EditDocumentAction.java +++ b/Workspace/Siman/src/org/splat/simer/EditDocumentAction.java @@ -37,6 +37,12 @@ public class EditDocumentAction extends DisplayStudyStepAction { * Injected repository service. */ private RepositoryService _repositoryService; + + /** + * Value of the menu property. + * It can be: none, create, open, study, knowledge, sysadmin, help. + */ + private String _menuProperty; /** * Operations enumeration. @@ -56,10 +62,18 @@ public class EditDocumentAction extends DisplayStudyStepAction { */ public String doInitialize() { mystudy = getOpenStudy(); + + setMenuProperty("study"); + initializationScreenContext(_menuProperty); + return SUCCESS; } public String doSetDocument() { + + setMenuProperty("study"); + initializationScreenContext(_menuProperty); + try { mystudy = getOpenStudy(); @@ -106,6 +120,10 @@ public class EditDocumentAction extends DisplayStudyStepAction { // ------------------------- // Session connex = Database.getCurSession(); // Transaction transax = connex.beginTransaction(); + + setMenuProperty("study"); + initializationScreenContext(_menuProperty); + try { // Getting user inputs mystudy = getOpenStudy(); @@ -133,6 +151,10 @@ public class EditDocumentAction extends DisplayStudyStepAction { } public String doDeleteDocument() { + + setMenuProperty("study"); + initializationScreenContext(_menuProperty); + try { mystudy = getOpenStudy(); @@ -221,4 +243,20 @@ public class EditDocumentAction extends DisplayStudyStepAction { public void setStepService(StepService stepService) { _stepService = stepService; } + + /** + * Get the menuProperty. + * @return the menuProperty + */ + public String getMenuProperty() { + return _menuProperty; + } + + /** + * Set the menuProperty. + * @param menuProperty the menuProperty to set + */ + public void setMenuProperty(String menuProperty) { + this._menuProperty = menuProperty; + } } \ No newline at end of file diff --git a/Workspace/Siman/src/org/splat/simer/EditKnowledgeElementAction.java b/Workspace/Siman/src/org/splat/simer/EditKnowledgeElementAction.java index c4975d0..16f48ba 100644 --- a/Workspace/Siman/src/org/splat/simer/EditKnowledgeElementAction.java +++ b/Workspace/Siman/src/org/splat/simer/EditKnowledgeElementAction.java @@ -43,6 +43,12 @@ public class EditKnowledgeElementAction extends DisplayStudyStepAction { * Injected knowledge element type service. */ private KnowledgeElementTypeService _knowledgeElementTypeService; + + /** + * Value of the menu property. + * It can be: none, create, open, study, knowledge, sysadmin, help. + */ + private String _menuProperty; // ============================================================================================================================== // Action methods @@ -55,6 +61,10 @@ public class EditKnowledgeElementAction extends DisplayStudyStepAction { */ public String doInitialize() { mystudy = getOpenStudy(); + + setMenuProperty("study"); + initializationScreenContext(_menuProperty); + return SUCCESS; } @@ -64,6 +74,10 @@ public class EditKnowledgeElementAction extends DisplayStudyStepAction { * @return SUCCESS if operation succeeded, ERROR if Runtime exception, otherwise INPUT */ public String doSetKnowledge() { + + setMenuProperty("study"); + initializationScreenContext(_menuProperty); + try { User user = getConnectedUser(); mystudy = getOpenStudy(); @@ -117,6 +131,9 @@ public class EditKnowledgeElementAction extends DisplayStudyStepAction { mystudy.remove(kelm); getMenu("study").selects(mystudy.getSelection()); // Updates the menu icon, in case of last removed document + + setMenuProperty("study"); + initializationScreenContext(_menuProperty); return SUCCESS; } @@ -233,4 +250,20 @@ public class EditKnowledgeElementAction extends DisplayStudyStepAction { KnowledgeElementTypeService knowledgeElementTypeService) { _knowledgeElementTypeService = knowledgeElementTypeService; } + + /** + * Get the menuProperty. + * @return the menuProperty + */ + public String getMenuProperty() { + return _menuProperty; + } + + /** + * Set the menuProperty. + * @param menuProperty the menuProperty to set + */ + public void setMenuProperty(String menuProperty) { + this._menuProperty = menuProperty; + } } \ No newline at end of file diff --git a/Workspace/Siman/src/org/splat/simer/EditScenarioPropertiesAction.java b/Workspace/Siman/src/org/splat/simer/EditScenarioPropertiesAction.java index 59ea206..311eb2a 100644 --- a/Workspace/Siman/src/org/splat/simer/EditScenarioPropertiesAction.java +++ b/Workspace/Siman/src/org/splat/simer/EditScenarioPropertiesAction.java @@ -17,6 +17,12 @@ public class EditScenarioPropertiesAction extends DisplayStudyStepAction { private String subject; private ScenarioService _scenarioService; private ProjectElementService _projectElementService; + + /** + * Value of the menu property. + * It can be: none, create, open, study, knowledge, sysadmin, help. + */ + private String _menuProperty; /** * Serial version ID. @@ -42,6 +48,9 @@ public class EditScenarioPropertiesAction extends DisplayStudyStepAction { myscenario = (Scenario) step.getOwner(); // The selected step belong to a scenario lasdate = datstring.format(myscenario.getLastModificationDate()); subject = label.getString("label.study") + " " + mystudy.getTitle(); + + setMenuProperty("study"); + initializationScreenContext(_menuProperty); return SUCCESS; } @@ -58,6 +67,10 @@ public class EditScenarioPropertiesAction extends DisplayStudyStepAction { mystudy.getMenu().refreshGivenStepItem( getProjectElementService().getFirstStep(myscenario)); // For updating the scenario icon + + setMenuProperty("study"); + initializationScreenContext(_menuProperty); + return SUCCESS; } @@ -136,4 +149,20 @@ public class EditScenarioPropertiesAction extends DisplayStudyStepAction { ProjectElementService projectElementService) { _projectElementService = projectElementService; } + + /** + * Get the menuProperty. + * @return the menuProperty + */ + public String getMenuProperty() { + return _menuProperty; + } + + /** + * Set the menuProperty. + * @param menuProperty the menuProperty to set + */ + public void setMenuProperty(String menuProperty) { + this._menuProperty = menuProperty; + } } \ No newline at end of file diff --git a/Workspace/Siman/src/org/splat/simer/EditSimulationContextAction.java b/Workspace/Siman/src/org/splat/simer/EditSimulationContextAction.java index 79718e2..939d5d1 100644 --- a/Workspace/Siman/src/org/splat/simer/EditSimulationContextAction.java +++ b/Workspace/Siman/src/org/splat/simer/EditSimulationContextAction.java @@ -37,6 +37,12 @@ public class EditSimulationContextAction extends DisplayStudyStepAction { * Injected simulation context type service. */ private SimulationContextTypeService _simulationContextTypeService; + + /** + * Value of the menu property. + * It can be: none, create, open, study, knowledge, sysadmin, help. + */ + private String _menuProperty; /** * Get the stepService. @@ -67,6 +73,9 @@ public class EditSimulationContextAction extends DisplayStudyStepAction { mystudy = getOpenStudy(); contype = getInvolvedContexts(); + + setMenuProperty("study"); + initializationScreenContext(_menuProperty); if (contype.isEmpty()) return "create"; @@ -76,6 +85,10 @@ public class EditSimulationContextAction extends DisplayStudyStepAction { public String doSelectContext() { mystudy = getOpenStudy(); + + setMenuProperty("study"); + initializationScreenContext(_menuProperty); + int typid = Integer.valueOf(selectype); if (typid == 0) return "create"; @@ -94,6 +107,10 @@ public class EditSimulationContextAction extends DisplayStudyStepAction { // -------------------------------- try { mystudy = getOpenStudy(); + + setMenuProperty("study"); + initializationScreenContext(_menuProperty); + if (newtype.length() == 0 || value.length() == 0) return INPUT; @@ -122,6 +139,10 @@ public class EditSimulationContextAction extends DisplayStudyStepAction { } public String doDeleteContext() { + + setMenuProperty("study"); + initializationScreenContext(_menuProperty); + try { mystudy = getOpenStudy(); @@ -148,6 +169,10 @@ public class EditSimulationContextAction extends DisplayStudyStepAction { String[] input = value.split(","); // Session connex = Database.getCurSession(); // Transaction transax = connex.beginTransaction(); + + setMenuProperty("study"); + initializationScreenContext(_menuProperty); + try { mystudy = getOpenStudy(); @@ -326,4 +351,20 @@ public class EditSimulationContextAction extends DisplayStudyStepAction { SimulationContextTypeService simulationContextTypeService) { _simulationContextTypeService = simulationContextTypeService; } + + /** + * Get the menuProperty. + * @return the menuProperty + */ + public String getMenuProperty() { + return _menuProperty; + } + + /** + * Set the menuProperty. + * @param menuProperty the menuProperty to set + */ + public void setMenuProperty(String menuProperty) { + this._menuProperty = menuProperty; + } } \ No newline at end of file diff --git a/Workspace/Siman/src/org/splat/simer/EditStudyAction.java b/Workspace/Siman/src/org/splat/simer/EditStudyAction.java index 76c546c..3fce953 100644 --- a/Workspace/Siman/src/org/splat/simer/EditStudyAction.java +++ b/Workspace/Siman/src/org/splat/simer/EditStudyAction.java @@ -14,6 +14,12 @@ public class EditStudyAction extends DisplayStudyStepAction { private enum Execute { publish, promote } private StudyService _studyService; + + /** + * Value of the menu property. + * It can be: none, create, open, study, knowledge, sysadmin, help. + */ + private String _menuProperty; // ============================================================================================================================== // Action methods @@ -29,6 +35,9 @@ public class EditStudyAction extends DisplayStudyStepAction { if (todo == Execute.publish) getStudyService().moveToPublic(study); else if (todo == Execute.promote) getStudyService().moveToReference(study); mystudy.getPopup().setContext("study", mystudy.getStudyRights()); // The context has changed + + setMenuProperty("study"); + initializationScreenContext(_menuProperty); return SUCCESS; } @@ -55,4 +64,20 @@ public class EditStudyAction extends DisplayStudyStepAction { public void setStudyService(StudyService studyService) { _studyService = studyService; } + + /** + * Get the menuProperty. + * @return the menuProperty + */ + public String getMenuProperty() { + return _menuProperty; + } + + /** + * Set the menuProperty. + * @param menuProperty the menuProperty to set + */ + public void setMenuProperty(String menuProperty) { + this._menuProperty = menuProperty; + } } \ No newline at end of file diff --git a/Workspace/Siman/src/org/splat/simer/ImportDocumentAction.java b/Workspace/Siman/src/org/splat/simer/ImportDocumentAction.java index e030492..2af9157 100644 --- a/Workspace/Siman/src/org/splat/simer/ImportDocumentAction.java +++ b/Workspace/Siman/src/org/splat/simer/ImportDocumentAction.java @@ -64,7 +64,12 @@ public class ImportDocumentAction extends UploadBaseNextAction { /** * Injected repository service. */ - private RepositoryService _repositoryService; + private RepositoryService _repositoryService; + /** + * Value of the menu property. + * It can be: none, create, open, study, knowledge, sysadmin, help. + */ + private String _menuProperty; // ============================================================================================================================== // Action methods @@ -75,6 +80,10 @@ public class ImportDocumentAction extends UploadBaseNextAction { * @return SUCCESS in success, otherwise - ERROR */ public String doInitialize() { + + setMenuProperty("study"); + initializationScreenContext(_menuProperty); + User user = getConnectedUser(); File updir = getRepositoryService().getDownloadDirectory(user); File upfile = new File(updir.getPath() + "/" + filename); @@ -171,6 +180,10 @@ public class ImportDocumentAction extends UploadBaseNextAction { */ public String doImport() { // ------------------------- + + setMenuProperty("study"); + initializationScreenContext(_menuProperty); + if (action == ToDo.cancel) return "cancel"; if (doctype == 0) { @@ -442,4 +455,20 @@ public class ImportDocumentAction extends UploadBaseNextAction { public void setDocumentTypeService(DocumentTypeService documentTypeService) { _documentTypeService = documentTypeService; } + + /** + * Get the menuProperty. + * @return the menuProperty + */ + public String getMenuProperty() { + return _menuProperty; + } + + /** + * Set the menuProperty. + * @param menuProperty the menuProperty to set + */ + public void setMenuProperty(String menuProperty) { + this._menuProperty = menuProperty; + } } \ No newline at end of file diff --git a/Workspace/Siman/src/org/splat/simer/MenuBarSettings.java b/Workspace/Siman/src/org/splat/simer/MenuBarSettings.java new file mode 100644 index 0000000..22a9a65 --- /dev/null +++ b/Workspace/Siman/src/org/splat/simer/MenuBarSettings.java @@ -0,0 +1,344 @@ +/***************************************************************************** + * Company EURIWARE + * Application SIMAN + * File $Id$ + * Creation date 19.10.2012 + * @author Author: Maria KRUCHININA + * @version Revision: + *****************************************************************************/ + +package org.splat.simer; + +/** + * Settings for menu bar. + * @author Maria KRUCHININA + * + */ +public class MenuBarSettings { + + /** + * The SALOME WEB-site URL. + */ + private String webSiteURL; + + /** + * Help URL. + */ + private String helpURL; + + //=== MENUS========================================== + /** + * Property, is this menu the "Create the Study" one. + */ + private Boolean isMenuCreate; + + /** + * Property, is this menu the "Open the Study" one. + */ + private Boolean isMenuOpen; + + /** + * Property, is this menu the "Display the Open Study" one. + */ + private Boolean isMenuStudy; + + /** + * Property, is this menu the "Display the Open Knowledge" one. + */ + private Boolean isMenuKnowledge; + + /** + * Property, is this menu the "Managing the database" one. + */ + private Boolean isMenuSysAdmin; + + /** + * Property, is this menu the "Help" one. + */ + private Boolean isMenuHelp; + + //=== OTHER OPERATIONS ============================ + + /** + * Can the given User create the given Study. + */ + private Boolean canUserCreateStudy; + + /** + * Is the given Study NULL. + */ + private Boolean isStudyNull; + + /** + * Is the given Knowledge NULL. + */ + private Boolean isKnowledgeNull; + + /** + * Can the given User manage the Database. + */ + private Boolean canUserManageDatabase; + + /** + * Initialize the initial properties for menus. + */ + public void initializeInitialMenuProperties() { + + webSiteURL = ApplicationSettings.getWebSiteURL(); + helpURL = ApplicationSettings.getHelpURL(); + + } + + /** + * Initialize the menu bar properties. + * @param menuProperty - parameter of menu bar. + */ + public void intializeMenuBar (final String menuProperty) { + + if ("none".equals(menuProperty)) { + setIsMenuCreate(false); + setIsMenuOpen(false); + setIsMenuStudy(false); + setIsMenuKnowledge(false); + setIsMenuSysAdmin(false); + setIsMenuHelp(false); + } else if ("create".equals(menuProperty)) { + setIsMenuCreate(true); + setIsMenuOpen(false); + setIsMenuStudy(false); + setIsMenuKnowledge(false); + setIsMenuSysAdmin(false); + setIsMenuHelp(false); + } else if ("open".equals(menuProperty)) { + setIsMenuCreate(false); + setIsMenuOpen(true); + setIsMenuStudy(false); + setIsMenuKnowledge(false); + setIsMenuSysAdmin(false); + setIsMenuHelp(false); + } else if ("study".equals(menuProperty)) { + setIsMenuCreate(false); + setIsMenuOpen(false); + setIsMenuStudy(true); + setIsMenuKnowledge(false); + setIsMenuSysAdmin(false); + setIsMenuHelp(false); + } else if ("knowledge".equals(menuProperty)) { + setIsMenuCreate(false); + setIsMenuOpen(false); + setIsMenuStudy(false); + setIsMenuKnowledge(true); + setIsMenuSysAdmin(false); + setIsMenuHelp(false); + } else if ("sysadmin".equals(menuProperty)) { + setIsMenuCreate(false); + setIsMenuOpen(false); + setIsMenuStudy(false); + setIsMenuKnowledge(false); + setIsMenuSysAdmin(true); + setIsMenuHelp(false); + } else if ("help".equals(menuProperty)) { + setIsMenuCreate(false); + setIsMenuOpen(false); + setIsMenuStudy(false); + setIsMenuKnowledge(false); + setIsMenuSysAdmin(false); + setIsMenuHelp(true); + } + } + + //====== GETTERS AND SETERS ============== + + /** + * Get the webSiteURL. + * @return the webSiteURL + */ + public String getWebSiteURL() { + return webSiteURL; + } + + /** + * Set the webSiteURL. + * @param webSiteURL the webSiteURL to set + */ + public void setWebSiteURL(final String webSiteURL) { + this.webSiteURL = webSiteURL; + } + + /** + * Get the helpURL. + * @return the helpURL + */ + public String getHelpURL() { + return helpURL; + } + + /** + * Set the helpURL. + * @param helpURL the helpURL to set + */ + public void setHelpURL(final String helpURL) { + this.helpURL = helpURL; + } + + /** + * Get the isMenuCreate. + * @return the isMenuCreate + */ + public Boolean getIsMenuCreate() { + return isMenuCreate; + } + + /** + * Set the isMenuCreate. + * @param isMenuCreate the isMenuCreate to set + */ + public void setIsMenuCreate(final Boolean isMenuCreate) { + this.isMenuCreate = isMenuCreate; + } + + /** + * Get the isMenuOpen. + * @return the isMenuOpen + */ + public Boolean getIsMenuOpen() { + return isMenuOpen; + } + + /** + * Set the isMenuOpen. + * @param isMenuOpen the isMenuOpen to set + */ + public void setIsMenuOpen(final Boolean isMenuOpen) { + this.isMenuOpen = isMenuOpen; + } + + /** + * Get the isMenuStudy. + * @return the isMenuStudy + */ + public Boolean getIsMenuStudy() { + return isMenuStudy; + } + + /** + * Set the isMenuStudy. + * @param isMenuStudy the isMenuStudy to set + */ + public void setIsMenuStudy(final Boolean isMenuStudy) { + this.isMenuStudy = isMenuStudy; + } + + /** + * Get the isMenuKnowledge. + * @return the isMenuKnowledge + */ + public Boolean getIsMenuKnowledge() { + return isMenuKnowledge; + } + + /** + * Set the isMenuKnowledge. + * @param isMenuKnowledge the isMenuKnowledge to set + */ + public void setIsMenuKnowledge(final Boolean isMenuKnowledge) { + this.isMenuKnowledge = isMenuKnowledge; + } + + /** + * Get the isMenuSysAdmin. + * @return the isMenuSysAdmin + */ + public Boolean getIsMenuSysAdmin() { + return isMenuSysAdmin; + } + + /** + * Set the isMenuSysAdmin. + * @param isMenuSysAdmin the isMenuSysAdmin to set + */ + public void setIsMenuSysAdmin(final Boolean isMenuSysAdmin) { + this.isMenuSysAdmin = isMenuSysAdmin; + } + + /** + * Get the isMenuHelp. + * @return the isMenuHelp + */ + public Boolean getIsMenuHelp() { + return isMenuHelp; + } + + /** + * Set the isMenuHelp. + * @param isMenuHelp the isMenuHelp to set + */ + public void setIsMenuHelp(final Boolean isMenuHelp) { + this.isMenuHelp = isMenuHelp; + } + + /** + * Get the canUserCreateStudy. + * @return the canUserCreateStudy + */ + public Boolean getCanUserCreateStudy() { + return canUserCreateStudy; + } + + /** + * Set the canUserCreateStudy. + * @param canUserCreateStudy the canUserCreateStudy to set + */ + public void setCanUserCreateStudy(final Boolean canUserCreateStudy) { + this.canUserCreateStudy = canUserCreateStudy; + } + + /** + * Get the isStudyNull. + * @return the isStudyNull + */ + public Boolean getIsStudyNull() { + return isStudyNull; + } + + /** + * Set the isStudyNull. + * @param isStudyNull the isStudyNull to set + */ + public void setIsStudyNull(final Boolean isStudyNull) { + this.isStudyNull = isStudyNull; + } + + /** + * Get the isKnowledgeNull. + * @return the isKnowledgeNull + */ + public Boolean getIsKnowledgeNull() { + return isKnowledgeNull; + } + + /** + * Set the isKnowledgeNull. + * @param isKnowledgeNull the isKnowledgeNull to set + */ + public void setIsKnowledgeNull(final Boolean isKnowledgeNull) { + this.isKnowledgeNull = isKnowledgeNull; + } + + /** + * Get the canUserManageDatabase. + * @return the canUserManageDatabase + */ + public Boolean getCanUserManageDatabase() { + return canUserManageDatabase; + } + + /** + * Set the canUserManageDatabase. + * @param canUserManageDatabase the canUserManageDatabase to set + */ + public void setCanUserManageDatabase(final Boolean canUserManageDatabase) { + this.canUserManageDatabase = canUserManageDatabase; + } + +} diff --git a/Workspace/Siman/src/org/splat/simer/NewScenarioAction.java b/Workspace/Siman/src/org/splat/simer/NewScenarioAction.java index cc1b634..246cb50 100644 --- a/Workspace/Siman/src/org/splat/simer/NewScenarioAction.java +++ b/Workspace/Siman/src/org/splat/simer/NewScenarioAction.java @@ -36,6 +36,12 @@ public class NewScenarioAction extends Action { */ private ProjectElementService _projectElementService; private Menu _menu; + + /** + * Value of the menu property. + * It can be: none, create, open, study, knowledge, sysadmin, help. + */ + private String _menuProperty; /** * Serial version ID. @@ -67,6 +73,10 @@ public class NewScenarioAction extends Action { Menu menu = ((NewScenarioMenu)getMenu()).init(study); //RKV menu.selects(selection); getSession().put("menu.scenario", menu); + + setMenuProperty("study"); + initializationScreenContext(_menuProperty); + return SUCCESS; } @@ -81,6 +91,10 @@ public class NewScenarioAction extends Action { action = null; getMenu("scenario").selects(selection); + + setMenuProperty("study"); + initializationScreenContext(_menuProperty); + return SUCCESS; } @@ -125,6 +139,10 @@ public class NewScenarioAction extends Action { } catch (RuntimeException saverror) { logger.error("Reason:", saverror); + + setMenuProperty("study"); + initializationScreenContext(_menuProperty); + return ERROR; } catch (Exception error) { @@ -233,4 +251,20 @@ public class NewScenarioAction extends Action { public void setScenarioService(ScenarioService scenarioService) { _scenarioService = scenarioService; } + + /** + * Get the menuProperty. + * @return the menuProperty + */ + public String getMenuProperty() { + return _menuProperty; + } + + /** + * Set the menuProperty. + * @param menuProperty the menuProperty to set + */ + public void setMenuProperty(String menuProperty) { + this._menuProperty = menuProperty; + } } \ No newline at end of file diff --git a/Workspace/Siman/src/org/splat/simer/NewStudyAction.java b/Workspace/Siman/src/org/splat/simer/NewStudyAction.java index 1a89f79..df6211e 100644 --- a/Workspace/Siman/src/org/splat/simer/NewStudyAction.java +++ b/Workspace/Siman/src/org/splat/simer/NewStudyAction.java @@ -32,6 +32,12 @@ public class NewStudyAction extends Action { * Injected scenario service. */ private ScenarioService _scenarioService; + + /** + * Value of the menu property. + * It can be: none, create, open, study, knowledge, sysadmin, help. + */ + private String _menuProperty; // ============================================================================================================================== // Action methods @@ -48,6 +54,9 @@ public class NewStudyAction extends Action { ApplicationSettings.getCurrentLocale()); title = locale.getString("label.study") + " " + String.valueOf(number + 1); + + setMenuProperty("create"); + initializationScreenContext(_menuProperty); return SUCCESS; } @@ -65,8 +74,13 @@ public class NewStudyAction extends Action { throw new Exception(); if (valid == 0) { value = input[1].trim(); - if (value.length() == 0) + if (value.length() == 0) { + + setMenuProperty("create"); + initializationScreenContext(_menuProperty); + return INPUT; // No need to reinitialize the list of existing products + } } sprop.setTitle(title).setManager(getConnectedUser()); sprop.checkValidity(); @@ -77,6 +91,10 @@ public class NewStudyAction extends Action { .selectType("product"); contelm = getSimulationContextService() .selectSimulationContextsWhere(cprop.setType(product)); + + setMenuProperty("create"); + initializationScreenContext(_menuProperty); + return INPUT; // Title empty, simply wait for input without error message } try { @@ -104,9 +122,15 @@ public class NewStudyAction extends Action { // Update of the session number += 1; open(study); // Opens the study, + + setMenuProperty("study"); + initializationScreenContext(_menuProperty); + return SUCCESS; } catch (Exception error) { logger.error("Unable to save the study, reason:", error); + setMenuProperty("none"); + initializationScreenContext(_menuProperty); return ERROR; } } @@ -194,4 +218,20 @@ public class NewStudyAction extends Action { public void setScenarioService(ScenarioService scenarioService) { _scenarioService = scenarioService; } + + /** + * Get the menuProperty. + * @return the menuProperty + */ + public String getMenuProperty() { + return _menuProperty; + } + + /** + * Set the menuProperty. + * @param menuProperty the menuProperty to set + */ + public void setMenuProperty(String menuProperty) { + this._menuProperty = menuProperty; + } } \ No newline at end of file diff --git a/Workspace/Siman/src/org/splat/simer/NotYetImplementedAction.java b/Workspace/Siman/src/org/splat/simer/NotYetImplementedAction.java index 9f5666e..e6ecc09 100644 --- a/Workspace/Siman/src/org/splat/simer/NotYetImplementedAction.java +++ b/Workspace/Siman/src/org/splat/simer/NotYetImplementedAction.java @@ -7,13 +7,39 @@ public class NotYetImplementedAction extends Action { * Serial version ID. */ private static final long serialVersionUID = 3131921588316476454L; + + /** + * Value of the menu property. + * It can be: none, create, open, study, knowledge, sysadmin, help. + */ + private String _menuProperty; // ============================================================================================================================== // Action methods // ============================================================================================================================== public String doInitialize () { -// ----------------------------- +// ----------------------------- + + setMenuProperty("study"); + initializationScreenContext(_menuProperty); + return SUCCESS; } + + /** + * Get the menuProperty. + * @return the menuProperty + */ + public String getMenuProperty() { + return _menuProperty; + } + + /** + * Set the menuProperty. + * @param menuProperty the menuProperty to set + */ + public void setMenuProperty(String menuProperty) { + this._menuProperty = menuProperty; + } } \ No newline at end of file diff --git a/Workspace/Siman/src/org/splat/simer/OpenStudy.java b/Workspace/Siman/src/org/splat/simer/OpenStudy.java index d572a40..b28bc68 100644 --- a/Workspace/Siman/src/org/splat/simer/OpenStudy.java +++ b/Workspace/Siman/src/org/splat/simer/OpenStudy.java @@ -388,7 +388,10 @@ public class OpenStudy extends OpenObject implements OpenStudyServices { popup = ApplicationSettings.getPopupMenu("steditable"); popup.setContext("study", new StudyRights(cuser, mystudy)); } - ustep.setActor(cuser); + //ustep = getProjectElementService().getFirstStep(mystudy); + if (ustep != null) { + ustep.setActor(cuser); + } urightstudy = new StudyRights(cuser, mystudy); urightstep = new StepRights(cuser, ustep); } @@ -573,4 +576,12 @@ public class OpenStudy extends OpenObject implements OpenStudyServices { public void setDocumentService(DocumentService documentService) { _documentService = documentService; } + + public Study getMystudy() { + return mystudy; + } + + public void setMystudy(Study mystudy) { + this.mystudy = mystudy; + } } \ No newline at end of file diff --git a/Workspace/Siman/src/org/splat/simer/SearchKnowledgeAction.java b/Workspace/Siman/src/org/splat/simer/SearchKnowledgeAction.java index 60bf70f..009f8c0 100644 --- a/Workspace/Siman/src/org/splat/simer/SearchKnowledgeAction.java +++ b/Workspace/Siman/src/org/splat/simer/SearchKnowledgeAction.java @@ -47,6 +47,12 @@ public class SearchKnowledgeAction extends SearchBaseAction { * Injected user service. */ private UserService _userService; + + /** + * Value of the menu property. + * It can be: none, create, open, study, knowledge, sysadmin, help. + */ + private String _menuProperty; // ============================================================================================================================== // Action methods @@ -58,6 +64,10 @@ public class SearchKnowledgeAction extends SearchBaseAction { * @return SUCCESS if succeeded, ERROR if doSearch() is failed */ public String doInitialize() { + + setMenuProperty("open"); + initializationScreenContext(_menuProperty); + try { loadFilter(); doSearch(); @@ -78,6 +88,9 @@ public class SearchKnowledgeAction extends SearchBaseAction { protected String doSearch() throws InvalidPropertyException { // ---------------------------- + setMenuProperty("open"); + initializationScreenContext(_menuProperty); + Map session = getSession(); User user = getConnectedUser(); @@ -322,4 +335,20 @@ public class SearchKnowledgeAction extends SearchBaseAction { public void setUserService(UserService userService) { _userService = userService; } + + /** + * Get the menuProperty. + * @return the menuProperty + */ + public String getMenuProperty() { + return _menuProperty; + } + + /** + * Set the menuProperty. + * @param menuProperty the menuProperty to set + */ + public void setMenuProperty(String menuProperty) { + this._menuProperty = menuProperty; + } } \ No newline at end of file diff --git a/Workspace/Siman/src/org/splat/simer/SearchStudyAction.java b/Workspace/Siman/src/org/splat/simer/SearchStudyAction.java index e6e8c06..68fcef2 100644 --- a/Workspace/Siman/src/org/splat/simer/SearchStudyAction.java +++ b/Workspace/Siman/src/org/splat/simer/SearchStudyAction.java @@ -44,6 +44,12 @@ public class SearchStudyAction extends SearchBaseAction { * Injected user service. */ private UserService _userService; + + /** + * Value of the menu property. + * It can be: none, create, open, study, knowledge, sysadmin, help. + */ + private String _menuProperty; /** * Serial version ID. @@ -70,11 +76,18 @@ public class SearchStudyAction extends SearchBaseAction { // Final initialization of the form setCandidates(); setContextTypeOptions(getInvolvedContexts()); + + setMenuProperty("open"); + initializationScreenContext(_menuProperty); return SUCCESS; } catch (Exception error) { // No need to roll back the transaction as it is read only logger.error("Reason: ", error); + + setMenuProperty("none"); + initializationScreenContext(_menuProperty); + return ERROR; } } @@ -324,4 +337,20 @@ public class SearchStudyAction extends SearchBaseAction { public void setUserService(UserService userService) { _userService = userService; } + + /** + * Get the menuProperty. + * @return the menuProperty + */ + public String getMenuProperty() { + return _menuProperty; + } + + /** + * Set the menuProperty. + * @param menuProperty the menuProperty to set + */ + public void setMenuProperty(String menuProperty) { + this._menuProperty = menuProperty; + } } \ No newline at end of file diff --git a/Workspace/Siman/src/org/splat/simer/StartAction.java b/Workspace/Siman/src/org/splat/simer/StartAction.java index ae892fb..8e075b4 100644 --- a/Workspace/Siman/src/org/splat/simer/StartAction.java +++ b/Workspace/Siman/src/org/splat/simer/StartAction.java @@ -20,6 +20,13 @@ public class StartAction extends Action implements ServletRequestAware { private ProjectSettingsService _projectSettingsService; private ApplicationSettings _ApplicationSettings; + + /** + * Value of the menu property. + * It can be: none, create, open, study, knowledge, sysadmin, help. + */ + private String _menuProperty; + /** * Serial version ID. */ @@ -56,10 +63,18 @@ public class StartAction extends Action implements ServletRequestAware { session.put("knowledge.filter", wapp.getFilter("knowledge")); // transax.commit(); + + setMenuProperty("none"); + initializationScreenContext(_menuProperty); + return SUCCESS; } catch (Exception error) { logger.fatal("Reason:", error); + + setMenuProperty("study"); + initializationScreenContext(_menuProperty); + return ERROR; } } @@ -104,4 +119,20 @@ public class StartAction extends Action implements ServletRequestAware { public void setApplicationSettings(ApplicationSettings applicationSettings) { _ApplicationSettings = applicationSettings; } + + /** + * Get the menuProperty. + * @return the menuProperty + */ + public String getMenuProperty() { + return _menuProperty; + } + + /** + * Set the menuProperty. + * @param menuProperty the menuProperty to set + */ + public void setMenuProperty(String menuProperty) { + this._menuProperty = menuProperty; + } } \ No newline at end of file diff --git a/Workspace/Siman/src/org/splat/simer/StudyPropertiesAction.java b/Workspace/Siman/src/org/splat/simer/StudyPropertiesAction.java index 07e84c4..018497c 100644 --- a/Workspace/Siman/src/org/splat/simer/StudyPropertiesAction.java +++ b/Workspace/Siman/src/org/splat/simer/StudyPropertiesAction.java @@ -59,6 +59,12 @@ public class StudyPropertiesAction extends DisplayStudyStepAction { * Injected user service. */ private UserService _userService; + + /** + * Value of the menu property. + * It can be: none, create, open, study, knowledge, sysadmin, help. + */ + private String _menuProperty; /** * Save operation type enumeration pointing which section of properties has been edited. @@ -111,11 +117,16 @@ public class StudyPropertiesAction extends DisplayStudyStepAction { member = getStudyService().getContributors(study); staff = null; validor = null; + + setMenuProperty("study"); + initializationScreenContext(_menuProperty); - if (mystudy.isOpenForWriting() && user.canEditProperties()) + if (mystudy.isOpenForWriting() && user.canEditProperties()) { return "edit"; - else + } + else { return "display"; + } } public String doEditTitle() { @@ -145,6 +156,10 @@ public class StudyPropertiesAction extends DisplayStudyStepAction { other = null; // transax.commit(); + + setMenuProperty("study"); + initializationScreenContext(_menuProperty); + return SUCCESS; } @@ -182,6 +197,10 @@ public class StudyPropertiesAction extends DisplayStudyStepAction { i.remove(); } // transax.commit(); + + setMenuProperty("study"); + initializationScreenContext(_menuProperty); + return SUCCESS; } @@ -225,6 +244,10 @@ public class StudyPropertiesAction extends DisplayStudyStepAction { } } // transax.commit(); + + setMenuProperty("study"); + initializationScreenContext(_menuProperty); + return SUCCESS; } @@ -302,6 +325,7 @@ public class StudyPropertiesAction extends DisplayStudyStepAction { // transax.commit(); doInitialize(); // Re-initialization following the above edition + return SUCCESS; } @@ -471,4 +495,20 @@ public class StudyPropertiesAction extends DisplayStudyStepAction { public void setUserService(UserService userService) { _userService = userService; } + + /** + * Get the menuProperty. + * @return the menuProperty + */ + public String getMenuProperty() { + return _menuProperty; + } + + /** + * Set the menuProperty. + * @param menuProperty the menuProperty to set + */ + public void setMenuProperty(String menuProperty) { + this._menuProperty = menuProperty; + } } \ No newline at end of file diff --git a/Workspace/Siman/src/org/splat/simer/UploadAction.java b/Workspace/Siman/src/org/splat/simer/UploadAction.java index ad51319..4505ed2 100644 --- a/Workspace/Siman/src/org/splat/simer/UploadAction.java +++ b/Workspace/Siman/src/org/splat/simer/UploadAction.java @@ -20,6 +20,12 @@ public class UploadAction extends Action { * Injected repository service. */ private RepositoryService _repositoryService; + + /** + * Value of the menu property. + * It can be: none, create, open, study, knowledge, sysadmin, help. + */ + private String _menuProperty; private static final long serialVersionUID = 6003880772275115923L; @@ -31,11 +37,17 @@ public class UploadAction extends Action { public String doInitialize () { // ----------------------------- + setMenuProperty("study"); + initializationScreenContext(_menuProperty); + return SUCCESS; } public String doUpload () { // ------------------------- + setMenuProperty("study"); + initializationScreenContext(_menuProperty); + if (action == ToDo.cancel) return "cancel"; try { File udir = getRepositoryService().getDownloadDirectory(getConnectedUser()); @@ -46,9 +58,18 @@ public class UploadAction extends Action { if (file.exists()) file.delete(); Do.copy(upload, file); logger.info("Uploading \"" + uploadFileName + "\" " + uploadMimeType + " file."); + /*if (next == null || next.isEmpty()) { + next = "import"; + }*/ + + logger.info("MKA next = " + next); return next; } catch (OutOfMemoryError error) { + + setMenuProperty("none"); + initializationScreenContext(_menuProperty); + return "outofmemory"; } catch (Exception error) { @@ -117,4 +138,20 @@ public class UploadAction extends Action { public void setRepositoryService(RepositoryService repositoryService) { _repositoryService = repositoryService; } + + /** + * Get the menuProperty. + * @return the menuProperty + */ + public String getMenuProperty() { + return _menuProperty; + } + + /** + * Set the menuProperty. + * @param menuProperty the menuProperty to set + */ + public void setMenuProperty(String menuProperty) { + this._menuProperty = menuProperty; + } } \ No newline at end of file diff --git a/Workspace/Siman/src/org/splat/simer/UploadStudyAction.java b/Workspace/Siman/src/org/splat/simer/UploadStudyAction.java new file mode 100644 index 0000000..b6d1994 --- /dev/null +++ b/Workspace/Siman/src/org/splat/simer/UploadStudyAction.java @@ -0,0 +1,50 @@ +/***************************************************************************** + * Company EURIWARE + * Application SIMAN + * File $Id$ + * Creation date 24.10.2012 + * @author Author: Maria KRUCHININA + * @version Revision: + *****************************************************************************/ + +package org.splat.simer; + +/** + * Action class for uploading the study. + * @author Maria KRUCHININA + * + */ +public class UploadStudyAction extends Action { + + /** + * Value of the menu property. + * It can be: none, create, open, study, knowledge, sysadmin, help. + */ + private String _menuProperty; + + private static final long serialVersionUID = 6003880772275115924L; + + public String doInitialize () { + + setMenuProperty("study"); + initializationScreenContext(_menuProperty); + + return SUCCESS; + } + + /** + * Get the menuProperty. + * @return the menuProperty + */ + public String getMenuProperty() { + return _menuProperty; + } + + /** + * Set the menuProperty. + * @param menuProperty the menuProperty to set + */ + public void setMenuProperty(String menuProperty) { + this._menuProperty = menuProperty; + } +} diff --git a/Workspace/Siman/src/org/splat/simer/VersionDocumentAction.java b/Workspace/Siman/src/org/splat/simer/VersionDocumentAction.java index 1b02a87..cd89a60 100644 --- a/Workspace/Siman/src/org/splat/simer/VersionDocumentAction.java +++ b/Workspace/Siman/src/org/splat/simer/VersionDocumentAction.java @@ -46,6 +46,11 @@ public class VersionDocumentAction extends UploadBaseNextAction { * Injected repository service. */ private RepositoryService _repositoryService; + /** + * Value of the menu property. + * It can be: none, create, open, study, knowledge, sysadmin, help. + */ + private String _menuProperty; /** * Serial version ID. @@ -58,6 +63,10 @@ public class VersionDocumentAction extends UploadBaseNextAction { public String doInitialize() { // ----------------------------- + + setMenuProperty("study"); + initializationScreenContext(_menuProperty); + Session connex = Database.getCurSession(); Transaction transax = connex.beginTransaction(); User user = getConnectedUser(); @@ -134,6 +143,9 @@ public class VersionDocumentAction extends UploadBaseNextAction { public String doVersion() { // ------------------------- + setMenuProperty("study"); + initializationScreenContext(_menuProperty); + if (action == ToDo.cancel) return "cancel"; @@ -370,4 +382,20 @@ public class VersionDocumentAction extends UploadBaseNextAction { public void setRepositoryService(RepositoryService repositoryService) { _repositoryService = repositoryService; } + + /** + * Get the menuProperty. + * @return the menuProperty + */ + public String getMenuProperty() { + return _menuProperty; + } + + /** + * Set the menuProperty. + * @param menuProperty the menuProperty to set + */ + public void setMenuProperty(String menuProperty) { + this._menuProperty = menuProperty; + } } \ No newline at end of file diff --git a/Workspace/Siman/src/org/splat/simer/admin/DatabaseIndexingAction.java b/Workspace/Siman/src/org/splat/simer/admin/DatabaseIndexingAction.java index 0cdec24..8fb35f3 100644 --- a/Workspace/Siman/src/org/splat/simer/admin/DatabaseIndexingAction.java +++ b/Workspace/Siman/src/org/splat/simer/admin/DatabaseIndexingAction.java @@ -31,6 +31,12 @@ public class DatabaseIndexingAction extends Action { * Injected search service. */ private SearchService _searchService; + + /** + * Value of the menu property. + * It can be: none, create, open, study, knowledge, sysadmin, help. + */ + private String _menuProperty; // ============================================================================================================================== // Action methods @@ -43,6 +49,10 @@ public class DatabaseIndexingAction extends Action { public String doInitialize() { newstudies = getSearchService().selectStudies(); indices = ""; + + setMenuProperty("sysadmin"); + initializationScreenContext(_menuProperty); + return SUCCESS; } @@ -108,4 +118,20 @@ public class DatabaseIndexingAction extends Action { public void setSearchService(SearchService searchService) { _searchService = searchService; } + + /** + * Get the menuProperty. + * @return the menuProperty + */ + public String getMenuProperty() { + return _menuProperty; + } + + /** + * Set the menuProperty. + * @param menuProperty the menuProperty to set + */ + public void setMenuProperty(String menuProperty) { + this._menuProperty = menuProperty; + } } \ No newline at end of file diff --git a/Workspace/Siman/src/org/splat/simer/admin/ImportUserAction.java b/Workspace/Siman/src/org/splat/simer/admin/ImportUserAction.java index 14f772d..e9e04ac 100644 --- a/Workspace/Siman/src/org/splat/simer/admin/ImportUserAction.java +++ b/Workspace/Siman/src/org/splat/simer/admin/ImportUserAction.java @@ -32,6 +32,12 @@ public class ImportUserAction extends UploadBaseNextAction { * Injected user service. */ private UserService _userService; + + /** + * Value of the menu property. + * It can be: none, create, open, study, knowledge, sysadmin, help. + */ + private String _menuProperty; // ============================================================================================================================== // Action methods @@ -51,13 +57,17 @@ public class ImportUserAction extends UploadBaseNextAction { i.remove(); // Just for not showing the corresponding reserved username break; } + + setMenuProperty("sysadmin"); + initializationScreenContext(_menuProperty); + return SUCCESS; } catch (Exception error) { return ERROR; } } - + // ============================================================================================================================== // Getters // ============================================================================================================================== @@ -103,4 +113,20 @@ public class ImportUserAction extends UploadBaseNextAction { public void setUserService(UserService userService) { _userService = userService; } + + /** + * Get the menuProperty. + * @return the menuProperty + */ + public String getMenuProperty() { + return _menuProperty; + } + + /** + * Set the menuProperty. + * @param menuProperty the menuProperty to set + */ + public void setMenuProperty(String menuProperty) { + this._menuProperty = menuProperty; + } } \ No newline at end of file diff --git a/Workspace/Siman/src/spring/applicationContext.xml b/Workspace/Siman/src/spring/applicationContext.xml index e23007a..78dd149 100644 --- a/Workspace/Siman/src/spring/applicationContext.xml +++ b/Workspace/Siman/src/spring/applicationContext.xml @@ -38,6 +38,10 @@ http://www.springframework.org/schema/context/spring-context-3.0.xsd"> + + + scope="prototype" abstract="true"> + @@ -171,12 +176,12 @@ http://www.springframework.org/schema/context/spring-context-3.0.xsd"> + scope="prototype" parent ="baseAction"> + scope="prototype" parent ="baseAction"> + class="org.splat.simer.NotYetImplementedAction" + scope="prototype" parent ="baseAction"> + class="org.splat.simer.SearchStudyAction" + scope="prototype" parent ="baseAction"> + class="org.splat.simer.SearchKnowledgeAction" + scope="prototype" parent ="baseAction"> @@ -211,18 +219,24 @@ http://www.springframework.org/schema/context/spring-context-3.0.xsd"> + class="org.splat.simer.DisplayKnowledgeAction" + scope="prototype" parent ="baseAction"> + scope="prototype" parent ="baseAction"> + + + + class="org.splat.simer.VersionDocumentAction" + scope="prototype" parent ="baseAction"> @@ -231,12 +245,13 @@ http://www.springframework.org/schema/context/spring-context-3.0.xsd"> + scope="prototype" parent ="baseAction"> + class="org.splat.simer.admin.ImportUserAction" + scope="prototype" parent="baseAction">