Ejemplo n.º 1
0
  /* (non-Javadoc)
   * @see org.dspace.app.dav.DAVResource#children()
   */
  @Override
  protected DAVResource[] children() throws SQLException {

    EPerson ep = this.context.getCurrentUser();
    if (ep != null) {
      List<WorkflowItem> wi = null;
      if (this.pathElt[0].equals("workflow_own")) {
        wi = WorkflowManager.getOwnedTasks(this.context, ep);
      } else if (this.pathElt[0].equals("workflow_pool")) {
        wi = WorkflowManager.getPooledTasks(this.context, ep);
      }
      if (wi != null) {
        log.debug("children(): Got " + String.valueOf(wi.size()) + " Workflow Items.");
        DAVResource result[] = new DAVResource[wi.size()];
        ListIterator wii = wi.listIterator();
        int i = 0;
        while (wii.hasNext()) {
          WorkflowItem wfi = (WorkflowItem) wii.next();
          result[i++] =
              new DAVWorkflowItem(
                  this.context,
                  this.request,
                  this.response,
                  makeChildPath(DAVWorkflowItem.getPathElt(wfi.getID())),
                  wfi);
        }
        return result;
      }
    }
    return new DAVResource[0];
  }
Ejemplo n.º 2
0
 /**
  * Match the URIs this subclass understands and return the corresponding resource.
  *
  * @param context the context
  * @param request the request
  * @param response the response
  * @param pathElt the path elt
  * @return the DAV resource
  * @throws DAVStatusException the DAV status exception
  * @throws SQLException the SQL exception
  */
 protected static DAVResource matchResourceURI(
     Context context, HttpServletRequest request, HttpServletResponse response, String pathElt[])
     throws DAVStatusException, SQLException {
   // The "/workflow" URI:
   if (pathElt.length > 0 && pathElt[0].startsWith("workflow_")) {
     if (pathElt.length > 1) {
       return DAVWorkflowItem.matchResourceURI(context, request, response, pathElt);
     } else if (pathElt[0].equals("workflow_own") || pathElt[0].equals("workflow_pool")) {
       return new DAVWorkflow(context, request, response, pathElt);
     } else {
       throw new DAVStatusException(
           HttpServletResponse.SC_NOT_FOUND, "Unrecognized URI path element: " + pathElt[0]);
     }
   }
   return null;
 }
Ejemplo n.º 3
0
 /**
  * Gets the path.
  *
  * @param wfi the wfi
  * @return URI path to this object.
  */
 protected static String getPath(WorkflowItem wfi) {
   return "workflow_pool/" + DAVWorkflowItem.getPathElt(wfi);
 }