Search in sources :

Example 91 with NotFoundException

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));
}
Also used : NotFoundException(org.apache.syncope.core.persistence.api.dao.NotFoundException) AnyType(org.apache.syncope.core.persistence.api.entity.AnyType) PreAuthorize(org.springframework.security.access.prepost.PreAuthorize)

Example 92 with NotFoundException

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;
}
Also used : NotFoundException(org.apache.syncope.core.persistence.api.dao.NotFoundException) ApplicationTO(org.apache.syncope.common.lib.to.ApplicationTO) Application(org.apache.syncope.core.persistence.api.entity.Application) PreAuthorize(org.springframework.security.access.prepost.PreAuthorize)

Example 93 with NotFoundException

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());
}
Also used : ConnInstanceHistoryConf(org.apache.syncope.core.persistence.api.entity.ConnInstanceHistoryConf) NotFoundException(org.apache.syncope.core.persistence.api.dao.NotFoundException) PreAuthorize(org.springframework.security.access.prepost.PreAuthorize)

Example 94 with NotFoundException

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;
}
Also used : Locale(java.util.Locale) CurrentLocale(org.identityconnectors.common.l10n.CurrentLocale) ConnInstanceTO(org.apache.syncope.common.lib.to.ConnInstanceTO) NotFoundException(org.apache.syncope.core.persistence.api.dao.NotFoundException) ExternalResource(org.apache.syncope.core.persistence.api.entity.resource.ExternalResource) PreAuthorize(org.springframework.security.access.prepost.PreAuthorize) Transactional(org.springframework.transaction.annotation.Transactional)

Example 95 with NotFoundException

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;
}
Also used : NotFoundException(org.apache.syncope.core.persistence.api.dao.NotFoundException) DynRealmTO(org.apache.syncope.common.lib.to.DynRealmTO) DynRealm(org.apache.syncope.core.persistence.api.entity.DynRealm) PreAuthorize(org.springframework.security.access.prepost.PreAuthorize)

Aggregations

NotFoundException (org.apache.syncope.core.persistence.api.dao.NotFoundException)110 PreAuthorize (org.springframework.security.access.prepost.PreAuthorize)87 SyncopeClientException (org.apache.syncope.common.lib.SyncopeClientException)41 Transactional (org.springframework.transaction.annotation.Transactional)21 Date (java.util.Date)12 ExternalResource (org.apache.syncope.core.persistence.api.entity.resource.ExternalResource)10 SchedulerException (org.quartz.SchedulerException)10 ArrayList (java.util.ArrayList)8 List (java.util.List)8 AnyType (org.apache.syncope.core.persistence.api.entity.AnyType)8 Report (org.apache.syncope.core.persistence.api.entity.Report)8 SchedTask (org.apache.syncope.core.persistence.api.entity.task.SchedTask)8 User (org.apache.syncope.core.persistence.api.entity.user.User)8 HashMap (java.util.HashMap)7 Collectors (java.util.stream.Collectors)7 Pair (org.apache.commons.lang3.tuple.Pair)7 ExecTO (org.apache.syncope.common.lib.to.ExecTO)7 Autowired (org.springframework.beans.factory.annotation.Autowired)7 StringUtils (org.apache.commons.lang3.StringUtils)6 DuplicateException (org.apache.syncope.core.persistence.api.dao.DuplicateException)6