Package org.candlepin.common.exceptions

Examples of org.candlepin.common.exceptions.BadRequestException


        ActivationKey key1 = new ActivationKey("key1", owner);
        keys.add(key1);
        key1.setServiceLevel("I don't exist");

        Consumer consumer = new Consumer("sys.example.com", null, null, system);
        doThrow(new BadRequestException("exception")).when(serviceLevelValidator)
            .validate(eq(owner), eq(key1.getServiceLevel()));
        consumerBindUtil.handleActivationKeys(consumer, keys);
    }
View Full Code Here


        ActivationKey key1 = new ActivationKey("key1", owner);
        keys.add(key1);
        key1.setServiceLevel("I don't exist");

        Consumer consumer = new Consumer("sys.example.com", null, null, system);
        doThrow(new BadRequestException("exception")).when(serviceLevelValidator)
            .validate(eq(owner), eq(key1.getServiceLevel()));
        consumerBindUtil.handleActivationKeys(consumer, keys);
    }
View Full Code Here

    }

    @Override
    public Product createProduct(Product product) {
        if (prodCurator.find(product.getId()) != null) {
            throw new BadRequestException("product with ID " + product.getId() +
                " already exists");
        }
        else {
            if (product.getId() == null || product.getId().trim().equals("")) {
                product.setId(idGenerator.generateId());
View Full Code Here

    @Produces(MediaType.APPLICATION_JSON)
    public DistributorVersion create(DistributorVersion dv,
        @Context Principal principal) {
        DistributorVersion existing = curator.findByName(dv.getName());
        if (existing != null) {
            throw new BadRequestException(
                i18n.tr("A distributor version with name {0} " +
                        "already exists", dv.getName()));
        }
        return curator.create(dv);
    }
View Full Code Here

            ConsumerType toReturn = consumerTypeCurator.create(in);
            return toReturn;
        }
        catch (Exception e) {
            log.error("Problem creating unit type:", e);
            throw new BadRequestException(
                i18n.tr("Problem creating unit type: {0}", in));
        }
    }
View Full Code Here

    @Produces(MediaType.APPLICATION_JSON)
    public ConsumerType update(ConsumerType in) throws BadRequestException {
        ConsumerType type = consumerTypeCurator.find(in.getId());

        if (type == null) {
            throw new BadRequestException(
                i18n.tr("Unit type with label {0} could not be found.", in.getId()));
        }

        consumerTypeCurator.merge(in);
        return in;
View Full Code Here

    @Produces(MediaType.APPLICATION_JSON)
    public void deleteConsumerType(@PathParam("id") String id) {
        ConsumerType type = consumerTypeCurator.find(id);

        if (type == null) {
            throw new BadRequestException(
                i18n.tr("Unit type with id {0} could not be found.", id));
        }

        consumerTypeCurator.delete(type);
    }
View Full Code Here

        if (product == null) {
            throw new NotFoundException(
                i18n.tr("Product with UUID ''{0}'' could not be found.", pid));
        }
        if (prodAdapter.productHasSubscriptions(product)) {
            throw new BadRequestException(
                i18n.tr("Product with UUID ''{0}'' cannot be deleted " +
                    "while subscriptions exist.", pid));
        }

        prodAdapter.deleteProduct(product);
View Full Code Here

                keySuccess &= handleActivationKeyPools(consumer, key);
            }
            listSuccess |= keySuccess;
        }
        if (!listSuccess) {
            throw new BadRequestException(i18n.tr("No activation key was applied successfully."));
        }
    }
View Full Code Here

    public static Date getFromDate(String from, String to, String days) {
        if (days != null && !days.trim().equals("") &&
            (to != null && !to.trim().equals("") ||
                from != null && !from.trim().equals(""))) {
            throw new BadRequestException("You can use either the to/from " +
                                           "date parameters or the number of " +
                                           "days parameter, but not both");
        }

        Date daysDate = null;
View Full Code Here

TOP

Related Classes of org.candlepin.common.exceptions.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.