001/* 002 * Copyright 2010 Anyware Services 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 */ 016package org.ametys.plugins.repository.version; 017 018import org.ametys.plugins.repository.AmetysObject; 019import org.ametys.plugins.repository.AmetysRepositoryException; 020import org.ametys.plugins.repository.UnknownAmetysObjectException; 021 022 023/** 024 * {@link AmetysObject} with versioning capabilities. 025 */ 026public interface VersionableAmetysObject extends VersionAwareAmetysObject 027{ 028 /** 029 * Persists the current version of this {@link AmetysObject} 030 * @throws AmetysRepositoryException if a problem occurs 031 */ 032 public void checkpoint() throws AmetysRepositoryException; 033 034 /** 035 * Restore data from the specified label.<br> 036 * @param label the label 037 * @throws UnknownAmetysObjectException if the label does not correspond to any revision 038 * @throws AmetysRepositoryException if a problem occurs 039 */ 040 public void restoreFromLabel(String label) throws UnknownAmetysObjectException, AmetysRepositoryException; 041 042 /** 043 * Restore data from the specified revision.<br> 044 * @param revision the revision 045 * @throws UnknownAmetysObjectException if the revision does not exist 046 * @throws AmetysRepositoryException if a problem occurs 047 */ 048 public void restoreFromRevision(String revision) throws UnknownAmetysObjectException, AmetysRepositoryException; 049 050 /** 051 * Add a label on this object. 052 * @param label the label to add. 053 * @param moveIfPresent what to do if the content already has this label : move it to the current revision if <code>true</code>, keep it unchanged if <code>false</code>. 054 * @throws AmetysRepositoryException if some problem arises. 055 */ 056 public void addLabel(String label, boolean moveIfPresent) throws AmetysRepositoryException; 057 058 /** 059 * Remove a label from this object.<br> 060 * If the label doesn't exist, it is silently ignored. 061 * @param label the label to remove 062 * @throws AmetysRepositoryException if some problem arises. 063 */ 064 public void removeLabel(String label) throws AmetysRepositoryException; 065}