Examples of SyncopeClientCompositeErrorException


Examples of org.apache.syncope.common.validation.SyncopeClientCompositeErrorException

    @RequestMapping(method = RequestMethod.POST, value = "/{kind}/create")
    public SchemaTO create(final HttpServletResponse response, @RequestBody final SchemaTO schemaTO,
            @PathVariable("kind") final String kind) {

        if (StringUtils.isBlank(schemaTO.getName())) {
            SyncopeClientCompositeErrorException sccee =
                    new SyncopeClientCompositeErrorException(HttpStatus.BAD_REQUEST);
            SyncopeClientException sce = new SyncopeClientException(SyncopeClientExceptionType.RequiredValuesMissing);
            sce.addElement("Schema name");
            sccee.addException(sce);
            throw sccee;
        }

        AttributableUtil attrUtil = getAttributableUtil(kind);
View Full Code Here

Examples of org.apache.syncope.common.validation.SyncopeClientCompositeErrorException

        try {
            jobInstanceLoader.registerJob(task, task.getJobClassName(), task.getCronExpression());
        } catch (Exception e) {
            LOG.error("While registering quartz job for task " + task.getId(), e);

            SyncopeClientCompositeErrorException scce =
                    new SyncopeClientCompositeErrorException(HttpStatus.BAD_REQUEST);
            SyncopeClientException sce = new SyncopeClientException(SyncopeClientExceptionType.Scheduling);
            sce.addElement(e.getMessage());
            scce.addException(sce);
            throw scce;
        }

        auditManager.audit(Category.task, TaskSubCategory.create, Result.success,
                "Successfully created task: " + task.getId() + "/" + taskUtil);
View Full Code Here

Examples of org.apache.syncope.common.validation.SyncopeClientCompositeErrorException

            throw new NotFoundException("Task " + taskTO.getId());
        }

        TaskUtil taskUtil = getTaskUtil(task);

        SyncopeClientCompositeErrorException scce = new SyncopeClientCompositeErrorException(HttpStatus.BAD_REQUEST);

        binder.updateSchedTask(task, taskTO, taskUtil);
        task = taskDAO.save(task);

        try {
            jobInstanceLoader.registerJob(task, task.getJobClassName(), task.getCronExpression());
        } catch (Exception e) {
            LOG.error("While registering quartz job for task " + task.getId(), e);

            SyncopeClientException sce = new SyncopeClientException(SyncopeClientExceptionType.Scheduling);
            sce.addElement(e.getMessage());
            scce.addException(sce);
            throw scce;
        }

        auditManager.audit(Category.task, TaskSubCategory.update, Result.success,
                "Successfully udpated task: " + task.getId() + "/" + taskUtil);
View Full Code Here

Examples of org.apache.syncope.common.validation.SyncopeClientCompositeErrorException

                    LOG.error("While executing task {}", task, e);

                    auditManager.audit(Category.task, TaskSubCategory.execute, Result.failure,
                            "Could not start execution for task: " + task.getId() + "/" + taskUtil, e);

                    SyncopeClientCompositeErrorException scce = new SyncopeClientCompositeErrorException(
                            HttpStatus.BAD_REQUEST);
                    SyncopeClientException sce = new SyncopeClientException(SyncopeClientExceptionType.Scheduling);
                    sce.addElement(e.getMessage());
                    scce.addException(sce);
                    throw scce;
                }

                result = new TaskExecTO();
                result.setTask(taskId);
View Full Code Here

