Examples of Rendition


Examples of com.day.cq.dam.api.Rendition

     * Test of getRendition method, of class RenditionPatternPicker.
     */
    @Test
    public void testGetRendition_MatchingRegex() {
        RenditionPatternPicker instance = new RenditionPatternPicker("^cust.*");
        Rendition expResult = customRendition;
        Rendition result = instance.getRendition(asset);
        assertEquals(expResult, result);
    }
View Full Code Here

Examples of com.day.cq.dam.api.Rendition

        assertEquals(expResult, result);
    }

    public void testGetRendition_MultiMatchingRegex() {
        RenditionPatternPicker instance = new RenditionPatternPicker("^cq5dam.*");
        Rendition expResult = largeRendition;
        Rendition result = instance.getRendition(asset);
        assertEquals(expResult, result);
    }
View Full Code Here

Examples of com.day.cq.dam.api.Rendition

        assertEquals(expResult, result);
    }

    public void testGetRendition_NonMatchingRegex() {
        RenditionPatternPicker instance = new RenditionPatternPicker("nothinghere");
        Rendition expResult = originalRendition;
        Rendition result = instance.getRendition(asset);
        assertEquals(expResult, result);
    }
View Full Code Here

Examples of com.day.cq.dam.api.Rendition

        when(data.getPayloadType()).thenReturn(AbstractAssetWorkflowProcess.TYPE_JCR_PATH);
        when(data.getPayload()).thenReturn(path);

        Resource resource = mock(Resource.class);
        Asset asset = mock(Asset.class);
        Rendition rendition = mock(Rendition.class);
        when(resource.adaptTo(Asset.class)).thenReturn(asset);
        when(resource.getResourceType()).thenReturn(DamConstants.NT_DAM_ASSET);
        when(resourceResolver.getResource(path)).thenReturn(resource);
        when(asset.getRendition(isA(RenditionPicker.class))).thenReturn(rendition);

        when(rendition.getStream()).then(new Answer<InputStream>() {

            @Override
            public InputStream answer(InvocationOnMock invocation) throws Throwable {
                return getClass().getResourceAsStream("/img/test.png");
            }
View Full Code Here

Examples of com.day.cq.dam.api.Rendition

            log.warn("Rendition name was not configured in arguments. Skipping.");
            return;
        }

        final Asset asset = getAssetFromPayload(workItem, workflowSession.getSession());
        final Rendition rendition = asset.getRendition(new PrefixRenditionPicker(renditionName));

        if (rendition == null) {
            log.warn("Rendition name {} was not available for asset {}. Skipping.", renditionName, asset);
            return;
        }

        Layer layer = null;
        try {
            layer = new Layer(rendition.getStream());

            layer = processLayer(layer, rendition, workflowSession, args);

            String mimetype = layer.getMimeType();
            double quality = mimetype.equals("image/gif") ? getQuality(MAX_GIF_QUALITY, qualityStr) : getQuality(1.0,
                    qualityStr);

            saveImage(asset, rendition, layer, mimetype, quality);
        } catch (IIOException e) {
            log.warn("Unable to load image layer from " + rendition.getPath(), e);
        } catch (IOException e) {
            log.warn("Unable to load image layer from " + rendition.getPath(), e);
        } finally {
            if (layer != null) {
                layer.dispose();
                layer = null;
            }
View Full Code Here

Examples of com.day.cq.dam.api.Rendition

     *
     * @param asset
     * @return
     */
    private static long getSize(final Asset asset) {
        final Rendition original = asset.getOriginal();
        if (original == null) {
            return 0;
        }
        return original.getSize();
    }
View Full Code Here

Examples of com.day.cq.dam.api.Rendition

        if (DamUtil.isAsset(resource)) {
            // For assets, pick the configured rendition if it exists
            // If rendition does not exist, use original

            final Asset asset = DamUtil.resolveToAsset(resource);
            Rendition rendition = asset.getRendition(renditionPatternPicker);

            if (rendition == null) {
                log.warn("Could not find rendition [ {} ] for [ {} ]", renditionPatternPicker.toString(),
                        resource.getPath());
                rendition = asset.getOriginal();
            }

            final Resource renditionResource = request.getResourceResolver().getResource(rendition.getPath());

            final Image image = new Image(resource);
            image.set(Image.PN_REFERENCE, renditionResource.getPath());
            return image;
View Full Code Here

Examples of org.apache.chemistry.opencmis.client.api.Rendition

        return getObject().getRenditions().size();
    }

    @Override
    public Object getDetailValueAt(int rowIndex, int columnIndex) {
        Rendition rendition = getObject().getRenditions().get(rowIndex);

        switch (columnIndex) {
        case 0:
            return rendition.getTitle();
        case 1:
            return rendition.getKind();
        case 2:
            return rendition.getMimeType();
        case 3:
            return rendition.getLength();
        case 4:
            return rendition.getStreamId();
        }

        return null;
    }
View Full Code Here

Examples of org.apache.chemistry.opencmis.client.api.Rendition

        return getObject().getRenditions().size();
    }

    @Override
    public Object getDetailValueAt(int rowIndex, int columnIndex) {
        Rendition rendition = getObject().getRenditions().get(rowIndex);

        switch (columnIndex) {
        case 0:
            return rendition.getTitle();
        case 1:
            return rendition.getKind();
        case 2:
            return rendition.getMimeType();
        case 3:
            return rendition.getLength();
        case 4:
            return rendition.getStreamId();
        }

        return null;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.