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