ExperimentBean expBean = (ExperimentBean)JSFUtil.getManagedObject("ExperimentBean");
exp = expBean.getExperiment();
log.debug("Recieved comment " + getComment() + " for " + expBean.getEname());
Comment cmt = new CommentImpl(exp.getEntityID(), getExpPhase() );
if( title == null || "".equals(title) ) {
title = getComment();
if ( title.length() > CommentBacking.TITLE_LENGTH )
title = getComment().substring(0, CommentBacking.TITLE_LENGTH );
}
// User is?
UserBean user = (UserBean)JSFUtil.getManagedObject("UserBean");
// Existing comment?
if( ! "".equals(commentId) && commentId != null ) {
cmt = cm.getComment(this.getlCommentID());
} else {
cmt.setAuthorID(user.getUserid());
cmt.setExperimentPhaseID( expBean.getCurrentPhaseName() );
}
// Edit/update the comment:
cmt.setParentID( getlParentID() );
cmt.setExperimentID(exp.getEntityID());
cmt.setPostDate( java.util.Calendar.getInstance() );
cmt.setComment(title , this.comment );
// Add or update, depending on commendId:
if( "".equals(commentId) ) {
cm.registerComment(cmt, expBean.getID(), getExpPhase() );