001/* 002 * (C) Copyright 2013 Nuxeo SA (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 * 014 * Contributors: 015 * Florent Guillaume 016 */ 017package org.nuxeo.ecm.platform.picture.api.adapters; 018 019import java.io.IOException; 020import java.util.ArrayList; 021import java.util.List; 022import java.util.Map; 023 024import org.nuxeo.ecm.core.api.Blob; 025import org.nuxeo.ecm.core.api.PropertyException; 026import org.nuxeo.ecm.platform.picture.api.ImageInfo; 027 028/** 029 * Picture adapter that creates no picture views at all. 030 */ 031public class NoPictureAdapter extends AbstractPictureAdapter { 032 033 public static final String ORIGINAL_VIEW_NAME = "Original"; 034 035 @Override 036 public boolean createPicture(Blob blob, String filename, String title, 037 ArrayList<Map<String, Object>> pictureConversions) throws IOException { 038 // create no views 039 return true; 040 } 041 042 @Override 043 public void doRotate(int angle) { 044 } 045 046 @Override 047 public void doCrop(String coords) { 048 } 049 050 @Override 051 public Blob getPictureFromTitle(String title) throws PropertyException { 052 if (ORIGINAL_VIEW_NAME.equals(title)) { 053 return (Blob) doc.getPropertyValue("file:content"); 054 } 055 return null; 056 } 057 058 @Override 059 public String getFirstViewXPath() { 060 return "file:"; // "content" added by caller 061 } 062 063 @Override 064 public String getViewXPath(String viewName) { 065 if (ORIGINAL_VIEW_NAME.equals(viewName)) { 066 return getFirstViewXPath(); 067 } 068 return null; 069 } 070 071 @Override 072 public boolean fillPictureViews(Blob blob, String filename, String title, 073 ArrayList<Map<String, Object>> pictureConversions) { 074 return true; 075 } 076 077 @Override 078 public void preFillPictureViews(Blob blob, List<Map<String, Object>> pictureConversions, ImageInfo imageInfo) { 079 } 080 081}