Search in sources :

Example 1 with ERROR_CODE_ADD_SECRET_TYPE

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

the class SecretDAOImpl method addSecretType.

@Override
public void addSecretType(SecretType secretType) throws SecretManagementException {
    NamedJdbcTemplate jdbcTemplate = getNewTemplate();
    try {
        jdbcTemplate.executeInsert(SQLConstants.INSERT_SECRET_TYPE, preparedStatement -> {
            preparedStatement.setString(DB_SCHEMA_COLUMN_NAME_ID, secretType.getId());
            preparedStatement.setString(DB_SCHEMA_COLUMN_NAME_NAME, secretType.getName());
            preparedStatement.setString(DB_SCHEMA_COLUMN_NAME_DESCRIPTION, secretType.getDescription());
        }, secretType, false);
    } catch (DataAccessException e) {
        throw handleServerException(ERROR_CODE_ADD_SECRET_TYPE, secretType.getName(), 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)1 DataAccessException (org.wso2.carbon.database.utils.jdbc.exceptions.DataAccessException)1