Search in sources :

Example 1 with ERROR_CODE_DELETE_SECRET

use of org.wso2.carbon.identity.secret.mgt.core.constant.SecretConstants.ErrorMessages.ERROR_CODE_DELETE_SECRET in project carbon-identity-framework by wso2.

the class SecretDAOImpl method deleteSecretById.

@Override
public void deleteSecretById(String secretId, int tenantId) throws SecretManagementException {
    NamedJdbcTemplate jdbcTemplate = getNewTemplate();
    try {
        jdbcTemplate.executeUpdate(SQLConstants.DELETE_SECRET_BY_ID, preparedStatement -> {
            preparedStatement.setString(DB_SCHEMA_COLUMN_NAME_ID, secretId);
            preparedStatement.setInt(DB_SCHEMA_COLUMN_NAME_TENANT_ID, tenantId);
        });
    } catch (DataAccessException e) {
        throw handleServerException(ERROR_CODE_DELETE_SECRET, secretId, e);
    }
}
Also used : NamedJdbcTemplate(org.wso2.carbon.database.utils.jdbc.NamedJdbcTemplate) DataAccessException(org.wso2.carbon.database.utils.jdbc.exceptions.DataAccessException)

Example 2 with ERROR_CODE_DELETE_SECRET

use of org.wso2.carbon.identity.secret.mgt.core.constant.SecretConstants.ErrorMessages.ERROR_CODE_DELETE_SECRET in project carbon-identity-framework by wso2.

the class SecretDAOImpl method deleteSecretByName.

@Override
public void deleteSecretByName(String name, String secretTypeId, int tenantId) throws SecretManagementException {
    NamedJdbcTemplate jdbcTemplate = getNewTemplate();
    try {
        jdbcTemplate.executeUpdate(SQLConstants.DELETE_SECRET, preparedStatement -> {
            preparedStatement.setString(DB_SCHEMA_COLUMN_NAME_SECRET_NAME, name);
            preparedStatement.setString(DB_SCHEMA_COLUMN_NAME_TYPE, secretTypeId);
            preparedStatement.setInt(DB_SCHEMA_COLUMN_NAME_TENANT_ID, tenantId);
        });
    } catch (DataAccessException e) {
        throw handleServerException(ERROR_CODE_DELETE_SECRET, e);
    }
}
Also used : NamedJdbcTemplate(org.wso2.carbon.database.utils.jdbc.NamedJdbcTemplate) DataAccessException(org.wso2.carbon.database.utils.jdbc.exceptions.DataAccessException)

Aggregations

NamedJdbcTemplate (org.wso2.carbon.database.utils.jdbc.NamedJdbcTemplate)2 DataAccessException (org.wso2.carbon.database.utils.jdbc.exceptions.DataAccessException)2