Package eu.planets_project.tb.api.model

Examples of eu.planets_project.tb.api.model.Comment


     * @param commentId the commentId to set
     */
    public void setCommentId(String commentId) {
        this.commentId = commentId;
        if( commentId == null || "".equals(commentId) ) return;
        Comment c = cm.getComment(getlCommentID());
        this.title = c.getTitle();
        this.comment = c.getComment();
        this.parentId = Long.valueOf(c.getParentID()).toString();
        this.author = c.getAuthorID();
        this.expPhase = c.getExperimentPhaseID();
        // Format the date:
        java.text.DateFormat df = java.text.DateFormat.getDateTimeInstance();
        this.time = df.format(c.getPostDate().getTime());
        //this.storeCurrentURL();
    }
View Full Code Here


        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() );
View Full Code Here

        // Do nothing if there are no comments.
        if( cmts.size() == 0 ) return;
       
        // Iterate over the children:
        for (java.util.Iterator<Comment> cit = cmts.iterator(); cit.hasNext (); ) {
            Comment c = cit.next();
            CommentTreeNode cnode = new CommentTreeNode();
            cnode.setTitle(c.getTitle());
            cnode.setBody(c.getComment());
            cnode.setIdentifier(Long.valueOf( c.getCommentID() ).toString() );
            cnode.setAuthor(c.getAuthorID());
            // Format the date:
            java.text.DateFormat df = java.text.DateFormat.getDateTimeInstance();
            cnode.setTime( df.format(c.getPostDate().getTime()) );
            cnode.setExpPhase(c.getExperimentPhaseID());
            cnode.setLeaf(false);
            // Add the child element to the tree:
            List<CommentTreeNode> cchilds = (List<CommentTreeNode>) parent.getChildren();
            cchilds.add(cnode);
            // Look for sub-comments:
View Full Code Here

        }       
       
        // Go through the comments and correct the parent IDs:
        for( Comment c1 : cmts.values() ) {
          // For this old identifier, look for it's parent comment:
          Comment c2 = cmts.get(c1.getParentID());
          if( c2 != null ) {
              // Update the parent ID to the new comment ID:
              c1.setParentID( c2.getCommentID() );
              // Don't forget to persist the id changes to the DB:
              cmp.updateComment(c1);
          }
        }
       
View Full Code Here

TOP

Related Classes of eu.planets_project.tb.api.model.Comment

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.