use of org.apache.syncope.core.persistence.api.dao.NotFoundException in project syncope by apache.
the class AnyTypeLogic method update.
@PreAuthorize("hasRole('" + StandardEntitlement.ANYTYPE_UPDATE + "')")
public AnyTypeTO update(final AnyTypeTO anyTypeTO) {
AnyType anyType = anyTypeDAO.find(anyTypeTO.getKey());
if (anyType == null) {
LOG.error("Could not find anyType '" + anyTypeTO.getKey() + "'");
throw new NotFoundException(anyTypeTO.getKey());
}
binder.update(anyType, anyTypeTO);
anyType = anyTypeDAO.save(anyType);
return binder.getAnyTypeTO(anyTypeDAO.save(anyType));
}
use of org.apache.syncope.core.persistence.api.dao.NotFoundException in project syncope by apache.
the class ApplicationLogic method delete.
@PreAuthorize("hasRole('" + StandardEntitlement.APPLICATION_DELETE + "')")
public ApplicationTO delete(final String key) {
Application application = applicationDAO.find(key);
if (application == null) {
LOG.error("Could not find application '" + key + "'");
throw new NotFoundException(key);
}
ApplicationTO deleted = binder.getApplicationTO(application);
applicationDAO.delete(key);
return deleted;
}
use of org.apache.syncope.core.persistence.api.dao.NotFoundException in project syncope by apache.
the class ConnectorHistoryLogic method restore.
@PreAuthorize("hasRole('" + StandardEntitlement.CONNECTOR_HISTORY_RESTORE + "')")
public void restore(final String key) {
ConnInstanceHistoryConf connInstanceHistoryConf = connInstanceHistoryConfDAO.find(key);
if (connInstanceHistoryConf == null) {
throw new NotFoundException("Connector History Conf '" + key + "'");
}
binder.update(connInstanceHistoryConf.getConf());
}
use of org.apache.syncope.core.persistence.api.dao.NotFoundException in project syncope by apache.
the class ConnectorLogic method readByResource.
@PreAuthorize("hasRole('" + StandardEntitlement.CONNECTOR_READ + "')")
@Transactional(readOnly = true)
public ConnInstanceTO readByResource(final String resourceName, final String lang) {
CurrentLocale.set(StringUtils.isBlank(lang) ? Locale.ENGLISH : new Locale(lang));
ExternalResource resource = resourceDAO.find(resourceName);
if (resource == null) {
throw new NotFoundException("Resource '" + resourceName + "'");
}
ConnInstanceTO connInstance = binder.getConnInstanceTO(connFactory.getConnector(resource).getConnInstance());
connInstance.setKey(resource.getConnector().getKey());
return connInstance;
}
use of org.apache.syncope.core.persistence.api.dao.NotFoundException in project syncope by apache.
the class DynRealmLogic method delete.
@PreAuthorize("hasRole('" + StandardEntitlement.DYNREALM_DELETE + "')")
public DynRealmTO delete(final String key) {
DynRealm dynRealm = dynRealmDAO.find(key);
if (dynRealm == null) {
LOG.error("Could not find dynamic realm '" + key + "'");
throw new NotFoundException(key);
}
DynRealmTO deleted = binder.getDynRealmTO(dynRealm);
dynRealmDAO.delete(key);
return deleted;
}
Aggregations