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

File OverwriteQuestion.java

 

Coverage histogram

../../../../img/srcFileCovDistChart0.png
83% of files have more coverage

Code metrics

0
8
7
1
118
38
7
0.88
1.14
7
1

Classes

Class Line # Actions
OverwriteQuestion 31 8 0% 7 15
0.00%
 

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.job;
21   
22    import org.xwiki.model.reference.EntityReference;
23   
24    /**
25    * Question asked when an entity with the same name is found during a copy or move operation and we don't know whether
26    * to overwrite or keep the existing entity.
27    *
28    * @version $Id: 6df92c59509e40590efbdbdf86f81f7efcde59cc $
29    * @since 7.2M1
30    */
 
31    public class OverwriteQuestion
32    {
33    /**
34    * The entity being copied or moved.
35    */
36    private final EntityReference source;
37   
38    /**
39    * An entity with the same name that exists at the destination.
40    */
41    private final EntityReference destination;
42   
43    /**
44    * Whether to overwrite or not the destination entity with the one being copied or moved.
45    */
46    private boolean overwrite = true;
47   
48    /**
49    * Whether this question will be asked again or not if another pair of entities with the same name is found.
50    */
51    private boolean askAgain = true;
52   
53    /**
54    * Ask whether to overwrite or not the destination entity with the source entity.
55    *
56    * @param source the entity being copied or moved
57    * @param destination an entity with the same name that exists at the destination
58    */
 
59  0 toggle public OverwriteQuestion(EntityReference source, EntityReference destination)
60    {
61  0 this.source = source;
62  0 this.destination = destination;
63    }
64   
65    /**
66    * @return the entity that is being copied or moved
67    */
 
68  0 toggle public EntityReference getSource()
69    {
70  0 return source;
71    }
72   
73    /**
74    * @return an entity with the same name that exists at the destination
75    */
 
76  0 toggle public EntityReference getDestination()
77    {
78  0 return destination;
79    }
80   
81    /**
82    * @return {@code true} to overwrite the destination entity with the one being copied or moved, {@code false} to
83    * keep the destination entity
84    */
 
85  0 toggle public boolean isOverwrite()
86    {
87  0 return overwrite;
88    }
89   
90    /**
91    * Sets whether to overwrite or not the destination entity with the one being copied or moved.
92    *
93    * @param overwrite {@code true} to overwrite, {@code false} to keep
94    */
 
95  0 toggle public void setOverwrite(boolean overwrite)
96    {
97  0 this.overwrite = overwrite;
98    }
99   
100    /**
101    * @return whether this question will be asked again or not if another pair of entities with the same name is found
102    */
 
103  0 toggle public boolean isAskAgain()
104    {
105  0 return askAgain;
106    }
107   
108    /**
109    * Sets whether this question will be asked again or not if another pair of entities with the same name is found.
110    *
111    * @param askAgain {@code true} to ask again, {@code false} to perform the same action for the following entities,
112    * during the current operation
113    */
 
114  0 toggle public void setAskAgain(boolean askAgain)
115    {
116  0 this.askAgain = askAgain;
117    }
118    }