Package org.corrib.s3b.sscf.manage.sioc

Examples of org.corrib.s3b.sscf.manage.sioc.SiocPostBean


      }
     
     
      String strMilis = Long.toString(System.currentTimeMillis());
      //create a post with attributes set to given values
      SiocPostBean post = new SiocPostBean();
      post.setUri(request.getRequestURL()+"/"+Sha1sum.getInstance().calc(person.getMbox().toString()+strMilis));
      post.setPostedBy(person);
      post.setPostedResource(resourceUri);
      post.setPostBody(postBody);
      post.setPostedWhen(strMilis);
      post.setPostTitle(postTitle);
      post.setKeywords(hasKeywords);

    //  try {
        // add new post on current resource to the reposistory and get its uri
        if (parentPostUri != null && !"0".equals(parentPostUri)) {
          //System.out.println("if");
          postedResource.addPost(post, parentPostUri);
        } else {
          //System.out.println("else");
          postedResource.addPost(post, null);
        }
       
        List<SiocPostBean> posts = postedResource.getRootPosts();
        int postsNo = 0;
        for (SiocPostBean p : posts) {
          postsNo += p.getRepliesNo();
        }

        request.setAttribute("postUri", post.getUri());
        request.setAttribute("postTitle", post.getPostTitle());
        request.setAttribute("postsNo", postsNo);
        request.setAttribute("parentPostUri", parentPostUri);
        request.setAttribute("postedBy", post.getPostedBy().getMbox());
        request.setAttribute("postedWhen", post.getPostedWhenNice());
        request.setAttribute("postBody", post.getPostBody());
        request.setAttribute("postKeywords", post.getKeywords());
       
        request.getRequestDispatcher("siocPostNew_xml.jsp").forward(request,response);
        /*} catch (AccessDeniedException e) {
        e.printStackTrace();
      }*/
      return;
    }

    //as an action to "show more"
    if (request.getParameter("postUri") != null) {

      //System.out.println("show post - postUri set");
      // this parameter provides information wheter the post's details
      // should be showed or hidden
      String action = request.getParameter("action");
      String postUri = request.getParameter("postUri");


      SiocPostBean post = getPost(postedResource, postUri);
      // TODO error handling
      if (post == null) {
        response.sendError(HttpServletResponse.SC_BAD_REQUEST,MISSING_ADD_POST_FORM_PARAM);
        return;
      }
View Full Code Here


   * @return SiocPost with all the properties set, including its replies, and their replies
   */
  private SiocPostBean getPost(PostedResource postedResource, String postUri) {
    List<SiocPostBean> posts = postedResource.getRootPosts();
    for (Iterator<SiocPostBean> iter = posts.iterator(); iter.hasNext();) {
      SiocPostBean post = iter.next();
      if (postUri.equals(post.getUri())) {
        return post;
      }
    }
    return null;
  }
View Full Code Here

TOP

Related Classes of org.corrib.s3b.sscf.manage.sioc.SiocPostBean

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.