1 /*****************************************************************************
5 * Creation date Nov 21, 2012
8 *****************************************************************************/
10 package org.splat.simer;
12 import java.util.Date;
14 import org.splat.exception.InvalidParameterException;
15 import org.splat.service.dto.StepCommentDTO;
17 * Step comment creation/modification action.
20 public class EditStepCommentAction extends DisplayStudyStepAction {
25 private static final long serialVersionUID = 6467920934724352021L;
28 * The value of the comment.
30 private String _commentValue;
33 * The title of the comment.
35 private String _commentTitle;
37 // ==============================================================================================================================
39 // ==============================================================================================================================
42 * Creation of a new comment.
43 * @return SUCCESS if operation succeeded, ERROR if Runtime exception, otherwise INPUT
45 public String doCreate() {
47 if ("true".equals(getWriteAccess()) && getUserRights().canCreateDocument()
48 && _commentValue!=null && _commentValue.length()>0
49 && _commentTitle!=null && _commentTitle.length()>0) {
51 StepCommentDTO stepCommentDTO = new StepCommentDTO(
52 null, //id must be null
54 getOpenStudy().getSelectedStep().getOwner().getIndex(),
55 getOpenStudy().getSelectedStep().getNumber(),
56 new Date(), //current date and time
57 getConnectedUser().getRid(),
58 null, //userName is unnecessary
62 getStepService().addStepComment(stepCommentDTO);
64 } catch (InvalidParameterException error) {
65 LOG.debug("Error while trying to add comment: " + error.getMessage());
74 * Get the commentValue.
75 * @return the commentValue
77 public String getCommentValue() {
82 * Set the commentValue.
83 * @param commentValue the commentValue to set
85 public void setCommentValue(final String commentValue) {
86 _commentValue = commentValue;
90 * Get the commentTitle.
91 * @return the commentTitle
93 public String getCommentTitle() {
98 * Set the commentTitle.
99 * @param commentTitle the commentTitle to set
101 public void setCommentTitle(final String commentTitle) {
102 _commentTitle = commentTitle;