Examples of Comments


Examples of entity.Comments

        EntityManager em = null;
        try {
            em = getEntityManager();
            em.getTransaction().begin();
            Commentrates persistentCommentrates = em.find(Commentrates.class, commentrates.getId());
            Comments commentsOld = persistentCommentrates.getComments();
            Comments commentsNew = commentrates.getComments();
            List<String> illegalOrphanMessages = null;
            if (commentsNew != null && !commentsNew.equals(commentsOld)) {
                Commentrates oldCommentratesOfComments = commentsNew.getCommentrates();
                if (oldCommentratesOfComments != null) {
                    if (illegalOrphanMessages == null) {
                        illegalOrphanMessages = new ArrayList<String>();
                    }
                    illegalOrphanMessages.add("The Comments " + commentsNew + " already has an item of type Commentrates whose comments column cannot be null. Please make another selection for the comments field.");
                }
            }
            if (illegalOrphanMessages != null) {
                throw new IllegalOrphanException(illegalOrphanMessages);
            }
            if (commentsNew != null) {
                commentsNew = em.getReference(commentsNew.getClass(), commentsNew.getId());
                commentrates.setComments(commentsNew);
            }
            commentrates = em.merge(commentrates);
            if (commentsOld != null && !commentsOld.equals(commentsNew)) {
                commentsOld.setCommentrates(null);
                commentsOld = em.merge(commentsOld);
            }
            if (commentsNew != null && !commentsNew.equals(commentsOld)) {
                commentsNew.setCommentrates(commentrates);
                commentsNew = em.merge(commentsNew);
            }
            em.getTransaction().commit();
        } catch (Exception ex) {
            String msg = ex.getLocalizedMessage();
View Full Code Here

Examples of entity.Comments

                commentrates = em.getReference(Commentrates.class, id);
                commentrates.getId();
            } catch (EntityNotFoundException enfe) {
                throw new NonexistentEntityException("The commentrates with id " + id + " no longer exists.", enfe);
            }
            Comments comments = commentrates.getComments();
            if (comments != null) {
                comments.setCommentrates(null);
                comments = em.merge(comments);
            }
            em.remove(commentrates);
            em.getTransaction().commit();
        } finally {
View Full Code Here

Examples of entity.Comments

                enrollmentId = em.getReference(enrollmentId.getClass(), enrollmentId.getId());
                comments.setEnrollmentId(enrollmentId);
            }
            em.persist(comments);
            if (commentrates != null) {
                Comments oldCommentsOfCommentrates = commentrates.getComments();
                if (oldCommentsOfCommentrates != null) {
                    oldCommentsOfCommentrates.setCommentrates(null);
                    oldCommentsOfCommentrates = em.merge(oldCommentsOfCommentrates);
                }
                commentrates.setComments(comments);
                commentrates = em.merge(commentrates);
            }
View Full Code Here