Examples of org.apache.syncope.common.validation.SyncopeClientCompositeErrorException

            default:
        }

        if (!sce.isEmpty()) {
            SyncopeClientCompositeErrorException scce =
                    new SyncopeClientCompositeErrorException(HttpStatus.BAD_REQUEST);
            scce.addException(sce);

            auditManager.audit(Category.task, TaskSubCategory.report, Result.failure,
                    "Could not reported execution status: " + exec.getId() + "/" + taskUtil, scce);

            throw scce;
View Full Code Here

Examples of org.apache.syncope.common.validation.SyncopeClientCompositeErrorException

    public Exception fromResponse(final Response response) {
        Exception ex = null;
        final int statusCode = response.getStatus();

        // 1. Check for composite exception in HTTP header
        SyncopeClientCompositeErrorException scce = checkCompositeException(response);
        if (scce != null) {
            ex = scce;

            // TODO reduce SCCEE to really composite ones and use normal exception for others
            // } else if (statusCode == HttpStatus.SC_FORBIDDEN) {
View Full Code Here

Examples of org.apache.syncope.common.validation.SyncopeClientCompositeErrorException

        if (exTypesInHeaders == null) {
            LOG.debug("No " + SyncopeClientErrorHandler.EXCEPTION_TYPE_HEADER + " provided");
            return null;
        }

        final SyncopeClientCompositeErrorException compException = new SyncopeClientCompositeErrorException(
                org.springframework.http.HttpStatus.valueOf(statusCode));

        final Set<String> handledExceptions = new HashSet<String>();
        for (Object exceptionTypeValue : exTypesInHeaders) {
            final String exTypeAsString = (String) exceptionTypeValue;
            SyncopeClientExceptionType exceptionType = null;
            try {
                exceptionType = SyncopeClientExceptionType.getFromHeaderValue(exTypeAsString);
            } catch (IllegalArgumentException e) {
                LOG.error("Unexpected value of " + SyncopeClientErrorHandler.EXCEPTION_TYPE_HEADER + ": "
                        + exTypeAsString, e);
            }
            if (exceptionType != null) {
                handledExceptions.add(exTypeAsString);

                final SyncopeClientException clientException = new SyncopeClientException();
                clientException.setType(exceptionType);
                if (response.getHeaders().get(exceptionType.getElementHeaderName()) != null
                        && !response.getHeaders().get(exceptionType.getElementHeaderName()).isEmpty()) {
                    // TODO update clientException to support list of objects
                    final List<Object> elObjectList = response.getHeaders().get(exceptionType.getElementHeaderName());
                    final List<String> elStringList = new ArrayList<String>();
                    for (Object elementObject : elObjectList) {
                        if (elementObject instanceof String) {
                            elStringList.add((String) elementObject);
                        }
                    }
                    clientException.setElements(elStringList);
                }
                compException.addException(clientException);
            }
        }

        exTypesInHeaders.removeAll(handledExceptions);
        if (!exTypesInHeaders.isEmpty()) {
            LOG.error("Unmanaged exceptions: " + exTypesInHeaders);
        }

        if (compException.hasExceptions()) {
            return compException;
        }

        return null;
    }
View Full Code Here

Examples of org.apache.syncope.common.validation.SyncopeClientCompositeErrorException

@Component
public class DerivedSchemaDataBinder {

    private AbstractDerSchema populate(final AbstractDerSchema derSchema, final DerivedSchemaTO derSchemaTO) {
        SyncopeClientCompositeErrorException scce = new SyncopeClientCompositeErrorException(HttpStatus.BAD_REQUEST);

        if (StringUtils.isBlank(derSchemaTO.getExpression())) {
            SyncopeClientException requiredValuesMissing =
                    new SyncopeClientException(SyncopeClientExceptionType.RequiredValuesMissing);
            requiredValuesMissing.addElement("expression");

            scce.addException(requiredValuesMissing);
        } else if (!JexlUtil.isExpressionValid(derSchemaTO.getExpression())) {
            SyncopeClientException invalidMandatoryCondition = new SyncopeClientException(
                    SyncopeClientExceptionType.InvalidValues);
            invalidMandatoryCondition.addElement(derSchemaTO.getExpression());

            scce.addException(invalidMandatoryCondition);
        }

        if (scce.hasExceptions()) {
            throw scce;
        }

        BeanUtils.copyProperties(derSchemaTO, derSchema);
View Full Code Here

Examples of org.apache.syncope.common.validation.SyncopeClientCompositeErrorException

        if (itemTO == null || itemTO.getIntMappingType() == null) {
            LOG.error("Null mappingTO provided");
            return null;
        }

        SyncopeClientCompositeErrorException scce = new SyncopeClientCompositeErrorException(HttpStatus.BAD_REQUEST);

        SyncopeClientException requiredValuesMissing = new SyncopeClientException(
                SyncopeClientExceptionType.RequiredValuesMissing);

        if (itemTO.getIntAttrName() == null) {
            if (IntMappingType.getEmbedded().contains(itemTO.getIntMappingType())) {
                itemTO.setIntAttrName(itemTO.getIntMappingType().toString());
            } else {
                requiredValuesMissing.addElement("intAttrName");
            }
        }

        // Throw composite exception if there is at least one element set
        // in the composing exceptions
        if (!requiredValuesMissing.isEmpty()) {
            scce.addException(requiredValuesMissing);
        }

        // no mandatory condition implies mandatory condition false
        if (!JexlUtil.isExpressionValid(itemTO.getMandatoryCondition() == null
                ? "false" : itemTO.getMandatoryCondition())) {

            SyncopeClientException invalidMandatoryCondition = new SyncopeClientException(
                    SyncopeClientExceptionType.InvalidValues);

            invalidMandatoryCondition.addElement(itemTO.getMandatoryCondition());

            scce.addException(invalidMandatoryCondition);
        }

        if (scce.hasExceptions()) {
            throw scce;
        }

        AbstractMappingItem item = (AbstractMappingItem) SerializationUtils.clone(prototype);
        BeanUtils.copyProperties(itemTO, item, MAPPINGITEM_IGNORE_PROPERTIES);
View Full Code Here

Examples of org.apache.syncope.common.validation.SyncopeClientCompositeErrorException

            }

            checkJexl(template, sce);
        }
        if (!sce.isEmpty()) {
            SyncopeClientCompositeErrorException scce = new SyncopeClientCompositeErrorException(
                    HttpStatus.BAD_REQUEST);
            scce.addException(sce);
            throw scce;
        }

        // 2. all JEXL expressions are valid: accept user and role templates
        task.setUserTemplate(taskTO.getUserTemplate());
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.