Package org.candlepin.model

Examples of org.candlepin.model.Cdn


        productsById.put(subProvided1.getProductId(), TestUtil.createProduct(
            subProvided1.getProductId(), subProvided1.getProductName()));

        Meta meta = new Meta();
        meta.setCdnLabel("test-cdn");
        Cdn testCdn = new Cdn("test-cdn",
            "Test CDN", "https://test.url.com");
        when(cdnCurator.lookupByLabel("test-cdn")).thenReturn(testCdn);

        Subscription sub = importer.importObject(om, reader, owner,
            productsById, consumerDto, meta);
View Full Code Here


     */
    @DELETE
    @Path("/{label}")
    public void delete(@PathParam("label") String label,
        @Context Principal principal) {
        Cdn cdn = curator.lookupByLabel(label);
        if (cdn != null) {
            curator.delete(cdn);
        }
    }
View Full Code Here

    @POST
    @Consumes(MediaType.APPLICATION_JSON)
    @Produces(MediaType.APPLICATION_JSON)
    public Cdn create(Cdn cdn,
        @Context Principal principal) {
        Cdn existing = curator.lookupByLabel(cdn.getLabel());
        if (existing != null) {
            throw new BadRequestException(
                i18n.tr("A CDN with the label {0}" +
                        "already exists", cdn.getLabel()));
        }
View Full Code Here

    @Produces(MediaType.APPLICATION_JSON)
    @Path("/{label}")
    public Cdn update(@PathParam("label") String label,
        Cdn cdn,
        @Context Principal principal) {
        Cdn existing = verifyAndLookupCdn(label);
        if (!StringUtils.isBlank(cdn.getName())) {
            existing.setName(cdn.getName());
        }
        if (!StringUtils.isBlank(cdn.getUrl())) {
            existing.setUrl(cdn.getUrl());
        }
        if (cdn.getCertificate() != null) {
            existing.setCertificate(cdn.getCertificate());
        }
        curator.merge(existing);
        return existing;
    }
View Full Code Here

        curator.merge(existing);
        return existing;
    }

    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));
        }
View Full Code Here

        }

        subscription.setProduct(findProduct(productsById, entitlement.getProductId()));
        String cdnLabel = meta.getCdnLabel();
        if (!StringUtils.isBlank(cdnLabel)) {
            Cdn cdn = cdnCurator.lookupByLabel(cdnLabel);
            if (cdn != null) {
                subscription.setCdn(cdn);
            }
        }
View Full Code Here

        this.curator = curator;
    }

    public Cdn createObject(ObjectMapper mapper, Reader reader)
        throws IOException {
        Cdn cdn = mapper.readValue(reader,
            Cdn.class);
        cdn.setId(null);
        return cdn;
    }
View Full Code Here

     * @param cdnSet Set of CDN's.
     */
    public void store(Set<Cdn> cdnSet) {
        log.debug("Creating/updating cdns");
        for (Cdn cdn : cdnSet) {
            Cdn existing = curator.lookupByLabel(cdn.getLabel());
            if (existing == null) {
                curator.create(cdn);
                log.debug("Created CDN: " + cdn.getName());
            }
            else {
                existing.setName(cdn.getName());
                existing.setUrl(cdn.getUrl());
                curator.merge(existing);
                log.debug("Updating CDN: " + cdn.getName());
            }
        }
    }
View Full Code Here

TOP

Related Classes of org.candlepin.model.Cdn

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.