Examples of AuditLogManager


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

      goToMetadataList = true;
    } else
    // all other commands (user is adding or updating an element, or
    // retrieving from history)
    if (metadataId != -2) {
      AuditLogManager alm = null;
      MetadataElement elem = null;
      try {
        if (metadataId == -1) {
          // -1 is for a blank form request from the list, asking
          // to add a new element
          elem = new MetadataElement();
          try {
            elem.setIndexMultiplier(1);
          } catch (ValidationException e) {
            // won't happen
          }
          elem.setMetadataId(-1);
          elem.setProjectId(((Project) ((HashMap) getServletContext()
              .getAttribute("projectMap")).get(command
              .getProject())).getProjectId());
          if (subCommand.equals("kf")) {
            elem.setIsKeyField(true);
          }
        } else if (subCommand.equals("history")) {
          alm = new AuditLogManager();
          String[] vals = command.getOther().get(2).split("\\|");
          try {
            AuditLog record = alm.getRecord(Integer
                .parseInt(vals[0]), ContentType.valueOf(Integer
                .parseInt(vals[1])), metadataId, Timestamp
                .valueOf(vals[2]));
            String data = record.getDataExport();
            elem = new MetadataElement();
            elem.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 (elem == null) {
            elem = manager.getMetadataElement(metadataId);
          }
        } else {
          elem = manager.getMetadataElement(metadataId);
        }
      } catch (NumberFormatException e) {
        request.setAttribute("errorMessage",
            "Invalid metadata ID requested.");
      } catch (NoSuchMetadataException e) {
        request.setAttribute("errorMessage",
            "The requested metadata element could not be found.");
      }

      if (request.getParameter("projectId") != null) {
        // this is an add/update from the form
        String oldContent = elem.toString();
        populateVBOFromRequest(elem, request, fieldMessages, true);
        if (oldContent.equals(elem.toString())) {
          errors.add("No changes detected.");
        }

        if ((fieldMessages.size() == 0) && (errors.size() == 0)) {
          try {
            elem
                .setContentType(ContentType.valueOf(
                    command.getModifier().toUpperCase())
                    .getValue());
            if (elem.getMetadataId() == -1) {
              manager.addMetadata(((User) request.getSession()
                  .getAttribute("user")), elem);
            } else {
              manager.updateMetadata(elem, oldContent,
                  ((User) request.getSession().getAttribute(
                      "user")));
            }

            request
                .setAttribute(
                    "successMessage",
                    "Your metadata element ("
                        + elem
                            .getFriendlyElementQualifierName()
                        + ") was successfully updated.");
            goToMetadataList = true;
          } catch (NoSuchMetadataException e) {
            errors
                .add("Couldn't find the metadata element for updating, or an ID for adding.");
          }
        }

        if (fieldMessages.size() != 0) {
          String plural = "";
          if (fieldMessages.size() > 1) {
            plural = "s";
          }
          errors.add("Form field" + plural
              + " failed validation (see below).");
        }
      }

      if ((elem != null) && (!goToMetadataList)) {
        request.setAttribute("metadata", elem);
        // put the project's history in the request scope (the project
        // itself is in the application scope)
        if (elem.getMetadataId() != -1) {
          if (alm == null) {
            alm = new AuditLogManager();
          }
          ArrayList<AuditLog> historyRecords = alm.getUpdateRecords(
              ((HashMap<String, Project>) getServletContext()
                  .getAttribute("projectMap")).get(
                  command.getProject()).getProjectId(),
              ContentType.METADATA, elem.getMetadataId());
          if ((historyRecords != null) && (historyRecords.size() > 0)) {
View Full Code Here

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

    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

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

    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");
      errors.add("The system couldn't retrieve project data.");
View Full Code Here

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

   */
  private void handleHistory( HttpServletRequest request, HttpServletResponse response, Command command )
  {
    ArrayList<String> errors = new ArrayList<String>();
    String[] vals = command.getOther().get(0).split("\\|");
    AuditLogManager alm = new AuditLogManager();
    boolean isErrors = false;
    User user = new User();
    int projectId = -1;
    String data = "";

    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");
      errors.add("Project Id couldn't be found. ");
View Full Code Here

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

      }
    } else {
      // we're going to the community add/edit or view page
      request.setAttribute(command.isViewCommand() ? "vbo" : "community",
          community);
      ArrayList<AuditLog> historyRecords = (new AuditLogManager())
          .getUpdateRecords(
              ((HashMap<String, Project>) getServletContext()
                  .getAttribute("projectMap")).get(
                  command.getProject()).getProjectId(),
              ContentType.COMMUNITY, community.getCommunityId());
View Full Code Here

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

    // user is requesting a previous revision to a community
    boolean goToList = false;

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

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

      }
      request.setAttribute("elements", guiElements);

      request.setAttribute(command.isViewCommand() ? "vbo" : "bundle",
          bundle);
      ArrayList<AuditLog> historyRecords = (new AuditLogManager())
          .getUpdateRecords(
              ((HashMap<String, Project>) getServletContext()
                  .getAttribute("projectMap")).get(
                  command.getProject()).getProjectId(),
              ContentType.BUNDLE, bundle.getBundleId());
View Full Code Here

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

    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 {
        AuditLog record = alm.getRecord(Integer.parseInt(vals[0]),
            ContentType.valueOf(Integer.parseInt(vals[1])),
            (bundleId = Integer.parseInt(vals[2])), Timestamp
                .valueOf(vals[3]));
        String data = record.getDataExport();
        bundle = new Bundle();
View Full Code Here

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

      }
      request.setAttribute("elements", guiElements);

      request.setAttribute(
          command.isViewCommand() ? "vbo" : "collection", collection);
      ArrayList<AuditLog> historyRecords = (new AuditLogManager())
          .getUpdateRecords(
              ((HashMap<String, Project>) getServletContext()
                  .getAttribute("projectMap")).get(
                  command.getProject()).getProjectId(),
              ContentType.COLLECTION, collection
View Full Code Here

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

    WorkflowManager workflowManager = new WorkflowManager();
    Collection collection = null;
    boolean goToList = false;

    String[] vals = command.getOther().get(0).split("\\|");
    AuditLogManager alm = new AuditLogManager();
    int collectionId = -1;
    try {
      collectionId = Integer.parseInt(vals[2]);
      if (!workflowManager.canEdit(user, command.getProject(), command
          .getCommand(), collectionId)) {
        errors.add("You don't have permission to edit "
            + "the requested collection.");
        goToList = true;
      } else {
        AuditLog record = alm.getRecord(Integer.parseInt(vals[0]),
            ContentType.valueOf(Integer.parseInt(vals[1])),
            (collectionId = Integer.parseInt(vals[2])), Timestamp
                .valueOf(vals[3]));
        String data = record.getDataExport();
        collection = new Collection();
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.