Package com.dietsodasoftware.yail.xmlrpc.service

Examples of com.dietsodasoftware.yail.xmlrpc.service.InfusionsoftParameterValidationException


        }

        private Builder dateIsBefore(String field, Object value){
            final Object dateCompare = parameterValues.get(field);
            if(dateCompare != null && !(dateCompare instanceof Map)){
                throw new IllegalArgumentException(new InfusionsoftParameterValidationException("Can only compare against a given field once in a query"));
            }

            final Map<String, Object> dateRange;
            if(dateCompare == null){
                dateRange = new HashMap<String, Object>();
                parameterValues.put(field, dateRange);
            } else {
                dateRange = (Map<String, Object>) dateCompare;
            }


            final String beforeValue = DateCompare.before.value(parameterValues);
            if(beforeValue != null){
                throw new IllegalArgumentException(new InfusionsoftParameterValidationException("Already comparing field before a date"));
            }

            dateRange.put(DateCompare.before.name(), value);
            return this;
        }
View Full Code Here


        }

        private Builder dateIsAfter(String field, Object value) {
            final Object dateCompare = parameterValues.get(field);
            if(dateCompare != null && !(dateCompare instanceof Map)){
                throw new IllegalArgumentException(new InfusionsoftParameterValidationException("Can only compare against a given field once in a query"));
            }

            final Map<String, Object> dateRange;
            if(dateCompare == null){
                dateRange = new HashMap<String, Object>();
                parameterValues.put(field, dateRange);
            } else {
                dateRange = (Map<String, Object>) dateCompare;
            }


            final String afterValue = DateCompare.since.value(parameterValues);
            if(afterValue != null){
                throw new IllegalArgumentException(new InfusionsoftParameterValidationException("Already comparing field after a date"));
            }

            dateRange.put(DateCompare.since.name(), value);
            return this;
        }
View Full Code Here

            return dateIsBetween(field.name(), beforeDate, afterDate);
        }

        private Builder dateIsBetween(String field, Object beforeDate, Object afterDate) {
            if (beforeDate == null || afterDate == null) {
                throw new IllegalArgumentException(new InfusionsoftParameterValidationException("Can't compare between two values if you don't give them to me"));

            }
            final Object dateCompare = parameterValues.get(field);
            if (dateCompare != null && !(dateCompare instanceof Map)) {
                throw new IllegalArgumentException(new InfusionsoftParameterValidationException("Can only compare against a given field once in a query"));
            }

            final Map<String, Object> dateRange;
            if (dateCompare == null) {
                dateRange = new HashMap<String, Object>();
                parameterValues.put(field, dateRange);
            } else {
                dateRange = (Map<String, Object>) dateCompare;
            }

            final String beforeValue = DateCompare.before.value(parameterValues);
            final String afterValue = DateCompare.since.value(parameterValues);
            if (afterValue != null || beforeValue != null) {
                throw new IllegalArgumentException(new InfusionsoftParameterValidationException("Already comparing field after a date"));
            }

            dateRange.put(DateCompare.since.name(), afterDate);
            dateRange.put(DateCompare.before.name(), beforeDate);
            return this;
View Full Code Here

  private String orderBy;

    @ArgumentValidator
    public void ensureOrderByAscending() throws InfusionsoftParameterValidationException {
        if(ascending != null && orderBy == null){
            throw new InfusionsoftParameterValidationException("Must provide orderBy field or custom field to declare ascending/descending query");
        }

        if(ascending == null && orderBy != null){
            throw new InfusionsoftParameterValidationException("Must provide ascending/descending to declare order by field or custom field query");
        }

    }
View Full Code Here

TOP

Related Classes of com.dietsodasoftware.yail.xmlrpc.service.InfusionsoftParameterValidationException

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.