use of org.wso2.carbon.identity.template.mgt.TemplateMgtConstants.SqlQueries.DELETE_TEMPLATE in project carbon-identity-framework by wso2.
the class TemplateManagerDAOImpl method deleteTemplate.
/**
* Delete {@link Template} for a given template name and a tenant Id.
*
* @param templateName name of the {@link Template} to be deleted.the tenant
* @param tenantId tenant Id of the tenant which the {@link Template} resides.
* @return TemplateInfo of the deleted {@link Template}.
* @throws TemplateManagementException If error occurs while deleting the {@link Template}
*/
public TemplateInfo deleteTemplate(String templateName, Integer tenantId) throws TemplateManagementException {
JdbcTemplate jdbcTemplate = JdbcUtils.getNewTemplate();
try {
jdbcTemplate.executeUpdate(DELETE_TEMPLATE, preparedStatement -> {
preparedStatement.setString(1, templateName);
preparedStatement.setInt(2, tenantId);
});
} catch (DataAccessException e) {
throw new TemplateManagementServerException(String.format(ERROR_CODE_DELETE_TEMPLATE.getMessage(), tenantId.toString(), templateName), ERROR_CODE_DELETE_TEMPLATE.getCode(), e);
}
return new TemplateInfo(tenantId, templateName);
}
Aggregations