use of org.gluu.model.custom.script.model.ScriptError in project oxCore by GluuFederation.
the class CustomScriptManager method clearScriptErrorImpl.
protected void clearScriptErrorImpl(CustomScript customScript) {
// Load entry from DN
String customScriptDn = customScript.getDn();
Class<? extends CustomScript> scriptType = customScript.getScriptType().getCustomScriptModel();
CustomScript loadedCustomScript = customScriptService.getCustomScriptByDn(scriptType, customScriptDn);
// Check if there is no error
ScriptError currError = loadedCustomScript.getScriptError();
if (currError == null) {
return;
}
// Save error into script entry
loadedCustomScript.setScriptError(null);
customScriptService.update(loadedCustomScript);
}
use of org.gluu.model.custom.script.model.ScriptError in project oxCore by GluuFederation.
the class CustomScriptManager method saveScriptErrorImpl.
protected void saveScriptErrorImpl(CustomScript customScript, Exception exception, boolean overwrite) {
// Load entry from DN
String customScriptDn = customScript.getDn();
Class<? extends CustomScript> scriptType = customScript.getScriptType().getCustomScriptModel();
CustomScript loadedCustomScript = customScriptService.getCustomScriptByDn(scriptType, customScriptDn);
// Check if there is error value already
ScriptError currError = loadedCustomScript.getScriptError();
if (!overwrite && (currError != null)) {
return;
}
// Save error into script entry
StringBuilder builder = new StringBuilder();
builder.append(ExceptionUtils.getStackTrace(exception));
String message = exception.getMessage();
if (message != null && !StringUtils.isEmpty(message)) {
builder.append("\n==================Further details============================\n");
builder.append(message);
}
loadedCustomScript.setScriptError(new ScriptError(new Date(), builder.toString()));
customScriptService.update(loadedCustomScript);
}
Aggregations