Package edu.uga.galileo.voci.model

Examples of edu.uga.galileo.voci.model.ProjectManager$ProjectUpdateNotifier


    request.setAttribute("oldPwd", user.getPwd());
    int projectId = -1;
    ArrayList historyRecords = new ArrayList();
    try
    {
      projectId = new ProjectManager().getProjectID(command.getProject());
      historyRecords = (new AuditLogManager()).getUpdateRecords(projectId, ContentType.USER, user.getUserId());
    }
    catch( NoSuchProjectException ex )
    {
      Logger.debug("\n\n Could not retrieve projectId - UserServlet.processUpdateRequest \n\n");
View Full Code Here


    try
    {
      // userid/type/date
      // getRecord(int projectId, ContentType contentType, int contentId,
      // Timestamp update)
      projectId = new ProjectManager().getProjectID(command.getProject());
      AuditLog record = alm.getRecord(projectId, ContentType.valueOf(Integer.parseInt(vals[1])), Integer.parseInt(vals[0]),
          Timestamp.valueOf(vals[2].replace("%20", " ")));
      data = record.getDataExport();

      Logger.debug("\n\n the data looks like : " + data + "\n\n");

      user = new User();
      user.fromString(data);
      request.setAttribute("isDirty", "t");
    }
    catch( NullPointerException e )
    {
      errors.add("Invalid history request format.");
    }
    catch( NumberFormatException e )
    {
      errors.add("Invalid history request format.");
    }
    catch( NoSuchAuditLogRecordException e )
    {
      errors.add("The history record requested couldn't be located.");
    }
    catch( DataTypeMismatchException e )
    {
      Logger.error("Data type mismatch occurred pulling " + command.getOther().get(0) + " from the audit log", e);
      errors.add("A system error was encountered (DataTypeMismatch). " + "Please contact a system administrator.");
    }
    catch( NoSuchProjectException ex )
    {
      Logger.debug("\n\n Could not retrieve projectId - UserServlet.processUpdateRequest \n\n");
      errors.add("Could not retrieve projectId.");
    }

    if (errors.size() > 0)
    {
      request.setAttribute("errorMessage", generateErrorMessage(errors));
    }

    // attach full list of roles to user
    try
    {
      user = new RoleManager().setFullListRoleNames(new ProjectManager().getProjectID(command.getProject()), user);
    }
    catch( NoSuchProjectException ex )
    {
      Logger.error("System can't retrieve correct Project" + Calendar.getInstance().getTime().toString());
      errors.add("Project does not exist.  Please contact an Administrator.");
    }

    user.setRoles(user.getRoles());

    request.setAttribute("user", user);
    request.setAttribute("oldPwd", user.getPwd());

    projectId = -1;
    ArrayList historyRecords = new ArrayList();
    try
    {
      projectId = new ProjectManager().getProjectID(command.getProject());
      historyRecords = (new AuditLogManager()).getUpdateRecords(projectId, ContentType.USER, user.getUserId());
    }
    catch( NoSuchProjectException ex )
    {
      Logger.debug("\n\n Could not retrieve projectId - UserServlet.handleHistory \n\n");
View Full Code Here

    RoleManager roleManager = new RoleManager();

    try
    {
      // attach full list of roles and user-specific roles if they exist
      user = roleManager.setFullListRoleNames(new ProjectManager().getProjectID(command.getProject()), user);

    }
    catch( NoSuchProjectException ex )
    {
      Logger.debug("\n\n Could not retrieve projectId - UserServlet.processUpdateRequest \n\n");
View Full Code Here

   */
  @SuppressWarnings("unchecked")
  protected void handleRequest(HttpServletRequest request,
      HttpServletResponse response) {
    Command command = (Command) request.getAttribute("command");
    ProjectManager manager = new ProjectManager();

    Project project = null;
    ArrayList<String> errors = new ArrayList<String>();
    HashMap<String, String> fieldMessages = new HashMap<String, String>();

    // first check to see if we're just pulling a record from the history
    try {
      if ((command.getModifier() != null)
          && (command.getModifier().equals("history"))) {
        String[] vals = command.getOther().get(0).split("\\|");
        AuditLogManager alm = new AuditLogManager();
        try {
          AuditLog record = alm.getRecord(Integer.parseInt(vals[0]),
              ContentType.valueOf(Integer.parseInt(vals[1])),
              Integer.parseInt(vals[2]), Timestamp
                  .valueOf(vals[3]));
          String data = record.getDataExport();
          project = new Project();
          project.fromString(data);
          request.setAttribute("isDirty", "t");
        } catch (NullPointerException e) {
          errors.add("Invalid history request format.");
        } catch (NumberFormatException e) {
          errors.add("Invalid history request format.");
        } catch (NoSuchAuditLogRecordException e) {
          errors
              .add("The history record requested couldn't be located.");
        } catch (DataTypeMismatchException e) {
          Logger.error(
              "Data type mismatch occurred pulling "
                  + command.getOther().get(0)
                  + " from the audit log", e);
          errors
              .add("A system error was encountered (DataTypeMismatch). "
                  + "Please contact a system administrator.");
        }

        if (project == null) {
          project = manager.getProject(command.getProject());
        }
      } else {
        // if it's not from history, then...
        project = manager.getProject(command.getProject());

        String cancel;
        if (((cancel = request.getParameter("cancelChanges")) != null)
            && (cancel.equals("yes"))) {
          request.setAttribute("successMessage",
              "Your changes have been cancelled.");
        } else {
          if (request.getParameter("projectId") != null) {
            // this is an update from the project form if the
            // projectId param is set
            String oldVersion = project.toString();
            if ((project.getProjectId() != Integer.parseInt(request
                .getParameter("projectId")))
                || (!project.getHandle().equals(
                    request.getParameter("handle")))
                || (!project.getHandle().equals(
                    command.getProject()))) {
              errors
                  .add("Form corruption occurred ... please try again.");
            } else {
              // go ahead and populate the data from the request
              populateVBOFromRequest(project, request,
                  fieldMessages, true);
            }

            if (project.toString().equals(oldVersion)) {
              errors.add("No changes detected.");
            }

            if ((errors.size() == 0) && (fieldMessages.size() == 0)) {
              User user = (User) request.getSession()
                  .getAttribute("user");
              manager.updateProject(project, user, oldVersion);
              request.setAttribute("successMessage",
                  "Project successfully updated <span class=\"tinyformtext\">("
                      + Calendar.getInstance().getTime()
                          .toString() + ")</span>");
            }
View Full Code Here

    // if errors occurred, we will not delete
    if (errors.isEmpty()) {
      try {
        User sessionUser = (User) request.getSession().getAttribute(
            "user");
        roleManager.deleteRole(new ProjectManager().getProject(command
            .getProject()), sessionUser, role, role.toString());
        // if delete successful send messages....
        request.setAttribute("successMessage",
            "Role successfully deleted <span class=\"tinyformtext\">("
                + Calendar.getInstance().getTime().toString()
View Full Code Here

    // if no errors occurred update role record
    if ((!isErrors) && (fieldMessages.size() == 0)) {
      try {
        User sessionUser = (User) request.getSession().getAttribute(
            "user");
        roleManager.updateRole(new ProjectManager().getProject(command
            .getProject()), sessionUser, role, oldContent);
        // if update was successful send messages....
        request.setAttribute("successMessage",
            "Role successfully updated <span class=\"tinyformtext\">("
                + Calendar.getInstance().getTime().toString()
                + ")</span>");
      } catch (RoleUpdateAddException nsuex) {
        Logger.error("\n Could not update role data \n", nsuex);
        errors.add("Role update failed...");
      } catch (NoSuchProjectException ex) {
        Logger.error("\n Project doesn't exist (" + project.toString()
            + ") \n", ex);
        errors.add("Project doesn't exist.");
      }
    }

    if (errors.size() > 0) {
      request.setAttribute("errorMessage", generateErrorMessage(errors));
    }

    if (fieldMessages.size() > 0) {
      request.setAttribute("fieldMessages", fieldMessages);
    }

    request.setAttribute("role", role);

    int projectId = -1;
    ArrayList historyRecords = new ArrayList();
    try {
      projectId = new ProjectManager().getProjectID(command.getProject());
      historyRecords = (new AuditLogManager()).getUpdateRecords(projectId,
          ContentType.ROLE, role.getRoleId());
    } catch (NoSuchProjectException ex) {
      Logger
          .debug("\n\n Could not retrieve projectId - RoleServlet.processUpdateRequest \n\n");
View Full Code Here

    try {
      // roleId/type/date
      // getRecord(int projectId, ContentType contentType, int contentId,
      // Timestamp update)
      projectId = new ProjectManager().getProjectID(command.getProject());
      AuditLog record = alm.getRecord(projectId, ContentType
          .valueOf(Integer.parseInt(vals[1])), Integer
          .parseInt(vals[0]), Timestamp.valueOf(vals[2].replace(
          "%20", " ")));
      data = record.getDataExport();

      Logger.debug("\n\n the data looks like : " + data + "\n\n");

      role = new Role();
      role.fromString(data);
      request.setAttribute("isDirty", "t");
    } catch (NullPointerException e) {
      errors.add("Invalid history request format.");
    } catch (NumberFormatException e) {
      errors.add("Invalid history request format.");
    } catch (NoSuchAuditLogRecordException e) {
      errors.add("The history record requested couldn't be located.");
    } catch (DataTypeMismatchException e) {
      Logger.error("Data type mismatch occurred pulling "
          + command.getOther().get(0) + " from the audit log", e);
      errors.add("A system error was encountered (DataTypeMismatch). "
          + "Please contact a system administrator.");
    } catch (NoSuchProjectException ex) {
      Logger
          .debug("\n\n Could not retrieve projectId - RoleServlet.processUpdateRequest \n\n");
      errors.add("Could not retrieve projectId.");
    }

    if (errors.size() > 0) {
      request.setAttribute("errorMessage", generateErrorMessage(errors));
    }

    request.setAttribute("role", role);

    projectId = -1;
    ArrayList historyRecords = new ArrayList();
    try {
      projectId = new ProjectManager().getProjectID(command.getProject());
      historyRecords = (new AuditLogManager()).getUpdateRecords(projectId,
          ContentType.ROLE, role.getRoleId());
    } catch (NoSuchProjectException ex) {
      Logger
          .debug("\n\n Could not retrieve projectId - RoleServlet.handleHistory \n\n");
View Full Code Here

    request.setAttribute("role", role);
    int projectId = -1;
    ArrayList historyRecords = new ArrayList();
    try {
      projectId = new ProjectManager().getProjectID(command.getProject());
      historyRecords = (new AuditLogManager()).getUpdateRecords(projectId,
          ContentType.ROLE, role.getRoleId());
    } catch (NoSuchProjectException ex) {
      Logger
          .debug("\n\n Could not retrieve projectId - RoleServlet.processUpdateRequest \n\n");
View Full Code Here

      HttpServletResponse response, Command command) {
    ArrayList<Role> roleList = new ArrayList<Role>();
    RoleManager roleManager = new RoleManager();

    try {
      roleList = roleManager.getRoleList(new ProjectManager()
          .getProjectID(command.getProject()));
    } catch (NoSuchProjectException ex) {
      Logger
          .error("\n\n Could not retrieve projectId - RoleServlet.listRoles() \n\n");
      request
View Full Code Here

TOP

Related Classes of edu.uga.galileo.voci.model.ProjectManager$ProjectUpdateNotifier

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.