use of org.apache.syncope.core.persistence.api.dao.NotFoundException in project syncope by apache.
the class ConfigurationLogic method delete.
@PreAuthorize("hasRole('" + StandardEntitlement.CONFIGURATION_DELETE + "')")
public void delete(final String schema) {
Optional<? extends CPlainAttr> conf = confDAO.find(schema);
if (!conf.isPresent()) {
PlainSchema plainSchema = plainSchemaDAO.find(schema);
if (plainSchema == null) {
throw new NotFoundException("Configuration schema " + schema);
}
}
confDAO.delete(schema);
}
use of org.apache.syncope.core.persistence.api.dao.NotFoundException in project syncope by apache.
the class ConnectorHistoryLogic method delete.
@PreAuthorize("hasRole('" + StandardEntitlement.CONNECTOR_HISTORY_DELETE + "')")
public void delete(final String key) {
ConnInstanceHistoryConf connInstanceHistoryConf = connInstanceHistoryConfDAO.find(key);
if (connInstanceHistoryConf == null) {
throw new NotFoundException("Connector History Conf '" + key + "'");
}
connInstanceHistoryConfDAO.delete(key);
}
use of org.apache.syncope.core.persistence.api.dao.NotFoundException in project syncope by apache.
the class ConnectorLogic method delete.
@PreAuthorize("hasRole('" + StandardEntitlement.CONNECTOR_DELETE + "')")
public ConnInstanceTO delete(final String key) {
ConnInstance connInstance = connInstanceDAO.authFind(key);
if (connInstance == null) {
throw new NotFoundException("Connector '" + key + "'");
}
Set<String> effectiveRealms = RealmUtils.getEffective(AuthContextUtils.getAuthorizations().get(StandardEntitlement.CONNECTOR_DELETE), connInstance.getAdminRealm().getFullPath());
securityChecks(effectiveRealms, connInstance.getAdminRealm().getFullPath(), connInstance.getKey());
if (!connInstance.getResources().isEmpty()) {
SyncopeClientException associatedResources = SyncopeClientException.build(ClientExceptionType.AssociatedResources);
connInstance.getResources().forEach(resource -> {
associatedResources.getElements().add(resource.getKey());
});
throw associatedResources;
}
ConnInstanceTO deleted = binder.getConnInstanceTO(connInstance);
connInstanceDAO.delete(key);
return deleted;
}
use of org.apache.syncope.core.persistence.api.dao.NotFoundException in project syncope by apache.
the class ConnectorLogic method read.
@PreAuthorize("hasRole('" + StandardEntitlement.CONNECTOR_READ + "')")
@Transactional(readOnly = true)
public ConnInstanceTO read(final String key, final String lang) {
CurrentLocale.set(StringUtils.isBlank(lang) ? Locale.ENGLISH : new Locale(lang));
ConnInstance connInstance = connInstanceDAO.authFind(key);
if (connInstance == null) {
throw new NotFoundException("Connector '" + key + "'");
}
return binder.getConnInstanceTO(connInstance);
}
use of org.apache.syncope.core.persistence.api.dao.NotFoundException in project syncope by apache.
the class DomainLogic method delete.
@PreAuthorize("hasRole('" + StandardEntitlement.DOMAIN_DELETE + "') and authentication.details.domain == " + "T(org.apache.syncope.common.lib.SyncopeConstants).MASTER_DOMAIN")
public DomainTO delete(final String key) {
Domain domain = domainDAO.find(key);
if (domain == null) {
LOG.error("Could not find domain '" + key + "'");
throw new NotFoundException(key);
}
DomainTO deleted = binder.getDomainTO(domain);
domainDAO.delete(key);
return deleted;
}
Aggregations