Package org.candlepin.common.exceptions

Examples of org.candlepin.common.exceptions.NotFoundException


            updated.getEnvironment() == null ? null : updated.getEnvironment().getId();
        if (environmentId != null && (toUpdate.getEnvironment() == null ||
                    !toUpdate.getEnvironment().getId().equals(environmentId))) {
            Environment e = environmentCurator.find(environmentId);
            if (e == null) {
                throw new NotFoundException(i18n.tr(
                    "Environment with ID ''{0}'' could not be found.", environmentId));
            }
            toUpdate.setEnvironment(e);

            // lazily regenerate certs, so the client can still work
View Full Code Here


    private Entitlement verifyAndLookupEntitlement(String entitlementId) {
        Entitlement entitlement = entitlementCurator.find(entitlementId);

        if (entitlement == null) {
            throw new NotFoundException(i18n.tr(
                "Entitlement with ID ''{0}'' could not be found.", entitlementId));
        }
        return entitlement;
    }
View Full Code Here

        // FIXME: just a stub, needs CertifcateService (and/or a
        // CertificateCurator) to lookup by serialNumber
        Consumer consumer = consumerCurator.verifyAndLookupConsumer(consumerUuid);

        if (consumer == null) {
            throw new NotFoundException(i18n.tr(
                "Unit with ID ''{0}'' could not be found.", consumerUuid));
        }

        int total = poolManager.revokeAllEntitlements(consumer);
        log.debug("Revoked " + total + " entitlements from " + consumerUuid);
View Full Code Here

        if (toDelete != null) {
            poolManager.revokeEntitlement(toDelete);
            return;
        }

        throw new NotFoundException(i18n.tr(
            "Entitlement with ID ''{0}'' could not be found.", dbid));
    }
View Full Code Here

        if (toDelete != null) {
            poolManager.revokeEntitlement(toDelete);
            return;
        }
        throw new NotFoundException(i18n.tr(
            "Entitlement Certificate with serial number ''{0}'' could not be found.",
            serial.toString())); // prevent serial number formatting.
    }
View Full Code Here

    @Produces(MediaType.APPLICATION_JSON)
    @Transactional
    public void removeDeletionRecord(@PathParam("consumer_uuid") String uuid) {
        DeletedConsumer dc = deletedConsumerCurator.findByConsumerUuid(uuid);
        if (dc == null) {
            throw new NotFoundException(i18n.tr(
                "Deletion record for hypervisor ''{0}'' not found.", uuid));
        }
        deletedConsumerCurator.delete(dc);
    }
View Full Code Here

        if (toReturn != null) {
            return toReturn;
        }

        throw new NotFoundException(
            i18n.tr("Product with UUID ''{0}'' could not be found.", pid));
    }
View Full Code Here

        @PathParam("product_uuid") String productId) {

        Product product = prodAdapter.getProductById(productId);

        if (product == null) {
            throw new NotFoundException(
                i18n.tr("Product with UUID ''{0}'' could not be found.", productId));
        }

        return prodAdapter.getProductCertificate(product);
    }
View Full Code Here

    @Produces(MediaType.APPLICATION_JSON)
    @Path("/{product_uuid}")
    public void deleteProduct(@PathParam("product_uuid") String pid) {
        Product product = prodAdapter.getProductById(pid);
        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 " +
View Full Code Here

        @PathParam("product_uuid") String pid,
        @QueryParam("lazy_regen") @DefaultValue("true") Boolean lazyRegen) {

        Product product = prodAdapter.getProductById(pid);
        if (product == null) {
            throw new NotFoundException(
                i18n.tr("Product with UUID ''{0}'' could not be found.", pid));
        }

        return RefreshPoolsForProductJob.forProduct(product, lazyRegen);
    }
View Full Code Here

TOP

Related Classes of org.candlepin.common.exceptions.NotFoundException

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.