Examples of entity.Comments

    public void edit(Comments comments) throws IllegalOrphanException, NonexistentEntityException, Exception {
        EntityManager em = null;
        try {
            em = getEntityManager();
            em.getTransaction().begin();
            Comments persistentComments = em.find(Comments.class, comments.getId());
            Commentrates commentratesOld = persistentComments.getCommentrates();
            Commentrates commentratesNew = comments.getCommentrates();
            Enrollment enrollmentIdOld = persistentComments.getEnrollmentId();
            Enrollment enrollmentIdNew = comments.getEnrollmentId();
            List<String> illegalOrphanMessages = null;
            if (commentratesOld != null && !commentratesOld.equals(commentratesNew)) {
                if (illegalOrphanMessages == null) {
                    illegalOrphanMessages = new ArrayList<String>();
                }
                illegalOrphanMessages.add("You must retain Commentrates " + commentratesOld + " since its comments field is not nullable.");
            }
            if (illegalOrphanMessages != null) {
                throw new IllegalOrphanException(illegalOrphanMessages);
            }
            if (commentratesNew != null) {
                commentratesNew = em.getReference(commentratesNew.getClass(), commentratesNew.getId());
                comments.setCommentrates(commentratesNew);
            }
            if (enrollmentIdNew != null) {
                enrollmentIdNew = em.getReference(enrollmentIdNew.getClass(), enrollmentIdNew.getId());
                comments.setEnrollmentId(enrollmentIdNew);
            }
            comments = em.merge(comments);
            if (commentratesNew != null && !commentratesNew.equals(commentratesOld)) {
                Comments oldCommentsOfCommentrates = commentratesNew.getComments();
                if (oldCommentsOfCommentrates != null) {
                    oldCommentsOfCommentrates.setCommentrates(null);
                    oldCommentsOfCommentrates = em.merge(oldCommentsOfCommentrates);
                }
                commentratesNew.setComments(comments);
                commentratesNew = em.merge(commentratesNew);
            }
View Full Code Here

Examples of entity.Comments

    public void destroy(Integer id) throws IllegalOrphanException, NonexistentEntityException {
        EntityManager em = null;
        try {
            em = getEntityManager();
            em.getTransaction().begin();
            Comments comments;
            try {
                comments = em.getReference(Comments.class, id);
                comments.getId();
            } catch (EntityNotFoundException enfe) {
                throw new NonexistentEntityException("The comments with id " + id + " no longer exists.", enfe);
            }
            List<String> illegalOrphanMessages = null;
            Commentrates commentratesOrphanCheck = comments.getCommentrates();
            if (commentratesOrphanCheck != null) {
                if (illegalOrphanMessages == null) {
                    illegalOrphanMessages = new ArrayList<String>();
                }
                illegalOrphanMessages.add("This Comments (" + comments + ") cannot be destroyed since the Commentrates " + commentratesOrphanCheck + " in its commentrates field has a non-nullable comments field.");
            }
            if (illegalOrphanMessages != null) {
                throw new IllegalOrphanException(illegalOrphanMessages);
            }
            Enrollment enrollmentId = comments.getEnrollmentId();
            if (enrollmentId != null) {
                enrollmentId.getCommentsList().remove(comments);
                enrollmentId = em.merge(enrollmentId);
            }
            em.remove(comments);
View Full Code Here

Examples of net.relatedwork.shared.dto.Comments

    @Inject CommentsAccessHelper commentsAccessHelper;

    @Override
    public Comments execute(NewCommentAction newCommentAction, ExecutionContext executionContext) throws ActionException {
        Comments comment = newCommentAction.getComment();
        String targetUri = comment.getTargetUri();

        IOHelper.log(
                String.format("Creating new comment. Target[%s] Comment[%s]", targetUri, comment.getComment()));

        Node targetNode = commentsAccessHelper.getTargetNode(targetUri, comment.isReply());
        commentsAccessHelper.addComment(comment, targetNode);
        return comment;
    }
View Full Code Here

Examples of net.relatedwork.shared.dto.Comments

        } else {
            // fromNode is a Author/Paper node
            targetUri = (String) fromNode.getProperty(DBNodeProperties.URI);
        }

        Comments comment = new Comments();
        comment.setUri((String) commentNode.getProperty(DBNodeProperties.COMMENT_URI));
        comment.setAuthor(author);
        comment.setComment((String) commentNode.getProperty(DBNodeProperties.COMMENT_BODY));
        comment.setDate((String) commentNode.getProperty(DBNodeProperties.COMMENT_DATE));
        comment.setVoting((Integer) commentNode.getProperty(DBNodeProperties.COMMENT_VOTES));
        comment.setType(discussionTypeMapper.fromDBRelationship(relationshipType));
        comment.setTargetUri(targetUri);

        System.out.println("Got comment of type " + comment.getType() + ": " + comment.getComment());
        return comment;
    }
View Full Code Here

Examples of net.sf.laja.parser.template.Comments

  }
 
  private void generateStatements(int phase, GrammarData grammarData,
      StatementList statementList, boolean generateDeclarations) {
    for (Def def : defList) {
      Comments comments = new Comments();

      // Show the definition.
      List<String> statement = def.getStatement();
      String defname = def.getVarName() + " = ";
      boolean tab = false;
      if (statement.size() > 1) {
        comments.add(tab, defname.trim())// Add comment.
        defname = "";
        tab = true;
      }
      for (String s : statement) {
        comments.add(tab, defname + s);
        defname = "";
      }
      if (statementList != null && comments.hasElements()) {
        statementList.add(new Statement(phase, comments));
      }
      String name = def.getVarName();
      GrammarElement grammarElement = def.getVal();
      grammarElement.generate(phase, false, generateDeclarations, true, false, null, name, name, "*", "*", grammarData, statementList);
View Full Code Here

Examples of org.dmlite.model.component.comment.Comments

    try {
      App app = (App) getApplication();

      ModelContext commentsModelContext = new ModelContext();
      commentsModelContext.setDomainModel(app.getDomainModel());
      Comments comments = (Comments) app.getEntry("Comments");
      commentsModelContext.setEntities(comments);

      ViewContext commentsViewContext = new ViewContext();
      commentsViewContext.setApp(app);
View Full Code Here

Examples of org.docx4j.wml.Comments

    }
   
    // Comments
    if (this.getCommentsPart()!=null) {
      log.debug("Looking at comments");     
      Comments comments = this.getCommentsPart().getJaxbElement();
      finder.walkJAXBElements(comments);
    }
   
    // Add fonts used in the styles we discovered
    // .. 2013 03 10: no longer necessary
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.