use of password.pwm.util.db.DatabaseException in project pwm by pwm-project.
the class PwNotifyDbStorageService method writeStoredState.
public void writeStoredState(final UserIdentity userIdentity, final SessionLabel sessionLabel, final StoredNotificationState storedNotificationState) throws PwmUnrecoverableException {
final String guid;
try {
guid = LdapOperationsHelper.readLdapGuidValue(pwmApplication, sessionLabel, userIdentity, true);
} catch (ChaiUnavailableException e) {
throw new PwmUnrecoverableException(PwmUnrecoverableException.fromChaiException(e).getErrorInformation());
}
if (StringUtil.isEmpty(guid)) {
throw new PwmUnrecoverableException(PwmError.ERROR_MISSING_GUID);
}
final String rawDbValue = JsonUtil.serialize(storedNotificationState);
try {
pwmApplication.getDatabaseAccessor().put(TABLE, guid, rawDbValue);
} catch (DatabaseException e) {
throw new PwmUnrecoverableException(new ErrorInformation(PwmError.ERROR_DB_UNAVAILABLE, e.getMessage()));
}
}
Aggregations