001/* 002 * (C) Copyright 2012 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 * Antoine Taillefer <ataillefer@nuxeo.com> 018 */ 019package org.nuxeo.drive.service; 020 021import org.nuxeo.drive.adapter.impl.DocumentBackedFileItem; 022import org.nuxeo.drive.service.impl.DefaultFileSystemItemFactory; 023import org.nuxeo.ecm.core.api.CoreSession; 024import org.nuxeo.ecm.core.api.DocumentModel; 025import org.nuxeo.ecm.core.api.VersioningOption; 026 027/** 028 * A {@link FileSystemItemFactory} able to handle versioning. 029 * 030 * @author Antoine Taillefer 031 * @see DefaultFileSystemItemFactory 032 */ 033public interface VersioningFileSystemItemFactory extends FileSystemItemFactory { 034 035 /** 036 * Returns true if the given {@link DocumentModel} needs to be versioned. An example of policy could be to version 037 * the document if the last modification was done more than {@link #getVersioningDelay()} seconds ago. 038 * 039 * @see DocumentBackedFileItem#versionIfNeeded(DocumentModel doc, CoreSession session) 040 */ 041 boolean needsVersioning(DocumentModel doc); 042 043 /** 044 * Gets the delay passed which a document needs to be versioned since its last modification. 045 * 046 * @see DefaultFileSystemItemFactory#needsVersioning(DocumentModel) 047 */ 048 double getVersioningDelay(); 049 050 /** 051 * Sets the delay passed which a document needs to be versioned since its last modification. 052 */ 053 void setVersioningDelay(double versioningDelay); 054 055 /** 056 * Gets the increment option used when versioning a document. 057 * 058 * @see DocumentBackedFileItem#versionIfNeeded(DocumentModel doc, CoreSession session) 059 */ 060 VersioningOption getVersioningOption(); 061 062 /** 063 * Sets the increment option used when versioning a document. 064 */ 065 void setVersioningOption(VersioningOption versioningOption); 066 067}