1. Project Clover database Sat Feb 2 2019 06:45:20 CET
  2. Package org.xwiki.refactoring.job

File AbstractCopyOrMoveRequest.java

 

Coverage histogram

../../../../img/srcFileCovDistChart10.png
0% of files have more coverage

Code metrics

0
6
6
1
108
32
6
1
1
6
1

Classes

Class Line # Actions
AbstractCopyOrMoveRequest 30 6 0% 6 0
1.0100%
 

Contributing tests

This file is covered by 41 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.refactoring.job;
21   
22    import org.xwiki.model.reference.EntityReference;
23   
24    /**
25    * Represents a request used for Copy, Move or Rename (though Move).
26    *
27    * @version $Id: 7b72f43c42fab31b77d2e65c84f20a73fd8de757 $
28    * @since 10.11RC1
29    */
 
30    public abstract class AbstractCopyOrMoveRequest extends EntityRequest
31    {
32    /**
33    * @see #getDestination()
34    */
35    private static final String PROPERTY_DESTINATION = "destination";
36   
37    /**
38    * @see #isUpdateLinks()
39    */
40    private static final String PROPERTY_UPDATE_LINKS = "updateLinks";
41   
42    /**
43    * @see #isUpdateLinksOnFarm()
44    */
45    private static final String PROPERTY_UPDATE_LINKS_ON_FARM = "updateLinksOnFarm";
46   
47    /**
48    * @return the destination entity, where to move the entities specified by {@link #getEntityReferences()}
49    */
 
50  216 toggle public EntityReference getDestination()
51    {
52  216 return getProperty(PROPERTY_DESTINATION);
53    }
54   
55    /**
56    * Sets the destination entity, where to move the entities specified by {@link #getEntityReferences()}.
57    *
58    * @param destination the destination entity
59    */
 
60  74 toggle public void setDestination(EntityReference destination)
61    {
62  74 setProperty(PROPERTY_DESTINATION, destination);
63    }
64   
65    /**
66    * @return {@code true} if the links that target the old entity reference (before the move) should be updated to
67    * target the new reference (after the move), {@code false} to preserve the old link target
68    */
 
69  50 toggle public boolean isUpdateLinks()
70    {
71  50 return getProperty(PROPERTY_UPDATE_LINKS, true);
72    }
73   
74    /**
75    * Sets whether the links that target the old entity reference (before the move) should be updated to target the new
76    * reference (after the move) or not.
77    *
78    * @param updateLinks {@code true} to update the links, {@code false} to preserve the old link target
79    */
 
80  16 toggle public void setUpdateLinks(boolean updateLinks)
81    {
82  16 setProperty(PROPERTY_UPDATE_LINKS, updateLinks);
83    }
84   
85    /**
86    * @return {@code true} if the job should update the links that target the old entity reference (before the move)
87    * from anywhere on the farm, {@code false} if the job should update only the links from the wiki where the
88    * entity was located before the move
89    */
 
90  70 toggle public boolean isUpdateLinksOnFarm()
91    {
92  70 return getProperty(PROPERTY_UPDATE_LINKS_ON_FARM, false);
93    }
94   
95    /**
96    * Sets whether the job should update the links that target the old entity reference (before the move) from anywhere
97    * on the farm, or only from the wiki where the entity was located before the mode.
98    * <p>
99    * Note that this parameter has no effect if {@link #isUpdateLinks()} is {@code false}.
100    *
101    * @param updateLinksOnFarm {@code true} to update the links from anywhere on the farm, {@code false} to update only
102    * the links from the wiki where the entity is located
103    */
 
104  2 toggle public void setUpdateLinksOnFarm(boolean updateLinksOnFarm)
105    {
106  2 setProperty(PROPERTY_UPDATE_LINKS_ON_FARM, updateLinksOnFarm);
107    }
108    }