/*
 * (C) Copyright 2013 Nuxeo SA (http://nuxeo.com/) and contributors.
 *
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the GNU Lesser General Public License
 * (LGPL) version 2.1 which accompanies this distribution, and is available at
 * http://www.gnu.org/licenses/lgpl.html
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Lesser General Public License for more details.
 *
 * Contributors:
 *     Florent Guillaume
 */
package org.nuxeo.ecm.platform.picture.api.adapters;

import java.io.IOException;
import java.util.ArrayList;
import java.util.Map;

import org.nuxeo.ecm.core.api.Blob;
import org.nuxeo.ecm.core.api.ClientException;
import org.nuxeo.ecm.core.api.model.PropertyException;

/**
 * Picture adapter that creates no picture views at all.
 */
public class NoPictureAdapter extends AbstractPictureAdapter {

    public static final String ORIGINAL_VIEW_NAME = "Original";

    @Override
    public boolean createPicture(Blob blob, String filename, String title,
            ArrayList<Map<String, Object>> pictureTemplates)
            throws IOException, ClientException {
        // create no views
        return true;
    }

    @Override
    public void doRotate(int angle) {
    }

    @Override
    public void doCrop(String coords) {
    }

    @Override
    public Blob getPictureFromTitle(String title) throws PropertyException,
            ClientException {
        if (ORIGINAL_VIEW_NAME.equals(title)) {
            return (Blob) doc.getPropertyValue("file:content");
        }
        return null;
    }

    @Override
    public String getFirstViewXPath() {
        return "file:"; // "content" added by caller
    }

    @Override
    public String getViewXPath(String viewName) {
        if (ORIGINAL_VIEW_NAME.equals(viewName)) {
            return getFirstViewXPath();
        }
        return null;
    }

}

@@ -749,16 +749,39 @@
 ayList;%0A
+import java.util.List;%0A
 import j
@@ -932,16 +932,69 @@
 ception;
+%0Aimport org.nuxeo.ecm.platform.picture.api.ImageInfo;
 %0A%0A/**%0A *
@@ -2133,10 +2133,340 @@
 %0A    %7D%0A%0A
+    @Override%0A    public boolean fillPictureViews(Blob blob, String filename, String title,%0A            ArrayList%3CMap%3CString, Object%3E%3E pictureTemplates) %7B%0A        return true;%0A    %7D%0A%0A    @Override%0A    public void preFillPictureViews(Blob blob,%0A            List%3CMap%3CString, Object%3E%3E pictureTemplates, ImageInfo imageInfo) %7B%0A    %7D%0A%0A
 %7D%0A

fix forward-port due to NXP-10022 changes