use of org.wso2.carbon.identity.configuration.mgt.core.constant.SQLConstants.INSERT_OR_UPDATE_RESOURCE_TYPE_ORACLE in project carbon-identity-framework by wso2.
the class ConfigurationDAOImpl method replaceResourceType.
/**
* {@inheritDoc}
*/
@Override
public void replaceResourceType(ResourceType resourceType) throws ConfigurationManagementException {
JdbcTemplate jdbcTemplate = JdbcUtils.getNewTemplate();
try {
String query = SQLConstants.INSERT_OR_UPDATE_RESOURCE_TYPE_MYSQL;
if (isH2DB()) {
query = INSERT_OR_UPDATE_RESOURCE_TYPE_H2;
} else if (isPostgreSQLDB()) {
query = INSERT_OR_UPDATE_RESOURCE_TYPE_POSTGRESQL;
} else if (isMSSqlDB() || isDB2DB()) {
query = INSERT_OR_UPDATE_RESOURCE_TYPE_MSSQL_OR_DB2;
} else if (isOracleDB()) {
query = INSERT_OR_UPDATE_RESOURCE_TYPE_ORACLE;
}
jdbcTemplate.executeInsert(query, preparedStatement -> {
int initialParameterIndex = 1;
preparedStatement.setString(initialParameterIndex, resourceType.getId());
preparedStatement.setString(++initialParameterIndex, resourceType.getName());
preparedStatement.setString(++initialParameterIndex, resourceType.getDescription());
}, resourceType, false);
} catch (DataAccessException e) {
throw handleServerException(ERROR_CODE_UPDATE_RESOURCE_TYPE, resourceType.getName(), e);
}
}
Aggregations