HttpServletResponse response, Command command) {
ArrayList<String> errors = new ArrayList<String>();
String[] vals = command.getOther().get(0).split("\\|");
AuditLogManager alm = new AuditLogManager();
boolean isErrors = false;
Role role = new Role();
int projectId = -1;
String data = "";
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");
}
if ((!historyRecords.isEmpty()) && (historyRecords.size() > 0)) {
request.setAttribute("history", historyRecords);
}
if ((errors.size() > 0) || (isErrors)) {
// go back to role.jsp and state error
sendRequestToRoleJSP(request, response, command);
Logger.debug("\n\n this role data had erros : " + role.toString()
+ "\n\n");
} else {
sendRequestToRoleJSP(request, response, command);
}
}// end handleHistory()