Commit 68528448 authored by Michael Ritter's avatar Michael Ritter
Browse files

Add new log entries to differentiate cancelled/aborted audits

parent e56ff67b
...@@ -100,6 +100,10 @@ public enum LogEnum { ...@@ -100,6 +100,10 @@ public enum LogEnum {
FILE_REGISTER(25, "File Registered", "New file registered but is not ready for auditing"), FILE_REGISTER(25, "File Registered", "New file registered but is not ready for auditing"),
FILE_AUDIT_FALLBACK(26, "File Audit Fallback", "File Audit could not connect to the IMS, falling back to audit-only mode"), FILE_AUDIT_FALLBACK(26, "File Audit Fallback", "File Audit could not connect to the IMS, falling back to audit-only mode"),
SMTP_ERROR(27, "SMTP Communication Error", "Could not connect to designated SMTP host"), SMTP_ERROR(27, "SMTP Communication Error", "Could not connect to designated SMTP host"),
// audit stop errors
FILE_AUDIT_CANCEL(30, "File Audit Cancel", "Auditing of this collection's files was cancelled"),
FILE_AUDIT_ABORT(31, "File Audit Aborted", "Auditing of this collection's files was aborted"),
SYSTEM_ERROR(99, "System Error", "Unknown system error occurred, check server logs"); SYSTEM_ERROR(99, "System Error", "Unknown system error occurred, check server logs");
private int type; private int type;
private String shortName; private String shortName;
...@@ -178,6 +182,11 @@ public enum LogEnum { ...@@ -178,6 +182,11 @@ public enum LogEnum {
case 26: case 26:
return FILE_AUDIT_FALLBACK; return FILE_AUDIT_FALLBACK;
case 30:
return FILE_AUDIT_CANCEL;
case 31:
return FILE_AUDIT_ABORT;
case 99: case 99:
return SYSTEM_ERROR; return SYSTEM_ERROR;
} }
......
...@@ -282,42 +282,43 @@ public class LogServlet extends EntityManagerServlet { ...@@ -282,42 +282,43 @@ public class LogServlet extends EntityManagerServlet {
* @return * @return
*/ */
private String generateTypeString( Map<String, String> selectedTypes ) { private String generateTypeString( Map<String, String> selectedTypes ) {
String returnString = ""; StringBuilder returnString = new StringBuilder();
if ( selectedTypes.size() > 0 ) { if ( selectedTypes.size() > 0 ) {
returnString = " l.logType IN ( "; returnString = new StringBuilder(" l.logType IN ( ");
} }
for ( String key : selectedTypes.keySet() ) { for ( String key : selectedTypes.keySet() ) {
if ( CHOICE_ERRORS.equals(key) ) { if ( CHOICE_ERRORS.equals(key) ) {
returnString += LogEnum.SYSTEM_ERROR.getType() + ","; returnString.append(LogEnum.SYSTEM_ERROR.getType()).append(",");
returnString += LogEnum.SITE_UNACCESSABLE.getType() + ","; returnString.append(LogEnum.SITE_UNACCESSABLE.getType()).append(",");
returnString += LogEnum.LOG_TYPE_UNKNOWN.getType() + ","; returnString.append(LogEnum.LOG_TYPE_UNKNOWN.getType()).append(",");
returnString += LogEnum.CREATE_TOKEN_ERROR.getType() + ","; returnString.append(LogEnum.CREATE_TOKEN_ERROR.getType()).append(",");
returnString += LogEnum.ERROR_READING.getType() + ","; returnString.append(LogEnum.ERROR_READING.getType()).append(",");
returnString += LogEnum.UNKNOWN_IMS_COMMUNICATION_ERROR.getType() + ","; returnString.append(LogEnum.UNKNOWN_IMS_COMMUNICATION_ERROR.getType()).append(",");
} else if ( CHOICE_MISSING.equals(key) ) { } else if ( CHOICE_MISSING.equals(key) ) {
returnString += LogEnum.FILE_MISSING.getType() + ","; returnString.append(LogEnum.FILE_MISSING.getType()).append(",");
returnString += LogEnum.FILE_CORRUPT.getType() + ","; returnString.append(LogEnum.FILE_CORRUPT.getType()).append(",");
returnString += LogEnum.MISSING_TOKEN.getType() + ","; returnString.append(LogEnum.MISSING_TOKEN.getType()).append(",");
} else if ( CHOICE_NEWMASTER.equals(key) ) { } else if ( CHOICE_NEWMASTER.equals(key) ) {
returnString += LogEnum.FILE_NEW.getType() + ","; returnString.append(LogEnum.FILE_NEW.getType()).append(",");
returnString += LogEnum.ADD_TOKEN.getType() + ","; returnString.append(LogEnum.ADD_TOKEN.getType()).append(",");
returnString += LogEnum.FILE_ONLINE.getType() + ","; returnString.append(LogEnum.FILE_ONLINE.getType()).append(",");
returnString.append(LogEnum.FILE_REGISTER.getType()).append(",");
} else if ( CHOICE_SYNC.equals(key) ) { } else if ( CHOICE_SYNC.equals(key) ) {
returnString += LogEnum.FILE_AUDIT_FINISH.getType() + ","; returnString.append(LogEnum.FILE_AUDIT_FINISH.getType()).append(",");
returnString += LogEnum.FILE_AUDIT_START.getType() + ","; returnString.append(LogEnum.FILE_AUDIT_START.getType()).append(",");
returnString.append(LogEnum.FILE_AUDIT_CANCEL.getType()).append(",");
returnString.append(LogEnum.FILE_AUDIT_ABORT.getType()).append(",");
} }
} }
if ( returnString.length() > 0 ) { if ( returnString.length() > 0 ) {
// remove last ',' // remove last ','
returnString = returnString.substring(0, returnString.length() - 1); returnString = new StringBuilder(returnString.substring(0, returnString.length() - 1));
returnString += ")"; returnString.append(")");
} }
return returnString; return returnString.toString();
} }
/** /**
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment