Package org.candlepin.common.exceptions

Examples of org.candlepin.common.exceptions.NotFoundException


    @Produces(MediaType.APPLICATION_JSON)
    public Environment getEnv(
        @PathParam("env_id") @Verify(Environment.class) String envId) {
        Environment e = envCurator.find(envId);
        if (e == null) {
            throw new NotFoundException(i18n.tr("No such environment: {0}", envId));
        }
        return e;
    }
View Full Code Here


    @DELETE
    @Path("/{env_id}")
    public void deleteEnv(@PathParam("env_id") @Verify(Environment.class) String envId) {
        Environment e = envCurator.find(envId);
        if (e == null) {
            throw new NotFoundException(i18n.tr("No such environment: {0}", envId));
        }

        // Cleanup all consumers and their entitlements:
        for (Consumer c : e.getConsumers()) {
            poolManager.revokeAllEntitlements(c);
View Full Code Here

    }

    private Environment lookupEnvironment(String envId) {
        Environment e = envCurator.find(envId);
        if (e == null) {
            throw new NotFoundException(i18n.tr(
                "No such environment: {0}", envId));
        }
        return e;
    }
View Full Code Here

    private DistributorVersion verifyAndLookupDistributorVersion(String id) {
        DistributorVersion dv = curator.findById(id);

        if (dv == null) {
            throw new NotFoundException(i18n.tr("No such distributor version: {0}",
                id));
        }
        return dv;
    }
View Full Code Here

        @Verify(User.class) String username,
        User user) {

        // Note, to change the username, the old username needs to be provided.
        if (userService.findByLogin(username) == null) {
            throw new NotFoundException(i18n.tr("User {0} does not exist", username));
        }
        return userService.updateUser(user);
    }
View Full Code Here

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

        throw new NotFoundException(
            i18n.tr("Unit type with id '" + id + "' could not be found."));
    }
View Full Code Here

     */
    public static Owner lookupOwner(Owner owner, OwnerCurator ownerCurator) {
        Owner o = ownerCurator.lookupByKey(owner.getKey());
        if (o == null) {
            if (owner.getKey() == null) {
                throw new NotFoundException(
                    "An owner does not exist for a null org id");
            }

            o = owner;
        }
View Full Code Here

    @Test(expected = NotFoundException.class)
    public void testBindByPoolBadConsumerUuid() throws Exception {
        ConsumerCurator consumerCurator = mock(ConsumerCurator.class);
        when(consumerCurator.verifyAndLookupConsumer(any(String.class)))
            .thenThrow(new NotFoundException(""));
        ConsumerResource consumerResource = new ConsumerResource(consumerCurator, null,
            null, null, null, null, null, i18n, null, null, null,
            null, null, null, null, null, null, null, null, null, null, null,
            null, new CandlepinCommonTestConfig(), null, null, null, consumerBindUtil);
View Full Code Here

     */
    @Test(expected = NotFoundException.class)
    public void testRegenerateEntitlementCertificatesWithInvalidConsumerId() {
        ConsumerCurator consumerCurator = mock(ConsumerCurator.class);
        when(consumerCurator.verifyAndLookupConsumer(any(String.class)))
            .thenThrow(new NotFoundException(""));
        ConsumerResource consumerResource = new ConsumerResource(consumerCurator, null,
            null, null, null, null, null, i18n, null, null, null,
            null, null, null, null, null, null, null, null, null, null, null,
            null, new CandlepinCommonTestConfig(), null, null, null, consumerBindUtil);

View Full Code Here

    private Cdn verifyAndLookupCdn(String label) {
        Cdn cdn = curator.lookupByLabel(label);

        if (cdn == null) {
            throw new NotFoundException(i18n.tr("No such content delivery network: {0}",
                label));
        }
        return cdn;
    }
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.