Examples of AuthorImpl


Examples of com.atlassian.bamboo.author.AuthorImpl

    protected void addChangesetsToPendingCommmits(ChangesetInfo[] changesets, List<Commit> commits)
      throws RepositoryException {

    for(ChangesetInfo changeset : changesets) {
      CommitImpl commit = new CommitImpl();
      commit.setAuthor(new AuthorImpl(changeset.getOwner()));
      commit.setDate(changeset.getDate());
      commit.setComment("Branch: " + changeset.getChangesetBranch() +
          "; Changeset num: " + changeset.getChangesetId() +
          ". Comments: " +  changeset.getComments());
      List<CommitFile> files = getFiles(changeset.getChangesetId());
View Full Code Here

Examples of ma.glasnost.orika.test.common.types.TestCaseClasses.AuthorImpl

  }
 
  @Test
  @Concurrent(20)
  public void testGenerateMappers() {
    BookImpl book = new BookImpl("The Book Title", new AuthorImpl("The Author Name"));
    Library lib = new LibraryImpl("The Library", Arrays.<Book>asList(book));
   
    LibraryDTO mappedLib = mapper.map(lib, LibraryDTO.class);
   
    // Just to be sure things mapped as expected
View Full Code Here

Examples of ma.glasnost.orika.test.common.types.TestCaseClasses.AuthorImpl

    @Test
    public void testBaseCaseWithCollectionTypes() {
     
      List<Book> books = new ArrayList<Book>(4);
     
      Author author1 = new AuthorImpl("Author #1");
      Author author2 = new AuthorImpl("Author #2");
     
      books.add(new BookImpl("Book #1", author1));
      books.add(new BookImpl("Book #2", author1));
      books.add(new BookImpl("Book #3", author2));
      books.add(new BookImpl("Book #4", author2));
View Full Code Here

Examples of ma.glasnost.orika.test.common.types.TestCaseClasses.AuthorImpl

 
 
  @Test
  public void testExtendedMapper() {
    MyMapperFactory factory = new MyMapperFactory.Builder().useAutoMapping(true).traceMethodCalls(true).build();
    Author author = new AuthorImpl("Test Author");
   
    AuthorDTO mapped = factory.getMapperFacade().map(author, AuthorDTO.class);
    Assert.assertNotNull(mapped);
    Assert.assertEquals(author.getName(), mapped.getName());
  }
View Full Code Here

Examples of ma.glasnost.orika.test.common.types.TestCaseClasses.AuthorImpl

    @Test
    public void testBaseCaseWithCollectionTypes() {
     
      List<Book> books = new ArrayList<Book>(4);
     
      Author author1 = new AuthorImpl("Author #1");
      Author author2 = new AuthorImpl("Author #2");
     
      books.add(new BookImpl("Book #1", author1));
      books.add(new BookImpl("Book #2", author1));
      books.add(new BookImpl("Book #3", author2));
      books.add(new BookImpl("Book #4", author2));
View Full Code Here

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

   *
   */
  public void createBlogPost(String authorEmail, String title, String blogText,
      List<String> tags) {
   
    AuthorImpl a = getAuthor(authorEmail);
   
    if(title == null) title = "";
    Date publishDate = new Date(System.currentTimeMillis());
    if(tags == null) tags = new ArrayList<String>();
   

    try {
      Connection connection = dataSource.getConnection();
      // let's find the max id from the blogentry table
      String sql = "SELECT max(id) FROM BLOGENTRY";
      PreparedStatement ppsm = connection.prepareStatement(sql);
      ResultSet rs = ppsm.executeQuery();
      // we only expect to have one row returned
      rs.next();

      long max_id = rs.getLong(1);
      ppsm.close();
     
      long post_id = max_id + 1;
      sql = "INSERT INTO BLOGENTRY VALUES (?,?,?,?,?,?)";
     
        ppsm = connection.prepareStatement(sql);
      ppsm.setLong(1, post_id);
      ppsm.setString(2, blogText);
      if (publishDate != null)
        ppsm
            .setDate(3, new java.sql.Date(publishDate
                .getTime()));
      else
        ppsm.setDate(3, null);
      ppsm.setString(4, title);
     
        ppsm.setDate(5, null);
      ppsm.setString(6, a.getEmail());
      int rows = ppsm.executeUpdate();
      if (rows != 1)
        throw new IllegalArgumentException(
            "The blog entry record cannot be inserted: "
                + blogText);
      ppsm.close();
     
      // insert a row in the relationship table

      sql = "INSERT INTO Author_BlogEntry VALUES (?,?)";
      ppsm = connection.prepareStatement(sql);
      ppsm.setString(1, a.getEmail());
      ppsm.setLong(2, post_id);

      rows = ppsm.executeUpdate();
      ppsm.close();
      connection.close();
     
      if (rows != 1)
        throw new IllegalArgumentException(
            "The Author_BlogEntry record cannot be inserted: "
                + a.getEmail() + " , " + post_id);

    } catch (SQLException sqle) {
      sqle.printStackTrace();
    }

View Full Code Here

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

      PreparedStatement ppsm = connection.prepareStatement(sql);

      ResultSet ars = ppsm.executeQuery();

      while (ars.next()) {
        AuthorImpl ar = new AuthorImpl();
        ar.setBio(ars.getString("bio"));
        ar.setDisplayName(ars.getString("displayName"));
        ar.setDob(ars.getDate("dob"));
        String email = ars.getString("email");
        ar.setEmail(email);
        ar.setName(ars.getString("name"));

        // let's find the blog entries for the author
        String sql_be = "SELECT * FROM BLOGENTRY be WHERE be.AUTHOR_EMAIL = '"
            + email + "'";
        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();
      }
        ppsm.close();
      connection.close();
View Full Code Here

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

   *
   */
  public void createBlogPost(String authorEmail, String title, String blogText,
      List<String> tags) {
   
    AuthorImpl a = getAuthor(authorEmail);
   
    if(title == null) title = "";
    Date publishDate = new Date(System.currentTimeMillis());
    if(tags == null) tags = new ArrayList<String>();
   

    try {
      Connection connection = dataSource.getConnection();
      // let's find the max id from the blogentry table
      String sql = "SELECT max(id) FROM BLOGENTRY";
      PreparedStatement ppsm = connection.prepareStatement(sql);
      ResultSet rs = ppsm.executeQuery();
      // we only expect to have one row returned
      rs.next();

      long max_id = rs.getLong(1);
      ppsm.close();
     
      long post_id = max_id + 1;
      sql = "INSERT INTO BLOGENTRY VALUES (?,?,?,?,?,?)";
     
        ppsm = connection.prepareStatement(sql);
      ppsm.setLong(1, post_id);
      ppsm.setString(2, blogText);
      if (publishDate != null)
        ppsm
            .setDate(3, new java.sql.Date(publishDate
                .getTime()));
      else
        ppsm.setDate(3, null);
      ppsm.setString(4, title);
     
        ppsm.setDate(5, null);
      ppsm.setString(6, a.getEmail());
      int rows = ppsm.executeUpdate();
      if (rows != 1)
        throw new IllegalArgumentException(
            "The blog entry record cannot be inserted: "
                + blogText);
      ppsm.close();
     
      // insert a row in the relationship table

      sql = "INSERT INTO Author_BlogEntry VALUES (?,?)";
      ppsm = connection.prepareStatement(sql);
      ppsm.setString(1, a.getEmail());
      ppsm.setLong(2, post_id);

      rows = ppsm.executeUpdate();
      ppsm.close();
      connection.close();
     
      if (rows != 1)
        throw new IllegalArgumentException(
            "The Author_BlogEntry record cannot be inserted: "
                + a.getEmail() + " , " + post_id);

    } catch (SQLException sqle) {
      sqle.printStackTrace();
    }

View Full Code Here

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

      PreparedStatement ppsm = connection.prepareStatement(sql);

      ResultSet ars = ppsm.executeQuery();

      while (ars.next()) {
        AuthorImpl ar = new AuthorImpl();
        ar.setBio(ars.getString("bio"));
        ar.setDisplayName(ars.getString("displayName"));
        ar.setDob(ars.getDate("dob"));
        String email = ars.getString("email");
        ar.setEmail(email);
        ar.setName(ars.getString("name"));

        // let's find the blog entries for the author
        String sql_be = "SELECT * FROM BLOGENTRY be WHERE be.AUTHOR_EMAIL = '"
            + email + "'";
        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();
      }
        ppsm.close();
      connection.close();
View Full Code Here

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

  }

  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
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.