Package org.corrib.s3b.sscf.manage

Examples of org.corrib.s3b.sscf.manage.XfoafSscfResource


      response.sendError(HttpServletResponse.SC_BAD_REQUEST, String.format(MISSING_RESOURCE_URI));
      return;
    }

    //create the XfoafSscfResource object for current resource
    XfoafSscfResource resource = XfoafSscfResource.getXfoafSscfResource(resourceUri);
   
    PostedResource postedResource = PostedResource.create(resource.getStringURI());
   
    // export all the posts on given resource to the 2RDF
    if (request.getParameter("export2RDF") != null && "true".equals(request.getParameter("export2RDF"))) {
     
      response.setContentType("text/xml");
      response.getWriter().write(postedResource.exportPosts2RDF());
     
      return;
    }
   
   
    //get the user mbox from request
    String authorMbox = request.getParameter("authorMbox");   
    if (authorMbox == null || "".equals(authorMbox)) {
      response.sendError(HttpServletResponse.SC_BAD_REQUEST, String.format(MISSING_AUTHOR_MBOX));
      return;
    }
   
   
    //create a Person object for current user
    Person person = PersonFactory.findPerson(authorMbox);
    if (person == null) {
      person = PersonFactory.createPerson(authorMbox, null, false);
    }
   
   
    // show root posts of given resource
    if (request.getParameter("getRootPosts") != null && "true".equals(request.getParameter("getRootPosts"))) {
     
      //get the evaluation of the resource
      float currentRating = Float.isNaN(resource.getEvaluation()) ? 0 : resource.getEvaluation();
      float currentUserRating = Float.isNaN(resource.getEvaluation(person)) ? 0 : resource.getEvaluation(person);
     
      //System.out.println("__eval " + resource.getEvaluation(person) + " .. " + resource.getEvaluationsNo());
     
      //sets the attributes used after redirection
      request.setAttribute("resourceUri", resourceUri);
      request.setAttribute("authorMbox", authorMbox);
      request.setAttribute("currentRating", Float.valueOf(currentRating));
      request.setAttribute("currentUserRating", Float.valueOf(currentUserRating));
      request.setAttribute("isUserAllowedToRate", Float.isNaN(resource.getEvaluation(person)) ? true : false );
      request.setAttribute("currentRatingsNo", resource.getEvaluationsNo());
     
      /*System.out.println(request.getAttribute("currentRating") + " " + request.getAttribute("currentUserRating") + " "
          + request.getAttribute("currentRatingsNo"));*/
     
      request.getRequestDispatcher(JSP_PAGE_PATH).forward(request,response);
 
View Full Code Here

TOP

Related Classes of org.corrib.s3b.sscf.manage.XfoafSscfResource

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.