DCT-000001=Document type "{0}" already exists
DCT-000002=Can not delete the document "{0}" because it is used by other documents.
DCT-000003=Can not save a document in {0} state. Check the validation cycle.
-PARAM-000001=Parameter {0} is invalid with value: {1}
+PRM-000001=Parameter {0} is invalid with value: {1}
DCT-000001=Document type "{0}" already exists
DCT-000002=Can not delete the document "{0}" because it is used by other documents.
DCT-000003=Can not save a document in {0} state. Check the validation cycle.
-PARAM-000001=Parameter {0} is invalid with value: {1}
+PRM-000001=Parameter {0} is invalid with value: {1}
\ No newline at end of file
*/
DCT_000003("DCT-000003"),
/**
- * Parameter {1} is invalid with value: {2}.
+ * Parameter {0} is invalid with value: {1}.
*/
- PARAM_000001("PARAM-000001");
+ PRM_000001("PRM-000001");
/**
* Value.
*/
<union-subclass name="org.splat.dal.bo.som.StepCommentAttribute"
extends="org.splat.dal.bo.kernel.TextAttribute" table="step_comment">
- <many-to-one name="user" column="user" not-null="true" />
+ <many-to-one name="user" column="author" not-null="true" />
<property name="date" column="date" not-null="true" />
<property name="step" column="step" not-null="true" />
<property name="title" column="title" not-null="true" type="text"/>
<union-subclass name="org.splat.dal.bo.som.Study" extends="org.splat.dal.bo.som.ProjectElement" table="study" lazy="false">
<!-- String sid -->
- <property name="sid" column="sid" access="field" not-null="true" />
+ <property name="sid" column="reference" access="field" not-null="true" />
<!-- int docount -->
<property name="docount" column="docount" access="field" not-null="true" />
}
/**
+ * {@inheritDoc}
* @see org.splat.service.StepService#getStepComments(org.splat.som.Step)
*/
@Override
+ @Transactional(readOnly = true)
public List<StepCommentDTO> getStepComments(final Step step) throws InvalidParameterException {
ProjectElement owner = _projectElementDAO.get(step.getOwner().getRid());
if(owner == null) {
import org.splat.dal.bo.som.Study;
import org.splat.dal.bo.som.Study.Properties;
import org.splat.dal.bo.som.ValidationCycle;
+import org.splat.exception.InvalidParameterException;
import org.splat.kernel.InvalidPropertyException;
import org.splat.kernel.MissedPropertyException;
import org.splat.kernel.MultiplyDefinedException;
* Mark study as reference.
*
* @param aStudy - the Study
- * @return true if operation is success
*/
void markStudyAsReference(Study aStudy);
* This operation is inverse one to Mark as reference.
*
* @param aStudy - the Study
- * @return true if operation is success
*/
void removeStudyAsReference(Study aStudy);
+
+ /**
+ * Get the description attribute related to the study
+ * (there supposed to be the only one such attribute in the database).
+ * @param studyId the study id
+ * @return the description attribute value (null if does not exist)
+ * @throws InvalidParameterException if a study with such id does not exist in the database.
+ */
+ String getDescription(Long studyId) throws InvalidParameterException;
+
+ /**
+ * Set the description attribute related to the study.
+ * @param studyId the study id
+ * @param descriptionText the description text
+ * @throws InvalidParameterException if some parameters are invalid.
+ */
+ void setDescription(Long studyId, String descriptionText) throws InvalidParameterException;
+
}
import org.splat.dal.bo.som.Scenario;
import org.splat.dal.bo.som.SimulationContext;
import org.splat.dal.bo.som.Study;
+import org.splat.dal.bo.som.Study.Properties;
import org.splat.dal.bo.som.ValidationCycle;
+import org.splat.dal.bo.som.ValidationCycle.Actor;
import org.splat.dal.bo.som.ValidationCycleRelation;
import org.splat.dal.bo.som.ValidationStep;
import org.splat.dal.bo.som.Visibility;
-import org.splat.dal.bo.som.Study.Properties;
-import org.splat.dal.bo.som.ValidationCycle.Actor;
+import org.splat.dal.dao.som.DescriptionAttributeDAO;
+import org.splat.dal.dao.som.DocumentDAO;
import org.splat.dal.dao.som.IDBuilderDAO;
+import org.splat.dal.dao.som.PublicationDAO;
import org.splat.dal.dao.som.ScenarioDAO;
import org.splat.dal.dao.som.StudyDAO;
import org.splat.dal.dao.som.ValidationCycleDAO;
+import org.splat.exception.InvalidParameterException;
import org.splat.kernel.InvalidPropertyException;
import org.splat.kernel.MissedPropertyException;
import org.splat.kernel.MultiplyDefinedException;
import org.splat.service.technical.IndexService;
import org.splat.service.technical.ProjectSettingsService;
import org.splat.service.technical.ProjectSettingsServiceImpl;
+import org.splat.service.technical.RepositoryService;
import org.splat.som.Revision;
import org.springframework.transaction.annotation.Transactional;
* Injected user service.
*/
private UserService _userService;
+
+ /**
+ * Injected publication DAO.
+ */
+ private PublicationDAO _publicationDAO;
+
+ /**
+ * Injected repository service.
+ */
+ private RepositoryService _repositoryService;
+
+ /**
+ * Injected document DAO.
+ */
+ private DocumentDAO _documentDAO;
+
+ /**
+ * Injected description attribute DAO.
+ */
+ private DescriptionAttributeDAO _descriptionAttributeDAO;
/**
* {@inheritDoc}
aStudy.setProgressState(ProgressState.APPROVED);
getStudyDAO().merge(aStudy);
}
+
+ /**
+ * {@inheritDoc}
+ * @see org.splat.service.StudyService#getDescription(java.lang.Long)
+ */
+ @Override
+ @Transactional(readOnly = true)
+ public String getDescription(final Long studyId) throws InvalidParameterException {
+ if(studyId == null) {
+ throw new InvalidParameterException("studyId", "null");
+ }
+ Study study = _studyDAO.get(studyId);
+ if(study == null) {
+ throw new InvalidParameterException("studyId", studyId.toString());
+ }
+ return study.getDescription();
+ }
+
+
+ /**
+ * {@inheritDoc}
+ * @see org.splat.service.StudyService#setDescription(java.lang.Long, java.lang.String)
+ */
+ @Override
+ @Transactional
+ public void setDescription(final Long studyId, final String descriptionText)
+ throws InvalidParameterException {
+ if(studyId == null) {
+ throw new InvalidParameterException("studyId", "null");
+ }
+ Study study = _studyDAO.get(studyId);
+ if(study == null) {
+ throw new InvalidParameterException("studyId", studyId.toString());
+ }
+ study.setAttribute(new DescriptionAttribute(study, descriptionText));
+ }
/**
* Get project settings.
public void setUserService(final UserService userService) {
_userService = userService;
}
+
+ /**
+ * Get the publicationDAO.
+ * @return the publicationDAO
+ */
+ public PublicationDAO getPublicationDAO() {
+ return _publicationDAO;
+ }
+
+ /**
+ * Set the publicationDAO.
+ * @param publicationDAO the publicationDAO to set
+ */
+ public void setPublicationDAO(final PublicationDAO publicationDAO) {
+ _publicationDAO = publicationDAO;
+ }
+
+ /**
+ * Get the repositoryService.
+ * @return the repositoryService
+ */
+ public RepositoryService getRepositoryService() {
+ return _repositoryService;
+ }
+
+ /**
+ * Set the repositoryService.
+ * @param repositoryService the repositoryService to set
+ */
+ public void setRepositoryService(final RepositoryService repositoryService) {
+ _repositoryService = repositoryService;
+ }
+
+ /**
+ * Get the documentDAO.
+ * @return the documentDAO
+ */
+ public DocumentDAO getDocumentDAO() {
+ return _documentDAO;
+ }
+
+ /**
+ * Set the documentDAO.
+ * @param documentDAO the documentDAO to set
+ */
+ public void setDocumentDAO(final DocumentDAO documentDAO) {
+ _documentDAO = documentDAO;
+ }
+
+ /**
+ * Get the descriptionAttributeDAO.
+ * @return the descriptionAttributeDAO
+ */
+ public DescriptionAttributeDAO getDescriptionAttributeDAO() {
+ return _descriptionAttributeDAO;
+ }
+
+ /**
+ * Set the descriptionAttributeDAO.
+ * @param descriptionAttributeDAO the descriptionAttributeDAO to set
+ */
+ public void setDescriptionAttributeDAO(
+ final DescriptionAttributeDAO descriptionAttributeDAO) {
+ _descriptionAttributeDAO = descriptionAttributeDAO;
+ }
+
}
<property name="validationCycleDAO" ref="validationCycleDAO" />
<property name="documentTypeService" ref="documentTypeService" />
<property name="userService" ref="userService" />
+ <property name="descriptionAttributeDAO" ref="descriptionAttributeDAO" />
</bean>
<bean id="userRights" abstract="true" scope="session">
import org.splat.dal.bo.som.Document.Properties;
import org.splat.dal.bo.som.DocumentType;
import org.splat.dal.bo.som.File;
-import org.splat.dal.bo.som.ProgressState;
import org.splat.dal.bo.som.ProjectElement;
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.StepCommentAttribute;
import org.splat.dal.bo.som.Study;
import org.splat.dal.bo.som.UsedByRelation;
import org.splat.dal.bo.som.UsesRelation;
-import org.splat.dal.bo.som.Visibility;
import org.splat.dal.dao.kernel.UserDAO;
import org.splat.dal.dao.som.Database;
import org.splat.dal.dao.som.FileDAO;
import org.testng.annotations.Test;
import test.splat.common.BaseTest;
+import test.splat.util.TestEntitiesGenerator;
/**
* Test class for StepService.
return pub;
}
+
/**
* Test of addition of a new step comment.
*
@Test
public void testAddStepComment() throws BusinessException{
- User goodUser = getTestUser("goodUser");
+ User goodUser = TestEntitiesGenerator.getTestUser("goodUser");
_userDAO.create(goodUser);
- Study goodStudy = getTestStudy(goodUser);
+ Study goodStudy = TestEntitiesGenerator.getTestStudy(goodUser);
_studyDAO.create(goodStudy);
getHibernateTemplate().flush();
StepCommentDTO goodStepCommentDTO = createStepCommentDTO(goodUser, goodStudy);
//valid DTO, non-existing user
{
//get a non-existing id
- User badUser = getTestUser("badUser");
+ User badUser = TestEntitiesGenerator.getTestUser("badUser");
_userDAO.create(badUser);
getHibernateTemplate().evict(badUser);//so createStepCommentDTO will invoke an
//actual query to the base, not cache in order to check if the user already exists
//valid DTO, non-existing project element
{
- Study badStudy = getTestStudy(goodUser);
+ Study badStudy = TestEntitiesGenerator.getTestStudy(goodUser);
_studyDAO.create(badStudy);
getHibernateTemplate().evict(badStudy);//so createStepCommentDTO will invoke an
//actual query to the base, not cache in order to check if the study already exists
@Test
public void testGetStepComments() throws BusinessException {
- User user = getTestUser("goodUser");
+ User user = TestEntitiesGenerator.getTestUser("goodUser");
_userDAO.create(user);
- Study study = getTestStudy(user);
+ Study study = TestEntitiesGenerator.getTestStudy(user);
//Before we create the study in the database:
org.splat.som.Step step = new org.splat.som.Step(_projectSettings.getStep(1), study);
new Integer(0), new Date(), user.getRid(), user.getName(), "Good comment title");
}
- /**
- * Create a transient user.
- *
- * @param userName the userName
- * @return a transient StepCommentDTO
- * @throws BusinessException if something's wrong
- */
- private User getTestUser(final String userName) throws BusinessException {
-
- User.Properties uprop = new User.Properties();
- uprop.setUsername(userName)
- .setName("TST_Username")
- .setFirstName("TST_FirstName")
- .setDisplayName("TST_test.user")
- .setMailAddress("noreply@salome-platform.org")
- .addRole("TST-User");
- uprop.disableCheck();
- User user = new User(uprop);
- return user;
- }
-
- /**
- * Create a transient study.
- *
- * @param user the user that will be placed in 'manager' and 'actor' properties
- * @return the test study
- * @throws BusinessException if something's wrong
- */
- private Study getTestStudy(final User user) throws BusinessException{
- Study.Properties studyProps = new Study.Properties();
- studyProps.setActor(user)
- .setManager(user)
- .setTitle("a test study")
- .setDescription("description")
- .setDate(new Date())
- .setReference("test reference")
- .setSimulationContexts(new ArrayList<SimulationContext>())
- .setState(ProgressState.inWORK)
- .setVisibility(Visibility.PUBLIC);
- Study study = new Study(studyProps);
- return study;
- }
-
/**
* Create StepCommentDTO with all the fields filled in from StepCommentAttribute.
* @param comment the comment
import java.util.Map;
import org.splat.dal.bo.kernel.User;
+import org.splat.dal.bo.som.DescriptionAttribute;
import org.splat.dal.bo.som.Document;
+import org.splat.dal.bo.som.Document.Properties;
import org.splat.dal.bo.som.DocumentType;
import org.splat.dal.bo.som.ProjectElement;
import org.splat.dal.bo.som.Publication;
import org.splat.dal.bo.som.Scenario;
import org.splat.dal.bo.som.Study;
-import org.splat.dal.bo.som.Document.Properties;
+import org.splat.dal.dao.kernel.UserDAO;
import org.splat.dal.dao.som.Database;
import org.splat.dal.dao.som.StudyDAO;
+import org.splat.exception.BusinessException;
+import org.splat.exception.InvalidParameterException;
import org.splat.kernel.InvalidPropertyException;
import org.splat.kernel.MissedPropertyException;
import org.splat.kernel.MultiplyDefinedException;
import org.testng.annotations.Test;
import test.splat.common.BaseTest;
+import test.splat.util.TestEntitiesGenerator;
/**
* Test class for StudyService.
@Autowired
@Qualifier("studyService")
private transient StudyService _studyService;
+
+ /**
+ * The UserDAO. Later injected by Spring.
+ */
+ @Autowired
+ @Qualifier("userDAO")
+ private transient UserDAO _userDAO;
/**
* Create a persistent scenario for tests.
rollbackNestedTransaction();
LOG.debug(">>>>> END testGenerateLocalIndex()");
}
+
+ /**
+ * Test of retrieval of a study description.
+ *
+ * @throws BusinessException if there is something wrong likely unrelated to the tested method
+ */
+ @Test
+ public void testGetDescription() throws BusinessException {
+ LOG.debug(">>>>> BEGIN testGetDescription()");
+ startNestedTransaction();
+
+ User user = TestEntitiesGenerator.getTestUser("GoodUser");
+ _userDAO.create(user);
+ Study study = TestEntitiesGenerator.getTestStudy(user);
+ _studyDAO.create(study);
+ _studyDAO.flush();
+ Long studyId = Long.valueOf(study.getIndex());
+
+ //Empty description:
+ Assert.assertNull(_studyService.getDescription(studyId),
+ "returned value for study without description must be null");
+
+ //Not empty description:
+ study.setAttribute(new DescriptionAttribute(study, "description"));
+ _studyDAO.update(study);
+ _studyDAO.flush();
+ Assert.assertEquals("description", _studyService.getDescription(studyId));
+
+ //null id
+ try {
+ _studyService.getDescription(null);
+ Assert.fail("retrieval with null study id must fail");
+ } catch(InvalidParameterException e){
+ LOG.debug("Expected exception is thrown: "
+ + e.getClass().getSimpleName() + ": " + e.getMessage());
+ }
+
+ //Non-existing id
+ Study tmpStudy = TestEntitiesGenerator.getTestStudy(user);
+ _studyDAO.create(tmpStudy);
+ Long nonExistingId = tmpStudy.getIndex();
+ _studyDAO.delete(tmpStudy);
+ try {
+ _studyService.getDescription(nonExistingId);
+ Assert.fail("retrieval with non-existing study id must fail");
+ } catch(InvalidParameterException e){
+ LOG.debug("Expected exception is thrown: "
+ + e.getClass().getSimpleName() + ": " + e.getMessage());
+ }
+
+ rollbackNestedTransaction();
+ LOG.debug(">>>>> END testGetDescription()");
+ }
+
+ /**
+ * Test of setting of a study description.
+ *
+ * @throws BusinessException if there is something wrong likely unrelated to the tested method
+ */
+ @Test
+ public void testSetDescription() throws BusinessException {
+ LOG.debug(">>>>> BEGIN testSetDescription()");
+ startNestedTransaction();
+
+ User user = TestEntitiesGenerator.getTestUser("GoodUser");
+ _userDAO.create(user);
+ Study study = TestEntitiesGenerator.getTestStudy(user);
+ _studyDAO.create(study);
+ _studyDAO.flush();
+ Long studyId = Long.valueOf(study.getIndex());
+
+ //Setting description for study without any
+ _studyService.setDescription(studyId, "description");
+
+ //Resetting description
+ _studyService.setDescription(studyId, "replaced description");
+
+ //null id
+ try {
+ _studyService.setDescription(null, "description");
+ Assert.fail("setting with null study id must fail");
+ } catch(InvalidParameterException e){
+ LOG.debug("Expected exception is thrown: "
+ + e.getClass().getSimpleName() + ": " + e.getMessage());
+ }
+
+ //Non-existing id
+ Study tmpStudy = TestEntitiesGenerator.getTestStudy(user);
+ _studyDAO.create(tmpStudy);
+ Long nonExistingId = tmpStudy.getIndex();
+ _studyDAO.delete(tmpStudy);
+
+ try {
+ _studyService.setDescription(nonExistingId, "description");
+ Assert.fail("retrieval with non-existing study id must fail");
+ } catch(InvalidParameterException e){
+ LOG.debug("Expected exception is thrown: "
+ + e.getClass().getSimpleName() + ": " + e.getMessage());
+ }
+
+ rollbackNestedTransaction();
+ LOG.debug(">>>>> END testSetDescription()");
+ }
}
--- /dev/null
+/*****************************************************************************
+ * Company EURIWARE
+ * Application SIMAN
+ * File $Id$
+ * Creation date Feb 12, 2013
+ * @author $Author$
+ * @version $Revision$
+ *****************************************************************************/
+
+package test.splat.util;
+
+import java.util.ArrayList;
+import java.util.Date;
+
+import org.splat.dal.bo.kernel.User;
+import org.splat.dal.bo.som.ProgressState;
+import org.splat.dal.bo.som.SimulationContext;
+import org.splat.dal.bo.som.Study;
+import org.splat.dal.bo.som.Visibility;
+import org.splat.exception.BusinessException;
+
+/**
+ * Utility class for creating test entities.
+ */
+public class TestEntitiesGenerator {
+
+ /**
+ * Create a transient user.
+ *
+ * @param userName the userName
+ * @return a transient StepCommentDTO
+ * @throws BusinessException if something's wrong
+ */
+ public static User getTestUser(final String userName) throws BusinessException {
+
+ User.Properties uprop = new User.Properties();
+ uprop.setUsername(userName)
+ .setName("TST_Username")
+ .setFirstName("TST_FirstName")
+ .setDisplayName("TST_test.user")
+ .setMailAddress("noreply@salome-platform.org")
+ .addRole("TST-User");
+ uprop.disableCheck();
+ User user = new User(uprop);
+ return user;
+ }
+
+ /**
+ * Create a transient study.
+ *
+ * @param user the user that will be placed in 'manager' and 'actor' properties
+ * @return the test study
+ * @throws BusinessException if something's wrong
+ */
+ public static Study getTestStudy(final User user) throws BusinessException{
+ Study.Properties studyProps = new Study.Properties();
+ studyProps.setActor(user)
+ .setManager(user)
+ .setTitle("a test study")
+ //.setDescription("description")
+ .setDate(new Date())
+ .setReference("test reference")
+ .setSimulationContexts(new ArrayList<SimulationContext>())
+ .setState(ProgressState.inWORK)
+ .setVisibility(Visibility.PUBLIC);
+ Study study = new Study(studyProps);
+ return study;
+ }
+}
<put-attribute name="display_comments_pane" value="zone.stepcomments"/>
</definition>
+<definition name="zone.description" template="/jsp/readDescription.jsp"/>
+
+<definition name="page.description" template="/jsp/descriptionPane.jsp">
+ <put-attribute name="display_description_pane" value="zone.description" />
+</definition>
+
<definition name="zone.displaystudy" template="/study/displayStudyStep.jsp">
<put-attribute name="step_comments_pane" value="page.stepcomments" />
+ <put-attribute name="description_pane" value="page.description" />
</definition>
<definition name="page.displaystudy" extends="baseLayout">
--- /dev/null
+<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
+ pageEncoding="ISO-8859-1"%>
+<%@ taglib prefix="s" uri="/struts-tags"%>
+<%@ taglib prefix="tiles" uri="http://tiles.apache.org/tags-tiles"%>
+
+<div id="display_description_div">
+ <tiles:insertAttribute name="display_description_pane" ignore="true" />
+</div>
+
+<s:if test="%{writeAccess == 'true' && stepEnabled == 'true'}">
+ <script type="text/javascript">
+ $(document).ready(function(){
+ $("#description_form").ajaxForm({
+ target: '#display_description_div'
+ });
+
+ // Bind the add button
+ $("#set_description_button").click(function() {
+ document.getElementById("display_description_div").style.display = 'none';
+ document.getElementById("set_description_button_div").style.display = 'none';
+ document.getElementById("description_editor_div").style.display = 'block';
+ document.getElementById("descriptionValue").contentDocument.body.innerHTML =
+ document.getElementById("display_description_div").innerHTML;
+ });
+
+ function hideDescriptionEditor() {
+ document.getElementById("display_description_div").style.display = 'block';
+ document.getElementById("set_description_button_div").style.display = 'block';
+ document.getElementById("description_editor_div").style.display = 'none';
+ document.getElementById('descriptionValue').contentDocument.body.innerHTML = '';
+ }
+
+ // Bind the cancel button
+ $("#cancel_set_description_button").click(hideDescriptionEditor);
+
+ // Bind the submit event
+ $('#description_form').on('submit', hideDescriptionEditor);
+ });
+ </script>
+
+ <div id="set_description_button_div">
+ <table width="100%" cellpadding="0" cellspacing="0" border="0" class="attribute">
+ <tr>
+ <td width="20" height="20" align="center">
+ <img id="set_description_button" src="<s:url value="/skin/icon.add.png"/>" onMouseOver=this.src="<s:url value="/skin/icon.addhot.png"/>"
+ onMouseOut=this.src="<s:url value="/skin/icon.add.png"/>" title="<s:text name="tooltip.adddescription"/>"/>
+ </td>
+ <td> </td>
+ </tr>
+ </table>
+ </div>
+
+ <div id="description_editor_div" style="display: none;">
+ <form name="description_form" id="description_form" action="set-description" method="post">
+ <table width="100%" cellpadding="0" cellspacing="0" border="0" class="attribute">
+ <tr valign="top">
+ <td width="20" height="20" align="center">
+ <img id="cancel_set_description_button" src="<s:url value="/skin/icon.undo.png"/>"
+ title="<s:text name="tooltip.cancel"/>" />
+ </td>
+ <td>
+ <script language='JavaScript'>
+ displayTextEditor('descriptionValue', '', 300, 150);
+ </script>
+ </td>
+ </tr>
+ </table>
+ </form>
+ </div>
+</s:if>
\ No newline at end of file
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
- pageEncoding="ISO-8859-1"
-%>
-<%@ taglib prefix="s" uri="/struts-tags"
-%>
-<%@ page import="org.splat.simer.AbstractOpenObject"%>
-<%
-// On the contrary of Struts tags, the Java implementation allows the HTML contents of knowledge values to be displayed
- String entitype = request.getParameter("entity"); // Study or Knowledge element
- AbstractOpenObject object = (AbstractOpenObject)session.getAttribute(entitype + ".open");
- String description = object.getDisplayedDescription();
-%>
-<table cellpadding=0 cellspacing=0 border=0 class=text>
-<% if (description != null) {
-%><tr>
- <td><%=description%></td>
- </tr>
-<% }
-%><tr height=2><td></td></tr>
- <tr height=18>
- <s:if test="%{writeAccess == 'true' && stepEnabled == 'true'}">
- <td>
- <img src="<s:url value="/skin/icon.add.png"/>" border="none" title="<s:text name="tooltip.adddescription"/>" />
- </td>
- </s:if>
- </tr>
-</table>
\ No newline at end of file
+ pageEncoding="ISO-8859-1"%>
+<%@ taglib prefix="s" uri="/struts-tags"%>
+<s:property value="descriptionValue" escapeHtml="false"/>
\ No newline at end of file
<td width=38%> <!-- Must conform to the width of above tab-description -->
<div id="top-spacer"></div>
<div id=article-body class=text>
- <jsp:include page="/jsp/readDescription.jsp">
- <jsp:param name="entity" value="study" />
- </jsp:include>
+ <tiles:insertAttribute name="description_pane" ignore="true" />
</div>
</td>
<td width=1></td> <!-- Trick for aligning the vertical separator with the tab -->
* Injected Step Service.
*/
private StepService _stepService;
+
+ /**
+ * Study description.
+ */
+ private String _descriptionValue;
// ==============================================================================================================================
// Action methods
setMenu();
}
loadComments();
+ loadDescription();
return res;
}
}
}
+ /**
+ * Loads description (if already loaded - reloads).
+ */
+ public void loadDescription() {
+ try {
+ _descriptionValue = _studyService.getDescription(_openStudy.getIndex());
+ } catch(InvalidParameterException exception) {
+ _descriptionValue = null;
+ LOG.debug("Error while trying to add description: " + exception.getMessage());
+ }
+ }
+
+ /**
+ * Sets study description.
+ * @return SUCCESS if succeeded, INPUT otherwise.
+ */
+ public String doSetDescription() {
+ String res = INPUT;
+ try {
+ _studyService.setDescription(_openStudy.getIndex(), _descriptionValue);
+ res = SUCCESS;
+ } catch(InvalidParameterException exception) {
+ LOG.debug("Error while trying to add description: " + exception.getMessage());
+ }
+ loadDescription();
+ return res;
+ }
+
// ==============================================================================================================================
// Getters
// ==============================================================================================================================
public void setStepService(final StepService stepService) {
_stepService = stepService;
}
+
+ /**
+ * Get the descriptionValue.
+ * @return the descriptionValue
+ */
+ public String getDescriptionValue() {
+ return _descriptionValue;
+ }
+
+ /**
+ * Set the descriptionValue.
+ * @param descriptionValue the descriptionValue to set
+ */
+ public void setDescriptionValue(final String descriptionValue) {
+ _descriptionValue = descriptionValue;
+ }
}
\ No newline at end of file
page.editscenarioproperties
</result>
</action>
+ <action name="set-description"
+ class="displayStudyStepAction" method="setDescription">
+ <result name="success" type="tiles">
+ zone.description
+ </result>
+ </action>
<!-- Edition of scenario
-->