1. Project Clover database Tue Dec 20 2016 21:24:09 CET
  2. Package org.xwiki.extension.xar.question

File ConflictQuestion.java

 

Coverage histogram

../../../../../img/srcFileCovDistChart8.png
54% of files have more coverage

Code metrics

0
15
11
2
134
69
11
0.73
1.36
5.5
1

Classes

Class Line # Actions
ConflictQuestion 28 15 0% 11 5
0.807692380.8%
ConflictQuestion.GlobalAction 30 0 - 0 0
-1.0 -
 

Contributing tests

This file is covered by 6 tests. .

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.extension.xar.question;
21   
22    import com.xpn.xwiki.doc.XWikiDocument;
23   
24    /**
25    * @version $Id: c9a1fbd1ba4a223f11befaf27e377380d9bdb05a $
26    * @since 4.0M2
27    */
 
28    public class ConflictQuestion
29    {
 
30    public enum GlobalAction
31    {
32    CURRENT,
33    PREVIOUS,
34    NEXT,
35    MERGED,
36    CUSTOM
37    };
38   
39    // Answer datas
40   
41    private GlobalAction globalAction = GlobalAction.MERGED;
42   
43    private XWikiDocument customDocument;
44   
45    // Question datas
46   
47    private XWikiDocument currentDocument;
48   
49    private XWikiDocument previousDocument;
50   
51    private XWikiDocument nextDocument;
52   
53    private XWikiDocument mergedDocument;
54   
55    private boolean always;
56   
 
57  16 toggle public ConflictQuestion(XWikiDocument currentDocument, XWikiDocument previousDocument, XWikiDocument nextDocument,
58    XWikiDocument mergedDocument)
59    {
60  16 this.currentDocument = currentDocument;
61  16 this.previousDocument = previousDocument;
62  16 this.nextDocument = nextDocument;
63  16 this.mergedDocument = mergedDocument;
64    }
65   
 
66  12 toggle public XWikiDocument getCurrentDocument()
67    {
68  12 return this.currentDocument;
69    }
70   
 
71  2 toggle public XWikiDocument getPreviousDocument()
72    {
73  2 return this.previousDocument;
74    }
75   
 
76  10 toggle public XWikiDocument getNextDocument()
77    {
78  10 return this.nextDocument;
79    }
80   
 
81  5 toggle public XWikiDocument getMergedDocument()
82    {
83  5 return this.mergedDocument;
84    }
85   
86    // Answer
87   
 
88  24 toggle public GlobalAction getGlobalAction()
89    {
90  24 return this.globalAction;
91    }
92   
 
93  15 toggle public void setGlobalAction(GlobalAction globalAction)
94    {
95  15 this.globalAction = globalAction;
96    }
97   
98    /**
99    * @since 4.1
100    */
 
101  0 toggle public XWikiDocument getCustomDocument()
102    {
103  0 return this.customDocument;
104    }
105   
106    /**
107    * @since 4.1
108    */
 
109  0 toggle public void setCustomDocument(XWikiDocument customDocument)
110    {
111  0 this.customDocument = customDocument;
112  0 this.globalAction = GlobalAction.CUSTOM;
113    }
114   
115    /**
116    * @return if true apply the same answer to following conflict. Does nothing if the answer is
117    * {@link GlobalAction#CUSTOM}.
118    * @since 5.1RC1
119    */
 
120  16 toggle public boolean isAlways()
121    {
122  16 return this.always;
123    }
124   
125    /**
126    * @param always if true apply the same answer to following conflict. Does nothing if the answer is
127    * {@link GlobalAction#CUSTOM}.
128    * @since 5.1RC1
129    */
 
130  12 toggle public void setAlways(boolean always)
131    {
132  12 this.always = always;
133    }
134    }