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