1. Project Clover database Tue Dec 20 2016 21:24:09 CET
  2. Package org.xwiki.refactoring.internal

File ModelBridge.java

 

Code metrics

0
0
0
1
123
21
0
-
-
0
-

Classes

Class Line # Actions
ModelBridge 38 0 - 0 0
-1.0 -
 

Contributing tests

No tests hitting this source file were found.

Source view

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.refactoring.internal;
21   
22    import java.util.List;
23    import java.util.Map;
24   
25    import org.xwiki.component.annotation.Role;
26    import org.xwiki.model.reference.DocumentReference;
27    import org.xwiki.model.reference.SpaceReference;
28   
29    /**
30    * Interface used to access the XWiki model and to perform low level operations on it.
31    * <p>
32    * Keep this interface internal because it's not part of the public API exposed by this module.
33    *
34    * @version $Id: 93a37805a1c11f1bcc9cbe5e1a25c4b0d4295a9d $
35    * @since 7.4M2
36    */
37    @Role
 
38    public interface ModelBridge
39    {
40    /**
41    * Create a new document with the specified reference.
42    *
43    * @param documentReference the reference of the new document
44    * @return {@code true} if the document was create successfully, {@code false} if the creation failed
45    */
46    boolean create(DocumentReference documentReference);
47   
48    /**
49    * Copy a document with the specified reference.
50    *
51    * @param source the document to copy
52    * @param destination the reference of the document copy that is going to be created
53    * @return {@code true} if the document was copied successfully, {@code false} if the copy failed
54    */
55    boolean copy(DocumentReference source, DocumentReference destination);
56   
57    /**
58    * Delete the specified document.
59    *
60    * @param documentReference the reference of the document to delete
61    * @return {@code true} if the document was deleted successfully, {@code false} if the delete failed
62    */
63    boolean delete(DocumentReference documentReference);
64   
65    /**
66    * Remove the edit lock from the specified document.
67    *
68    * @param documentReference the document to unlock
69    * @return {@code true} if the lock was removed successfully, {@code false} if the remove failed
70    */
71    boolean removeLock(DocumentReference documentReference);
72   
73    /**
74    * Create a redirect from the old document reference to the new document reference.
75    *
76    * @param oldReference the old document reference
77    * @param newReference the new document reference
78    */
79    void createRedirect(DocumentReference oldReference, DocumentReference newReference);
80   
81    /**
82    * @param reference a document reference
83    * @return {@code true} if the specified document exists, {@code false} otherwise
84    */
85    boolean exists(DocumentReference reference);
86   
87    /**
88    * @param reference a document reference
89    * @return the list of documents that have links to the specified document
90    */
91    List<DocumentReference> getBackLinkedReferences(DocumentReference reference);
92   
93    /**
94    * @param spaceReference a space reference
95    * @return the list of all the documents from the specified space and its nested spaces
96    */
97    List<DocumentReference> getDocumentReferences(SpaceReference spaceReference);
98   
99    /**
100    * @param oldParentReference the old document reference for which to update its children's parent fields
101    * @param newParentReference the new value to set in the chidlren's parent field
102    * @return {@code true} if the parent fields were successfully updated, {@code false} if the update failed
103    * @since 8.0M2
104    * @since 7.4.2
105    */
106    boolean updateParentField(DocumentReference oldParentReference, DocumentReference newParentReference);
107   
108    /**
109    * Sets the current user reference on the execution context.
110    *
111    * @param userReference the user reference to put on the execution context
112    * @return the previous user reference that was on the execution context
113    */
114    DocumentReference setContextUserReference(DocumentReference userReference);
115   
116    /**
117    * Modify the specified document based on the given parameters (usually the fields to update).
118    *
119    * @param documentReference specifies the document to update
120    * @param parameters specifies the updates to perform (e.g. which fields to update)
121    */
122    void update(DocumentReference documentReference, Map<String, String> parameters);
123    }