Package com.cumulocity.me.sdk

Examples of com.cumulocity.me.sdk.SDKException


    private void validateEntity(WebMethod method, ResourceRepresentation entity) {
        try {
            validationService.isValid(entity, (RepresentationValidationContext) contextForMethod.get(method));
        } catch (RepresentationValidationException e) {
            throw new SDKException(422, e.getMessage());
        }
    }
View Full Code Here


import com.cumulocity.me.sdk.SDKException;

public class SDKWebExceptionHandler implements WebExceptionHandler {

    public WebResponse handle(WebException exception) {
        throw new SDKException(exception.getResponse().getStatus(), exception.getMessage());
    }
View Full Code Here

    }

    public static void checkStatus(WebResponse response, int expectedStatusCode) throws SDKException {
        int status = response.getStatus();
        if (status != expectedStatusCode) {
            throw new SDKException(status, "Http status code: " + status);
        }
    }
View Full Code Here

                .writeCommand()
                .writeHeaders()
                .writeBody()
                .buildResponse();
        } catch (IOException e) {
            throw new SDKException(e.getMessage(), e);
        }
    }
View Full Code Here

    private Object newCollectionRepresentationInstance() {
        try {
            return type.newInstance();
        } catch (Exception ex) {
            throw new SDKException("internal error", ex);
        }
    }
View Full Code Here

        this.pageSize = pageSize;
    }

    public BaseCollectionRepresentation getPage(BaseCollectionRepresentation collectionRepresentation, int pageNumber) {
        if (collectionRepresentation == null) {
            throw new SDKException("Unable to determin the Resource URL. ");
        }
        return getPage(collectionRepresentation, pageNumber, collectionRepresentation.getPageStatistics() == null ?
                DEFAULT_PAGE_SIZE : collectionRepresentation.getPageStatistics().getPageSize());
    }
View Full Code Here

                DEFAULT_PAGE_SIZE : collectionRepresentation.getPageStatistics().getPageSize());
    }

    public BaseCollectionRepresentation getPage(BaseCollectionRepresentation collectionRepresentation, int pageNumber, int pageSize) {
        if (collectionRepresentation == null || collectionRepresentation.getSelf() == null) {
            throw new SDKException("Unable to determin the Resource URL. ");
        }

        Map params = new HashMap();
        params.put(PAGE_SIZE_KEY, String.valueOf(pageSize < 1 ? DEFAULT_PAGE_SIZE : pageSize));
        params.put(PAGE_NUMBER_KEY, String.valueOf(pageNumber));
View Full Code Here

        return (BaseCollectionRepresentation) restConnector.get(url, getMediaType(), getResponseClass());
    }

    public BaseCollectionRepresentation getNextPage(BaseCollectionRepresentation collectionRepresentation) {
        if (collectionRepresentation == null) {
            throw new SDKException("Unable to determin the Resource URL. ");
        }
        if (collectionRepresentation.getNext() == null) {
            return null;
        }
        return getCollection(collectionRepresentation.getNext());
View Full Code Here

        return getCollection(collectionRepresentation.getNext());
    }

    public BaseCollectionRepresentation getPreviousPage(BaseCollectionRepresentation collectionRepresentation) {
        if (collectionRepresentation == null) {
            throw new SDKException("Unable to determin the Resource URL. ");
        }
        if (collectionRepresentation.getPrev() == null) {
            return null;
        }
        return getCollection(collectionRepresentation.getPrev());
View Full Code Here

TOP

Related Classes of com.cumulocity.me.sdk.SDKException

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.