public Post.Builder resolve(final Post.Builder post) throws SQLException {
      Timer.Context ctx = metrics.resolvePostTimer.time();
      try {
         User author = resolveUser(post.getAuthorId());
         if(author != null) {
            List<Meta> meta = userMetadata(post.getAuthorId());
            if(meta.size() > 0) {
               author = author.withMetadata(meta);
            }
            post.setAuthor(author);
         }

         List<Meta> meta = selectPostMeta(post.getId());
         if(meta.size() > 0) {
            post.setMetadata(meta);
         }

         List<TaxonomyTerm> terms = selectPostTerms(post.getId());
         if(terms.size() > 0) {
            post.setTaxonomyTerms(terms);
         }

         List<Post> children = selectChildren(post.getId(), false);
         if(children.size() > 0) {
            post.setChildren(children);
         }
         return post;
      } finally {
         ctx.stop();
      }
   }
public Post . Builder resolve ( final Post . Builder post ) throws SQLException { Timer . Context ctx = metrics . resolvePostTimer . time ( ) ; try { User author = resolveUser ( post . getAuthorId ( ) ) ; if ( author != null ) { List < Meta > meta = userMetadata ( post . getAuthorId ( ) ) ; if ( meta . size ( ) > 0 ) { author = author . withMetadata ( meta ) ; } post . setAuthor ( author ) ; } List < Meta > meta = selectPostMeta ( post . getId ( ) ) ; if ( meta . size ( ) > 0 ) { post . setMetadata ( meta ) ; } List < TaxonomyTerm > terms = selectPostTerms ( post . getId ( ) ) ; if ( terms . size ( ) > 0 ) { post . setTaxonomyTerms ( terms ) ; } List < Post > children = selectChildren ( post . getId ( ) , false ) ; if ( children . size ( ) > 0 ) { post . setChildren ( children ) ; } return post ; } finally { ctx . stop ( ) ; } }
Resolves user, author, terms and meta for a post.
@param post The post builder.
@return The builder with resolved items.
@throws SQLException on database error.