001/*
002 * (C) Copyright 2010 Nuxeo SA (http://nuxeo.com/) and others.
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 *     http://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 * Contributors:
016 * Nuxeo - initial API and implementation
017 */
018
019package org.nuxeo.ecm.platform.rendition;
020
021import java.util.Calendar;
022import java.util.List;
023
024import org.nuxeo.ecm.core.api.Blob;
025import org.nuxeo.ecm.core.api.DocumentModel;
026import org.nuxeo.ecm.platform.rendition.service.RenditionDefinition;
027
028/**
029 * Interface hiding the actual rendition implementation and allowing for Lazy computation of the rendition blobs.
030 * <p>
031 * RenditionDefinition is partially wrapper in the {@link Rendition}
032 *
033 * @since 5.6
034 * @author <a href="mailto:tdelprat@nuxeo.com">Tiry</a>
035 */
036public interface Rendition {
037
038    /**
039     * Returns icon file name
040     */
041    String getIcon();
042
043    /**
044     * Returns the {@link RenditionDefinition} name
045     */
046    String getName();
047
048    /**
049     * Returns the {@link RenditionDefinition} CMIS name
050     *
051     * @since 7.3
052     */
053    String getCmisName();
054
055    /**
056     * Returns the {@link RenditionDefinition} label
057     */
058    String getLabel();
059
060    /**
061     * Returns the King of the {@link RenditionDefinition}
062     */
063    String getKind();
064
065    /**
066     * Returns the type of the provider that was used to generate the rendition
067     */
068    String getProviderType();
069
070    /**
071     * Indicates if the Rendition is stored or live
072     */
073    boolean isStored();
074
075    /**
076     * Returns rendered Blob
077     */
078    Blob getBlob();
079
080    /**
081     * Returns rendered Blobs
082     */
083    List<Blob> getBlobs();
084
085    /**
086     * Return the Document hosting the rendition.
087     * <p>
088     * In case of a Live rendition it will be the target document and in case of stored Rendition it will be the
089     * Rendition document it self
090     */
091    DocumentModel getHostDocument();
092
093    /**
094     * Returns last modification date.
095     * <p>
096     * Returns current time for live renditions.
097     */
098    Calendar getModificationDate();
099
100    /**
101     * Checks if this rendition's computation has completed.
102     *
103     * @since 7.10
104     */
105    boolean isCompleted();
106
107}