Search in sources :

Example 46 with NotFoundException

use of org.apache.syncope.core.persistence.api.dao.NotFoundException in project syncope by apache.

the class ReportLogic method deleteExecution.

@PreAuthorize("hasRole('" + StandardEntitlement.REPORT_DELETE + "')")
@Override
public ExecTO deleteExecution(final String executionKey) {
    ReportExec reportExec = reportExecDAO.find(executionKey);
    if (reportExec == null) {
        throw new NotFoundException("Report execution " + executionKey);
    }
    ExecTO reportExecToDelete = binder.getExecTO(reportExec);
    reportExecDAO.delete(reportExec);
    return reportExecToDelete;
}
Also used : ExecTO(org.apache.syncope.common.lib.to.ExecTO) NotFoundException(org.apache.syncope.core.persistence.api.dao.NotFoundException) ReportExec(org.apache.syncope.core.persistence.api.entity.ReportExec) PreAuthorize(org.springframework.security.access.prepost.PreAuthorize)

Example 47 with NotFoundException

use of org.apache.syncope.core.persistence.api.dao.NotFoundException in project syncope by apache.

the class ResourceHistoryLogic method restore.

@PreAuthorize("hasRole('" + StandardEntitlement.RESOURCE_HISTORY_RESTORE + "')")
public void restore(final String key) {
    ExternalResourceHistoryConf resourceHistoryConf = resourceHistoryConfDAO.find(key);
    if (resourceHistoryConf == null) {
        throw new NotFoundException("Resource History Conf '" + key + "'");
    }
    binder.update(resourceHistoryConf.getEntity(), resourceHistoryConf.getConf());
}
Also used : ExternalResourceHistoryConf(org.apache.syncope.core.persistence.api.entity.resource.ExternalResourceHistoryConf) NotFoundException(org.apache.syncope.core.persistence.api.dao.NotFoundException) PreAuthorize(org.springframework.security.access.prepost.PreAuthorize)

Example 48 with NotFoundException

use of org.apache.syncope.core.persistence.api.dao.NotFoundException in project syncope by apache.

the class ResourceHistoryLogic method delete.

@PreAuthorize("hasRole('" + StandardEntitlement.RESOURCE_HISTORY_DELETE + "')")
public void delete(final String key) {
    ExternalResourceHistoryConf resourceHistoryConf = resourceHistoryConfDAO.find(key);
    if (resourceHistoryConf == null) {
        throw new NotFoundException("Resource History Conf '" + key + "'");
    }
    resourceHistoryConfDAO.delete(key);
}
Also used : ExternalResourceHistoryConf(org.apache.syncope.core.persistence.api.entity.resource.ExternalResourceHistoryConf) NotFoundException(org.apache.syncope.core.persistence.api.dao.NotFoundException) PreAuthorize(org.springframework.security.access.prepost.PreAuthorize)

Example 49 with NotFoundException

use of org.apache.syncope.core.persistence.api.dao.NotFoundException in project syncope by apache.

the class AnyTypeClassLogic method update.

@PreAuthorize("hasRole('" + StandardEntitlement.ANYTYPECLASS_UPDATE + "')")
public AnyTypeClassTO update(final AnyTypeClassTO anyTypeClassTO) {
    AnyTypeClass anyType = anyTypeClassDAO.find(anyTypeClassTO.getKey());
    if (anyType == null) {
        LOG.error("Could not find anyTypeClass '" + anyTypeClassTO.getKey() + "'");
        throw new NotFoundException(anyTypeClassTO.getKey());
    }
    binder.update(anyType, anyTypeClassTO);
    anyType = anyTypeClassDAO.save(anyType);
    return binder.getAnyTypeClassTO(anyType);
}
Also used : NotFoundException(org.apache.syncope.core.persistence.api.dao.NotFoundException) AnyTypeClass(org.apache.syncope.core.persistence.api.entity.AnyTypeClass) PreAuthorize(org.springframework.security.access.prepost.PreAuthorize)

Example 50 with NotFoundException

use of org.apache.syncope.core.persistence.api.dao.NotFoundException in project syncope by apache.

the class ConfigurationLogic method get.

@PreAuthorize("hasRole('" + StandardEntitlement.CONFIGURATION_GET + "')")
@Transactional(readOnly = true)
public AttrTO get(final String schema) {
    AttrTO result;
    Optional<? extends CPlainAttr> conf = confDAO.find(schema);
    if (conf.isPresent()) {
        result = binder.getAttrTO(conf.get());
    } else {
        PlainSchema plainSchema = plainSchemaDAO.find(schema);
        if (plainSchema == null) {
            throw new NotFoundException("Configuration schema " + schema);
        }
        result = new AttrTO();
        result.setSchema(schema);
    }
    return result;
}
Also used : AttrTO(org.apache.syncope.common.lib.to.AttrTO) NotFoundException(org.apache.syncope.core.persistence.api.dao.NotFoundException) PlainSchema(org.apache.syncope.core.persistence.api.entity.PlainSchema) PreAuthorize(org.springframework.security.access.prepost.PreAuthorize) Transactional(org.springframework.transaction.annotation.Transactional)

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