Examples of EntryImpl


Examples of org.apache.aries.samples.blog.persistence.jdbc.entity.EntryImpl

        PreparedStatement ppsm2 = connection.prepareStatement(sql_be);
        ResultSet rs = ppsm2.executeQuery();

        List<EntryImpl> blogs = new ArrayList<EntryImpl>();
        while (rs.next()) {
          EntryImpl blog = new EntryImpl();
          blog.setAuthor(ar);
          blog.setId(rs.getLong("id"));
          blog.setBlogText(rs.getString("blogText"));
          blog.setPublishDate(rs.getDate("publishDate"));
          blog.setTitle(rs.getString("title"));
          blog.setUpdatedDate(rs.getDate("updatedDate"));
          blogs.add(blog);
        }
        ar.setEntries(blogs);
        authorList.add(ar);
        ppsm2.close();
View Full Code Here

Examples of org.apache.aries.samples.blog.persistence.jdbc.entity.EntryImpl

      Connection connection = dataSource.getConnection();
      PreparedStatement ppsm = connection.prepareStatement(sql);
      ResultSet blogrs = ppsm.executeQuery();

      while (blogrs.next()) {
        EntryImpl be = new EntryImpl();
        be.setId(blogrs.getLong("id"));
        be.setBlogText(blogrs.getString("blogText"));
        be.setPublishDate(blogrs.getDate("publishDate"));
        be.setTitle(blogrs.getString("title"));
        be.setUpdatedDate(blogrs.getDate("updatedDate"));
        // find the author email address
        String author_email = blogrs.getString("AUTHOR_EMAIL");
        String author_sql = "SELECT * FROM Author a WHERE a.email ='"
            + author_email + "'";
        List<AuthorImpl> authors = findAuthors(author_sql);
        // there should be just one entry, as email is the primary key
        // for the Author table
        if (authors.size() != 1)
          throw new IllegalArgumentException(
              "We got more than one author with the same email address. This is wrong");
        else
          be.setAuthor(authors.get(0));
        blogEntryList.add(be);
      }
      ppsm.close();
      connection.close();
    } catch (Exception e) {
View Full Code Here

Examples of org.apache.aries.samples.blog.persistence.jpa.entity.EntryImpl

  public void createBlogPost(String authorEmail, String title,
      String blogText, List<String> tags) {
 
    AuthorImpl a = em.find(AuthorImpl.class, authorEmail);
    EntryImpl b = new EntryImpl();

    Date publishDate = new Date(System.currentTimeMillis());

    b.setBlogText(blogText);
    b.setAuthor(a);
    b.setTitle((title == null) ? "" : title);
    b.setPublishDate(publishDate);
    b.setTags((tags == null) ? new ArrayList<String>() : tags);

    a.updateEntries(b);
    em.persist(b);   
    em.merge(b.getAuthor());
    //Uncomment this line to verify that datasources have been enlisted.
    //The data base should not contain the blog post even though it has been persisted.
    //throw new RuntimeException();
  }
View Full Code Here

Examples of org.apache.aries.samples.blog.persistence.jpa.entity.EntryImpl

    em.merge(a);
  }
 
  public void updateBlogEntry(long id, String email, String title,
      String blogText, List<String> tags, Date updatedDate) {
    EntryImpl b = em.find(EntryImpl.class, id);
    b.setTitle(title);
    b.setBlogText(blogText);
    b.setTags(tags);
    b.setUpdatedDate(updatedDate);

    em.merge(b);
  }
View Full Code Here

Examples of org.apache.aries.samples.blog.persistence.jpa.entity.EntryImpl

  public void removeAuthor(String emailAddress) {
    em.remove(em.find(AuthorImpl.class, emailAddress));
  }

  public void removeBlogEntry(long id) {
    EntryImpl b = em.find(EntryImpl.class, id);
    b = em.merge(b);
    b.getAuthor().getEntries().remove(b);

    em.remove(em.merge(b));
    em.merge(b.getAuthor());

  }
View Full Code Here

Examples of org.apache.aries.samples.blog.persistence.jpa.entity.EntryImpl

    em.merge(b.getAuthor());

  }

  public EntryImpl getBlogEntryById(long postId) {
    EntryImpl b =  em.find(EntryImpl.class, postId);
    return b;
  }
View Full Code Here

Examples of org.apache.aries.samples.blog.persistence.jpa.entity.EntryImpl

    return b;
  }

  public void setPublishDate (long postId, Date date) {
    //Added for testing
    EntryImpl b = em.find(EntryImpl.class, postId);
    b.setPublishDate(date)
    em.merge(b);
  }
View Full Code Here

Examples of org.apache.aries.samples.blog.persistence.jpa.entity.EntryImpl

    em.merge(b);
  }
 
  public void setUpdatedDate (long postId, Date date) {
    //Added for testing
    EntryImpl b = em.find(EntryImpl.class, postId);
    b.setUpdatedDate(date)
    em.merge(b);
  }
View Full Code Here

Examples of org.apache.aries.samples.blog.persistence.jpa.entity.EntryImpl

  public void createBlogPost(String authorEmail, String title,
      String blogText, List<String> tags) {
 
    AuthorImpl a = em.find(AuthorImpl.class, authorEmail);
    EntryImpl b = new EntryImpl();

    Date publishDate = new Date(System.currentTimeMillis());

    b.setBlogText(blogText);
    b.setAuthor(a);
    b.setTitle((title == null) ? "" : title);
    b.setPublishDate(publishDate);
    b.setTags((tags == null) ? new ArrayList<String>() : tags);

    a.updateEntries(b);
    em.persist(b);   
    em.merge(b.getAuthor());
  }
View Full Code Here

Examples of org.apache.aries.samples.blog.persistence.jpa.entity.EntryImpl

    em.merge(a);
  }
 
  public void updateBlogEntry(long id, String email, String title,
      String blogText, List<String> tags, Date updatedDate) {
    EntryImpl b = em.find(EntryImpl.class, id);
    b.setTitle(title);
    b.setBlogText(blogText);
    b.setTags(tags);
    b.setUpdatedDate(updatedDate);

    em.merge(b);
  }
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.