001    /**
002     * Copyright (c) 2000-2013 Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.portlet.documentlibrary.util;
016    
017    import com.liferay.portal.kernel.lar.PortletDataContext;
018    import com.liferay.portal.kernel.repository.model.FileEntry;
019    import com.liferay.portal.kernel.repository.model.FileVersion;
020    import com.liferay.portal.kernel.xml.Element;
021    
022    import java.io.InputStream;
023    
024    import java.util.Set;
025    
026    /**
027     * @author Sergio Gonz??lez
028     */
029    public interface ImageProcessor {
030    
031            public void cleanUp(FileEntry fileEntry);
032    
033            public void cleanUp(FileVersion fileVersion);
034    
035            public void exportGeneratedFiles(
036                            PortletDataContext portletDataContext, FileEntry fileEntry,
037                            Element fileEntryElement)
038                    throws Exception;
039    
040            public void generateImages(
041                            FileVersion sourceFileVersion, FileVersion destinationFileVersion)
042                    throws Exception;
043    
044            public Set<String> getImageMimeTypes();
045    
046            public InputStream getPreviewAsStream(FileVersion fileVersion)
047                    throws Exception;
048    
049            public long getPreviewFileSize(FileVersion fileVersion)
050                    throws Exception;
051    
052            public String getPreviewType(FileVersion fileVersion);
053    
054            public InputStream getThumbnailAsStream(FileVersion fileVersion, int index)
055                    throws Exception;
056    
057            public long getThumbnailFileSize(FileVersion fileVersion, int index)
058                    throws Exception;
059    
060            public String getThumbnailType(FileVersion fileVersion);
061    
062            public boolean hasImages(FileVersion fileVersion);
063    
064            public void importGeneratedFiles(
065                            PortletDataContext portletDataContext, FileEntry fileEntry,
066                            FileEntry importedFileEntry, Element fileEntryElement)
067                    throws Exception;
068    
069            public boolean isImageSupported(FileVersion fileVersion);
070    
071            public boolean isImageSupported(String mimeType);
072    
073            public boolean isSupported(String mimeType);
074    
075            public void storeThumbnail(
076                            long companyId, long groupId, long fileEntryId, long fileVersionId,
077                            long custom1ImageId, long custom2ImageId, InputStream is,
078                            String type)
079                    throws Exception;
080    
081            public void trigger(
082                    FileVersion sourceFileVersion, FileVersion destinationFileVersion);
083    
084    }