Package org.candlepin.common.exceptions

Examples of org.candlepin.common.exceptions.NotFoundException


        @QueryParam("to") String to,
        @QueryParam("days") String days) {
        Owner o = findOwner(ownerKey);

        if (o == null) {
            throw new NotFoundException(i18n.tr(
                "owner with key: {0} was not found.", ownerKey));
        }


        return statisticCurator.getStatisticsByOwner(o, qType, reference, vType,
View Full Code Here


        @Verify(Owner.class) @PathParam("owner_key") String ownerKey) {

        Owner o = findOwner(ownerKey);

        if (o == null) {
            throw new NotFoundException(i18n.tr(
                "owner with key: {0} was not found.", ownerKey));
        }

        Consumer ueberConsumer =
            consumerCurator.findByName(o, Consumer.UEBER_CERT_CONSUMER);
View Full Code Here

    public EntitlementCertificate getUeberCertificate(@Context Principal principal,
        @Verify(Owner.class) @PathParam("owner_key") String ownerKey) {

        Owner o = findOwner(ownerKey);
        if (o == null) {
            throw new NotFoundException(i18n.tr(
                "owner with key: {0} was not found.", ownerKey));
        }

        Consumer ueberConsumer =
            consumerCurator.findByName(o, Consumer.UEBER_CERT_CONSUMER);

        if (ueberConsumer == null) {
            throw new NotFoundException(i18n.tr(
                "ueber certificate for owner {0} was not found. Please generate one.",
                o.getKey()));
        }

        // ueber consumer has only one entitlement associated with it
View Full Code Here

    @Path("{owner_key}/upstream_consumers")
    public List<UpstreamConsumer> getUpstreamConsumers(@Context Principal principal,
        @Verify(Owner.class) @PathParam("owner_key") String ownerKey) {
        Owner o = findOwner(ownerKey);
        if (o == null) {
            throw new NotFoundException(i18n.tr(
                "owner with key: {0} was not found.", ownerKey));
        }

        // returning as a list for future proofing. today we support one, but
        // users of this api want to protect against having to change their code
View Full Code Here

        Query query = this.currentSession().createQuery(hql)
            .setParameter("jobid", jobId)
            .setInteger("canceled", JobState.CANCELED.ordinal());
        int updated = query.executeUpdate();
        if (updated == 0) {
            throw new NotFoundException("job not found");
        }
    }
View Full Code Here

     */
    public Rules getRules() {
        Rules dbRules = getDbRules();
        if (dbRules == null) {
            log.error("There is no rules file in the database, something is very wrong.");
            throw new NotFoundException(i18n.tr("No rules file found in the database"));
        }
        return dbRules;
    }
View Full Code Here

        log.info("call returned - status: [" + rsp.getStatus() + "] reason [" +
            rsp.getResponseStatus() + "]");

        if (rsp.getStatus() == Status.NOT_FOUND.getStatusCode()) {
            throw new NotFoundException("Can't find owner [" + key + "]");
        }

        Owner owner = rsp.getEntity();
        ownerCurator.replicate(owner);
View Full Code Here

    public Consumer verifyAndLookupConsumer(String consumerUuid) {
        Consumer consumer = this.findByUuid(consumerUuid);

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

                    if (argument == null && ((Verify) a).nullable()) {
                        continue;
                    }
                    else if (argument == null) {
                        log.info("null argument is not allowed");
                        throw new NotFoundException(i18n.tr(
                            "{0} with id {1} could not be found.",
                            Util.getClassName(verifyType), null));
                    }
                    if (argument instanceof String) {
                        String verifyParam = (String) argument;
                        log.debug("Verifying " + requiredAccess +
                            " access to " + verifyType + ": " + verifyParam);

                        Object entity = storeMap.get(verifyType).lookup(verifyParam);
                        // If the request is just for a single item, throw an exception
                        // if it is not found.
                        if (entity == null) {
                            // This is bad, we're verifying a parameter with an ID which
                            // doesn't seem to exist in the DB. Error will be thrown in
                            // invoke though.
                            String typeName = Util.getClassName(verifyType);
                            if (typeName.equals("Owner")) {
                                typeName = i18n.tr("Organization");
                            }
                            log.info("No such entity: " + typeName + " id: " +
                                verifyParam);

                            throw new NotFoundException(i18n.tr(
                                "{0} with id {1} could not be found.",
                                typeName, verifyParam));
                        }

                        entities.add(entity);
View Full Code Here

    @Path("/{content_id}")
    public Content updateContent(@PathParam("content_id") String contentId,
            Content changes) {
        Content lookedUp  = contentCurator.find(contentId);
        if (lookedUp == null) {
            throw new NotFoundException(
                i18n.tr("Content with id {0} could not be found.", contentId));
        }

        // FIXME: needs arches handled as well?
        changes.setId(contentId);
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.