Package org.apache.aries.samples.blog.persistence.jpa.entity

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


    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

  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

    em.merge(b.getAuthor());

  }

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

    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

    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

  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

    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

  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

    em.merge(b.getAuthor());

  }

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

TOP

Related Classes of org.apache.aries.samples.blog.persistence.jpa.entity.EntryImpl

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.