001/* 002 * (C) Copyright 2010 Nuxeo SAS (http://nuxeo.com/) and contributors. 003 * 004 * All rights reserved. This program and the accompanying materials 005 * are made available under the terms of the GNU Lesser General Public License 006 * (LGPL) version 2.1 which accompanies this distribution, and is available at 007 * http://www.gnu.org/licenses/lgpl.html 008 * 009 * This library is distributed in the hope that it will be useful, 010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 012 * Lesser General Public License for more details. 013 * Contributors: 014 * Nuxeo - initial API and implementation 015 */ 016 017package org.nuxeo.ecm.platform.rendition.service; 018 019import java.util.List; 020 021import org.nuxeo.ecm.core.api.DocumentModel; 022import org.nuxeo.ecm.core.api.DocumentRef; 023import org.nuxeo.ecm.platform.rendition.Rendition; 024 025/** 026 * Service handling Rendition Definitions and actual render based on a Rendition Definition 027 * 028 * @author <a href="mailto:troger@nuxeo.com">Thomas Roger</a> 029 * @author <a href="mailto:tdelprat@nuxeo.com">Tiry</a> 030 * @since 5.4.1 031 */ 032public interface RenditionService { 033 034 /** 035 * Returns a {@code List} of registered {@code RenditionDefinition}. The order of the List does not depend on the 036 * registering order. 037 * @deprecated since 7.2. Not used. 038 */ 039 @Deprecated 040 List<RenditionDefinition> getDeclaredRenditionDefinitions(); 041 042 /** 043 * Returns a {@code List} of registered {@code RenditionDefinition} matching a given provider type 044 * @deprecated since 7.2. Not used 045 */ 046 @Deprecated 047 List<RenditionDefinition> getDeclaredRenditionDefinitionsForProviderType(String providerType); 048 049 /** 050 * Returns a {@code List} of {@code RenditionDefinition} available on the given Document. The order of the List does 051 * not depend on the registering order. 052 */ 053 List<RenditionDefinition> getAvailableRenditionDefinitions(DocumentModel doc); 054 055 /** 056 * Render a document based on the given rendition definition name and returns the stored Rendition 057 * {@link DocumentRef}. 058 * <p> 059 * Only the user launching the render operation has the Read right on the returned document. 060 * 061 * @param sourceDocument the document to render 062 * @param renditionDefinitionName the rendition definition to use 063 * @return the {@code DocumentRef} of the newly created Rendition document. 064 */ 065 DocumentRef storeRendition(DocumentModel sourceDocument, String renditionDefinitionName); 066 067 /** 068 * Return the {@link Rendition} object for the given {@link DocumentModel} and a rendition definition name. 069 * <p> 070 * A stored rendition is returned if found and up to date, a new Rendition is created otherwise. 071 * 072 * @param doc the document to render 073 * @param renditionName the name of the rendition definition 074 * @return the {@link Rendition} object 075 */ 076 Rendition getRendition(DocumentModel doc, String renditionName); 077 078 /** 079 * Return the {@link Rendition} object for the given {@link DocumentModel} and a rendition definition name. 080 * <p> 081 * A stored rendition is returned if found and up to date, a new (live) Rendition is created otherwise. 082 * <p> 083 * If store parameter is true, the new created rendition is stored too and returned 084 * 085 * @param doc the document to render 086 * @param renditionName the name of the rendition definition 087 * @param store indicates if the rendition must be stored 088 * @return the {@link Rendition} object 089 */ 090 Rendition getRendition(DocumentModel doc, String renditionName, boolean store); 091 092 /** 093 * Returns a {@code List} of {@code Rendition} available on the given Document. 094 * <p> 095 * The order of the List does not depend on the registering order. 096 * <p> 097 * The returned rendition may be live or stored 098 */ 099 List<Rendition> getAvailableRenditions(DocumentModel doc); 100 101 /** 102 * Returns a {@code List} of {@code Rendition} available on the given Document. 103 * <p> 104 * If {@code onlyVisible} is true, returns only the rendition marked as visible. 105 * <p> 106 * The order of the List does not depend on the registering order. 107 * <p> 108 * The returned rendition may be live or stored 109 * 110 * @since 7.2 111 */ 112 List<Rendition> getAvailableRenditions(DocumentModel doc, boolean onlyVisible); 113 114}