Search in sources :

Example 21 with ApiError

use of org.entando.entando.aps.system.services.api.model.ApiError in project entando-core by entando.

the class SelfRestCaller method extractResponseStatusCode.

protected Response.Status extractResponseStatusCode(Object responseObject) {
    if (responseObject instanceof AbstractApiResponse) {
        Response.Status status = Response.Status.OK;
        AbstractApiResponse mainResponse = (AbstractApiResponse) responseObject;
        if (null != mainResponse.getErrors()) {
            for (int i = 0; i < mainResponse.getErrors().size(); i++) {
                ApiError error = mainResponse.getErrors().get(i);
                Response.Status errorStatus = error.getStatus();
                if (null != errorStatus && status.getStatusCode() < errorStatus.getStatusCode()) {
                    status = errorStatus;
                }
            }
        }
        return status;
    } else {
        return Response.Status.OK;
    }
}
Also used : StringApiResponse(org.entando.entando.aps.system.services.api.model.StringApiResponse) Response(javax.ws.rs.core.Response) AbstractApiResponse(org.entando.entando.aps.system.services.api.model.AbstractApiResponse) AbstractApiResponse(org.entando.entando.aps.system.services.api.model.AbstractApiResponse) ApiError(org.entando.entando.aps.system.services.api.model.ApiError)

Aggregations

ApiError (org.entando.entando.aps.system.services.api.model.ApiError)21 ApsSystemException (com.agiletec.aps.system.exception.ApsSystemException)13 ApiException (org.entando.entando.aps.system.services.api.model.ApiException)10 StringApiResponse (org.entando.entando.aps.system.services.api.model.StringApiResponse)9 ArrayList (java.util.ArrayList)8 UserDetails (com.agiletec.aps.system.services.user.UserDetails)4 AttributeFieldError (com.agiletec.aps.system.common.entity.model.AttributeFieldError)3 FieldError (com.agiletec.aps.system.common.entity.model.FieldError)3 IApsEntity (com.agiletec.aps.system.common.entity.model.IApsEntity)3 ContentRecordVO (com.agiletec.plugins.jacms.aps.system.services.content.model.ContentRecordVO)2 ContentModel (com.agiletec.plugins.jacms.aps.system.services.contentmodel.ContentModel)2 AbstractApiResponse (org.entando.entando.aps.system.services.api.model.AbstractApiResponse)2 StringListApiResponse (org.entando.entando.aps.system.services.api.model.StringListApiResponse)2 DataObjectModel (org.entando.entando.aps.system.services.dataobjectmodel.DataObjectModel)2 IUserProfile (org.entando.entando.aps.system.services.userprofile.model.IUserProfile)2 AttributeInterface (com.agiletec.aps.system.common.entity.model.attribute.AttributeInterface)1 DefaultJAXBAttributeType (com.agiletec.aps.system.common.entity.model.attribute.DefaultJAXBAttributeType)1 ContentUtilizer (com.agiletec.plugins.jacms.aps.system.services.content.ContentUtilizer)1 Content (com.agiletec.plugins.jacms.aps.system.services.content.model.Content)1 ResourceUtilizer (com.agiletec.plugins.jacms.aps.system.services.resource.ResourceUtilizer)1