Package org.apache.syncope.common.types

Examples of org.apache.syncope.common.types.SyncopeClientExceptionType


            } else {
                return ((BadRequestException) ex).getResponse();
            }

        } else if (ex instanceof InvalidEntityException) {
            SyncopeClientExceptionType exType = SyncopeClientExceptionType.valueOf("Invalid"
                    + ((InvalidEntityException) ex).getEntityClassSimpleName());

            responseBuilder.header(SyncopeClientErrorHandler.EXCEPTION_TYPE_HEADER, exType.getHeaderValue());

            for (@SuppressWarnings("rawtypes") Map.Entry<Class, Set<EntityViolationType>> violation
                    : ((InvalidEntityException) ex).getViolations().entrySet()) {

                for (EntityViolationType violationType : violation.getValue()) {
                    responseBuilder.header(exType.getElementHeaderName(),
                            violation.getClass().getSimpleName() + ": " + violationType);
                }
            }
            return responseBuilder.build();
        } else if (ex instanceof WorkflowException) {
View Full Code Here


                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);
                        }
View Full Code Here

            } else {
                return ((BadRequestException) ex).getResponse();
            }

        } else if (ex instanceof InvalidEntityException) {
            SyncopeClientExceptionType exType = SyncopeClientExceptionType.valueOf("Invalid"
                    + ((InvalidEntityException) ex).getEntityClassSimpleName());

            responseBuilder.header(SyncopeClientErrorHandler.EXCEPTION_TYPE_HEADER, exType.getHeaderValue());

            for (Map.Entry<Class<?>, Set<EntityViolationType>> violation
                    : ((InvalidEntityException) ex).getViolations().entrySet()) {

                for (EntityViolationType violationType : violation.getValue()) {
                    responseBuilder.header(exType.getElementHeaderName(),
                            violation.getClass().getSimpleName() + ": " + violationType);
                }
            }
            return responseBuilder.build();
        } else if (ex instanceof WorkflowException) {
View Full Code Here

        SyncopeClientCompositeErrorException compositeException =
                new SyncopeClientCompositeErrorException(response.getStatusCode());

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

                SyncopeClientException clientException = new SyncopeClientException();
                clientException.setType(exceptionType);
                if (response.getHeaders().get(exceptionType.getElementHeaderName()) != null
                        && !response.getHeaders().get(exceptionType.getElementHeaderName()).isEmpty()) {

                    clientException.setElements(response.getHeaders().get(exceptionType.getElementHeaderName()));
                }

                compositeException.addException(clientException);
            }
        }
View Full Code Here

        SyncopeClientCompositeErrorException compositeException =
                new SyncopeClientCompositeErrorException(response.getStatusCode());

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

                SyncopeClientException clientException = new SyncopeClientException();
                clientException.setType(exceptionType);
                if (response.getHeaders().get(exceptionType.getElementHeaderName()) != null
                        && !response.getHeaders().get(exceptionType.getElementHeaderName()).isEmpty()) {

                    clientException.setElements(response.getHeaders().get(exceptionType.getElementHeaderName()));
                }

                compositeException.addException(clientException);
            }
        }
View Full Code Here

                return responseBuilder.build();
            } else {
                return ((BadRequestException) ex).getResponse();
            }
        } else if (ex instanceof InvalidEntityException) {
            SyncopeClientExceptionType exType =
                    ((InvalidEntityException) ex).getEntityClassSimpleName().endsWith("Policy")
                    ? SyncopeClientExceptionType.InvalidPolicy
                    : SyncopeClientExceptionType.valueOf(
                            "Invalid" + ((InvalidEntityException) ex).getEntityClassSimpleName());

            responseBuilder.header(SyncopeClientErrorHandler.EXCEPTION_TYPE_HEADER, exType.getHeaderValue());

            for (Map.Entry<Class<?>, Set<EntityViolationType>> violation
                    : ((InvalidEntityException) ex).getViolations().entrySet()) {

                for (EntityViolationType violationType : violation.getValue()) {
                    responseBuilder.header(exType.getElementHeaderName(),
                            violation.getClass().getSimpleName() + ": " + violationType);
                }
            }
            return responseBuilder.build();
        } else if (ex instanceof WorkflowException) {
View Full Code Here

TOP

Related Classes of org.apache.syncope.common.types.SyncopeClientExceptionType

Copyright © 2018 www.massapicom. 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.