001/*
002 * (C) Copyright 2006-2007 Nuxeo SAS (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 *     Nuxeo - initial API and implementation
016 *
017 * $Id: JOOoConvertPluginImpl.java 18651 2007-05-13 20:28:53Z sfermigier $
018 */
019
020package org.nuxeo.ecm.webapp.versioning;
021
022import java.util.Collection;
023import java.util.Map;
024
025import javax.faces.component.UIComponent;
026import javax.faces.context.FacesContext;
027
028import org.nuxeo.ecm.core.api.DocumentModel;
029import org.nuxeo.ecm.core.api.VersionModel;
030import org.nuxeo.ecm.platform.versioning.api.VersioningActions;
031
032/**
033 * Web action listener interface for versioning.
034 *
035 * @author Dragos Mihalache
036 */
037public interface DocumentVersioning {
038
039    /**
040     * Returns the available versioning options for the document parameter and state.
041     *
042     * @param document the document for which the versioning options will be returned
043     * @return a collection of option names.
044     */
045    Collection<VersionModel> getItemVersioningHistory(DocumentModel document);
046
047    /**
048     * Returns the available versioning history for the current document and state.
049     *
050     * @return a collection of option names.
051     */
052    Collection<VersionModel> getCurrentItemVersioningHistory();
053
054    /**
055     * Creates a Map with versioning options (as keys) and labels (as map entry values).
056     */
057    Map<String, String> getVersioningOptionsMap(final DocumentModel documentModel);
058
059    /**
060     * @deprecated since 5.7.3: available versioning options are resolved by the widget now
061     */
062    @Deprecated
063    Map<String, String> getAvailableVersioningOptionsMap();
064
065    String getVersionLabel(DocumentModel document);
066
067    /**
068     * @deprecated since 5.7.3: selected option is not kept on this bean anymore, it's kept by the JSF component behind
069     *             widget definition
070     */
071    @Deprecated
072    String getVersioningOptionInstanceId();
073
074    /**
075     * @deprecated since 5.7.3: rendered clause for available versioning options are resolved by the widget now
076     */
077    @Deprecated
078    boolean factoryForRenderVersioningOption();
079
080    /**
081     * Web action method to set version increment option to the current documentModel.
082     *
083     * @deprecated since 5.7.3: document context map is now filled directly by the widget
084     */
085    @Deprecated
086    void setVersioningOptionInstanceId(String optionId);
087
088    /**
089     * @deprecated since 5.7.3: document context map is now filled directly by the widget
090     */
091    @Deprecated
092    void setVersioningOptionInstanceId(DocumentModel document, String optionId);
093
094    /**
095     * @deprecated since 5.7.3: document context map is now filled directly by the widget
096     */
097    @Deprecated
098    void setVersioningOptionInstanceId(DocumentModel document, VersioningActions option);
099
100    /**
101     * Versioning increment options - select radio component validator method. Check if an option has been selected.
102     * This is mandatory since the component is being displayed.
103     */
104    void validateOptionSelection(FacesContext context, UIComponent component, Object value);
105
106}