use of cz.metacentrum.perun.audit.events.GroupManagerEvents.GroupStructureSyncFailed in project perun by CESNET.
the class GroupsManagerBlImpl method processGroupStructureSynchronizationExceptionMessage.
/**
* Checks content of exception message and base on that sets attributes, logs, etc...
*
* Method used by group structure synchronization
*
* @param sess perun session
* @param group under which was group structure synchronization executed
* @param failedDueToException boolean value if there was an exception raised during group structure synchronization
* @param originalExceptionMessage group structure synchronization exception message
* @return exceptionMessage, either modified or unmodified
* @throws InternalErrorException
*/
private String processGroupStructureSynchronizationExceptionMessage(PerunSession sess, Group group, boolean failedDueToException, String originalExceptionMessage) {
String exceptionMessage = originalExceptionMessage;
if (exceptionMessage != null && exceptionMessage.isEmpty()) {
exceptionMessage = "Empty message.";
} else if (exceptionMessage != null && exceptionMessage.length() > 1000) {
exceptionMessage = exceptionMessage.substring(0, 1000) + " ... message is too long, other info is in perun log file. If needed, please ask perun administrators.";
}
if (exceptionMessage != null) {
if (failedDueToException) {
getPerunBl().getAuditer().log(sess, new GroupStructureSyncFailed(group));
log.debug("{} structure synchronization failed because of {}", group, originalExceptionMessage);
} else {
getPerunBl().getAuditer().log(sess, new GroupStructureSyncFinishedWithErrors(group));
log.debug("{} structure synchronization finished with errors: {}", group, originalExceptionMessage);
}
}
return exceptionMessage;
}
Aggregations