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