Class | Line # | Actions | |||||
---|---|---|---|---|---|---|---|
ElementInterface | 29 | 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 com.xpn.xwiki.objects; | |
21 | ||
22 | import org.xwiki.model.reference.DocumentReference; | |
23 | import org.xwiki.model.reference.EntityReference; | |
24 | ||
25 | import com.xpn.xwiki.XWikiContext; | |
26 | import com.xpn.xwiki.doc.merge.MergeConfiguration; | |
27 | import com.xpn.xwiki.doc.merge.MergeResult; | |
28 | ||
29 | public interface ElementInterface | |
30 | { | |
31 | /** | |
32 | * @return the reference of the element | |
33 | * @since 3.2M1 | |
34 | */ | |
35 | EntityReference getReference(); | |
36 | ||
37 | @Override | |
38 | String toString(); | |
39 | ||
40 | /** | |
41 | * @return the reference to the document in which this element is defined (for elements where this make sense, for | |
42 | * example for an XClass or a XObject). | |
43 | * @since 2.2M2 | |
44 | */ | |
45 | DocumentReference getDocumentReference(); | |
46 | ||
47 | /** | |
48 | * @return the free form name (for elements which don't point to a reference, for example for instances of | |
49 | * {@link BaseProperty}). | |
50 | */ | |
51 | String getName(); | |
52 | ||
53 | /** | |
54 | * @since 2.2M2 | |
55 | */ | |
56 | void setDocumentReference(DocumentReference reference); | |
57 | ||
58 | void setName(String name); | |
59 | ||
60 | /** | |
61 | * Apply a 3 ways merge on the current element based on provided previous and new version of the element. | |
62 | * <p> | |
63 | * All 3 elements are supposed to have the same class and reference. | |
64 | * | |
65 | * @param previousElement the previous version of the element | |
66 | * @param newElement the next version of the element | |
67 | * @param configuration the configuration of the merge Indicate how to deal with some conflicts use cases, etc. | |
68 | * @param context the XWiki context | |
69 | * @param mergeResult the merge report | |
70 | * @since 3.2M1 | |
71 | */ | |
72 | void merge(ElementInterface previousElement, ElementInterface newElement, MergeConfiguration configuration, | |
73 | XWikiContext context, MergeResult mergeResult); | |
74 | ||
75 | /** | |
76 | * Apply the provided element so that the current one contains the same informations and indicate if it was | |
77 | * necessary to modify it in any way. | |
78 | * | |
79 | * @param newElement the element to apply | |
80 | * @param clean true if informations that are not in the new element should be removed (for example class properties | |
81 | * not in the new class) | |
82 | * @return true if the element has been modified | |
83 | * @since 4.3M1 | |
84 | */ | |
85 | boolean apply(ElementInterface newElement, boolean clean); | |
86 | } |