From 83f455f08f80e2d2166c1100780913e005c3c4c3 Mon Sep 17 00:00:00 2001 From: rkv Date: Wed, 12 Dec 2012 09:17:52 +0000 Subject: [PATCH] Actions menu properties are refactored, unnecessary code is removed. --- .../org/splat/module/SaveDocumentAction.java | 9 +- .../Siman/src/org/splat/simer/Action.java | 50 ++ .../src/org/splat/simer/ConnectionAction.java | 27 +- .../splat/simer/DisplayKnowledgeAction.java | 164 +----- .../splat/simer/DisplayStudyStepAction.java | 216 ++------ .../org/splat/simer/EditDocumentAction.java | 212 ++------ .../simer/EditKnowledgeElementAction.java | 172 +------ .../simer/EditScenarioPropertiesAction.java | 193 +------ .../simer/EditSimulationContextAction.java | 223 +------- .../src/org/splat/simer/EditStudyAction.java | 187 +------ .../org/splat/simer/ImportDocumentAction.java | 154 +----- .../org/splat/simer/NewScenarioAction.java | 472 +++++++---------- .../src/org/splat/simer/NewStudyAction.java | 93 +--- .../splat/simer/NotYetImplementedAction.java | 139 +---- .../Siman/src/org/splat/simer/OpenStudy.java | 6 + .../org/splat/simer/SearchDocumentAction.java | 1 - .../splat/simer/SearchKnowledgeAction.java | 158 +----- .../org/splat/simer/SearchStudyAction.java | 152 +----- .../src/org/splat/simer/StartAction.java | 191 +------ .../splat/simer/StudyPropertiesAction.java | 474 ++++++------------ .../src/org/splat/simer/UploadAction.java | 148 +----- .../org/splat/simer/UploadStudyAction.java | 37 +- .../splat/simer/VersionDocumentAction.java | 153 +----- .../simer/admin/DatabaseIndexingAction.java | 71 +-- .../splat/simer/admin/ImportUserAction.java | 71 +-- .../simer/admin/KnowledgeElementAction.java | 1 - .../simer/admin/ProjectElementFacade.java | 10 - .../simer/admin/SimulationContextAction.java | 84 +--- .../Siman/src/org/splat/wapp/Constants.java | 22 +- 29 files changed, 670 insertions(+), 3220 deletions(-) diff --git a/Workspace/Siman/src/org/splat/module/SaveDocumentAction.java b/Workspace/Siman/src/org/splat/module/SaveDocumentAction.java index 1ab81b7..806dc9b 100644 --- a/Workspace/Siman/src/org/splat/module/SaveDocumentAction.java +++ b/Workspace/Siman/src/org/splat/module/SaveDocumentAction.java @@ -15,7 +15,6 @@ import org.splat.dal.bo.som.Document; import org.splat.dal.bo.som.DocumentType; import org.splat.dal.bo.som.ProgressState; import org.splat.dal.bo.som.Publication; -import org.splat.dal.bo.som.Scenario; import org.splat.dal.bo.som.SimulationContext; import org.splat.dal.bo.som.SimulationContextType; import org.splat.dal.dao.som.Database; @@ -95,7 +94,7 @@ public class SaveDocumentAction extends Action { String format = table[table.length - 1]; // Creation of the document - getScenarioService().checkin((Scenario) step.getOwner()); // Modules necessarily save their data in a scenario step + getScenarioService().checkin(step.getOwner().getIndex()); // Modules necessarily save their data in a scenario step connex.flush(); Document.Properties dprop = new Document.Properties(); @@ -202,7 +201,8 @@ public class SaveDocumentAction extends Action { * @param publicationService * the publicationService to set */ - public void setPublicationService(final PublicationService publicationService) { + public void setPublicationService( + final PublicationService publicationService) { _publicationService = publicationService; } @@ -437,7 +437,8 @@ public class SaveDocumentAction extends Action { * @param documentTypeService * the documentTypeService to set */ - public void setDocumentTypeService(final DocumentTypeService documentTypeService) { + public void setDocumentTypeService( + final DocumentTypeService documentTypeService) { _documentTypeService = documentTypeService; } } \ No newline at end of file diff --git a/Workspace/Siman/src/org/splat/simer/Action.java b/Workspace/Siman/src/org/splat/simer/Action.java index 04a6253..ff32355 100644 --- a/Workspace/Siman/src/org/splat/simer/Action.java +++ b/Workspace/Siman/src/org/splat/simer/Action.java @@ -109,6 +109,14 @@ public class Action extends ActionSupport implements ServletRequestAware, * 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. @@ -417,6 +425,7 @@ public class Action extends ActionSupport implements ServletRequestAware, public void initializationScreenContext(final String menuProperty) { initializationContext(); + setMenuProperty(menuProperty); getMenuBarSettings().intializeMenuBar(menuProperty); } @@ -434,6 +443,7 @@ public class Action extends ActionSupport implements ServletRequestAware, final String titleProperty, final String editDisabledProperty) { initializationContext(titleProperty, editDisabledProperty); + setMenuProperty(menuProperty); getMenuBarSettings().intializeMenuBar(menuProperty); } @@ -470,6 +480,7 @@ public class Action extends ActionSupport implements ServletRequestAware, final String toolProperty) { initializationContext(); + setMenuProperty(menuProperty); getMenuBarSettings().intializeMenuBar(menuProperty); getToolBarSettings().intializeMenuBar(toolProperty); } @@ -513,6 +524,7 @@ public class Action extends ActionSupport implements ServletRequestAware, initializationContext(); initializationContextLeftMenus(leftMenuProperty); + setMenuProperty(menuProperty); getMenuBarSettings().intializeMenuBar(menuProperty); getToolBarSettings().intializeMenuBar(toolProperty); } @@ -703,4 +715,42 @@ public class Action extends ActionSupport implements ServletRequestAware, 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; + } } \ 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 ea56286..42020b5 100644 --- a/Workspace/Siman/src/org/splat/simer/ConnectionAction.java +++ b/Workspace/Siman/src/org/splat/simer/ConnectionAction.java @@ -34,8 +34,6 @@ public class ConnectionAction extends Action { private String _password = null; private transient String _backmenu = null; - private String _menuProperty; - /** * Serial version ID. */ @@ -125,8 +123,7 @@ public class ConnectionAction extends Action { } this.connect(context, user); // Updates the session context - setMenuProperty(Constants.NONE); - initializationScreenContext(_menuProperty); + initializationScreenContext(Constants.NONE); res = _backmenu; if (res == null || "null".equals(res)) { @@ -177,8 +174,7 @@ public class ConnectionAction extends Action { this.disconnect(); // Updates the session context - setMenuProperty(Constants.NONE); - initializationScreenContext(_menuProperty); + initializationScreenContext(Constants.NONE); res = _backmenu; if (res == null || "null".equals(res)) { @@ -242,23 +238,4 @@ public class ConnectionAction extends Action { public void setBackMenu(final String menu) { this._backmenu = menu; } - - /** - * Get the menuProperty. - * - * @return the menuProperty - */ - public String getMenuProperty() { - return _menuProperty; - } - - /** - * Set the menuProperty. - * - * @param menuProperty - * the menuProperty to set - */ - public void setMenuProperty(final 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 6e7d032..9503490 100644 --- a/Workspace/Siman/src/org/splat/simer/DisplayKnowledgeAction.java +++ b/Workspace/Siman/src/org/splat/simer/DisplayKnowledgeAction.java @@ -23,37 +23,6 @@ public class DisplayKnowledgeAction extends AbstractDisplayAction { * 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; - - /** - * Value of the title bar property. - * It can be: study, knowledge. - */ - private String _titleProperty; - - /** - * Value of the tool bar property. - * It can be: none, standard, study, back. - */ - private String _toolProperty; - - /** - * Value of the left menu property. - * It can be: open, study, knowledge, scenario. - */ - private String _leftMenuProperty; - - /** - * Property that indicates whether the current open study is editable or not. - * On the screen it looks like pen on the status icon, pop-up menu also can be called. - * It is necessary for correct building the title bar. - */ - private String _editDisabledProperty = "false"; // ============================================================================================================================== // Action methods @@ -85,12 +54,10 @@ public class DisplayKnowledgeAction extends AbstractDisplayAction { } } getSession().put("menu.knowledge", _myknelm.getMenu()); - - setMenuProperty(Constants.KNOWLEDGE_MENU); - setTitleProperty(Constants.KNOWLEDGE_MENU); - setToolProperty(Constants.NONE); - setLeftMenuProperty(Constants.KNOWLEDGE_MENU); - initializationFullScreenContext(_menuProperty, _titleProperty, _editDisabledProperty, _toolProperty, _leftMenuProperty); + + initializationFullScreenContext(Constants.KNOWLEDGE_MENU, + Constants.KNOWLEDGE_MENU, Constants.FALSE, Constants.NONE, + Constants.KNOWLEDGE_MENU); return SUCCESS; } @@ -103,13 +70,11 @@ public class DisplayKnowledgeAction extends AbstractDisplayAction { } else { // Selection of a step of current study _myknelm.setSelection(_selection); } - - setMenuProperty(Constants.KNOWLEDGE_MENU); - setTitleProperty(Constants.KNOWLEDGE_MENU); - setToolProperty(Constants.NONE); - setLeftMenuProperty(Constants.KNOWLEDGE_MENU); - initializationFullScreenContext(_menuProperty, _titleProperty, _editDisabledProperty, _toolProperty, _leftMenuProperty); - + + initializationFullScreenContext(Constants.KNOWLEDGE_MENU, + Constants.KNOWLEDGE_MENU, Constants.FALSE, Constants.NONE, + Constants.KNOWLEDGE_MENU); + return SUCCESS; } @@ -123,13 +88,11 @@ public class DisplayKnowledgeAction extends AbstractDisplayAction { } else if (todo == Execute.reduceall) { _myknelm.reduceDocument(_myindex); } - - setMenuProperty(Constants.KNOWLEDGE_MENU); - setTitleProperty(Constants.KNOWLEDGE_MENU); - setToolProperty(Constants.NONE); - setLeftMenuProperty(Constants.KNOWLEDGE_MENU); - initializationFullScreenContext(_menuProperty, _titleProperty, _editDisabledProperty, _toolProperty, _leftMenuProperty); - + + initializationFullScreenContext(Constants.KNOWLEDGE_MENU, + Constants.KNOWLEDGE_MENU, Constants.FALSE, Constants.NONE, + Constants.KNOWLEDGE_MENU); + return SUCCESS; } @@ -141,22 +104,19 @@ public class DisplayKnowledgeAction extends AbstractDisplayAction { } else if (todo == Execute.reduce) { _myknelm.reduceKnowledge(_myindex); } - - setMenuProperty(Constants.KNOWLEDGE_MENU); - setTitleProperty(Constants.KNOWLEDGE_MENU); - setToolProperty(Constants.NONE); - setLeftMenuProperty(Constants.KNOWLEDGE_MENU); - initializationFullScreenContext(_menuProperty, _titleProperty, _editDisabledProperty, _toolProperty, _leftMenuProperty); - + + initializationFullScreenContext(Constants.KNOWLEDGE_MENU, + Constants.KNOWLEDGE_MENU, Constants.FALSE, Constants.NONE, + Constants.KNOWLEDGE_MENU); + return SUCCESS; } public String doClose() { closeKnowledge(); - - setMenuProperty(Constants.NONE); - initializationScreenContext(_menuProperty); - + + initializationScreenContext(Constants.NONE); + return SUCCESS; } @@ -204,84 +164,4 @@ public class DisplayKnowledgeAction extends AbstractDisplayAction { final 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(final String menuProperty) { - this._menuProperty = menuProperty; - } - - /** - * Get the _titleProperty. - * @return the _titleProperty - */ - public String getTitleProperty() { - return _titleProperty; - } - - /** - * Set the _titleProperty. - * @param _titleProperty the titleProperty to set - */ - public void setTitleProperty(final String titleProperty) { - _titleProperty = titleProperty; - } - - /** - * Get the _editDisabledProperty. - * @return the _editDisabledProperty - */ - public final String getEditDisabledProperty() { - return _editDisabledProperty; - } - - /** - * Set the editDisabledProperty. - * @param editDisabledProperty the editDisabledProperty to set - */ - public final void setEditDisabledProperty(final String editDisabledProperty) { - this._editDisabledProperty = editDisabledProperty; - } - - /** - * Get the toolProperty. - * @return the toolProperty - */ - public String getToolProperty() { - return _toolProperty; - } - - /** - * Set the toolProperty. - * @param toolProperty the toolProperty to set - */ - public void setToolProperty(final String toolProperty) { - _toolProperty = toolProperty; - } - - /** - * Get the leftMenuProperty. - * @return the leftMenuProperty - */ - public String getLeftMenuProperty() { - return _leftMenuProperty; - } - - /** - * Set the leftMenuProperty. - * @param leftMenuProperty the leftMenuProperty to set - */ - public void setLeftMenuProperty(final String leftMenuProperty) { - _leftMenuProperty = leftMenuProperty; - } } \ 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 d0a30e6..82dca6d 100644 --- a/Workspace/Siman/src/org/splat/simer/DisplayStudyStepAction.java +++ b/Workspace/Siman/src/org/splat/simer/DisplayStudyStepAction.java @@ -4,7 +4,6 @@ import java.util.List; import org.splat.dal.bo.som.ProjectElement; import org.splat.dal.bo.som.Scenario; -import org.splat.dal.bo.som.Study; import org.splat.service.StudyService; import org.splat.som.StepRights; import org.splat.wapp.Constants; @@ -34,47 +33,24 @@ public class DisplayStudyStepAction extends AbstractDisplayAction { */ private StudyService _studyService; - /** - * Value of the menu property. It can be: none, create, open, study, knowledge, sysadmin, help. - */ - private String _menuProperty; - - /** - * Value of the title bar property. It can be: study, knowledge. - */ - private String _titleProperty; - - /** - * Value of the tool bar property. It can be: none, standard, study, back. - */ - private String _toolProperty; - - /** - * Value of the left menu property. It can be: open, study, knowledge, scenario. - */ - private String _leftMenuProperty; - - /** - * Property that indicates whether the current open study is editable or not. On the screen it looks like pen on the status icon, pop-up - * menu also can be called. It is necessary for correct building the title bar. - */ - private String _editDisabledProperty = "false"; - // ============================================================================================================================== // Action methods // ============================================================================================================================== + /** + * Open the selected study. + * + * @return SUCCESS if succeeded or ERROR if can't open + */ public String doOpen() { - Study study; String res = SUCCESS; _openStudy = getOpenStudy(); if (_myindex == null) { if (_selection == null) { // Opening a study just newed _selection = _openStudy.getSelection(); // Default selection - study = _openStudy.getStudyObject(); } else { // Re-opening (refreshing) the currently open study - study = getStudyService().selectStudy(_openStudy.getIndex()); - _openStudy = open(study); // Closes the previously open study + _openStudy = open(getStudyService().selectStudy( + _openStudy.getIndex())); // Closes the previously open study _openStudy.setSelection(_selection); } } else { @@ -83,15 +59,13 @@ public class DisplayStudyStepAction extends AbstractDisplayAction { if (_openStudy != null && _openStudy.getStudyObject() != null && _openStudy.getIndex() == index) { // - The selected study is currently open _selection = _openStudy.getSelection(); // Current selection - study = _openStudy.getStudyObject(); // Current Study object // RKV:BEGIN: put in session if necessary if (!getSession().containsKey("study.open")) { - open(study); + open(_openStudy.getStudyObject()); } // RKV:END } else { // - The selected study is new - study = getStudyService().selectStudy(index); - _openStudy = open(study); + _openStudy = open(getStudyService().selectStudy(index)); _selection = _openStudy.getSelection(); // Default selection } } catch (Exception error) { @@ -112,23 +86,27 @@ public class DisplayStudyStepAction extends AbstractDisplayAction { } getSession().put("menu.study", _openStudy.getMenu()); - setMenuProperty(Constants.STUDY_MENU); - setTitleProperty(Constants.STUDY_MENU); - if (Constants.TRUE.equals(getWriteAccess()) - && getUserRights().canCreateDocument()) { - setToolProperty(Constants.STUDY_MENU); - } else { - setToolProperty(Constants.STANDARD_MENU); - } - - setLeftMenuProperty(Constants.STUDY_MENU); - - initializationFullScreenContext(_menuProperty, _titleProperty, - _editDisabledProperty, _toolProperty, _leftMenuProperty); + setMenu(); } return res; } + /** + * Set context menu. + */ + protected void setMenu() { + if (Constants.TRUE.equals(getWriteAccess()) + && getUserRights().canCreateDocument()) { + setToolProperty(Constants.STUDY_MENU); + } else { + setToolProperty(Constants.STANDARD_MENU); + } + + initializationFullScreenContext(Constants.STUDY_MENU, + Constants.STUDY_MENU, "false", getToolProperty(), + Constants.STUDY_MENU); + } + public String doSelectStep() { _openStudy = getOpenStudy(); @@ -148,18 +126,7 @@ public class DisplayStudyStepAction extends AbstractDisplayAction { menu.selects("prop-general"); } - setMenuProperty(Constants.STUDY_MENU); - setTitleProperty(Constants.STUDY_MENU); - if (Constants.TRUE.equals(getWriteAccess()) - && getUserRights().canCreateDocument()) { - setToolProperty(Constants.STUDY_MENU); - } else { - setToolProperty(Constants.STANDARD_MENU); - } - - setLeftMenuProperty(Constants.STUDY_MENU); - initializationFullScreenContext(_menuProperty, _titleProperty, - _editDisabledProperty, _toolProperty, _leftMenuProperty); + setMenu(); return SUCCESS; } @@ -175,17 +142,7 @@ public class DisplayStudyStepAction extends AbstractDisplayAction { _openStudy.reduceDocument(_myindex); } - setMenuProperty(Constants.STUDY_MENU); - setTitleProperty(Constants.STUDY_MENU); - if (Constants.TRUE.equals(getWriteAccess()) - && getUserRights().canCreateDocument()) { - setToolProperty(Constants.STUDY_MENU); - } else { - setToolProperty(Constants.STANDARD_MENU); - } - setLeftMenuProperty(Constants.STUDY_MENU); - initializationFullScreenContext(_menuProperty, _titleProperty, - _editDisabledProperty, _toolProperty, _leftMenuProperty); + setMenu(); return SUCCESS; } @@ -199,27 +156,19 @@ public class DisplayStudyStepAction extends AbstractDisplayAction { _openStudy.reduceKnowledge(_myindex); } - setMenuProperty(Constants.STUDY_MENU); - setTitleProperty(Constants.STUDY_MENU); - if (Constants.TRUE.equals(getWriteAccess()) - && getUserRights().canCreateDocument()) { - setToolProperty(Constants.STUDY_MENU); - } else { - setToolProperty(Constants.STANDARD_MENU); - } - setLeftMenuProperty(Constants.STUDY_MENU); - initializationFullScreenContext(_menuProperty, _titleProperty, - _editDisabledProperty, _toolProperty, _leftMenuProperty); + setMenu(); return SUCCESS; } + /** + * Close the currently open study. + * + * @return SUCCESS + */ public String doClose() { closeStudy(); - - setMenuProperty("none"); - initializationScreenContext(_menuProperty); - + initializationScreenContext("none"); return SUCCESS; } @@ -293,99 +242,4 @@ public class DisplayStudyStepAction extends AbstractDisplayAction { super.setOpenStudy(study); _openStudy = study; } - - /** - * Get the menuProperty. - * - * @return the menuProperty - */ - public String getMenuProperty() { - return _menuProperty; - } - - /** - * Set the menuProperty. - * - * @param menuProperty - * the menuProperty to set - */ - public void setMenuProperty(final String menuProperty) { - this._menuProperty = menuProperty; - } - - /** - * Get the _titleProperty. - * - * @return the _titleProperty - */ - public String getTitleProperty() { - return _titleProperty; - } - - /** - * Set the _titleProperty. - * - * @param _titleProperty - * the titleProperty to set - */ - public void setTitleProperty(final String titleProperty) { - _titleProperty = titleProperty; - } - - /** - * Get the editDisabledProperty. - * - * @return the editDisabledProperty - */ - public String getEditDisabledProperty() { - return _editDisabledProperty; - } - - /** - * Set the editDisabledProperty. - * - * @param editDisabledProperty - * the editDisabledProperty to set - */ - public void setEditDisabledProperty(final String editDisabledProperty) { - _editDisabledProperty = editDisabledProperty; - } - - /** - * Get the toolProperty. - * - * @return the toolProperty - */ - public String getToolProperty() { - return _toolProperty; - } - - /** - * Set the toolProperty. - * - * @param toolProperty - * the toolProperty to set - */ - public void setToolProperty(final String toolProperty) { - _toolProperty = toolProperty; - } - - /** - * Get the leftMenuProperty. - * - * @return the leftMenuProperty - */ - public String getLeftMenuProperty() { - return _leftMenuProperty; - } - - /** - * Set the leftMenuProperty. - * - * @param leftMenuProperty - * the leftMenuProperty to set - */ - public void setLeftMenuProperty(final String leftMenuProperty) { - _leftMenuProperty = leftMenuProperty; - } } \ 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 1cac34a..b2197aa 100644 --- a/Workspace/Siman/src/org/splat/simer/EditDocumentAction.java +++ b/Workspace/Siman/src/org/splat/simer/EditDocumentAction.java @@ -22,9 +22,9 @@ public class EditDocumentAction extends DisplayStudyStepAction { */ private static final long serialVersionUID = 4573036736137033679L; - private String index = null; - private String title = null; - private String filename = null; + private transient String _index = null; + private transient String _title = null; + private transient String _filename = null; /** * Injected publication service. */ @@ -37,37 +37,6 @@ 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; - - /** - * Value of the title bar property. - * It can be: study, knowledge. - */ - private String _titleProperty; - - /** - * Value of the tool bar property. - * It can be: none, standard, study, back. - */ - private String _toolProperty; - - /** - * Value of the left menu property. - * It can be: open, study, knowledge, scenario. - */ - private String _leftMenuProperty; - - /** - * Property that indicates whether the current open study is editable or not. - * On the screen it looks like pen on the status icon, pop-up menu also can be called. - * It is necessary for correct building the title bar. - */ - private String _editDisabledProperty = "false"; /** * Operations enumeration. @@ -87,41 +56,23 @@ public class EditDocumentAction extends DisplayStudyStepAction { */ public String doInitialize() { _openStudy = getOpenStudy(); - - setMenuProperty("study"); - setTitleProperty("study"); - if ("true".equals(getWriteAccess()) && getUserRights().canCreateDocument()) { - setToolProperty("study"); - } else { - setToolProperty("standard"); - } - setLeftMenuProperty("study"); - initializationFullScreenContext(_menuProperty, _titleProperty, _editDisabledProperty, _toolProperty, _leftMenuProperty); - + setMenu(); return SUCCESS; } public String doSetDocument() { - - setMenuProperty("study"); - setTitleProperty("study"); - if ("true".equals(getWriteAccess()) && getUserRights().canCreateDocument()) { - setToolProperty("study"); - } else { - setToolProperty("standard"); - } - setLeftMenuProperty("study"); - initializationFullScreenContext(_menuProperty, _titleProperty, _editDisabledProperty, _toolProperty, _leftMenuProperty); + + setMenu(); try { _openStudy = getOpenStudy(); Execute todo = Execute.valueOf(_action); Step step = _openStudy.getSelectedStep(); - Publication doc = step.getDocument(Integer.valueOf(index)); + Publication doc = step.getDocument(Integer.valueOf(_index)); if (todo == Execute.renameDocument) { - getPublicationService().rename(doc, title); + getPublicationService().rename(doc, _title); // Useless to update the document presentation } else if (todo == Execute.accept) { getPublicationService().actualize(doc); @@ -156,16 +107,8 @@ public class EditDocumentAction extends DisplayStudyStepAction { } public String doAttach() { - - setMenuProperty("study"); - setTitleProperty("study"); - if ("true".equals(getWriteAccess()) && getUserRights().canCreateDocument()) { - setToolProperty("study"); - } else { - setToolProperty("standard"); - } - setLeftMenuProperty("study"); - initializationFullScreenContext(_menuProperty, _titleProperty, _editDisabledProperty, _toolProperty, _leftMenuProperty); + + setMenu(); try { // Getting user inputs @@ -173,15 +116,17 @@ public class EditDocumentAction extends DisplayStudyStepAction { User user = getConnectedUser(); Step step = _openStudy.getSelectedStep(); File updir = getRepositoryService().getDownloadDirectory(user); - File upfile = new File(updir.getPath() + "/" + filename); - String[] parse = filename.split("\\x2E"); + File upfile = new File(updir.getPath() + "/" + _filename); + String[] parse = _filename.split("\\x2E"); - Publication edited = step.getDocument(Integer.valueOf(index)); - ConvertsRelation export = getPublicationService().attach(edited, parse[parse.length - 1]); + Publication edited = step.getDocument(Integer.valueOf(_index)); + ConvertsRelation export = getPublicationService().attach(edited, + parse[parse.length - 1]); - if (LOG.isInfoEnabled()) + if (LOG.isInfoEnabled()) { LOG.info("Moving \"" + upfile.getName() + "\" to \"" + updir.getPath() + "\"."); + } upfile.renameTo(export.getTo().asFile()); _openStudy.update(edited); @@ -193,22 +138,14 @@ public class EditDocumentAction extends DisplayStudyStepAction { } public String doDeleteDocument() { - - setMenuProperty("study"); - setTitleProperty("study"); - if ("true".equals(getWriteAccess()) && getUserRights().canCreateDocument()) { - setToolProperty("study"); - } else { - setToolProperty("standard"); - } - setLeftMenuProperty("study"); - initializationFullScreenContext(_menuProperty, _titleProperty, _editDisabledProperty, _toolProperty, _leftMenuProperty); + + setMenu(); try { _openStudy = getOpenStudy(); Step step = _openStudy.getSelectedStep(); - Publication doctag = step.getDocument(Integer.valueOf(index)); + Publication doctag = step.getDocument(Integer.valueOf(_index)); getStepService().removeDocument(step, doctag); // Updates the data structure @@ -224,19 +161,17 @@ public class EditDocumentAction extends DisplayStudyStepAction { // Getters and setters // ============================================================================================================================== - public void setDocumentTitle(String title) { - // ------------------------------------------- - this.title = title; + public void setDocumentTitle(final String title) { + this._title = title; } - public void setFileName(String filename) { - // ----------------------------------------- - this.filename = filename; + public void setFileName(final String filename) { + this._filename = filename; } - public void setIndex(String index) { - // ----------------------------------- - this.index = index; + @Override + public void setIndex(final String index) { + this._index = index; } /** @@ -254,7 +189,8 @@ public class EditDocumentAction extends DisplayStudyStepAction { * @param publicationService * the publicationService to set */ - public void setPublicationService(PublicationService publicationService) { + public void setPublicationService( + final PublicationService publicationService) { _publicationService = publicationService; } @@ -273,12 +209,13 @@ public class EditDocumentAction extends DisplayStudyStepAction { * @param repositoryService * the repositoryService to set */ - public void setRepositoryService(RepositoryService repositoryService) { + public void setRepositoryService(final RepositoryService repositoryService) { _repositoryService = repositoryService; } /** * Get the stepService. + * * @return the stepService */ public StepService getStepService() { @@ -287,90 +224,11 @@ public class EditDocumentAction extends DisplayStudyStepAction { /** * Set the stepService. - * @param stepService the stepService to set + * + * @param stepService + * the stepService to set */ - public void setStepService(StepService stepService) { + public void setStepService(final 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; - } - - /** - * Get the _titleProperty. - * @return the _titleProperty - */ - public String getTitleProperty() { - return _titleProperty; - } - - /** - * Set the _titleProperty. - * @param _titleProperty the titleProperty to set - */ - public void setTitleProperty(String titleProperty) { - _titleProperty = titleProperty; - } - - /** - * Get the editDisabledProperty. - * @return the editDisabledProperty - */ - public String getEditDisabledProperty() { - return _editDisabledProperty; - } - - /** - * Set the editDisabledProperty. - * @param editDisabledProperty the editDisabledProperty to set - */ - public void setEditDisabledProperty(String editDisabledProperty) { - _editDisabledProperty = editDisabledProperty; - } - - - /** - * Get the toolProperty. - * @return the toolProperty - */ - public String getToolProperty() { - return _toolProperty; - } - - /** - * Set the toolProperty. - * @param toolProperty the toolProperty to set - */ - public void setToolProperty(final String toolProperty) { - _toolProperty = toolProperty; - } - - /** - * Get the leftMenuProperty. - * @return the leftMenuProperty - */ - public String getLeftMenuProperty() { - return _leftMenuProperty; - } - - /** - * Set the leftMenuProperty. - * @param leftMenuProperty the leftMenuProperty to set - */ - public void setLeftMenuProperty(final String leftMenuProperty) { - _leftMenuProperty = leftMenuProperty; - } } \ 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 cfcb2c5..6d488e7 100644 --- a/Workspace/Siman/src/org/splat/simer/EditKnowledgeElementAction.java +++ b/Workspace/Siman/src/org/splat/simer/EditKnowledgeElementAction.java @@ -45,32 +45,6 @@ public class EditKnowledgeElementAction extends DisplayStudyStepAction { */ private KnowledgeElementTypeService _knowledgeElementTypeService; - /** - * Value of the menu property. It can be: none, create, open, study, knowledge, sysadmin, help. - */ - private String _menuProperty; - - /** - * Value of the title bar property. It can be: study, knowledge. - */ - private String _titleProperty; - - /** - * Property that indicates whether the current open study is editable or not. On the screen it looks like pen on the status icon, pop-up - * menu also can be called. It is necessary for correct building the title bar. - */ - private String _editDisabledProperty = "false"; - - /** - * Value of the tool bar property. It can be: none, standard, study, back. - */ - private String _toolProperty; - - /** - * Value of the left menu property. It can be: open, study, knowledge, scenario. - */ - private String _leftMenuProperty; - // ============================================================================================================================== // Action methods // ============================================================================================================================== @@ -82,19 +56,7 @@ public class EditKnowledgeElementAction extends DisplayStudyStepAction { */ public String doInitialize() { _openStudy = getOpenStudy(); - - setMenuProperty(Constants.STUDY_MENU); - setTitleProperty(Constants.STUDY_MENU); - if ("true".equals(getWriteAccess()) - && getUserRights().canCreateDocument()) { - setToolProperty(Constants.STUDY_MENU); - } else { - setToolProperty("standard"); - } - setLeftMenuProperty(Constants.STUDY_MENU); - initializationFullScreenContext(_menuProperty, _titleProperty, - _editDisabledProperty, _toolProperty, _leftMenuProperty); - + setMenu(); return SUCCESS; } @@ -106,17 +68,7 @@ public class EditKnowledgeElementAction extends DisplayStudyStepAction { public String doSetKnowledge() { String res = SUCCESS; - setMenuProperty(Constants.STUDY_MENU); - setTitleProperty(Constants.STUDY_MENU); - if ("true".equals(getWriteAccess()) - && getUserRights().canCreateDocument()) { - setToolProperty(Constants.STUDY_MENU); - } else { - setToolProperty("standard"); - } - setLeftMenuProperty(Constants.STUDY_MENU); - initializationFullScreenContext(_menuProperty, _titleProperty, - _editDisabledProperty, _toolProperty, _leftMenuProperty); + setMenu(); try { _openStudy = getOpenStudy(); @@ -212,19 +164,7 @@ public class EditKnowledgeElementAction extends DisplayStudyStepAction { */ private void updateMenu() { getMenu(Constants.STUDY_MENU).selects(_openStudy.getSelection()); // Updates the menu icon, in case of last removed document - - setMenuProperty(Constants.STUDY_MENU); - setTitleProperty(Constants.STUDY_MENU); - if ("true".equals(getWriteAccess()) - && getUserRights().canCreateDocument()) { - setToolProperty(Constants.STUDY_MENU); - } else { - setToolProperty("standard"); - } - setLeftMenuProperty(Constants.STUDY_MENU); - initializationFullScreenContext(_menuProperty, _titleProperty, - _editDisabledProperty, _toolProperty, _leftMenuProperty); - + setMenu(); } // ============================================================================================================================== @@ -338,111 +278,6 @@ public class EditKnowledgeElementAction extends DisplayStudyStepAction { _knowledgeElementTypeService = knowledgeElementTypeService; } - /** - * Get the menuProperty. - * - * @return the menuProperty - */ - @Override - public String getMenuProperty() { - return _menuProperty; - } - - /** - * Set the menuProperty. - * - * @param menuProperty - * the menuProperty to set - */ - @Override - public void setMenuProperty(final String menuProperty) { - this._menuProperty = menuProperty; - } - - /** - * Get the _titleProperty. - * - * @return the _titleProperty - */ - @Override - public String getTitleProperty() { - return _titleProperty; - } - - /** - * Set the titleProperty. - * - * @param titleProperty - * the titleProperty to set - */ - @Override - public void setTitleProperty(final String titleProperty) { - _titleProperty = titleProperty; - } - - /** - * Get the editDisabledProperty. - * - * @return the editDisabledProperty - */ - @Override - public String getEditDisabledProperty() { - return _editDisabledProperty; - } - - /** - * Set the editDisabledProperty. - * - * @param editDisabledProperty - * the editDisabledProperty to set - */ - @Override - public void setEditDisabledProperty(final String editDisabledProperty) { - _editDisabledProperty = editDisabledProperty; - } - - /** - * Get the toolProperty. - * - * @return the toolProperty - */ - @Override - public String getToolProperty() { - return _toolProperty; - } - - /** - * Set the toolProperty. - * - * @param toolProperty - * the toolProperty to set - */ - @Override - public void setToolProperty(final String toolProperty) { - _toolProperty = toolProperty; - } - - /** - * Get the leftMenuProperty. - * - * @return the leftMenuProperty - */ - @Override - public String getLeftMenuProperty() { - return _leftMenuProperty; - } - - /** - * Set the leftMenuProperty. - * - * @param leftMenuProperty - * the leftMenuProperty to set - */ - @Override - public void setLeftMenuProperty(final String leftMenuProperty) { - _leftMenuProperty = leftMenuProperty; - } - /** * Get the knowledgeValue. * @@ -460,5 +295,4 @@ public class EditKnowledgeElementAction extends DisplayStudyStepAction { public String getKnowledgeTitle() { return _knowledgeTitle; } - } \ 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 e2094b9..e29124f 100644 --- a/Workspace/Siman/src/org/splat/simer/EditScenarioPropertiesAction.java +++ b/Workspace/Siman/src/org/splat/simer/EditScenarioPropertiesAction.java @@ -14,9 +14,14 @@ import org.splat.wapp.Constants; public class EditScenarioPropertiesAction extends DisplayStudyStepAction { - private Scenario myscenario; - private String lasdate; - private String subject; + /** + * Serial version ID. + */ + private static final long serialVersionUID = 4964740932426016171L; + + private transient Scenario _myscenario; + private transient String _lasdate; + private transient String _subject; /** * The Scenario service. @@ -28,43 +33,11 @@ public class EditScenarioPropertiesAction extends DisplayStudyStepAction { */ private ProjectElementService _projectElementService; - /** - * Value of the menu property. It can be: none, create, open, study, knowledge, sysadmin, help. - */ - private String _menuProperty; - - /** - * Value of the title bar property. It can be: study, knowledge. - */ - private String _titleProperty; - - /** - * Property that indicates whether the current open study is editable or not. On the screen it looks like pen on the status icon, pop-up - * menu also can be called. It is necessary for correct building the title bar. - */ - private String _editDisabledProperty = "false"; - - /** - * Value of the tool bar property. It can be: none, standard, study, back. - */ - private String _toolProperty; - - /** - * Value of the left menu property. It can be: open, study, knowledge, scenario. - */ - private String _leftMenuProperty; - - /** - * Serial version ID. - */ - private static final long serialVersionUID = 4964740932426016171L; - // ============================================================================================================================== // Action methods // ============================================================================================================================== public String doInitialize() { - // ----------------------------- ResourceBundle label = ResourceBundle.getBundle("labels", getApplicationSettings().getCurrentLocale()); ResourceBundle custom = ResourceBundle.getBundle("som", @@ -75,17 +48,12 @@ public class EditScenarioPropertiesAction extends DisplayStudyStepAction { _openStudy = getOpenStudy(); step = _openStudy.getSelectedStep(); - myscenario = (Scenario) step.getOwner(); // The selected step belong to a scenario - lasdate = datstring.format(myscenario.getLastModificationDate()); - subject = label.getString("label.study") + " " + _openStudy.getTitle(); + _myscenario = (Scenario) step.getOwner(); // The selected step belong to a scenario + _lasdate = datstring.format(_myscenario.getLastModificationDate()); + _subject = label.getString("label.study") + " " + _openStudy.getTitle(); - setMenuProperty(Constants.STUDY_MENU); - setTitleProperty(Constants.STUDY_MENU); - setEditDisabledProperty("true"); - setToolProperty("back"); - setLeftMenuProperty("open"); - initializationFullScreenContext(_menuProperty, _titleProperty, - _editDisabledProperty, _toolProperty, _leftMenuProperty); + initializationFullScreenContext(Constants.STUDY_MENU, + Constants.STUDY_MENU, "true", "back", "open"); return SUCCESS; } @@ -103,26 +71,24 @@ public class EditScenarioPropertiesAction extends DisplayStudyStepAction { _openStudy = getOpenStudy(); _selection = _openStudy.getSelection(); step = _openStudy.getSelectedStep(); - myscenario = (Scenario) step.getOwner(); // The selected step belong to a scenario + _myscenario = (Scenario) step.getOwner(); // The selected step belong to a scenario - getScenarioService().checkin(myscenario.getIndex()); + getScenarioService().checkin(_myscenario.getIndex()); // TODO: Do it in the business service after moving to DTO instead of id parameter // or reread the scenario. - myscenario.setUser(null); + _myscenario.setUser(null); _openStudy.getMenu().refreshGivenStepItem( - getProjectElementService().getFirstStep(myscenario)); // For updating the scenario icon + getProjectElementService().getFirstStep(_myscenario)); // For updating the scenario icon - setMenuProperty(Constants.STUDY_MENU); if ("true".equals(getWriteAccess()) && getUserRights().canCreateDocument()) { setToolProperty(Constants.STUDY_MENU); } else { - setToolProperty("standard"); + setToolProperty(Constants.STANDARD_MENU); } - setLeftMenuProperty(Constants.STUDY_MENU); - initializationFullScreenContext(_menuProperty, _toolProperty, - _leftMenuProperty); + initializationFullScreenContext(Constants.STUDY_MENU, + getToolProperty(), Constants.STUDY_MENU); return SUCCESS; } @@ -138,16 +104,16 @@ public class EditScenarioPropertiesAction extends DisplayStudyStepAction { */ public User getAuthor() { User author; - if (myscenario.isCheckedout()) { - author = myscenario.getUser(); + if (_myscenario.isCheckedout()) { + author = _myscenario.getUser(); } else { - author = myscenario.getAuthor(); + author = _myscenario.getAuthor(); } return author; } public String getLastModificationDate() { - return lasdate; + return _lasdate; } public StepRights getSelectedStep() { @@ -155,15 +121,15 @@ public class EditScenarioPropertiesAction extends DisplayStudyStepAction { } public String getSubject() { - return subject; + return _subject; } public String getTitle() { - return myscenario.getTitle(); + return _myscenario.getTitle(); } public boolean isCheckedout() { - return myscenario.isCheckedout(); + return _myscenario.isCheckedout(); } /** @@ -204,109 +170,4 @@ public class EditScenarioPropertiesAction extends DisplayStudyStepAction { final ProjectElementService projectElementService) { _projectElementService = projectElementService; } - - /** - * Get the menuProperty. - * - * @return the menuProperty - */ - @Override - public String getMenuProperty() { - return _menuProperty; - } - - /** - * Set the menuProperty. - * - * @param menuProperty - * the menuProperty to set - */ - @Override - public void setMenuProperty(final String menuProperty) { - this._menuProperty = menuProperty; - } - - /** - * Get the _titleProperty. - * - * @return the _titleProperty - */ - @Override - public String getTitleProperty() { - return _titleProperty; - } - - /** - * Set the _titleProperty. - * - * @param _titleProperty - * the titleProperty to set - */ - @Override - public void setTitleProperty(final String titleProperty) { - _titleProperty = titleProperty; - } - - /** - * Get the editDisabledProperty. - * - * @return the editDisabledProperty - */ - @Override - public final String getEditDisabledProperty() { - return _editDisabledProperty; - } - - /** - * Set the editDisabledProperty. - * - * @param editDisabledProperty - * the editDisabledProperty to set - */ - @Override - public final void setEditDisabledProperty(final String editDisabledProperty) { - _editDisabledProperty = editDisabledProperty; - } - - /** - * Get the toolProperty. - * - * @return the toolProperty - */ - @Override - public String getToolProperty() { - return _toolProperty; - } - - /** - * Set the toolProperty. - * - * @param toolProperty - * the toolProperty to set - */ - @Override - public void setToolProperty(final String toolProperty) { - _toolProperty = toolProperty; - } - - /** - * Get the leftMenuProperty. - * - * @return the leftMenuProperty - */ - @Override - public String getLeftMenuProperty() { - return _leftMenuProperty; - } - - /** - * Set the leftMenuProperty. - * - * @param leftMenuProperty - * the leftMenuProperty to set - */ - @Override - public void setLeftMenuProperty(final String leftMenuProperty) { - _leftMenuProperty = leftMenuProperty; - } } \ 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 036ea3a..f1a0740 100644 --- a/Workspace/Siman/src/org/splat/simer/EditSimulationContextAction.java +++ b/Workspace/Siman/src/org/splat/simer/EditSimulationContextAction.java @@ -10,9 +10,7 @@ import org.splat.dal.bo.som.Study; import org.splat.service.SimulationContextService; import org.splat.service.SimulationContextTypeService; import org.splat.service.StepService; -import org.splat.service.StudyService; import org.splat.som.Step; -import org.splat.wapp.Constants; /** * Action for simulation context selection or input. @@ -48,10 +46,6 @@ public class EditSimulationContextAction extends DisplayStudyStepAction { * Context value. */ private transient String _value = null; - /** - * Injected study service. - */ - private StudyService _studyService; /** * Injected step service. */ @@ -65,32 +59,6 @@ public class EditSimulationContextAction extends DisplayStudyStepAction { */ private SimulationContextTypeService _simulationContextTypeService; - /** - * Value of the menu property. It can be: none, create, open, study, knowledge, sysadmin, help. - */ - private String _menuProperty; - - /** - * Value of the title bar property. It can be: study, knowledge. - */ - private String _titleProperty; - - /** - * Value of the tool bar property. It can be: none, standard, study, back. - */ - private String _toolProperty; - - /** - * Value of the left menu property. It can be: open, study, knowledge, scenario. - */ - private String _leftMenuProperty; - - /** - * Property that indicates whether the current open study is editable or not. On the screen it looks like pen on the status icon, pop-up - * menu also can be called. It is necessary for correct building the title bar. - */ - private String _editDisabledProperty = "false"; - // ============================================================================================================================== // Action methods // ============================================================================================================================== @@ -106,18 +74,7 @@ public class EditSimulationContextAction extends DisplayStudyStepAction { _openStudy = getOpenStudy(); _contype = getInvolvedContexts(); - setMenuProperty(Constants.STUDY_MENU); - setTitleProperty(Constants.STUDY_MENU); - if (Constants.TRUE.equals(getWriteAccess()) - && getUserRights().canCreateDocument()) { - setToolProperty(Constants.STUDY_MENU); - } else { - setToolProperty(Constants.STANDARD_MENU); - } - - setLeftMenuProperty(Constants.STUDY_MENU); - initializationFullScreenContext(_menuProperty, _titleProperty, - _editDisabledProperty, _toolProperty, _leftMenuProperty); + setMenu(); if (_contype.isEmpty()) { res = "create"; @@ -138,17 +95,7 @@ public class EditSimulationContextAction extends DisplayStudyStepAction { String res = "set"; _openStudy = getOpenStudy(); - setMenuProperty(Constants.STUDY_MENU); - setTitleProperty(Constants.STUDY_MENU); - if (Constants.TRUE.equals(getWriteAccess()) - && getUserRights().canCreateDocument()) { - setToolProperty(Constants.STUDY_MENU); - } else { - setToolProperty(Constants.STANDARD_MENU); - } - setLeftMenuProperty(Constants.STUDY_MENU); - initializationFullScreenContext(_menuProperty, _titleProperty, - _editDisabledProperty, _toolProperty, _leftMenuProperty); + setMenu(); int typid = Integer.valueOf(_selectype); if (typid == 0) { @@ -162,7 +109,7 @@ public class EditSimulationContextAction extends DisplayStudyStepAction { _contype = getInvolvedContexts(); _contelm = getSimulationContextService() .selectSimulationContextsWhere(cprop.setType(_type)); - + setAction("setContext"); setIndex(String.valueOf(getContextType().getIndex())); } @@ -181,17 +128,7 @@ public class EditSimulationContextAction extends DisplayStudyStepAction { try { _openStudy = getOpenStudy(); - setMenuProperty(Constants.STUDY_MENU); - setTitleProperty(Constants.STUDY_MENU); - if (Constants.TRUE.equals(getWriteAccess()) - && getUserRights().canCreateDocument()) { - setToolProperty(Constants.STUDY_MENU); - } else { - setToolProperty(Constants.STANDARD_MENU); - } - setLeftMenuProperty(Constants.STUDY_MENU); - initializationFullScreenContext(_menuProperty, _titleProperty, - _editDisabledProperty, _toolProperty, _leftMenuProperty); + setMenu(); if (_newtype.length() == 0 || _value.length() == 0) { res = INPUT; @@ -232,17 +169,7 @@ public class EditSimulationContextAction extends DisplayStudyStepAction { public String doDeleteContext() { String res = SUCCESS; - setMenuProperty(Constants.STUDY_MENU); - setTitleProperty(Constants.STUDY_MENU); - if (Constants.TRUE.equals(getWriteAccess()) - && getUserRights().canCreateDocument()) { - setToolProperty(Constants.STUDY_MENU); - } else { - setToolProperty(Constants.STANDARD_MENU); - } - setLeftMenuProperty(Constants.STUDY_MENU); - initializationFullScreenContext(_menuProperty, _titleProperty, - _editDisabledProperty, _toolProperty, _leftMenuProperty); + setMenu(); try { _openStudy = getOpenStudy(); @@ -276,17 +203,7 @@ public class EditSimulationContextAction extends DisplayStudyStepAction { String res = SUCCESS; String[] input = _value.split(","); - setMenuProperty(Constants.STUDY_MENU); - setTitleProperty(Constants.STUDY_MENU); - if (Constants.TRUE.equals(getWriteAccess()) - && getUserRights().canCreateDocument()) { - setToolProperty(Constants.STUDY_MENU); - } else { - setToolProperty(Constants.STANDARD_MENU); - } - setLeftMenuProperty(Constants.STUDY_MENU); - initializationFullScreenContext(_menuProperty, _titleProperty, - _editDisabledProperty, _toolProperty, _leftMenuProperty); + setMenu(); try { _openStudy = getOpenStudy(); @@ -322,7 +239,7 @@ public class EditSimulationContextAction extends DisplayStudyStepAction { } _openStudy.add(contex); _contype = getInvolvedContexts(); - + setAction("setContext"); setIndex(String.valueOf(getContextType().getIndex())); @@ -450,27 +367,6 @@ public class EditSimulationContextAction extends DisplayStudyStepAction { return contype; } - /** - * Get the studyService. - * - * @return the studyService - */ - @Override - public StudyService getStudyService() { - return _studyService; - } - - /** - * Set the studyService. - * - * @param studyService - * the studyService to set - */ - @Override - public void setStudyService(final StudyService studyService) { - _studyService = studyService; - } - /** * Get the simulationContextService. * @@ -529,109 +425,4 @@ public class EditSimulationContextAction extends DisplayStudyStepAction { public void setStepService(final StepService stepService) { _stepService = stepService; } - - /** - * Get the menuProperty. - * - * @return the menuProperty - */ - @Override - public String getMenuProperty() { - return _menuProperty; - } - - /** - * Set the menuProperty. - * - * @param menuProperty - * the menuProperty to set - */ - @Override - public void setMenuProperty(final String menuProperty) { - this._menuProperty = menuProperty; - } - - /** - * Get the _titleProperty. - * - * @return the _titleProperty - */ - @Override - public String getTitleProperty() { - return _titleProperty; - } - - /** - * Set the titleProperty. - * - * @param titleProperty - * the titleProperty to set - */ - @Override - public void setTitleProperty(final String titleProperty) { - _titleProperty = titleProperty; - } - - /** - * Get the editDisabledProperty. - * - * @return the editDisabledProperty - */ - @Override - public final String getEditDisabledProperty() { - return _editDisabledProperty; - } - - /** - * Set the editDisabledProperty. - * - * @param editDisabledProperty - * the editDisabledProperty to set - */ - @Override - public final void setEditDisabledProperty(final String editDisabledProperty) { - _editDisabledProperty = editDisabledProperty; - } - - /** - * Get the toolProperty. - * - * @return the toolProperty - */ - @Override - public String getToolProperty() { - return _toolProperty; - } - - /** - * Set the toolProperty. - * - * @param toolProperty - * the toolProperty to set - */ - @Override - public void setToolProperty(final String toolProperty) { - _toolProperty = toolProperty; - } - - /** - * Get the leftMenuProperty. - * - * @return the leftMenuProperty - */ - @Override - public String getLeftMenuProperty() { - return _leftMenuProperty; - } - - /** - * Set the leftMenuProperty. - * - * @param leftMenuProperty - * the leftMenuProperty to set - */ - @Override - public void setLeftMenuProperty(final String leftMenuProperty) { - _leftMenuProperty = leftMenuProperty; - } } \ 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 755ba3f..577b185 100644 --- a/Workspace/Siman/src/org/splat/simer/EditStudyAction.java +++ b/Workspace/Siman/src/org/splat/simer/EditStudyAction.java @@ -1,178 +1,43 @@ package org.splat.simer; import org.splat.dal.bo.som.Study; -import org.splat.service.StudyService; - public class EditStudyAction extends DisplayStudyStepAction { - - /** - * Serial version ID. - */ - private static final long serialVersionUID = -4865668290514118396L; - 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; - /** - * Value of the title bar property. - * It can be: study, knowledge. - */ - private String _titleProperty; - - /** - * Value of the tool bar property. - * It can be: none, standard, study, back. - */ - private String _toolProperty; - - /** - * Value of the left menu property. - * It can be: open, study, knowledge, scenario. - */ - private String _leftMenuProperty; - - /** - * Property that indicates whether the current open study is editable or not. - * On the screen it looks like pen on the status icon, pop-up menu also can be called. - * It is necessary for correct building the title bar. + * Serial version ID. */ - private String _editDisabledProperty = "false"; + private static final long serialVersionUID = -4865668290514118396L; -// ============================================================================================================================== -// Action methods -// ============================================================================================================================== - - public String doEdition () { - try { - _openStudy = getOpenStudy(); - - Execute todo = Execute.valueOf(_action); - Study study = _openStudy.getStudyObject(); - - if (todo == Execute.publish) getStudyService().moveToPublic(study); - else if (todo == Execute.promote) getStudyService().moveToReference(study); - _openStudy.getPopup().setContext("study", _openStudy.getStudyRights()); // The context has changed - - setMenuProperty("study"); - setTitleProperty("study"); - if ("true".equals(getWriteAccess()) && getUserRights().canCreateDocument()) { - setToolProperty("study"); - } else { - setToolProperty("standard"); - } - setLeftMenuProperty("study"); - initializationFullScreenContext(_menuProperty, _titleProperty, _editDisabledProperty, _toolProperty, _leftMenuProperty); - - return SUCCESS; - } - catch (RuntimeException saverror) { - LOG.error("Reason:", saverror); - return ERROR; - } - } - /** - * Get the studyService. - * - * @return the studyService - */ - public StudyService getStudyService() { - return _studyService; + private enum Execute { + publish, promote } - /** - * Set the studyService. - * - * @param studyService - * the studyService to set - */ - public void setStudyService(StudyService studyService) { - _studyService = studyService; - } - - /** - * Get the menuProperty. - * @return the menuProperty - */ - public String getMenuProperty() { - return _menuProperty; - } + // ============================================================================================================================== + // Action methods + // ============================================================================================================================== - /** - * Set the menuProperty. - * @param menuProperty the menuProperty to set - */ - public void setMenuProperty(String menuProperty) { - this._menuProperty = menuProperty; - } - - /** - * Get the _titleProperty. - * @return the _titleProperty - */ - public String getTitleProperty() { - return _titleProperty; - } + public String doEdition() { + try { + _openStudy = getOpenStudy(); - /** - * Set the _titleProperty. - * @param _titleProperty the titleProperty to set - */ - public void setTitleProperty(String titleProperty) { - _titleProperty = titleProperty; - } - /** - * Get the editDisabledProperty. - * @return the editDisabledProperty - */ - public final String getEditDisabledProperty() { - return _editDisabledProperty; - } - /** - * Set the editDisabledProperty. - * @param editDisabledProperty the editDisabledProperty to set - */ - public final void setEditDisabledProperty(String editDisabledProperty) { - _editDisabledProperty = editDisabledProperty; - } - - /** - * Get the toolProperty. - * @return the toolProperty - */ - public String getToolProperty() { - return _toolProperty; - } + Execute todo = Execute.valueOf(_action); + Study study = _openStudy.getStudyObject(); - /** - * Set the toolProperty. - * @param toolProperty the toolProperty to set - */ - public void setToolProperty(final String toolProperty) { - _toolProperty = toolProperty; - } - - /** - * Get the leftMenuProperty. - * @return the leftMenuProperty - */ - public String getLeftMenuProperty() { - return _leftMenuProperty; - } + if (todo == Execute.publish) { + getStudyService().moveToPublic(study); + } else if (todo == Execute.promote) { + getStudyService().moveToReference(study); + } + _openStudy.getPopup().setContext("study", + _openStudy.getStudyRights()); // The context has changed - /** - * Set the leftMenuProperty. - * @param leftMenuProperty the leftMenuProperty to set - */ - public void setLeftMenuProperty(final String leftMenuProperty) { - _leftMenuProperty = leftMenuProperty; - } + setMenu(); + return SUCCESS; + } catch (RuntimeException saverror) { + LOG.error("Reason:", saverror); + return ERROR; + } + } } \ 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 0a45e29..c5db79e 100644 --- a/Workspace/Siman/src/org/splat/simer/ImportDocumentAction.java +++ b/Workspace/Siman/src/org/splat/simer/ImportDocumentAction.java @@ -76,31 +76,6 @@ public class ImportDocumentAction 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; - - /** - * Value of the title bar property. It can be: study, knowledge. - */ - private String _titleProperty; - - /** - * Value of the tool bar property. It can be: none, standard, study, back. - */ - private String _toolProperty; - - /** - * Value of the left menu property. It can be: open, study, knowledge, scenario. - */ - private String _leftMenuProperty; - - /** - * Property that indicates whether the current open study is editable or not. On the screen it looks like pen on the status icon, pop-up - * menu also can be called. It is necessary for correct building the title bar. - */ - private String _editDisabledProperty = "false"; // ============================================================================================================================== // Action methods @@ -113,17 +88,13 @@ public class ImportDocumentAction extends UploadBaseNextAction { */ public String doInitialize() { - setMenuProperty(Constants.STUDY_MENU); - setTitleProperty(Constants.STUDY_MENU); - setEditDisabledProperty("true"); - if ("true".equals(getWriteAccess())) { + if (Constants.TRUE.equals(getWriteAccess())) { setToolProperty(Constants.STUDY_MENU); } else { setToolProperty(Constants.NONE); } - setLeftMenuProperty(Constants.STUDY_MENU); - initializationFullScreenContext(_menuProperty, _titleProperty, - _editDisabledProperty, _toolProperty, _leftMenuProperty); + initializationFullScreenContext(Constants.STUDY_MENU, Constants.STUDY_MENU, + Constants.FALSE, getToolProperty(), Constants.STUDY_MENU); User user = getConnectedUser(); File updir = getRepositoryService().getDownloadDirectory(user); @@ -270,9 +241,8 @@ public class ImportDocumentAction extends UploadBaseNextAction { private void setError(final String errorCode) { setErrorCode(errorCode); - setToolProperty(Constants.NONE); - initializationFullScreenContext(_menuProperty, _titleProperty, - _editDisabledProperty, _toolProperty, _leftMenuProperty); + initializationFullScreenContext(Constants.STUDY_MENU, Constants.STUDY_MENU, + Constants.FALSE, Constants.NONE, Constants.STUDY_MENU); } /** @@ -282,11 +252,8 @@ public class ImportDocumentAction extends UploadBaseNextAction { */ public String doImport() { - setMenuProperty(Constants.STUDY_MENU); - setTitleProperty(Constants.STUDY_MENU); - setEditDisabledProperty("true"); - initializationScreenContext(_menuProperty, _titleProperty, - _editDisabledProperty); + initializationScreenContext(Constants.STUDY_MENU, Constants.STUDY_MENU, + Constants.TRUE); if (action == ToDo.cancel) { return "cancel"; @@ -294,10 +261,8 @@ public class ImportDocumentAction extends UploadBaseNextAction { if (_documentType == 0) { setErrorCode("message.error.import.type"); - setToolProperty(Constants.NONE); - setLeftMenuProperty(Constants.STUDY_MENU); - initializationFullScreenContext(_menuProperty, _titleProperty, - _editDisabledProperty, _toolProperty, _leftMenuProperty); + initializationFullScreenContext(Constants.STUDY_MENU, Constants.STUDY_MENU, + Constants.TRUE, Constants.NONE, Constants.STUDY_MENU); return ERROR; } @@ -353,10 +318,8 @@ public class ImportDocumentAction extends UploadBaseNextAction { setErrorCode("message.error.internal"); } - setToolProperty(Constants.NONE); - setLeftMenuProperty(Constants.STUDY_MENU); - initializationFullScreenContext(_menuProperty, _titleProperty, - _editDisabledProperty, _toolProperty, _leftMenuProperty); + initializationFullScreenContext(Constants.STUDY_MENU, Constants.STUDY_MENU, + Constants.TRUE, Constants.NONE, Constants.STUDY_MENU); return ERROR; } @@ -589,99 +552,4 @@ public class ImportDocumentAction extends UploadBaseNextAction { final 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(final String menuProperty) { - this._menuProperty = menuProperty; - } - - /** - * Get the _titleProperty. - * - * @return the _titleProperty - */ - public String getTitleProperty() { - return _titleProperty; - } - - /** - * Set the titleProperty. - * - * @param titleProperty - * the titleProperty to set - */ - public void setTitleProperty(final String titleProperty) { - _titleProperty = titleProperty; - } - - /** - * Get the editDisabledProperty. - * - * @return the editDisabledProperty - */ - public final String getEditDisabledProperty() { - return _editDisabledProperty; - } - - /** - * Set the editDisabledProperty. - * - * @param editDisabledProperty - * the editDisabledProperty to set - */ - public final void setEditDisabledProperty(final String editDisabledProperty) { - _editDisabledProperty = editDisabledProperty; - } - - /** - * Get the toolProperty. - * - * @return the toolProperty - */ - public String getToolProperty() { - return _toolProperty; - } - - /** - * Set the toolProperty. - * - * @param toolProperty - * the toolProperty to set - */ - public void setToolProperty(final String toolProperty) { - _toolProperty = toolProperty; - } - - /** - * Get the leftMenuProperty. - * - * @return the leftMenuProperty - */ - public String getLeftMenuProperty() { - return _leftMenuProperty; - } - - /** - * Set the leftMenuProperty. - * - * @param leftMenuProperty - * the leftMenuProperty to set - */ - public void setLeftMenuProperty(final String leftMenuProperty) { - _leftMenuProperty = leftMenuProperty; - } } \ No newline at end of file diff --git a/Workspace/Siman/src/org/splat/simer/NewScenarioAction.java b/Workspace/Siman/src/org/splat/simer/NewScenarioAction.java index e93a67d..d750428 100644 --- a/Workspace/Siman/src/org/splat/simer/NewScenarioAction.java +++ b/Workspace/Siman/src/org/splat/simer/NewScenarioAction.java @@ -11,18 +11,18 @@ import org.splat.dal.bo.som.Study; import org.splat.service.ProjectElementService; import org.splat.service.ScenarioService; import org.splat.som.Step; +import org.splat.wapp.Constants; import org.splat.wapp.Menu; - public class NewScenarioAction extends Action { - private OpenStudy mystudy; - private List myscene; - private String mytitle; - private String selection; - private long scindex; - private int bastep; - private ToDo action; + private transient OpenStudy _mystudy; + private transient List _myscene; + private String _title; + private String _selection; + private transient long _scindex; + private transient int _bastep; + private transient ToDo _action; /** * Injected scenario service. */ @@ -32,210 +32,180 @@ 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; - - /** - * Value of the title bar property. - * It can be: study, knowledge. - */ - private String _titleProperty; - - /** - * Value of the tool bar property. - * It can be: none, standard, study, back. - */ - private String _toolProperty; - - /** - * Value of the left menu property. - * It can be: open, study, knowledge, scenario. - */ - private String _leftMenuProperty; - - /** - * Property that indicates whether the current open study is editable or not. - * On the screen it looks like pen on the status icon, pop-up menu also can be called. - * It is necessary for correct building the title bar. - */ - private String _editDisabledProperty = "false"; /** * Serial version ID. */ private static final long serialVersionUID = -5586724442986956861L; - protected enum ToDo { cancel, save }; - -// ============================================================================================================================== -// Action methods -// ============================================================================================================================== - - public String doInitialize () { -// ----------------------------- - mystudy = getOpenStudy(); - Study study = mystudy.getStudyObject(); - Scenario[] scene = study.getScenarii(); - Scenario base = scene[scene.length-1]; // Default base scenario - ResourceBundle locale = ResourceBundle.getBundle("labels", getApplicationSettings().getCurrentLocale()); - - myscene = Arrays.asList(scene); - scindex = base.getIndex(); - mytitle = locale.getString("label.scenario") + " " + String.valueOf(scene.length+1); - bastep = getProjectElementService().getFirstStep(base).getNumber(); // Better use the last current step ? - selection = scindex + "." + bastep; - action = null; - -//RKV Menu menu = new NewScenarioMenu(study); - Menu menu = ((NewScenarioMenu)getMenu()).init(study); //RKV - menu.selects(selection); - getSession().put("menu.scenario", menu); - - setMenuProperty("study"); - setTitleProperty("study"); - setEditDisabledProperty("true"); - setToolProperty("none"); - setLeftMenuProperty("scenario"); - initializationFullScreenContext(_menuProperty, _titleProperty, _editDisabledProperty, _toolProperty, _leftMenuProperty); - - setActionType("focus"); - - return SUCCESS; - } - - public String doSelectStep () { -// ----------------------------- - mystudy = getOpenStudy(); - Study study = mystudy.getStudyObject(); - Scenario[] scene = study.getScenarii(); - - myscene = Arrays.asList(scene); - bastep = getProjectElementService().getFirstStep(scene[0]).getNumber(); // All scenarios have the same first step number - action = null; - - getMenu("scenario").selects(selection); - - setMenuProperty("study"); - setTitleProperty("study"); - setEditDisabledProperty("true"); - setToolProperty("none"); - setLeftMenuProperty("scenario"); - initializationFullScreenContext(_menuProperty, _titleProperty, _editDisabledProperty, _toolProperty, _leftMenuProperty); - - setActionType("none"); - - return SUCCESS; - } - - public String doCreate () { -// ------------------------- - if (action == ToDo.cancel) return "cancel"; - -// Session session = Database.getCurSession(); -// Transaction transax = session.beginTransaction(); - try { mystudy = getOpenStudy(); - selection = getMenu("scenario").getSelection(); - Study study = mystudy.getStudyObject(); - String[] parse = selection.split("\\x2E"); - int scindex = Integer.valueOf(parse[0]); - int number = Integer.valueOf(parse[1]); - - Scenario[] scene = study.getScenarii(); - Scenario bascene = scene[0]; - for (int i=1; i contents = step[i].getAllDocuments(); - for (Iterator j=contents.iterator(); j.hasNext(); ) mystudy.update(j.next()); - } - mystudy.setSelection(bascene.getIndex() + "." + number); - getSession().remove("menu.scenario"); - return SUCCESS; - } - catch (RuntimeException saverror) { - LOG.error("Reason:", saverror); - - setMenuProperty("study"); - setTitleProperty("study"); - setToolProperty("standard"); - setLeftMenuProperty("study"); - initializationFullScreenContext(_menuProperty, _titleProperty, _editDisabledProperty, _toolProperty, _leftMenuProperty); - - return ERROR; - } - catch (Exception error) { - return INPUT; - } - } - -// ============================================================================================================================== -// Getters and setters -// ============================================================================================================================== - - public List getScenarii () { -// ------------------------------------ - return myscene; - } - public long getSelectedScenarioIndex () { -// -------------------------------------- - return scindex; - } - public String getSelection () { -// ----------------------------- - return selection; - } - public String getSharedStep () { -// ------------------------------- - String[] parse = selection.split("\\x2E"); - return parse[1]; - } - public String getTitle () { -// ------------------------- - return mytitle; - } - - public void setCancel (final boolean cancel) { -// -------------------------------------- - action = ToDo.cancel; - } - public void setSave (final boolean save) { -// ---------------------------------- - action = ToDo.save; - } - public void setSelectedScenario (final String index) { -// ---------------------------------------------- - scindex = Integer.valueOf(index); - } - public void setSelection (final String step) { -// -------------------------------------- - selection = step; - } - public void setTitle (final String title) { -// ----------------------------------- - mytitle = title; - } - public Boolean sharesStep () { -// ---------------------------- - return (Integer.valueOf(getSharedStep()) > bastep); - } + protected enum ToDo { + cancel, save + }; + + // ============================================================================================================================== + // Action methods + // ============================================================================================================================== + + public String doInitialize() { + _mystudy = getOpenStudy(); + Study study = _mystudy.getStudyObject(); + Scenario[] scene = study.getScenarii(); + Scenario base = scene[scene.length - 1]; // Default base scenario + ResourceBundle locale = ResourceBundle.getBundle("labels", + getApplicationSettings().getCurrentLocale()); + + _myscene = Arrays.asList(scene); + _scindex = base.getIndex(); + _title = locale.getString("label.scenario") + " " + + String.valueOf(scene.length + 1); + _bastep = getProjectElementService().getFirstStep(base).getNumber(); // Better use the last current step ? + _selection = _scindex + "." + _bastep; + _action = null; + + // RKV Menu menu = new NewScenarioMenu(study); + Menu menu = ((NewScenarioMenu) getMenu()).init(study); // RKV + menu.selects(_selection); + getSession().put("menu.scenario", menu); + + initializationFullScreenContext(Constants.STUDY_MENU, + Constants.STUDY_MENU, Constants.TRUE, Constants.NONE, + Constants.SCENARIO_MENU); + + setActionType("focus"); + + return SUCCESS; + } + + public String doSelectStep() { + _mystudy = getOpenStudy(); + Study study = _mystudy.getStudyObject(); + Scenario[] scene = study.getScenarii(); + + _myscene = Arrays.asList(scene); + _bastep = getProjectElementService().getFirstStep(scene[0]).getNumber(); // All scenarios have the same first step number + _action = null; + + getMenu("scenario").selects(_selection); + + initializationFullScreenContext(Constants.STUDY_MENU, + Constants.STUDY_MENU, Constants.TRUE, Constants.NONE, + Constants.SCENARIO_MENU); + + setActionType("none"); + + return SUCCESS; + } + + public String doCreate() { + if (_action == ToDo.cancel) { + return "cancel"; + } + + try { + _mystudy = getOpenStudy(); + _selection = getMenu("scenario").getSelection(); + Study study = _mystudy.getStudyObject(); + String[] parse = _selection.split("\\x2E"); + int scindex = Integer.valueOf(parse[0]); + int number = Integer.valueOf(parse[1]); + + Scenario[] scene = study.getScenarii(); + Scenario bascene = scene[0]; + for (int i = 1; i < scene.length; i++) { + bascene = scene[i]; + if (bascene.getIndex() == scindex) { + break; + } + } + Step[] step = null; + Scenario.Properties sprop = new Scenario.Properties().setManager( + getConnectedUser()).setTitle(_title) + .setInsertAfter(bascene); + + _bastep = getProjectElementService().getFirstStep(bascene) + .getNumber(); + if (this.sharesStep()) { + step = getProjectElementService().getSteps(bascene); + sprop.setBaseStep(step[number - _bastep]); + } + bascene = getScenarioService().addScenario(study, sprop); + // transax.commit(); + + // Update of the display + if (step != null) { + for (int i = 0; i < number - _bastep + 1; i++) { + List contents = step[i].getAllDocuments(); + for (Iterator j = contents.iterator(); j + .hasNext();) { + _mystudy.update(j.next()); + } + } + } + _mystudy.setSelection(bascene.getIndex() + "." + number); + getSession().remove("menu.scenario"); + return SUCCESS; + } catch (RuntimeException saverror) { + LOG.error("Reason:", saverror); + + initializationFullScreenContext(Constants.STUDY_MENU, + Constants.STUDY_MENU, Constants.FALSE, + Constants.STANDARD_MENU, Constants.STUDY_MENU); + + return ERROR; + } catch (Exception error) { + return INPUT; + } + } + + // ============================================================================================================================== + // Getters and setters + // ============================================================================================================================== + + public List getScenarii() { + return _myscene; + } + + public long getSelectedScenarioIndex() { + return _scindex; + } + + public String getSelection() { + return _selection; + } + + public String getSharedStep() { + String[] parse = _selection.split("\\x2E"); + return parse[1]; + } + + public String getTitle() { + return _title; + } + + public void setCancel(final boolean cancel) { + _action = ToDo.cancel; + } + + public void setSave(final boolean save) { + _action = ToDo.save; + } + + public void setSelectedScenario(final String index) { + _scindex = Integer.valueOf(index); + } + + public void setSelection(final String step) { + _selection = step; + } + + public void setTitle(final String title) { + _title = title; + } + + public Boolean sharesStep() { + return (Integer.valueOf(getSharedStep()) > _bastep); + } + /** * Get the projectElementService. * @@ -258,6 +228,7 @@ public class NewScenarioAction extends Action { /** * Get the menu. + * * @return the menu */ public Menu getMenu() { @@ -266,7 +237,9 @@ public class NewScenarioAction extends Action { /** * Set the menu. - * @param menu the menu to set + * + * @param menu + * the menu to set */ public void setMenu(final Menu menu) { _menu = menu; @@ -274,6 +247,7 @@ public class NewScenarioAction extends Action { /** * Get the scenarioService. + * * @return the scenarioService */ public ScenarioService getScenarioService() { @@ -282,89 +256,11 @@ public class NewScenarioAction extends Action { /** * Set the scenarioService. - * @param scenarioService the scenarioService to set + * + * @param scenarioService + * the scenarioService to set */ public void setScenarioService(final 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(final String menuProperty) { - this._menuProperty = menuProperty; - } - - /** - * Get the _titleProperty. - * @return the _titleProperty - */ - public String getTitleProperty() { - return _titleProperty; - } - - /** - * Set the _titleProperty. - * @param titleProperty the titleProperty to set - */ - public void setTitleProperty(final String titleProperty) { - _titleProperty = titleProperty; - } - - /** - * Get the _editDisabledProperty. - * @return the _editDisabledProperty - */ - public String getEditDisabledProperty() { - return _editDisabledProperty; - } - - /** - * Set the _editDisabledProperty. - * @param editDisabledProperty the editDisabledProperty to set - */ - public void setEditDisabledProperty(final String editDisabledProperty) { - _editDisabledProperty = editDisabledProperty; - } - - /** - * Get the toolProperty. - * @return the toolProperty - */ - public String getToolProperty() { - return _toolProperty; - } - - /** - * Set the toolProperty. - * @param toolProperty the toolProperty to set - */ - public void setToolProperty(final String toolProperty) { - _toolProperty = toolProperty; - } - - /** - * Get the leftMenuProperty. - * @return the leftMenuProperty - */ - public String getLeftMenuProperty() { - return _leftMenuProperty; - } - - /** - * Set the leftMenuProperty. - * @param leftMenuProperty the leftMenuProperty to set - */ - public void setLeftMenuProperty(final String leftMenuProperty) { - _leftMenuProperty = leftMenuProperty; - } } \ 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 8020aff..dd32969 100644 --- a/Workspace/Siman/src/org/splat/simer/NewStudyAction.java +++ b/Workspace/Siman/src/org/splat/simer/NewStudyAction.java @@ -12,6 +12,7 @@ import org.splat.kernel.MissedPropertyException; import org.splat.kernel.MultiplyDefinedException; import org.splat.service.ScenarioService; import org.splat.service.SimulationContextService; +import org.splat.wapp.Constants; /** * Action for creation of a new study. @@ -49,21 +50,6 @@ public class NewStudyAction extends Action { */ private ScenarioService _scenarioService; - /** - * 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; - - /** - * Value of the left menu property. It can be: open, study, knowledge, scenario. - */ - private String _leftMenuProperty; - // ============================================================================================================================== // Action methods // ============================================================================================================================== @@ -84,11 +70,8 @@ public class NewStudyAction extends Action { _title = locale.getString("label.study") + " " + String.valueOf(number + 1); - setMenuProperty("create"); - setToolProperty("none"); - setLeftMenuProperty("open"); - initializationFullScreenContext(_menuProperty, _toolProperty, - _leftMenuProperty); + initializationFullScreenContext(Constants.CREATE_MENU, Constants.NONE, + Constants.OPEN); return SUCCESS; } @@ -124,8 +107,7 @@ public class NewStudyAction extends Action { if (valid == 0) { value = input[1].trim(); if (value.length() == 0) { - setMenuProperty("create"); - initializationScreenContext(_menuProperty); + initializationScreenContext(Constants.CREATE_MENU); return INPUT; // No need to reinitialize the list of existing products } } @@ -153,18 +135,14 @@ public class NewStudyAction extends Action { number += 1; open(study); // Opens the study, - setMenuProperty("study"); - setToolProperty("none"); - setLeftMenuProperty("open"); - initializationFullScreenContext(_menuProperty, _toolProperty, - _leftMenuProperty); + initializationFullScreenContext(Constants.STUDY_MENU, + Constants.NONE, Constants.OPEN); return SUCCESS; } catch (Exception error) { LOG.error("Unable to save the study, reason:", error); setErrorCode("message.error.newstudy"); - setMenuProperty("none"); - initializationScreenContext(_menuProperty); + initializationScreenContext(Constants.NONE); return ERROR; } } @@ -258,61 +236,4 @@ public class NewStudyAction extends Action { public void setScenarioService(final 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(final String menuProperty) { - this._menuProperty = menuProperty; - } - - /** - * Get the toolProperty. - * - * @return the toolProperty - */ - public String getToolProperty() { - return _toolProperty; - } - - /** - * Set the toolProperty. - * - * @param toolProperty - * the toolProperty to set - */ - public void setToolProperty(final String toolProperty) { - _toolProperty = toolProperty; - } - - /** - * Get the leftMenuProperty. - * - * @return the leftMenuProperty - */ - public String getLeftMenuProperty() { - return _leftMenuProperty; - } - - /** - * Set the leftMenuProperty. - * - * @param leftMenuProperty - * the leftMenuProperty to set - */ - public void setLeftMenuProperty(final String leftMenuProperty) { - _leftMenuProperty = leftMenuProperty; - } } \ 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 5e21197..4749f8c 100644 --- a/Workspace/Siman/src/org/splat/simer/NotYetImplementedAction.java +++ b/Workspace/Siman/src/org/splat/simer/NotYetImplementedAction.java @@ -1,140 +1,33 @@ package org.splat.simer; +import org.splat.wapp.Constants; +/** + * The action for not yet implemented functionality. + */ 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; - - /** - * Value of the title bar property. - * It can be: study, knowledge. - */ - private String _titleProperty; - - /** - * Property that indicates whether the current open study is editable or not. - * On the screen it looks like pen on the status icon, pop-up menu also can be called. - * It is necessary for correct building the title bar. - */ - private String _editDisabledProperty = "false"; - - /** - * Value of the tool bar property. - * It can be: none, standard, study, back. - */ - private String _toolProperty; - - /** - * Value of the left menu property. - * It can be: open, study, knowledge, scenario. - */ - private String _leftMenuProperty; -// ============================================================================================================================== -// Action methods -// ============================================================================================================================== + // ============================================================================================================================== + // Action methods + // ============================================================================================================================== - public String doInitialize () { -// ----------------------------- - - setMenuProperty("study"); - setTitleProperty("study"); - setEditDisabledProperty("true"); - setToolProperty("none"); - setLeftMenuProperty("study"); - initializationFullScreenContext(_menuProperty, _titleProperty, _editDisabledProperty, _toolProperty, _leftMenuProperty); - - setErrorCode("message.error.notyetimplemented"); - - 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(final String menuProperty) { - this._menuProperty = menuProperty; - } - /** - * Get the _titleProperty. - * @return the _titleProperty + * Action initialization. + * + * @return SUCCESS */ - public String getTitleProperty() { - return _titleProperty; - } + public String doInitialize() { + initializationFullScreenContext(Constants.STUDY_MENU, + Constants.STUDY_MENU, Constants.TRUE, Constants.NONE, + Constants.STUDY_MENU); - /** - * Set the _titleProperty. - * @param _titleProperty the titleProperty to set - */ - public void setTitleProperty(final String titleProperty) { - _titleProperty = titleProperty; - } + setErrorCode("message.error.notyetimplemented"); - /** - * Get the editDisabledProperty. - * @return the editDisabledProperty - */ - public final String getEditDisabledProperty() { - return _editDisabledProperty; - } - - /** - * Set the editDisabledProperty. - * @param editDisabledProperty the editDisabledProperty to set - */ - public final void setEditDisabledProperty(final String editDisabledProperty) { - _editDisabledProperty = editDisabledProperty; - } - - /** - * Get the toolProperty. - * @return the toolProperty - */ - public String getToolProperty() { - return _toolProperty; - } - - /** - * Set the toolProperty. - * @param toolProperty the toolProperty to set - */ - public void setToolProperty(final String toolProperty) { - _toolProperty = toolProperty; - } - - /** - * Get the leftMenuProperty. - * @return the leftMenuProperty - */ - public String getLeftMenuProperty() { - return _leftMenuProperty; - } - - /** - * Set the leftMenuProperty. - * @param leftMenuProperty the leftMenuProperty to set - */ - public void setLeftMenuProperty(final String leftMenuProperty) { - _leftMenuProperty = leftMenuProperty; + return SUCCESS; } } \ 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 1fef311..8fc62e9 100644 --- a/Workspace/Siman/src/org/splat/simer/OpenStudy.java +++ b/Workspace/Siman/src/org/splat/simer/OpenStudy.java @@ -40,6 +40,9 @@ import org.splat.som.StudyRights; import org.splat.util.BeanHelper; import org.splat.wapp.ToolBar; +/** + * Presentation of the currently open study. + */ public class OpenStudy extends AbstractOpenObject implements OpenStudyServices { /** @@ -47,6 +50,9 @@ public class OpenStudy extends AbstractOpenObject implements OpenStudyServices { */ protected final static Logger LOGGER = org.splat.simer.Action.LOG; + /** + * The currently open study. + */ private transient Study _mystudy; /** * User rights on the open study. diff --git a/Workspace/Siman/src/org/splat/simer/SearchDocumentAction.java b/Workspace/Siman/src/org/splat/simer/SearchDocumentAction.java index a97e6ff..3aa5c6a 100644 --- a/Workspace/Siman/src/org/splat/simer/SearchDocumentAction.java +++ b/Workspace/Siman/src/org/splat/simer/SearchDocumentAction.java @@ -13,7 +13,6 @@ public class SearchDocumentAction extends Action { // ============================================================================================================================== public String doInitialize () { -// ----------------------------- return SUCCESS; } } \ 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 0ef7fc9..e404872 100644 --- a/Workspace/Siman/src/org/splat/simer/SearchKnowledgeAction.java +++ b/Workspace/Siman/src/org/splat/simer/SearchKnowledgeAction.java @@ -13,8 +13,7 @@ import org.splat.dal.bo.som.Visibility; import org.splat.kernel.InvalidPropertyException; import org.splat.service.KnowledgeElementTypeService; import org.splat.service.SearchService; -import org.splat.service.SimulationContextService; -import org.splat.service.UserService; +import org.splat.wapp.Constants; /** * Action for searching a knowledge in the database. @@ -58,38 +57,11 @@ public class SearchKnowledgeAction extends AbstractSearchBaseAction { * Injected search service. */ private SearchService _searchService; - /** - * Injected simulation context service. - */ - private SimulationContextService _simulationContextService; /** * Injected knowledge element service. */ private KnowledgeElementTypeService _knowledgeElementTypeService; - /** - * Injected user service. - */ - private UserService _userService; - - /** - * 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; - - /** - * Value of the left menu property. - * It can be: open, study, knowledge, scenario. - */ - private String _leftMenuProperty; - // ============================================================================================================================== // Action methods // ============================================================================================================================== @@ -100,20 +72,18 @@ public class SearchKnowledgeAction extends AbstractSearchBaseAction { * @return SUCCESS if succeeded, ERROR if doSearch() is failed */ public String doInitialize() { - - setMenuProperty("open"); - setToolProperty("none"); - setLeftMenuProperty("open"); - initializationFullScreenContext(_menuProperty, _toolProperty, _leftMenuProperty); - + + initializationFullScreenContext(Constants.OPEN, Constants.NONE, + Constants.OPEN); + String res = SUCCESS; try { loadFilter(); doSearch(); // Final initialization of the form - _knowledgeTypes = getKnowledgeElementTypeService().selectTypesWhere( - ProgressState.APPROVED); + _knowledgeTypes = getKnowledgeElementTypeService() + .selectTypesWhere(ProgressState.APPROVED); setCandidates(); setContextTypeOptions(getInvolvedContexts()); } catch (Exception error) { @@ -126,12 +96,9 @@ public class SearchKnowledgeAction extends AbstractSearchBaseAction { @Override protected String doSearch() throws InvalidPropertyException { - // ---------------------------- - setMenuProperty("open"); - initializationScreenContext(_menuProperty); - - Map session = getSession(); + initializationScreenContext(Constants.OPEN); + Map session = getSession(); KnowledgeElement.Properties sprop = new KnowledgeElement.Properties(); // Search matching all criteria @@ -184,37 +151,30 @@ public class SearchKnowledgeAction extends AbstractSearchBaseAction { // ============================================================================================================================== public String getContextMatch() { - // -------------------------------- return _contextMatch; } public String getCriteriaMatch() { - // --------------------------------- return _criteriaMatch; } public List getKnowledgeTypes() { - // ------------------------------------------------------ return _knowledgeTypes; } public String getReference() { - // ----------------------------- return _reference; } public String getState() { - // ------------------------ return _state; } public String getVisibility() { - // ------------------------------ return _visibility; } public String getWords() { - // ------------------------- return _words; } @@ -223,32 +183,26 @@ public class SearchKnowledgeAction extends AbstractSearchBaseAction { // ============================================================================================================================== public void setContextMatch(final String value) { - // ------------------------------------------ this._contextMatch = value; } public void setCriteriaMatch(final String value) { - // ------------------------------------------- this._criteriaMatch = value; } public void setReference(final String value) { - // --------------------------------------- this._reference = value; } public void setState(final String value) { - // ---------------------------------- this._state = value; } public void setVisibility(final String value) { - // ---------------------------------------- this._visibility = value; } public void setWords(final String value) { - // ----------------------------------- this._words = value; } @@ -258,14 +212,12 @@ public class SearchKnowledgeAction extends AbstractSearchBaseAction { @Override protected List getInvolvedContexts() { - // ------------------------------------------------------------ return getSimulationContextService().selectAllTypes(); } @Override @SuppressWarnings("unchecked") protected void loadFilter() { - // ---------------------------- Map session = getSession(); User user = getConnectedUser(); Map filter = (Map) session @@ -288,7 +240,6 @@ public class SearchKnowledgeAction extends AbstractSearchBaseAction { @Override @SuppressWarnings("unchecked") protected void saveFilter() { - // ---------------------------- Map session = getSession(); Map filter = (Map) session .get("knowledge.filter"); // A default filter is supposed being set at start @@ -304,7 +255,8 @@ public class SearchKnowledgeAction extends AbstractSearchBaseAction { _context = (List) filter.get("context"); // Only criteria not part of the form // Initialization required by all do functions - _knowledgeTypes = getKnowledgeElementTypeService().selectTypesWhere(ProgressState.APPROVED); + _knowledgeTypes = getKnowledgeElementTypeService().selectTypesWhere( + ProgressState.APPROVED); } /** @@ -326,28 +278,6 @@ public class SearchKnowledgeAction extends AbstractSearchBaseAction { _searchService = searchService; } - /** - * Get the simulationContextService. - * - * @return the simulationContextService - */ - @Override - public SimulationContextService getSimulationContextService() { - return _simulationContextService; - } - - /** - * Set the simulationContextService. - * - * @param simulationContextService - * the simulationContextService to set - */ - @Override - public void setSimulationContextService( - final SimulationContextService simulationContextService) { - _simulationContextService = simulationContextService; - } - /** * Get the knowledgeElementTypeService. * @@ -367,70 +297,4 @@ public class SearchKnowledgeAction extends AbstractSearchBaseAction { final KnowledgeElementTypeService knowledgeElementTypeService) { _knowledgeElementTypeService = knowledgeElementTypeService; } - - /** - * Get the userService. - * @return the userService - */ - @Override - public UserService getUserService() { - return _userService; - } - - /** - * Set the userService. - * @param userService the userService to set - */ - @Override - public void setUserService(final 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(final String menuProperty) { - this._menuProperty = menuProperty; - } - - /** - * Get the toolProperty. - * @return the toolProperty - */ - public String getToolProperty() { - return _toolProperty; - } - - /** - * Set the toolProperty. - * @param toolProperty the toolProperty to set - */ - public void setToolProperty(final String toolProperty) { - _toolProperty = toolProperty; - } - - /** - * Get the leftMenuProperty. - * @return the leftMenuProperty - */ - public String getLeftMenuProperty() { - return _leftMenuProperty; - } - - /** - * Set the leftMenuProperty. - * @param leftMenuProperty the leftMenuProperty to set - */ - public void setLeftMenuProperty(final String leftMenuProperty) { - _leftMenuProperty = leftMenuProperty; - } } \ 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 766971a..37beb4b 100644 --- a/Workspace/Siman/src/org/splat/simer/SearchStudyAction.java +++ b/Workspace/Siman/src/org/splat/simer/SearchStudyAction.java @@ -11,15 +11,19 @@ import org.splat.dal.bo.som.Study; import org.splat.dal.bo.som.Visibility; import org.splat.kernel.InvalidPropertyException; import org.splat.service.SearchService; -import org.splat.service.SimulationContextService; -import org.splat.service.UserService; import org.splat.service.technical.ProjectSettingsService; +import org.splat.wapp.Constants; /** * Search studies form action. */ public class SearchStudyAction extends AbstractSearchBaseAction { + /** + * Serial version ID. + */ + private static final long serialVersionUID = -1910481357051393077L; + /** * "Private", "Public", "All". */ @@ -52,37 +56,6 @@ public class SearchStudyAction extends AbstractSearchBaseAction { * Injected search service. */ private SearchService _searchService; - /** - * Injected simulation context service. - */ - private SimulationContextService _simulationContextService; - /** - * Injected user service. - */ - private UserService _userService; - - /** - * 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; - - /** - * Value of the left menu property. - * It can be: open, study, knowledge, scenario. - */ - private String _leftMenuProperty; - - /** - * Serial version ID. - */ - private static final long serialVersionUID = -1910481357051393077L; enum UserAction { refreshResult, selectContextType, selectContextValue, cancelSelect, removeContext @@ -94,6 +67,7 @@ public class SearchStudyAction extends AbstractSearchBaseAction { /** * Initialize study search form. + * * @return SUCCESS if no exception, otherwise return ERROR */ public String doInitialize() { @@ -105,25 +79,23 @@ public class SearchStudyAction extends AbstractSearchBaseAction { // Final initialization of the form setCandidates(); setContextTypeOptions(getInvolvedContexts()); - - setMenuProperty("open"); - setToolProperty("none"); - setLeftMenuProperty("open"); - initializationFullScreenContext(_menuProperty, _toolProperty, _leftMenuProperty); + initializationFullScreenContext(Constants.OPEN, Constants.NONE, + Constants.OPEN); + } catch (Exception error) { // No need to roll back the transaction as it is read only LOG.error("Reason: ", error); - - setMenuProperty("none"); - initializationScreenContext(_menuProperty); - + + initializationScreenContext(Constants.NONE); + res = ERROR; } return res; } - /** + /** * {@inheritDoc} + * * @see org.splat.simer.AbstractSearchBaseAction#doSearch() */ @Override @@ -321,98 +293,8 @@ public class SearchStudyAction extends AbstractSearchBaseAction { * @param projectSettingsService * project settings service */ - public void setProjectSettings(final ProjectSettingsService projectSettingsService) { + public void setProjectSettings( + final ProjectSettingsService projectSettingsService) { _projectSettings = projectSettingsService; } - - /** - * Get the simulationContextService. - * - * @return the simulationContextService - */ - @Override - public SimulationContextService getSimulationContextService() { - return _simulationContextService; - } - - /** - * Set the simulationContextService. - * - * @param simulationContextService - * the simulationContextService to set - */ - @Override - public void setSimulationContextService( - final SimulationContextService simulationContextService) { - _simulationContextService = simulationContextService; - } - - /** - * Get the userService. - * - * @return the userService - */ - @Override - public UserService getUserService() { - return _userService; - } - - /** - * Set the userService. - * - * @param userService - * the userService to set - */ - @Override - public void setUserService(final 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(final String menuProperty) { - this._menuProperty = menuProperty; - } - - /** - * Get the toolProperty. - * @return the toolProperty - */ - public String getToolProperty() { - return _toolProperty; - } - - /** - * Set the toolProperty. - * @param toolProperty the toolProperty to set - */ - public void setToolProperty(final String toolProperty) { - _toolProperty = toolProperty; - } - - /** - * Get the leftMenuProperty. - * @return the leftMenuProperty - */ - public String getLeftMenuProperty() { - return _leftMenuProperty; - } - - /** - * Set the leftMenuProperty. - * @param leftMenuProperty the leftMenuProperty to set - */ - public void setLeftMenuProperty(final String leftMenuProperty) { - _leftMenuProperty = leftMenuProperty; - } } \ 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 ab2832e..64a6ed5 100644 --- a/Workspace/Siman/src/org/splat/simer/StartAction.java +++ b/Workspace/Siman/src/org/splat/simer/StartAction.java @@ -2,9 +2,6 @@ package org.splat.simer; import java.util.Map; -import javax.servlet.http.HttpServletRequest; - -import org.apache.struts2.interceptor.ServletRequestAware; import org.splat.service.technical.ProjectSettingsService; import org.splat.som.ApplicationRights; import org.splat.wapp.Constants; @@ -12,51 +9,16 @@ import org.splat.wapp.Constants; /** * Start application action. */ -public class StartAction extends Action implements ServletRequestAware { +public class StartAction extends Action { /** * Serial version ID. */ private static final long serialVersionUID = 5875058140682652964L; - /** - * HTTP request. - */ - private transient HttpServletRequest _request = null; - /** * Injected project settings service. */ private ProjectSettingsService _projectSettings; - /** - * Injected application settings service. - */ - private ApplicationSettings _applicationSettings; - - /** - * Value of the menu property. It can be: none, create, open, study, knowledge, sysadmin, help. - */ - private String _menuProperty; - - /** - * Value of the title bar property. It can be: study, knowledge. - */ - private String _titleProperty; - - /** - * Property that indicates whether the current open study is editable or not. On the screen it looks like pen on the status icon, pop-up - * menu also can be called. It is necessary for correct building the title bar. - */ - private String _editDisabledProperty = "false"; - - /** - * Value of the tool bar property. It can be: none, standard, study, back. - */ - private String _toolProperty; - - /** - * Value of the left menu property. It can be: open, study, knowledge, scenario. - */ - private String _leftMenuProperty; // ============================================================================================================================== // Action execution @@ -64,12 +26,13 @@ public class StartAction extends Action implements ServletRequestAware { /** * Initialize application. + * * @return SUCCESS if succeeded, ERROR - if exception is caught */ public String doInitialize() { - StringBuffer wappurl = _request.getRequestURL(); // "http://{server}:{port}/{webapp}/", including the leading '/' + StringBuffer wappurl = getServletRequest().getRequestURL(); // "http://{server}:{port}/{webapp}/", including the leading '/' String res = SUCCESS; - + LOG.info(new StringBuffer("Initializing ").append(wappurl) .append("...").toString()); try { @@ -81,11 +44,12 @@ public class StartAction extends Action implements ServletRequestAware { // Database configuration project.configure(root - + ApplicationSettings.getApplicationProperty("wapp.configuration")); + + ApplicationSettings + .getApplicationProperty("wapp.configuration")); // Configure menus for the current user wapp.configure(); - + // Initialization of the user session Map session = getSession(); @@ -94,19 +58,14 @@ public class StartAction extends Action implements ServletRequestAware { session.put("knowledge.filter", wapp .getFilter(Constants.KNOWLEDGE_MENU)); - setMenuProperty(Constants.NONE); - initializationScreenContext(_menuProperty); - + initializationScreenContext(Constants.NONE); + } catch (Exception error) { LOG.fatal("Reason:", error); - setMenuProperty(Constants.STUDY_MENU); - setTitleProperty(Constants.STUDY_MENU); - setEditDisabledProperty("true"); - setToolProperty(Constants.NONE); - setLeftMenuProperty(Constants.STUDY_MENU); - initializationFullScreenContext(_menuProperty, _titleProperty, - _editDisabledProperty, _toolProperty, _leftMenuProperty); + initializationFullScreenContext(Constants.STUDY_MENU, + Constants.STUDY_MENU, Constants.TRUE, Constants.NONE, + Constants.STUDY_MENU); res = ERROR; } @@ -117,15 +76,6 @@ public class StartAction extends Action implements ServletRequestAware { // Setter // ============================================================================================================================== - /** - * {@inheritDoc} - * @see org.splat.simer.Action#setServletRequest(javax.servlet.http.HttpServletRequest) - */ - @Override - public void setServletRequest(final HttpServletRequest request) { - this._request = request; - } - /** * Get project settings. * @@ -145,121 +95,4 @@ public class StartAction extends Action implements ServletRequestAware { final ProjectSettingsService projectSettingsService) { _projectSettings = projectSettingsService; } - - /** - * Get the applicationSettings. - * - * @return the applicationSettings - */ - @Override - public ApplicationSettings getApplicationSettings() { - return _applicationSettings; - } - - /** - * Set the applicationSettings. - * - * @param applicationSettings - * the applicationSettings to set - */ - @Override - public void setApplicationSettings( - final 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(final String menuProperty) { - this._menuProperty = menuProperty; - } - - /** - * Get the _titleProperty. - * - * @return the _titleProperty - */ - public String getTitleProperty() { - return _titleProperty; - } - - /** - * Set the titleProperty. - * - * @param titleProperty - * the titleProperty to set - */ - public void setTitleProperty(final String titleProperty) { - _titleProperty = titleProperty; - } - - /** - * Get the editDisabledProperty. - * - * @return the editDisabledProperty - */ - public final String getEditDisabledProperty() { - return _editDisabledProperty; - } - - /** - * Set the editDisabledProperty. - * - * @param editDisabledProperty - * the editDisabledProperty to set - */ - public final void setEditDisabledProperty(final String editDisabledProperty) { - _editDisabledProperty = editDisabledProperty; - } - - /** - * Get the toolProperty. - * - * @return the toolProperty - */ - public String getToolProperty() { - return _toolProperty; - } - - /** - * Set the toolProperty. - * - * @param toolProperty - * the toolProperty to set - */ - public void setToolProperty(final String toolProperty) { - _toolProperty = toolProperty; - } - - /** - * Get the leftMenuProperty. - * - * @return the leftMenuProperty - */ - public String getLeftMenuProperty() { - return _leftMenuProperty; - } - - /** - * Set the leftMenuProperty. - * - * @param leftMenuProperty - * the leftMenuProperty to set - */ - public void setLeftMenuProperty(final String leftMenuProperty) { - _leftMenuProperty = leftMenuProperty; - } } \ 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 5f460ef..be785bc 100644 --- a/Workspace/Siman/src/org/splat/simer/StudyPropertiesAction.java +++ b/Workspace/Siman/src/org/splat/simer/StudyPropertiesAction.java @@ -1,8 +1,8 @@ package org.splat.simer; +import java.util.ArrayList; import java.util.Iterator; import java.util.List; -import java.util.Vector; import org.splat.dal.bo.kernel.User; import org.splat.dal.bo.som.DocumentType; @@ -12,10 +12,10 @@ import org.splat.dal.bo.som.ValidationStep; import org.splat.kernel.InvalidPropertyException; import org.splat.kernel.Name; import org.splat.service.DocumentTypeService; -import org.splat.service.StudyService; import org.splat.service.UserService; import org.splat.som.ApplicationRights; import org.splat.som.StudyRights; +import org.splat.wapp.Constants; /** * Edit/display study properties (study configuration) screen action. @@ -28,63 +28,48 @@ public class StudyPropertiesAction extends DisplayStudyStepAction { private static final long serialVersionUID = 4210696018741092900L; // Presentation fields - private List staff; - private List member; - private List validor; - private List validation; - private ValidationFacade validefault; - private List other; + private transient List _staff; + private transient List _member; + private transient List _validor; + private transient List _validation; + private transient ValidationFacade _validefault; + private transient List _other; // User input fields - private Save tosave; // Edition action (title, contributors or cycle) - private String edicycle; - private String stitle; // Title of the study - private String contributors; // List of existing contributors, some of them may have been removed - private String candidates; // List of added contributors - private long type; // Type of document to be included in the validation process - private int publisher; - private int reviewer; - private int approver; - /** - * Injected study service. + * Edition action (title, contributors or cycle). */ - private StudyService _studyService; + private transient Save _tosave; + private transient String _edicycle; /** - * Injected document type service. + * Title of the study. */ - private DocumentTypeService _documentTypeService; - + private transient String _stitle; /** - * Injected user service. + * List of existing contributors, some of them may have been removed. */ - private UserService _userService; - + private transient String _contributors; /** - * Value of the menu property. It can be: none, create, open, study, knowledge, sysadmin, help. + * List of added contributors. */ - private String _menuProperty; - + private transient String _candidates; /** - * Value of the title bar property. It can be: study, knowledge. + * Type of document to be included in the validation process. */ - private String _titleProperty; + private transient long _type; + private transient int _publisher; + private transient int _reviewer; + private transient int _approver; /** - * Value of the tool bar property. It can be: none, standard, study, back. - */ - private String _toolProperty; - - /** - * Value of the left menu property. It can be: open, study, knowledge, scenario. + * Injected document type service. */ - private String _leftMenuProperty; + private DocumentTypeService _documentTypeService; /** - * Property that indicates whether the current open study is editable or not. On the screen it looks like pen on the status icon, pop-up - * menu also can be called. It is necessary for correct building the title bar. + * Injected user service. */ - private String _editDisabledProperty = "false"; + private UserService _userService; /** * Save operation type enumeration pointing which section of properties has been edited. @@ -115,198 +100,174 @@ public class StudyPropertiesAction extends DisplayStudyStepAction { */ public String doInitialize() { + String res; _openStudy = getOpenStudy(); - validation = new Vector(); - validefault = null; - other = getDocumentTypeService().selectResultTypes(); + _validation = new ArrayList(); + _validefault = null; + _other = getDocumentTypeService().selectResultTypes(); Study study = _openStudy.getStudyObject(); StudyRights user = _openStudy.getStudyRights(); - for (Iterator i = other.iterator(); i.hasNext();) { + for (Iterator i = _other.iterator(); i.hasNext();) { DocumentType type = i.next(); ValidationCycle cycle = getStudyService().getValidationCycleOf( study, type); if (cycle.isDefault()) { - validefault = new ValidationFacade(cycle, + _validefault = new ValidationFacade(cycle, getApplicationSettings().getCurrentLocale()); continue; } - validation.add(new ValidationFacade(cycle, getApplicationSettings() - .getCurrentLocale())); + _validation.add(new ValidationFacade(cycle, + getApplicationSettings().getCurrentLocale())); i.remove(); } - if (validefault != null) { - validation.add(validefault); // In order to be at the end + if (_validefault != null) { + _validation.add(_validefault); // In order to be at the end } - member = getStudyService().getContributors(study); - staff = null; - validor = null; - - setMenuProperty("study"); - setTitleProperty("study"); - setEditDisabledProperty("true"); - setToolProperty("back"); - setLeftMenuProperty("open"); - initializationFullScreenContext(_menuProperty, _titleProperty, - _editDisabledProperty, _toolProperty, _leftMenuProperty); + _member = getStudyService().getContributors(study); + _staff = null; + _validor = null; + + initializationFullScreenContext(Constants.STUDY_MENU, + Constants.STUDY_MENU, Constants.TRUE, Constants.BACK, + Constants.OPEN); if (_openStudy.isOpenForWriting() && user.canEditProperties()) { - return "edit"; + res = "edit"; } else { - return "display"; + res = "display"; } + return res; } public String doEditTitle() { - // Session connex = Database.getCurSession(); - // Transaction transax = connex.beginTransaction(); _openStudy = getOpenStudy(); - validation = new Vector(); - validefault = null; - other = getDocumentTypeService().selectResultTypes(); + _validation = new ArrayList(); + _validefault = null; + _other = getDocumentTypeService().selectResultTypes(); Study study = _openStudy.getStudyObject(); - for (Iterator i = other.iterator(); i.hasNext();) { + for (Iterator i = _other.iterator(); i.hasNext();) { DocumentType type = i.next(); ValidationCycle cycle = getStudyService().getValidationCycleOf( study, type); if (cycle.isDefault()) { - validefault = new ValidationFacade(cycle, + _validefault = new ValidationFacade(cycle, getApplicationSettings().getCurrentLocale()); continue; } - validation.add(new ValidationFacade(cycle, getApplicationSettings() - .getCurrentLocale())); + _validation.add(new ValidationFacade(cycle, + getApplicationSettings().getCurrentLocale())); } - if (validefault != null) { - validation.add(validefault); // In order to be at the end + if (_validefault != null) { + _validation.add(_validefault); // In order to be at the end } - member = getStudyService().getContributors(study); - staff = null; - validor = null; - other = null; - - // transax.commit(); - - setMenuProperty("study"); - setTitleProperty("study"); - setEditDisabledProperty("true"); - setToolProperty("back"); - setLeftMenuProperty("open"); - initializationFullScreenContext(_menuProperty, _titleProperty, - _editDisabledProperty, _toolProperty, _leftMenuProperty); + _member = getStudyService().getContributors(study); + _staff = null; + _validor = null; + _other = null; + + initializationFullScreenContext(Constants.STUDY_MENU, + Constants.STUDY_MENU, Constants.TRUE, Constants.BACK, + Constants.OPEN); setActionType("edititle"); return SUCCESS; } public String doEditContributors() { - // Session connex = Database.getCurSession(); - // Transaction transax = connex.beginTransaction(); _openStudy = getOpenStudy(); - validation = new Vector(); - validefault = null; - other = getDocumentTypeService().selectAllTypes(); + _validation = new ArrayList(); + _validefault = null; + _other = getDocumentTypeService().selectAllTypes(); Study study = _openStudy.getStudyObject(); - for (Iterator i = other.iterator(); i.hasNext();) { + for (Iterator i = _other.iterator(); i.hasNext();) { DocumentType type = i.next(); ValidationCycle cycle = getStudyService().getValidationCycleOf( study, type); if (cycle.isDefault()) { - validefault = new ValidationFacade(cycle, + _validefault = new ValidationFacade(cycle, getApplicationSettings().getCurrentLocale()); continue; } - validation.add(new ValidationFacade(cycle, getApplicationSettings() - .getCurrentLocale())); + _validation.add(new ValidationFacade(cycle, + getApplicationSettings().getCurrentLocale())); } - if (validefault != null) { - validation.add(validefault); // In order to be at the end + if (_validefault != null) { + _validation.add(_validefault); // In order to be at the end } - member = getStudyService().getContributors(study); - staff = getUserService().selectAllUsers(); - validor = null; - other = null; + _member = getStudyService().getContributors(study); + _staff = getUserService().selectAllUsers(); + _validor = null; + _other = null; User me = this.getConnectedUser(); - for (Iterator i = staff.iterator(); i.hasNext();) { + for (Iterator i = _staff.iterator(); i.hasNext();) { User next = i.next(); ApplicationRights he = new ApplicationRights(next); - if (next.equals(me) || member.contains(next) + if (next.equals(me) || _member.contains(next) || !he.canContributeToStudy()) { i.remove(); } } - // transax.commit(); - setMenuProperty("study"); - setTitleProperty("study"); - setEditDisabledProperty("true"); - setToolProperty("back"); - setLeftMenuProperty("open"); - initializationFullScreenContext(_menuProperty, _titleProperty, - _editDisabledProperty, _toolProperty, _leftMenuProperty); + initializationFullScreenContext(Constants.STUDY_MENU, + Constants.STUDY_MENU, Constants.TRUE, Constants.BACK, + Constants.OPEN); setActionType("edibutor"); return SUCCESS; } public String doEditCycle() { - // Session connex = Database.getCurSession(); - // Transaction transax = connex.beginTransaction(); _openStudy = getOpenStudy(); - validation = new Vector(); - validefault = null; - other = getDocumentTypeService().selectResultTypes(); + _validation = new ArrayList(); + _validefault = null; + _other = getDocumentTypeService().selectResultTypes(); Study study = _openStudy.getStudyObject(); - for (Iterator i = other.iterator(); i.hasNext();) { + for (Iterator i = _other.iterator(); i.hasNext();) { DocumentType type = i.next(); ValidationCycle cycle = getStudyService().getValidationCycleOf( study, type); if (cycle.isDefault()) { - validefault = new ValidationFacade(cycle, + _validefault = new ValidationFacade(cycle, getApplicationSettings().getCurrentLocale()); continue; } - if (type.getName().equals(edicycle)) { - this.type = type.getIndex(); + if (type.getName().equals(_edicycle)) { + this._type = type.getIndex(); } - validation.add(new ValidationFacade(cycle, getApplicationSettings() - .getCurrentLocale())); + _validation.add(new ValidationFacade(cycle, + getApplicationSettings().getCurrentLocale())); i.remove(); } - if (validefault != null) { - validation.add(validefault); // In order to be at the end + if (_validefault != null) { + _validation.add(_validefault); // In order to be at the end } - member = getStudyService().getContributors(study); - validor = new Vector(); - staff = null; + _member = getStudyService().getContributors(study); + _validor = new ArrayList(); + _staff = null; List user = getUserService().selectAllUsers(); for (Iterator i = user.iterator(); i.hasNext();) { User next = i.next(); ApplicationRights he = new ApplicationRights(next); if (he.canValidate()) { if (next.equals(study.getAuthor())) { - validor.add(new ValidationFacade.ByManager(next, + _validor.add(new ValidationFacade.ByManager(next, getApplicationSettings().getCurrentLocale())); } else { - validor.add(next); + _validor.add(next); } } } - // transax.commit(); - setMenuProperty("study"); - setTitleProperty("study"); - setEditDisabledProperty("true"); - setToolProperty("back"); - setLeftMenuProperty("open"); - initializationFullScreenContext(_menuProperty, _titleProperty, - _editDisabledProperty, _toolProperty, _leftMenuProperty); + initializationFullScreenContext(Constants.STUDY_MENU, + Constants.STUDY_MENU, Constants.TRUE, Constants.BACK, + Constants.OPEN); setActionType("edicycle"); @@ -314,33 +275,30 @@ public class StudyPropertiesAction extends DisplayStudyStepAction { } public String doEdition() { - // -------------------------- - // Session connex = Database.getCurSession(); - // Transaction transax = connex.beginTransaction(); Study study = getOpenStudy().getStudyObject(); - if (tosave == Save.title) { + if (_tosave == Save.title) { // Edition of the title Study.Properties sprop = new Study.Properties(); try { - getStudyService().update(study, sprop.setTitle(stitle)); + getStudyService().update(study, sprop.setTitle(_stitle)); } catch (InvalidPropertyException e) { // TODO } - } else if (tosave == Save.contributor) { + } else if (_tosave == Save.contributor) { // Edition of contributors - if (contributors == null) { - contributors = ""; + if (_contributors == null) { + _contributors = ""; } - if (candidates == null) { - candidates = ""; + if (_candidates == null) { + _candidates = ""; } - String[] parsekept = contributors.split(","); - String[] parsenew = candidates.split(","); - Vector toremove = new Vector(getStudyService() + String[] parsekept = _contributors.split(","); + String[] parsenew = _candidates.split(","); + List toremove = new ArrayList(getStudyService() .getContributors(study)); for (int i = 0; i < parsekept.length; i++) { @@ -372,36 +330,31 @@ public class StudyPropertiesAction extends DisplayStudyStepAction { getStudyService().addContributor(study, newser); } - } else if (tosave == Save.cycle) { + } else if (_tosave == Save.cycle) { // Addition of a document validation cycle - DocumentType apply = getDocumentTypeService().selectType(type); + DocumentType apply = getDocumentTypeService().selectType(_type); ValidationCycle.Properties vprop = new ValidationCycle.Properties(); - if (publisher > 0) { - User actor = getUserService().selectUser(publisher); + if (_publisher > 0) { + User actor = getUserService().selectUser(_publisher); vprop.setActor(ValidationStep.PROMOTION, actor); } - if (reviewer > 0) { - User actor = getUserService().selectUser(reviewer); + if (_reviewer > 0) { + User actor = getUserService().selectUser(_reviewer); vprop.setActor(ValidationStep.REVIEW, actor); } - if (approver > 0) { - User actor = getUserService().selectUser(approver); + if (_approver > 0) { + User actor = getUserService().selectUser(_approver); vprop.setActor(ValidationStep.APPROVAL, actor); } getStudyService().setValidationCycle(study, apply, vprop); } - // transax.commit(); doInitialize(); // Re-initialization following the above edition - setMenuProperty("study"); - setTitleProperty("study"); - setEditDisabledProperty("true"); - setToolProperty("back"); - setLeftMenuProperty("open"); - initializationFullScreenContext(_menuProperty, _titleProperty, - _editDisabledProperty, _toolProperty, _leftMenuProperty); + initializationFullScreenContext(Constants.STUDY_MENU, + Constants.STUDY_MENU, Constants.TRUE, Constants.BACK, + Constants.OPEN); return SUCCESS; } @@ -411,53 +364,43 @@ public class StudyPropertiesAction extends DisplayStudyStepAction { // ============================================================================================================================== public User getAuthor() { - // ------------------------ return _openStudy.getStudyObject().getAuthor(); } public List getCandidates() { - // ---------------------------------- - return staff; + return _staff; } public String getCycle() { - // ------------------------- - return edicycle; + return _edicycle; } public List getContributors() { - // ------------------------------------ - return member; + return _member; } public ValidationFacade getDefaultValidation() { - // ----------------------------------------------- - return validefault; + return _validefault; } public long getDocumentTypeIndex() { - // ---------------------------------- - return type; + return _type; } public List getOtherDocumentTypes() { - // -------------------------------------------------- - return other; + return _other; } public String getStudyTitle() { - // ------------------------------ return _openStudy.getTitle(); } public List getValidations() { - // ----------------------------------------------- - return validation; + return _validation; } public List getValidationActors() { - // ---------------------------------------- - return validor; + return _validor; } // ============================================================================================================================== @@ -465,79 +408,47 @@ public class StudyPropertiesAction extends DisplayStudyStepAction { // ============================================================================================================================== public void setCandidates(final String indices) { - // ------------------------------------------ - candidates = indices; + _candidates = indices; } public void setCycle(final String type) { - // ---------------------------------- - edicycle = type; + _edicycle = type; } public void setMembers(final String indices) { - // --------------------------------------- - contributors = indices; + _contributors = indices; } public void setDocumentType(final String index) { - // ------------------------------------------ - type = Integer.valueOf(index); + _type = Integer.valueOf(index); } public void setApprover(final String index) { - // -------------------------------------- - approver = Integer.valueOf(index); + _approver = Integer.valueOf(index); } public void setPublisher(final String index) { - // --------------------------------------- - publisher = Integer.valueOf(index); + _publisher = Integer.valueOf(index); } public void setReviewer(final String index) { - // -------------------------------------- - reviewer = Integer.valueOf(index); + _reviewer = Integer.valueOf(index); } public void setTitle(final String title) { - // ----------------------------------- - stitle = title; + _stitle = title; } public void setSaveTitle(final String save) { - // -------------------------------------- - tosave = Save.title; + _tosave = Save.title; } public void setSaveContributors(final String save) { - // --------------------------------------------- - tosave = Save.contributor; + _tosave = Save.contributor; } public void setSaveCycle(final String save) { - // -------------------------------------- - tosave = Save.cycle; - } - - /** - * Get the studyService. - * - * @return the studyService - */ - @Override - public StudyService getStudyService() { - return _studyService; - } - - /** - * Set the studyService. - * - * @param studyService - * the studyService to set - */ - @Override - public void setStudyService(final StudyService studyService) { - _studyService = studyService; + _tosave = Save.cycle; } /** @@ -578,109 +489,4 @@ public class StudyPropertiesAction extends DisplayStudyStepAction { public void setUserService(final UserService userService) { _userService = userService; } - - /** - * Get the menuProperty. - * - * @return the menuProperty - */ - @Override - public String getMenuProperty() { - return _menuProperty; - } - - /** - * Set the menuProperty. - * - * @param menuProperty - * the menuProperty to set - */ - @Override - public void setMenuProperty(final String menuProperty) { - this._menuProperty = menuProperty; - } - - /** - * Get the _titleProperty. - * - * @return the _titleProperty - */ - @Override - public String getTitleProperty() { - return _titleProperty; - } - - /** - * Set the _titleProperty. - * - * @param _titleProperty - * the titleProperty to set - */ - @Override - public void setTitleProperty(final String titleProperty) { - _titleProperty = titleProperty; - } - - /** - * Get the editDisabledProperty. - * - * @return the editDisabledProperty - */ - @Override - public final String getEditDisabledProperty() { - return _editDisabledProperty; - } - - /** - * Set the editDisabledProperty. - * - * @param editDisabledProperty - * the editDisabledProperty to set - */ - @Override - public final void setEditDisabledProperty(final String editDisabledProperty) { - _editDisabledProperty = editDisabledProperty; - } - - /** - * Get the toolProperty. - * - * @return the toolProperty - */ - @Override - public String getToolProperty() { - return _toolProperty; - } - - /** - * Set the toolProperty. - * - * @param toolProperty - * the toolProperty to set - */ - @Override - public void setToolProperty(final String toolProperty) { - _toolProperty = toolProperty; - } - - /** - * Get the leftMenuProperty. - * - * @return the leftMenuProperty - */ - @Override - public String getLeftMenuProperty() { - return _leftMenuProperty; - } - - /** - * Set the leftMenuProperty. - * - * @param leftMenuProperty - * the leftMenuProperty to set - */ - @Override - public void setLeftMenuProperty(final String leftMenuProperty) { - _leftMenuProperty = leftMenuProperty; - } } \ 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 ce5b166..3084ed9 100644 --- a/Workspace/Siman/src/org/splat/simer/UploadAction.java +++ b/Workspace/Siman/src/org/splat/simer/UploadAction.java @@ -46,32 +46,6 @@ public class UploadAction extends Action { */ private RepositoryService _repositoryService; - /** - * Value of the menu property. It can be: none, create, open, study, knowledge, sysadmin, help. - */ - private String _menuProperty; - - /** - * Value of the title bar property. It can be: study, knowledge. - */ - private String _titleProperty; - - /** - * Value of the tool bar property. It can be: none, standard, study, back. - */ - private String _toolProperty; - - /** - * Value of the left menu property. It can be: open, study, knowledge, scenario. - */ - private String _leftMenuProperty; - - /** - * Property that indicates whether the current open study is editable or not. On the screen it looks like pen on the status icon, pop-up - * menu also can be called. It is necessary for correct building the title bar. - */ - private String _editDisabledProperty = "false"; - /** * Action modes enumeration. */ @@ -96,13 +70,9 @@ public class UploadAction extends Action { * @return SUCCESS */ public String doInitialize() { - setMenuProperty(Constants.STUDY_MENU); - setToolProperty(Constants.NONE); - setLeftMenuProperty("open"); - setTitleProperty(Constants.STUDY_MENU); - setEditDisabledProperty("true"); - initializationFullScreenContext(_menuProperty, _titleProperty, - _editDisabledProperty, _toolProperty, _leftMenuProperty); + initializationFullScreenContext(Constants.STUDY_MENU, + Constants.STUDY_MENU, Constants.TRUE, Constants.NONE, + Constants.OPEN); return SUCCESS; } @@ -114,11 +84,8 @@ public class UploadAction extends Action { * file or ERROR otherwise */ public String doUpload() { - setMenuProperty(Constants.STUDY_MENU); - setTitleProperty(Constants.STUDY_MENU); - setEditDisabledProperty("true"); - initializationScreenContext(_menuProperty, _titleProperty, - _editDisabledProperty); + initializationScreenContext(Constants.STUDY_MENU, Constants.STUDY_MENU, + Constants.TRUE); String res; if (_action == ToDo.cancel) { @@ -146,13 +113,9 @@ public class UploadAction extends Action { res = _nextAction; } catch (OutOfMemoryError error) { - setMenuProperty(Constants.NONE); - setTitleProperty(Constants.STUDY_MENU); - setEditDisabledProperty("true"); - setToolProperty(Constants.NONE); - setLeftMenuProperty(Constants.STUDY_MENU); - initializationFullScreenContext(_menuProperty, _titleProperty, - _editDisabledProperty, _toolProperty, _leftMenuProperty); + initializationFullScreenContext(Constants.NONE, + Constants.STUDY_MENU, Constants.TRUE, Constants.NONE, + Constants.STUDY_MENU); setErrorCode("message.error.outofmemory"); @@ -282,99 +245,4 @@ public class UploadAction extends Action { public void setRepositoryService(final 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(final String menuProperty) { - this._menuProperty = menuProperty; - } - - /** - * Get the _titleProperty. - * - * @return the _titleProperty - */ - public String getTitleProperty() { - return _titleProperty; - } - - /** - * Set the _titleProperty. - * - * @param titleProperty - * the titleProperty to set - */ - public void setTitleProperty(final String titleProperty) { - _titleProperty = titleProperty; - } - - /** - * Get the _editDisabledProperty. - * - * @return the _editDisabledProperty - */ - public String getEditDisabledProperty() { - return _editDisabledProperty; - } - - /** - * Set the editDisabledProperty. - * - * @param editDisabledProperty - * the editDisabledProperty to set - */ - public void setEditDisabledProperty(final String editDisabledProperty) { - this._editDisabledProperty = editDisabledProperty; - } - - /** - * Get the toolProperty. - * - * @return the toolProperty - */ - public String getToolProperty() { - return _toolProperty; - } - - /** - * Set the toolProperty. - * - * @param toolProperty - * the toolProperty to set - */ - public void setToolProperty(final String toolProperty) { - _toolProperty = toolProperty; - } - - /** - * Get the leftMenuProperty. - * - * @return the leftMenuProperty - */ - public String getLeftMenuProperty() { - return _leftMenuProperty; - } - - /** - * Set the leftMenuProperty. - * - * @param leftMenuProperty - * the leftMenuProperty to set - */ - public void setLeftMenuProperty(final String leftMenuProperty) { - _leftMenuProperty = leftMenuProperty; - } } \ 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 index b6d1994..97b3939 100644 --- a/Workspace/Siman/src/org/splat/simer/UploadStudyAction.java +++ b/Workspace/Siman/src/org/splat/simer/UploadStudyAction.java @@ -7,44 +7,25 @@ * @version Revision: *****************************************************************************/ -package org.splat.simer; +package org.splat.simer; + +import org.splat.wapp.Constants; /** * 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. + * Serialization version id. */ - 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; + public String doInitialize() { + initializationScreenContext(Constants.STUDY_MENU); + return SUCCESS; } } diff --git a/Workspace/Siman/src/org/splat/simer/VersionDocumentAction.java b/Workspace/Siman/src/org/splat/simer/VersionDocumentAction.java index 9f975c0..66778f3 100644 --- a/Workspace/Siman/src/org/splat/simer/VersionDocumentAction.java +++ b/Workspace/Siman/src/org/splat/simer/VersionDocumentAction.java @@ -78,31 +78,6 @@ 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; - - /** - * Value of the title bar property. It can be: study, knowledge. - */ - private String _titleProperty; - - /** - * Value of the tool bar property. It can be: none, standard, study, back. - */ - private String _toolProperty; - - /** - * Value of the left menu property. It can be: open, study, knowledge, scenario. - */ - private String _leftMenuProperty; - - /** - * Property that indicates whether the current open study is editable or not. On the screen it looks like pen on the status icon, pop-up - * menu also can be called. It is necessary for correct building the title bar. - */ - private String _editDisabledProperty = "false"; // ============================================================================================================================== // Action methods @@ -115,17 +90,14 @@ public class VersionDocumentAction extends UploadBaseNextAction { */ public String doInitialize() { - setMenuProperty(Constants.STUDY_MENU); - setTitleProperty(Constants.STUDY_MENU); - setEditDisabledProperty("true"); if ("true".equals(getWriteAccess())) { setToolProperty(Constants.STUDY_MENU); } else { setToolProperty(Constants.NONE); } - setLeftMenuProperty(Constants.STUDY_MENU); - initializationFullScreenContext(_menuProperty, _titleProperty, - _editDisabledProperty, _toolProperty, _leftMenuProperty); + initializationFullScreenContext(Constants.STUDY_MENU, + Constants.STUDY_MENU, Constants.TRUE, getToolProperty(), + Constants.STUDY_MENU); User user = getConnectedUser(); File updir = getRepositoryService().getDownloadDirectory(user); @@ -155,11 +127,10 @@ public class VersionDocumentAction extends UploadBaseNextAction { // Setup dependencies _usedby.addAll(tag.getRelations(UsedByRelation.class)); } else { - if (!(Constants.NONE.equals(_toolProperty))) { - setToolProperty(Constants.NONE); - setLeftMenuProperty(Constants.STUDY_MENU); - initializationFullScreenContext(_menuProperty, _titleProperty, - _editDisabledProperty, _toolProperty, _leftMenuProperty); + if (!(Constants.NONE.equals(getToolProperty()))) { + initializationFullScreenContext(Constants.STUDY_MENU, + Constants.STUDY_MENU, Constants.TRUE, Constants.NONE, + Constants.STUDY_MENU); } res = ERROR; } @@ -235,11 +206,8 @@ public class VersionDocumentAction extends UploadBaseNextAction { */ public String doVersion() { String res = ERROR; - setMenuProperty(Constants.STUDY_MENU); - setTitleProperty(Constants.STUDY_MENU); - setEditDisabledProperty("true"); - initializationScreenContext(_menuProperty, _titleProperty, - _editDisabledProperty); + initializationScreenContext(Constants.STUDY_MENU, Constants.STUDY_MENU, + Constants.TRUE); if (action == ToDo.cancel) { res = "cancel"; @@ -280,11 +248,9 @@ public class VersionDocumentAction extends UploadBaseNextAction { setErrorCode("message.error.internal"); } if (!SUCCESS.equals(res)) { - setToolProperty(Constants.NONE); - - setLeftMenuProperty(Constants.STUDY_MENU); - initializationFullScreenContext(_menuProperty, _titleProperty, - _editDisabledProperty, _toolProperty, _leftMenuProperty); + initializationFullScreenContext(Constants.STUDY_MENU, + Constants.STUDY_MENU, Constants.TRUE, Constants.NONE, + Constants.STUDY_MENU); } } return res; @@ -417,99 +383,4 @@ public class VersionDocumentAction extends UploadBaseNextAction { public void setRepositoryService(final 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(final String menuProperty) { - this._menuProperty = menuProperty; - } - - /** - * Get the _titleProperty. - * - * @return the _titleProperty - */ - public String getTitleProperty() { - return _titleProperty; - } - - /** - * Set the _titleProperty. - * - * @param titleProperty - * the titleProperty to set - */ - public void setTitleProperty(final String titleProperty) { - _titleProperty = titleProperty; - } - - /** - * Get the _editDisabledProperty. - * - * @return the _editDisabledProperty - */ - public String getEditDisabledProperty() { - return _editDisabledProperty; - } - - /** - * Set the editDisabledProperty. - * - * @param editDisabledProperty - * the editDisabledProperty to set - */ - public void setEditDisabledProperty(final String editDisabledProperty) { - this._editDisabledProperty = editDisabledProperty; - } - - /** - * Get the toolProperty. - * - * @return the toolProperty - */ - public String getToolProperty() { - return _toolProperty; - } - - /** - * Set the toolProperty. - * - * @param toolProperty - * the toolProperty to set - */ - public void setToolProperty(final String toolProperty) { - _toolProperty = toolProperty; - } - - /** - * Get the leftMenuProperty. - * - * @return the leftMenuProperty - */ - public String getLeftMenuProperty() { - return _leftMenuProperty; - } - - /** - * Set the leftMenuProperty. - * - * @param leftMenuProperty - * the leftMenuProperty to set - */ - public void setLeftMenuProperty(final String leftMenuProperty) { - _leftMenuProperty = leftMenuProperty; - } } \ 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 1dd125b..05b5931 100644 --- a/Workspace/Siman/src/org/splat/simer/admin/DatabaseIndexingAction.java +++ b/Workspace/Siman/src/org/splat/simer/admin/DatabaseIndexingAction.java @@ -32,24 +32,6 @@ public class DatabaseIndexingAction extends Action { */ private SearchService _searchService; - /** - * 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; - - /** - * Value of the left menu property. - * It can be: open, study, knowledge, scenario. - */ - private String _leftMenuProperty; - // ============================================================================================================================== // Action methods // ============================================================================================================================== @@ -62,10 +44,7 @@ public class DatabaseIndexingAction extends Action { _newstudies = getSearchService().selectStudies(); _indices = ""; - setMenuProperty("sysadmin"); - setToolProperty("none"); - setLeftMenuProperty("open"); - initializationFullScreenContext(_menuProperty, _toolProperty, _leftMenuProperty); + initializationFullScreenContext("sysadmin", "none", "open"); return SUCCESS; } @@ -132,52 +111,4 @@ public class DatabaseIndexingAction extends Action { public void setSearchService(final 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(final String menuProperty) { - this._menuProperty = menuProperty; - } - - /** - * Get the toolProperty. - * @return the toolProperty - */ - public String getToolProperty() { - return _toolProperty; - } - - /** - * Set the toolProperty. - * @param toolProperty the toolProperty to set - */ - public void setToolProperty(final String toolProperty) { - _toolProperty = toolProperty; - } - - /** - * Get the leftMenuProperty. - * @return the leftMenuProperty - */ - public String getLeftMenuProperty() { - return _leftMenuProperty; - } - - /** - * Set the leftMenuProperty. - * @param leftMenuProperty the leftMenuProperty to set - */ - public void setLeftMenuProperty(final String leftMenuProperty) { - _leftMenuProperty = leftMenuProperty; - } } \ 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 955ce2e..376450e 100644 --- a/Workspace/Siman/src/org/splat/simer/admin/ImportUserAction.java +++ b/Workspace/Siman/src/org/splat/simer/admin/ImportUserAction.java @@ -30,24 +30,6 @@ public class ImportUserAction extends UploadBaseNextAction { */ private UserService _userService; - /** - * 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; - - /** - * Value of the left menu property. - * It can be: open, study, knowledge, scenario. - */ - private String _leftMenuProperty; - // ============================================================================================================================== // Action methods // ============================================================================================================================== @@ -70,10 +52,7 @@ public class ImportUserAction extends UploadBaseNextAction { break; } - setMenuProperty("sysadmin"); - setToolProperty("none"); - setLeftMenuProperty("open"); - initializationFullScreenContext(_menuProperty, _toolProperty, _leftMenuProperty); + initializationFullScreenContext("sysadmin", "none", "open"); } catch (Exception error) { res = ERROR; @@ -126,52 +105,4 @@ public class ImportUserAction extends UploadBaseNextAction { public void setUserService(final 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(final String menuProperty) { - this._menuProperty = menuProperty; - } - - /** - * Get the toolProperty. - * @return the toolProperty - */ - public String getToolProperty() { - return _toolProperty; - } - - /** - * Set the toolProperty. - * @param toolProperty the toolProperty to set - */ - public void setToolProperty(final String toolProperty) { - _toolProperty = toolProperty; - } - - /** - * Get the leftMenuProperty. - * @return the leftMenuProperty - */ - public String getLeftMenuProperty() { - return _leftMenuProperty; - } - - /** - * Set the leftMenuProperty. - * @param leftMenuProperty the leftMenuProperty to set - */ - public void setLeftMenuProperty(final String leftMenuProperty) { - _leftMenuProperty = leftMenuProperty; - } } \ No newline at end of file diff --git a/Workspace/Siman/src/org/splat/simer/admin/KnowledgeElementAction.java b/Workspace/Siman/src/org/splat/simer/admin/KnowledgeElementAction.java index cc22a80..895e7f4 100644 --- a/Workspace/Siman/src/org/splat/simer/admin/KnowledgeElementAction.java +++ b/Workspace/Siman/src/org/splat/simer/admin/KnowledgeElementAction.java @@ -15,7 +15,6 @@ public class KnowledgeElementAction extends Action { // ============================================================================================================================== public String doInitialize () { -// ----------------------------- return SUCCESS; } diff --git a/Workspace/Siman/src/org/splat/simer/admin/ProjectElementFacade.java b/Workspace/Siman/src/org/splat/simer/admin/ProjectElementFacade.java index e03b78b..0bde2f7 100644 --- a/Workspace/Siman/src/org/splat/simer/admin/ProjectElementFacade.java +++ b/Workspace/Siman/src/org/splat/simer/admin/ProjectElementFacade.java @@ -18,14 +18,12 @@ public class ProjectElementFacade { // ============================================================================================================================== public ProjectElementFacade (final Study represented, final ProjectSettingsService.Step at) { -// ------------------------------------------------------------------------ _index = represented.getIndex(); // The index of scenarios AND studies are unique _my = represented; _subtitle = ""; _step = "0." + at.getNumber(); } public ProjectElementFacade (final Scenario represented, final ProjectSettingsService.Step at) { -// --------------------------------------------------------------------------- _index = represented.getIndex(); // The index of scenarios AND studies are unique _my = represented.getOwnerStudy(); _subtitle = ", " + represented.getTitle(); @@ -38,12 +36,10 @@ public class ProjectElementFacade { @Override public boolean equals (final Object other) { -// ------------------------------------ return (this.hashCode() == other.hashCode()); } @Override public int hashCode () { -// ---------------------- return (int) _index; } @@ -52,27 +48,21 @@ public class ProjectElementFacade { // ============================================================================================================================== public String getAuthorName () { -// ------------------------------ return _my.getAuthor().getDisplayName(); } public ProgressState getProgressState () { -// ---------------------------------------- return _my.getProgressState(); } public String getReference () { -// ----------------------------- return _my.getReference(); } public String getSelection () { -// ----------------------------- return _step; } public String getStudyIndex () { -// ------------------------------ return String.valueOf(_my.getIndex()); } public String getTitle () { -// ------------------------- return _my.getTitle() + _subtitle; } } \ No newline at end of file diff --git a/Workspace/Siman/src/org/splat/simer/admin/SimulationContextAction.java b/Workspace/Siman/src/org/splat/simer/admin/SimulationContextAction.java index d952aef..d4cc3b9 100644 --- a/Workspace/Siman/src/org/splat/simer/admin/SimulationContextAction.java +++ b/Workspace/Siman/src/org/splat/simer/admin/SimulationContextAction.java @@ -86,21 +86,6 @@ public class SimulationContextAction extends Action { */ private SimulationContextService _simulationContextService; - /** - * 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; - - /** - * Value of the left menu property. It can be: open, study, knowledge, scenario. - */ - private String _leftMenuProperty; - /** * Context name comparator. */ @@ -171,11 +156,7 @@ public class SimulationContextAction extends Action { _edition = null; _owner = null; - setMenuProperty("study"); - setToolProperty("none"); - setLeftMenuProperty("open"); - initializationFullScreenContext(_menuProperty, _toolProperty, - _leftMenuProperty); + initializationFullScreenContext("study", "none", "open"); } catch (Exception error) { LOG.error("Reason:", error); res = ERROR; // No need to roll-back the transaction as it is read-only @@ -186,11 +167,7 @@ public class SimulationContextAction extends Action { public String doSelect() { String res = SUCCESS; - setMenuProperty("study"); - setToolProperty("none"); - setLeftMenuProperty("open"); - initializationFullScreenContext(_menuProperty, _toolProperty, - _leftMenuProperty); + initializationFullScreenContext("study", "none", "open"); Session connex = Database.getCurSession(); Transaction transax = connex.beginTransaction(); @@ -386,61 +363,4 @@ public class SimulationContextAction extends Action { public void setSearchService(final 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(final String menuProperty) { - this._menuProperty = menuProperty; - } - - /** - * Get the toolProperty. - * - * @return the toolProperty - */ - public String getToolProperty() { - return _toolProperty; - } - - /** - * Set the toolProperty. - * - * @param toolProperty - * the toolProperty to set - */ - public void setToolProperty(final String toolProperty) { - _toolProperty = toolProperty; - } - - /** - * Get the leftMenuProperty. - * - * @return the leftMenuProperty - */ - public String getLeftMenuProperty() { - return _leftMenuProperty; - } - - /** - * Set the leftMenuProperty. - * - * @param leftMenuProperty - * the leftMenuProperty to set - */ - public void setLeftMenuProperty(final String leftMenuProperty) { - _leftMenuProperty = leftMenuProperty; - } } \ No newline at end of file diff --git a/Workspace/Siman/src/org/splat/wapp/Constants.java b/Workspace/Siman/src/org/splat/wapp/Constants.java index 67ca84e..5ded1d2 100644 --- a/Workspace/Siman/src/org/splat/wapp/Constants.java +++ b/Workspace/Siman/src/org/splat/wapp/Constants.java @@ -8,12 +8,16 @@ * @copyright OPEN CASCADE 2012 *****************************************************************************/ -package org.splat.wapp; +package org.splat.wapp; /** * SIMAN constants. */ public class Constants { + /** + * Create menu key. + */ + public final static String CREATE_MENU = "create"; /** * Standard menu key. */ @@ -22,6 +26,10 @@ public class Constants { * Study menu key. */ public final static String STUDY_MENU = "study"; + /** + * Scenario menu key. + */ + public final static String SCENARIO_MENU = "scenario"; /** * Knowledge menu key. */ @@ -34,8 +42,20 @@ public class Constants { * TRUE literal constant. */ public final static String TRUE = "true"; + /** + * FALSE literal constant. + */ + public final static String FALSE = "false"; /** * Scenario properties menu key. */ public final static String PROP_SCENARIO = "prop-scenario"; + /** + * Tool property "back". + */ + public final static String BACK = "back"; + /** + * Left menu property "open". + */ + public final static String OPEN = "open"; } -- 2.30.2