use of org.wso2.carbon.identity.secret.mgt.core.constant.SQLConstants.UPDATE_SECRET_VALUE in project carbon-identity-framework by wso2.
the class SecretDAOImpl method updateSecretValue.
@Override
public Secret updateSecretValue(Secret secret, String value) throws SecretManagementException {
Timestamp currentTime = new java.sql.Timestamp(new Date().getTime());
NamedJdbcTemplate jdbcTemplate = getNewTemplate();
try {
jdbcTemplate.executeUpdate(UPDATE_SECRET_VALUE, preparedStatement -> {
preparedStatement.setString(DB_SCHEMA_COLUMN_NAME_ID, secret.getSecretId());
preparedStatement.setString(DB_SCHEMA_COLUMN_NAME_SECRET_VALUE, value);
preparedStatement.setTimeStamp(DB_SCHEMA_COLUMN_NAME_LAST_MODIFIED, currentTime, calendar);
});
secret.setLastModified(currentTime.toInstant().toString());
secret.setSecretValue(value);
} catch (DataAccessException e) {
throw handleServerException(ERROR_CODE_UPDATE_SECRET, "value", e);
}
return secret;
}
Aggregations