Package com.dottydingo.hyperion.exception

Examples of com.dottydingo.hyperion.exception.BadRequestException


            if(version == null || version.length() == 0)
                version = request.getFirstHeader(hyperionEndpointConfiguration.getVersionHeaderName());

            if(hyperionEndpointConfiguration.isRequireVersion() && httpMethod != HttpMethod.DELETE &&
                    (version == null || version.length()==0))
                throw new BadRequestException(String.format("The %s parameter must be specified",hyperionEndpointConfiguration.getVersionParameterName()));
        }


        if(version != null)
        {
            try
            {
                phaseContext.setVersion(Integer.parseInt(version));
            }
            catch(NumberFormatException e)
            {
                throw new BadRequestException(String.format("%s is not a valid value for version.",version));
            }
        }

        if(!validateMethod(httpMethod,uriRequestResult))
            throw new HyperionException(405,"Not allowed.");
View Full Code Here


        {
            return Integer.parseInt(value);
        }
        catch (NumberFormatException e)
        {
            throw new BadRequestException(String.format("%s must be an integer.",name));
        }
    }
View Full Code Here

        ApiObject clientObject = marshaller.unmarshall(request.getInputStream(), apiVersionPlugin.getApiClass());

        List ids = plugin.getKeyConverter().covertKeys(phaseContext.getId());
        if(ids.size() != 1)
            throw new BadRequestException("A single id must be provided for an update.");

        Set<String> fieldSet = persistenceContext.getRequestedFields();
        if(fieldSet != null)
            fieldSet.add("id");
View Full Code Here

        EndpointResponse response = phaseContext.getEndpointResponse();

        EntityPlugin plugin = phaseContext.getEntityPlugin();
        List<Serializable> ids = plugin.getKeyConverter().covertKeys(phaseContext.getId());
        if(ids.size() != 1)
            throw new BadRequestException("A single ID must be provided.");

        Integer start = getIntegerParameter("start",request);
        Integer limit = getIntegerParameter("limit",request);

        if(start != null && start < 1)
            throw new BadRequestException("The start parameter must be greater than zero.");

        if(limit != null && limit < 1)
            throw new BadRequestException("The limit parameter must be greater than zero.");

        PersistenceContext persistenceContext = buildPersistenceContext(phaseContext);

        PersistenceOperations operations = persistenceContext.getEntityPlugin().getPersistenceOperations();
        QueryResult<HistoryEntry> entries = operations.getHistory(ids.get(0),start,limit,persistenceContext);
View Full Code Here

        String query = request.getFirstParameter("query");
        String sort = request.getFirstParameter("sort");

        if(start != null && start < 1)
            throw new BadRequestException("The start parameter must be greater than zero.");

        if(limit != null && limit < 1)
            throw new BadRequestException("The limit parameter must be greater than zero.");

        if(limit == null)
            limit = configuration.getDefaultLimit();

        if(limit > configuration.getMaxLimit())
            throw new BadRequestException(String.format("The limit parameter can not be greater than %d.",configuration.getMaxLimit()));

        PersistenceContext persistenceContext = buildPersistenceContext(phaseContext);
        QueryResult queryResult = phaseContext.getEntityPlugin().getPersistenceOperations().query(query, start, limit, sort, persistenceContext);

        EntityResponse entityResponse = new EntityResponse();
View Full Code Here

TOP

Related Classes of com.dottydingo.hyperion.exception.BadRequestException

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.