Examples of WorkflowManager


Examples of edu.uga.galileo.voci.model.WorkflowManager

   */
  private boolean handleCommunityUpdateRequest(HttpServletRequest request,
      Command command, ArrayList<String> errors, User user,
      ArrayList<Integer> openNodes, HashMap<String, String> fieldMessages) {
    CommunityManager communityManager = new CommunityManager();
    WorkflowManager workflowManager = new WorkflowManager();
    Community community = null;

    // user is updating an existing community
    boolean goToList = false;

    int parentId = -1;
    if (request.getParameter("parentId") != null) {
      parentId = Integer.parseInt(request.getParameter("parentId"));
      // verify that the user can edit the requested parent
      if (!workflowManager.canEdit(user, command.getProject(), command
          .getCommand(), parentId)) {
        errors.add("You don't have permission to add a "
            + "subcommunity to the requested community.");
        goToList = true;
      } else {
        request.setAttribute("parentId", request
            .getParameter("parentId"));
      }
    }

    // continue processing the update request if no errors have been
    // encountered so far
    if (!goToList) {
      try {
        int communityId;
        boolean isFormSubmission = false;
        if (request.getParameter("communityId") != null) {
          // the id comes from the request if it's a form
          // submission
          communityId = Integer.parseInt(request
              .getParameter("communityId"));
          isFormSubmission = true;
        } else {
          // the id comes from the "other" portion of the command
          // if the user's clicked the community for editing
          communityId = Integer.parseInt(command.getOther().get(0));
        }

        if (communityId == -1) {
          // this is a new community
          try {
            community = communityManager.getCommunity(command, -1,
                false);
          } catch (NoSuchCommunityException e) {
            Logger.error("An empty community couldn't be created.",
                e);
            errors.add("Empty community couldn't be constructed.");
            goToList = true;
          }
        } else {
          // this is an existing community
          if (!workflowManager.canEdit(user, command.getProject(),
              command.getCommand(), communityId)) {
            errors.add("You don't have permission to edit "
                + "the requested community.");
            goToList = true;
          } else {
View Full Code Here

Examples of edu.uga.galileo.voci.model.WorkflowManager

      HttpServletResponse response) {
    User user = (User) request.getSession().getAttribute("user");
    ArrayList<String> errors = new ArrayList<String>();
    HashMap<String, String> fieldMessages = new HashMap<String, String>();
    Command command = (Command) request.getAttribute("command");
    WorkflowManager workflowManager = new WorkflowManager();

    // handle the "view vs. admin"-specific changes
    String openNodesAttributeName = command.isViewCommand() ? "openViewNodes"
        : "openTreeNodes";
    String contentListPage = "/"
        + command.getDisplayProject()
        + (command.isViewCommand() ? "/Content.jsp"
            : "/admin/ContentList.jsp");
    String vboViewPage = "/"
        + command.getDisplayProject()
        + (command.isViewCommand() ? "/VBODisplay.jsp"
            : "/admin/Bundle.jsp");
    if (command.isViewCommand()) {
      request.setAttribute("vboType", "Bundle");
    }

    // then do the regular page processing
    ArrayList<Integer> openNodes = (ArrayList<Integer>) request
        .getSession().getAttribute(openNodesAttributeName);
    if (openNodes == null) {
      openNodes = new ArrayList<Integer>();
    }

    boolean goToList = true;
    String cancel;

    if ((command.getModifier() != null)
        && (command.getModifier().equals("items"))) {
      // get the listing of items that belong to this bundle
      getItemWrappersForNode(command, (User) request.getSession()
          .getAttribute("user"), request);
    } else if ((command.getModifier() != null)
        && (command.getModifier().equals("search"))) {
      // prep for search functions
      setSearchObject(command, new BundleManager(), request, errors);
    } else if ((command.getModifier() != null)
        && (command.getModifier().equals("open"))) {
      // open nodes in the content tree
      openNodes(command, request, openNodesAttributeName, openNodes);
    } else if ((command.getModifier() != null)
        && (command.getModifier().equals("close"))) {
      // close nodes in the content tree
      closeNodes(command, request, openNodesAttributeName, openNodes);
    } else if (((cancel = request.getParameter("cancelChanges")) != null)
        && (cancel.equals("yes"))) {
      // user has elected to cancel changes made to a form
      request.setAttribute("successMessages",
          "Your changes have been cancelled.");
      int idToCancel = Integer.parseInt(request.getParameter("bundleId"));
      ContentLockManager.unlockContentByTypeAndID(ContentType.COMMUNITY
          .getValue(), idToCancel);
      goToList = true;
    } else if ((command.getModifier() != null)
        && (command.getModifier().equals("add"))) {
      goToList = handleBundleAddRequest(request, command, errors, user,
          openNodes, openNodesAttributeName);
    } else if ((command.getModifier() != null)
        && (command.getModifier().equals("delete"))) {
      goToList = handleBundleDeleteRequest(request, command, errors, user);
    } else if ((command.getModifier() != null)
        && (command.getModifier().equals("update"))
        && (!command.isViewCommand())) {
      goToList = handleBundleUpdateRequest(request, command, errors,
          user, openNodes, fieldMessages);
    } else if ((command.getModifier() != null)
        && (command.getModifier().equals("view"))
        && (command.isViewCommand())) {
      goToList = handleBundleViewRequest(request, command);
    } else if ((command.getModifier() != null)
        && (command.getModifier().equals("history"))) {
      goToList = handleHistoryRequest(request, command, errors, user);
    }

    Bundle bundle = request.getAttribute("bundle") == null ? null
        : (Bundle) request.getAttribute("bundle");

    // one last permissions check if we're on our way to the edit page
    if ((bundle != null)
        && (!command.isViewCommand())
        && (errors.size() == 0)
        && (fieldMessages.size() == 0)
        && (!goToList)
        && (!workflowManager.canEdit(user, command.getProject(),
            command.getCommand(), bundle.getBundleId()))) {
      errors.add("You don't have permission to "
          + "work on the requested content.");
      goToList = true;
    }
View Full Code Here

Examples of edu.uga.galileo.voci.model.WorkflowManager

   */
  private boolean handleBundleAddRequest(HttpServletRequest request,
      Command command, ArrayList<String> errors, User user,
      ArrayList<Integer> openNodes, String openNodesAttributeName) {
    BundleManager bundleManager = new BundleManager();
    WorkflowManager workflowManager = new WorkflowManager();
    Bundle bundle = null;

    boolean goToList = false;
    try {
      bundle = bundleManager.getBundle(command, -1, false);
      if ((command.getOther() != null)
          && (command.getOther().get(0).equals("to"))) {
        int parentId = Integer.parseInt(command.getOther().get(1));
        // verify that the user can edit the requested parent
        if (!workflowManager.canEdit(user, command.getProject(),
            command.getCommand(), parentId)) {
          errors.add("You don't have permission to add a "
              + "bundle to the requested object.");
          goToList = true;
        } else {
View Full Code Here

Examples of edu.uga.galileo.voci.model.WorkflowManager

   * @return <code>true</code>.
   */
  public boolean handleBundleDeleteRequest(HttpServletRequest request,
      Command command, ArrayList<String> errors, User user) {
    BundleManager bundleManager = new BundleManager();
    WorkflowManager workflowManager = new WorkflowManager();
    Bundle bundle = null;

    try {
      int bundleId = Integer.parseInt(command.getOther().get(0));
      if (!workflowManager.canEdit(user, command.getProject(), command
          .getCommand(), bundleId)) {
        errors.add("You don't have permission to delete "
            + "the requested bundle.");
      } else {
        try {
View Full Code Here

Examples of edu.uga.galileo.voci.model.WorkflowManager

   */
  private boolean handleBundleUpdateRequest(HttpServletRequest request,
      Command command, ArrayList<String> errors, User user,
      ArrayList<Integer> openNodes, HashMap<String, String> fieldMessages) {
    BundleManager bundleManager = new BundleManager();
    WorkflowManager workflowManager = new WorkflowManager();
    Bundle bundle = null;

    int parentId = -1;
    boolean goToList = false;
    if (request.getParameter("parentId") != null) {
      parentId = Integer.parseInt(request.getParameter("parentId"));
      // verify that the user can edit the requested parent
      if (!workflowManager.canEdit(user, command.getProject(), command
          .getCommand(), parentId)) {
        errors.add("You don't have permission to add a "
            + "bundle to the requested object.");
        goToList = true;
      } else {
        request.setAttribute("parentId", request
            .getParameter("parentId"));
      }
    }

    if (!goToList) {
      try {
        int bundleId;
        boolean isFormSubmission = false;
        if (request.getParameter("bundleId") != null) {
          // the id comes from the request if it's a form
          // submission
          bundleId = Integer.parseInt(request
              .getParameter("bundleId"));
          isFormSubmission = true;
        } else {
          // the id comes from the "other" portion of the command
          // if the user's clicked the bundle for editing
          bundleId = Integer.parseInt(command.getOther().get(0));
        }

        if (bundleId == -1) {
          // this is a new bundle
          try {
            bundle = bundleManager.getBundle(command, -1, false);
          } catch (NoSuchBundleException e) {
            Logger.error("An empty bundle couldn't be created.", e);
            errors.add("Empty bundle couldn't be constructed.");
            goToList = true;
          }
        } else {
          // this is an existing bundle
          // first make sure that the user can edit it
          if (!workflowManager.canEdit(user, command.getProject(),
              command.getCommand(), bundleId)) {
            errors.add("You don't have permission to edit "
                + "the requested bundle.");
            goToList = true;
          } else {
View Full Code Here

Examples of edu.uga.galileo.voci.model.WorkflowManager

   *         if all's well.
   */
  public boolean handleHistoryRequest(HttpServletRequest request,
      Command command, ArrayList<String> errors, User user) {
    BundleManager bundleManager = new BundleManager();
    WorkflowManager workflowManager = new WorkflowManager();
    Bundle bundle = null;

    boolean goToList = false;

    String[] vals = command.getOther().get(0).split("\\|");
    AuditLogManager alm = new AuditLogManager();
    int bundleId = -1;
    try {
      bundleId = Integer.parseInt(vals[2]);
      if (!workflowManager.canEdit(user, command.getProject(), command
          .getCommand(), bundleId)) {
        errors.add("You don't have permission to edit "
            + "the requested bundle.");
        goToList = true;
      } else {
View Full Code Here

Examples of edu.uga.galileo.voci.model.WorkflowManager

      HttpServletResponse response) {
    User user = (User) request.getSession().getAttribute("user");
    ArrayList<String> errors = new ArrayList<String>();
    HashMap<String, String> fieldMessages = new HashMap<String, String>();
    Command command = (Command) request.getAttribute("command");
    WorkflowManager workflowManager = new WorkflowManager();

    // handle the "view vs. admin"-specific changes
    String openNodesAttributeName = command.isViewCommand() ? "openViewNodes"
        : "openTreeNodes";
    String contentListPage = "/"
        + command.getDisplayProject()
        + (command.isViewCommand() ? "/Content.jsp"
            : "/admin/ContentList.jsp");
    String vboViewPage = "/"
        + command.getDisplayProject()
        + (command.isViewCommand() ? "/VBODisplay.jsp"
            : "/admin/Collection.jsp");
    if (command.isViewCommand()) {
      request.setAttribute("vboType", "Collection");
    }

    // then do the regular page processing
    ArrayList<Integer> openNodes = (ArrayList<Integer>) request
        .getSession().getAttribute(openNodesAttributeName);
    if (openNodes == null) {
      openNodes = new ArrayList<Integer>();
    }

    boolean goToList = true;
    String cancel;

    if ((command.getModifier() != null)
        && (command.getModifier().equals("items"))) {
      // get the listing of items that belong to this collection
      getItemWrappersForNode(command, (User) request.getSession()
          .getAttribute("user"), request);
    } else if ((command.getModifier() != null)
        && (command.getModifier().equals("search"))) {
      // prep for search functions
      setSearchObject(command, new CollectionManager(), request, errors);
    } else if ((command.getModifier() != null)
        && (command.getModifier().equals("open"))) {
      // open nodes in the content tree
      openNodes(command, request, openNodesAttributeName, openNodes);
    } else if ((command.getModifier() != null)
        && (command.getModifier().equals("close"))) {
      // close nodes in the content tree
      closeNodes(command, request, openNodesAttributeName, openNodes);
    } else if (((cancel = request.getParameter("cancelChanges")) != null)
        && (cancel.equals("yes"))) {
      // user has elected to cancel changes made to a form
      request.setAttribute("successMessages",
          "Your changes have been cancelled.");
      int idToCancel = Integer.parseInt(request
          .getParameter("collectionId"));
      ContentLockManager.unlockContentByTypeAndID(ContentType.COLLECTION
          .getValue(), idToCancel);
      goToList = true;
    } else if ((command.getModifier() != null)
        && (command.getModifier().equals("add"))) {
      goToList = handleCollectionAddRequest(request, command, errors,
          user, openNodes, openNodesAttributeName);
    } else if ((command.getModifier() != null)
        && (command.getModifier().equals("delete"))) {
      goToList = handleCollectionDeleteRequest(request, command, errors,
          user);
    } else if ((command.getModifier() != null)
        && (command.getModifier().equals("view"))
        && (command.isViewCommand())) {
      goToList = handleCollectionViewRequest(request, command);
    } else if ((command.getModifier() != null)
        && (command.getModifier().equals("update"))
        && (!command.isViewCommand())) {
      goToList = handleCollectionUpdateRequest(request, command, errors,
          user, openNodes, fieldMessages);
    } else if ((command.getModifier() != null)
        && (command.getModifier().equals("history"))) {
      goToList = handleHistoryRequest(request, command, errors, user);
    }

    Collection collection = request.getAttribute("collection") == null ? null
        : (Collection) request.getAttribute("collection");

    // one last permissions check if we're on our way to the edit page
    if ((collection != null)
        && (!command.isViewCommand())
        && (errors.size() == 0)
        && (fieldMessages.size() == 0)
        && (!goToList)
        && (!workflowManager.canEdit(user, command.getProject(),
            command.getCommand(), collection.getCollectionId()))) {
      errors.add("You don't have permission to "
          + "work on the requested content.");
      goToList = true;
    }
View Full Code Here

Examples of edu.uga.galileo.voci.model.WorkflowManager

   */
  private boolean handleCollectionAddRequest(HttpServletRequest request,
      Command command, ArrayList<String> errors, User user,
      ArrayList<Integer> openNodes, String openNodesAttributeName) {
    CollectionManager collectionManager = new CollectionManager();
    WorkflowManager workflowManager = new WorkflowManager();
    Collection collection = null;

    boolean goToList = false;
    try {
      collection = collectionManager.getCollection(command, -1, false);
      if ((command.getOther() != null)
          && (command.getOther().get(0).equals("to"))) {
        int parentId = Integer.parseInt(command.getOther().get(1));
        // verify that the user can edit the requested parent
        if (!workflowManager.canEdit(user, command.getProject(),
            command.getCommand(), parentId)) {
          errors.add("You don't have permission to add a "
              + "collection to the requested object.");
          goToList = true;
        } else {
View Full Code Here

Examples of edu.uga.galileo.voci.model.WorkflowManager

   */
  private boolean handleCollectionUpdateRequest(HttpServletRequest request,
      Command command, ArrayList<String> errors, User user,
      ArrayList<Integer> openNodes, HashMap<String, String> fieldMessages) {
    CollectionManager collectionManager = new CollectionManager();
    WorkflowManager workflowManager = new WorkflowManager();
    Collection collection = null;

    int parentId = -1;
    boolean goToList = false;
    if (request.getParameter("parentId") != null) {
      parentId = Integer.parseInt(request.getParameter("parentId"));
      // verify that the user can edit the requested parent
      if (!workflowManager.canEdit(user, command.getProject(), command
          .getCommand(), parentId)) {
        errors.add("You don't have permission to add a "
            + "collection to the requested object.");
        goToList = true;
      } else {
        request.setAttribute("parentId", request
            .getParameter("parentId"));
      }
    }

    if (!goToList) {
      try {
        int collectionId;
        boolean isFormSubmission = false;
        if (request.getParameter("collectionId") != null) {
          // the id comes from the request if it's a form
          // submission
          collectionId = Integer.parseInt(request
              .getParameter("collectionId"));
          isFormSubmission = true;
        } else {
          // the id comes from the "other" portion of the command
          // if the user's clicked the collection for editing
          collectionId = Integer.parseInt(command.getOther().get(0));
        }

        if (collectionId == -1) {
          // this is a new collection
          try {
            collection = collectionManager.getCollection(command,
                -1, false);
          } catch (NoSuchCollectionException e) {
            Logger.error(
                "An empty collection couldn't be created.", e);
            errors.add("Empty collection couldn't be constructed.");
            goToList = true;
          }
        } else {
          // this is an existing collection
          // first make sure that the user can edit it
          if (!workflowManager.canEdit(user, command.getProject(),
              command.getCommand(), collectionId)) {
            errors.add("You don't have permission to edit "
                + "the requested collection.");
            goToList = true;
          } else {
View Full Code Here

Examples of edu.uga.galileo.voci.model.WorkflowManager

   * @return <code>true</code>.
   */
  public boolean handleCollectionDeleteRequest(HttpServletRequest request,
      Command command, ArrayList<String> errors, User user) {
    CollectionManager collectionManager = new CollectionManager();
    WorkflowManager workflowManager = new WorkflowManager();
    Collection collection = null;

    try {
      int collectionId = Integer.parseInt(command.getOther().get(0));
      if (!workflowManager.canEdit(user, command.getProject(), command
          .getCommand(), collectionId)) {
        errors.add("You don't have permission to delete "
            + "the requested collection.");
      } else {
        try {
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.