Class | Line # | Actions | |||||
---|---|---|---|---|---|---|---|
ModelBridge | 39 | 0 | - | 0 | 0 |
1 | /* | |
2 | * See the NOTICE file distributed with this work for additional | |
3 | * information regarding copyright ownership. | |
4 | * | |
5 | * This is free software; you can redistribute it and/or modify it | |
6 | * under the terms of the GNU Lesser General Public License as | |
7 | * published by the Free Software Foundation; either version 2.1 of | |
8 | * the License, or (at your option) any later version. | |
9 | * | |
10 | * This software is distributed in the hope that it will be useful, | |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
13 | * Lesser General Public License for more details. | |
14 | * | |
15 | * You should have received a copy of the GNU Lesser General Public | |
16 | * License along with this software; if not, write to the Free | |
17 | * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA | |
18 | * 02110-1301 USA, or see the FSF site: http://www.fsf.org. | |
19 | */ | |
20 | package org.xwiki.sheet.internal; | |
21 | ||
22 | import java.util.Map; | |
23 | import java.util.Set; | |
24 | ||
25 | import org.xwiki.bridge.DocumentModelBridge; | |
26 | import org.xwiki.component.annotation.Role; | |
27 | import org.xwiki.model.reference.DocumentReference; | |
28 | ||
29 | /** | |
30 | * Bridge between the sheet module and the XWiki model. This interface is used mainly to decouple the sheet module from | |
31 | * the old XWiki model so that it can be tested more easily. | |
32 | * <p> | |
33 | * NOTE: Keep this interface internal because it's not part of the public API exposed by the sheet module. | |
34 | * | |
35 | * @version $Id: 04e36fdcaa0303077a160b0df76ac7f9a0abdf56 $ | |
36 | * @since 4.1M1 | |
37 | */ | |
38 | @Role | |
39 | public interface ModelBridge | |
40 | { | |
41 | /** | |
42 | * This method is needed only to keep backward compatibility with older XWiki applications that are still using the | |
43 | * deprecated "inline" action. Newer applications should use the "edit" action instead. | |
44 | * | |
45 | * @param document a document | |
46 | * @return the default edit mode for the given document, e.g. "edit", "inline" | |
47 | */ | |
48 | String getDefaultEditMode(DocumentModelBridge document); | |
49 | ||
50 | /** | |
51 | * @param document a document | |
52 | * @return the default translation of the given document; if the given document is the default translation then it | |
53 | * is returned as is | |
54 | */ | |
55 | DocumentModelBridge getDefaultTranslation(DocumentModelBridge document); | |
56 | ||
57 | /** | |
58 | * @return the action performed on the current document, e.g. "view", "edit", "preview" | |
59 | */ | |
60 | String getCurrentAction(); | |
61 | ||
62 | /** | |
63 | * Checks if the given document is the current document on the execution context. If the passed document is a | |
64 | * translation then it is compared with the current document translation. | |
65 | * | |
66 | * @param document the document to check | |
67 | * @return {@code true} if the given document is the current document or its current translation, {@code false} | |
68 | * otherwise | |
69 | */ | |
70 | boolean isCurrentDocument(DocumentModelBridge document); | |
71 | ||
72 | /** | |
73 | * Unlike {@link org.xwiki.bridge.DocumentAccessBridge#pushDocumentInContext(Map, DocumentReference)} which puts on | |
74 | * the context the version of the document taken from the database (the saved version), this method puts on the | |
75 | * context the given document instance. This is useful when the given document is modified, which is the case when | |
76 | * we preserve the programming rights of the sheet. | |
77 | * | |
78 | * @param document the document instance to put on the context | |
79 | * @return the map used to restore the context | |
80 | * @see org.xwiki.bridge.DocumentAccessBridge#pushDocumentInContext(Map, DocumentReference) | |
81 | */ | |
82 | Map<String, Object> pushDocumentInContext(DocumentModelBridge document); | |
83 | ||
84 | /** | |
85 | * @param document a document | |
86 | * @return the type of XObjects attached to the given document | |
87 | */ | |
88 | Set<DocumentReference> getXObjectClassReferences(DocumentModelBridge document); | |
89 | ||
90 | /** | |
91 | * Sets the document that should be used for checking programming rights. | |
92 | * | |
93 | * @param document the document used to check for programming rights | |
94 | * @return the previous security document or {@code null} if no security document was set before | |
95 | * @since 6.3M1 | |
96 | */ | |
97 | DocumentModelBridge setSecurityDocument(DocumentModelBridge document); | |
98 | } |