001/* 002 * (C) Copyright 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$ 020 */ 021 022package org.nuxeo.ecm.webapp.edit.lock; 023 024import java.io.Serializable; 025import java.util.Map; 026 027import org.nuxeo.ecm.core.api.DocumentModel; 028import org.nuxeo.ecm.platform.actions.Action; 029 030/** 031 * Interface for an action listener that will provide methods to lock/unlock a document, to lock/unlock the current 032 * document and to lock/unlock a list of documents (based on DocumentsListManager). 033 * 034 * @author <a href="mailto:[email protected]">Bogdan Tatar</a> 035 */ 036public interface LockActions extends Serializable { 037 038 String LOCKER = "document.locker"; 039 040 /** @since 5.4.2 */ 041 String LOCK_CREATED = "document.lock.created"; 042 043 /** 044 * Gets the lock of the current document. 045 * 046 */ 047 String lockCurrentDocument(); 048 049 /** 050 * Releases the lock of the current document. 051 * 052 */ 053 String unlockCurrentDocument(); 054 055 /** 056 * Gets the lock of the document. 057 * 058 * @param document the document of which lock is to be taken 059 */ 060 String lockDocument(DocumentModel document); 061 062 /** 063 * Releases the lock of the document. 064 * 065 * @param document the document of which lock is to be released 066 */ 067 String unlockDocument(DocumentModel document); 068 069 /** 070 * Tests if the user can get the lock of a document. 071 * 072 * @return true if the user has this right, false otherwise 073 */ 074 Boolean getCanLockDoc(DocumentModel document); 075 076 /** 077 * Tests if the user can get the lock of the current document. 078 * 079 * @return true if the user has this right, false otherwise 080 */ 081 Boolean getCanLockCurrentDoc(); 082 083 /** 084 * Tests if the user can unlock a document. 085 * 086 * @return true if the user has this right, false otherwise 087 */ 088 Boolean getCanUnlockDoc(DocumentModel document); 089 090 /** 091 * Tests if the user can unlock the current document. 092 * 093 * @return true if the user has this right, false otherwise 094 */ 095 Boolean getCanUnlockCurrentDoc(); 096 097 /** 098 * Returns the action of lock or unlock for a document. 099 * 100 * @return the action of lock or unlock for a document 101 */ 102 Action getLockOrUnlockAction(); 103 104 /** 105 * Gets the details about the lock of a document,who did the lock and when the lock took place. 106 * 107 * @param document the document for which this information is needed 108 * @return the user who took the look and the time when he/she did this in a map 109 */ 110 Map<String, Serializable> getLockDetails(DocumentModel document); 111 112 /** 113 * Gets the details about the lock of the current document, who did the lock and when the lock took place. 114 * 115 * @return the user who took the look and the time when he/she did this in a map 116 */ 117 Map<String, Serializable> getCurrentDocLockDetails(); 118 119 void resetLockState(); 120 121}