1. Project Clover database Sat Feb 2 2019 06:45:20 CET
  2. Package org.xwiki.filter.instance.output

File DocumentInstanceOutputProperties.java

 

Coverage histogram

../../../../../img/srcFileCovDistChart9.png
41% of files have more coverage

Code metrics

0
18
17
1
240
104
17
0.94
1.06
17
1

Classes

Class Line # Actions
DocumentInstanceOutputProperties 32 18 0% 17 5
0.8571428785.7%
 

Contributing tests

This file is covered by 45 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.filter.instance.output;
21   
22    import org.xwiki.model.reference.DocumentReference;
23    import org.xwiki.model.reference.EntityReference;
24    import org.xwiki.properties.annotation.PropertyDescription;
25    import org.xwiki.properties.annotation.PropertyName;
26    import org.xwiki.rendering.syntax.Syntax;
27   
28    /**
29    * @version $Id: 5b96b801c3473f8e7812835f46d96812375d4c1f $
30    * @since 6.2M1
31    */
 
32    public class DocumentInstanceOutputProperties extends InstanceOutputProperties
33    {
34    /**
35    * @see #getDefaultReference()
36    */
37    private EntityReference defaultReference;
38   
39    /**
40    * @see #getSaveComment()
41    */
42    private String saveComment = "Import";
43   
44    /**
45    * @see #getDefaultSyntax()
46    */
47    private Syntax defaultSyntax;
48   
49    /**
50    * @see #isPreviousDeleted()
51    */
52    private boolean previousDeleted = true;
53   
54    /**
55    * @see #isVersionPreserved()
56    */
57    private boolean versionPreserved = true;
58   
59    /**
60    * @see #getAuthor()
61    */
62    private DocumentReference author;
63   
64    /**
65    * @see #isAuthorSet()
66    */
67    private boolean authorSet;
68   
69    /**
70    * @see #isAuthorPreserved()
71    */
72    private boolean authorPreserved = true;
73   
74    /**
75    * @see #isStoppedWhenSaveFail()
76    */
77    private boolean stoppedWhenSaveFail = true;
78   
79    /**
80    * @return The base reference to use to resolve reference from events
81    */
 
82  45874 toggle @PropertyName("Default reference")
83    @PropertyDescription("The base reference to use to resolve reference from events")
84    public EntityReference getDefaultReference()
85    {
86  45874 return this.defaultReference;
87    }
88   
89    /**
90    * @param defaultReference The base reference to use to resolve reference from events
91    */
 
92  7635 toggle public void setDefaultReference(EntityReference defaultReference)
93    {
94  7635 this.defaultReference = defaultReference;
95    }
96   
97    /**
98    * @return The comment to set when saving a document
99    */
 
100  19 toggle @PropertyName("Save comment")
101    @PropertyDescription("The comment to set when saving a document")
102    public String getSaveComment()
103    {
104  19 return this.saveComment;
105    }
106   
107    /**
108    * @param saveComment The comment to set when saving a document
109    */
 
110  5 toggle public void setSaveComment(String saveComment)
111    {
112  5 this.saveComment = saveComment;
113    }
114   
115    /**
116    * @return The default syntax if not is provided in events
117    */
 
118  57 toggle @PropertyName("Default syntax")
119    @PropertyDescription("The default syntax if not is provided in events")
120    public Syntax getDefaultSyntax()
121    {
122  57 return this.defaultSyntax;
123    }
124   
125    /**
126    * @param defaultSyntax The default syntax if not is provided in events
127    */
 
128  0 toggle public void setDefaultSyntax(Syntax defaultSyntax)
129    {
130  0 this.defaultSyntax = defaultSyntax;
131    }
132   
133    /**
134    * @return Indicate if existing document should be deleted before importing the new one
135    */
 
136  15 toggle @PropertyName("Delete existing document")
137    @PropertyDescription("Indicate if existing document should be deleted before importing the new one")
138    public boolean isPreviousDeleted()
139    {
140  15 return this.previousDeleted;
141    }
142   
143    /**
144    * @param previousDeleted Indicate if existing document should be deleted before importing the new one
145    */
 
146  5 toggle public void setPreviousDeleted(boolean previousDeleted)
147    {
148  5 this.previousDeleted = previousDeleted;
149    }
150   
151    /**
152    * @return Indicate if the versions coming from the events should be kept
153    */
 
154  8659 toggle @PropertyName("Preserve version")
155    @PropertyDescription("Indicate if the versions comming from the events should be kept")
156    public boolean isVersionPreserved()
157    {
158  8659 return this.versionPreserved;
159    }
160   
161    /**
162    * @param versionPreserved Indicate if the versions coming from the events should be kept
163    */
 
164  5060 toggle public void setVersionPreserved(boolean versionPreserved)
165    {
166  5060 this.versionPreserved = versionPreserved;
167    }
168   
169    /**
170    * @return the author to use when saving documents
171    * @since 8.2
172    */
 
173  15 toggle @PropertyName("Save author")
174    @PropertyDescription("The author to use when saving documents")
175    public DocumentReference getAuthor()
176    {
177  15 return this.author;
178    }
179   
180    /**
181    * @param author the author to use when saving documents
182    * @since 8.2
183    */
 
184  0 toggle public void setAuthor(DocumentReference author)
185    {
186  0 this.author = author;
187  0 this.authorSet = true;
188    }
189   
190    /**
191    * @return true if the author have been explicitly set
192    * @since 8.2
193    */
 
194  23000 toggle public boolean isAuthorSet()
195    {
196  23000 return this.authorSet;
197    }
198   
199    /**
200    * @return true if the authors coming from the events should be kept.
201    */
 
202  36 toggle @PropertyName("Preserve author")
203    @PropertyDescription("Indicate if the authors comming from the events should be kept."
204    + " If false the current user is used.")
205    public boolean isAuthorPreserved()
206    {
207  36 return !isAuthorSet() && this.authorPreserved;
208    }
209   
210    /**
211    * @param authorPreserved indicate if the authors coming from the events should be kept. Not taken into account if
212    * {@link #setAuthor(DocumentReference)} is used.
213    */
 
214  6 toggle public void setAuthorPreserved(boolean authorPreserved)
215    {
216  6 this.authorPreserved = authorPreserved;
217    }
218   
219    /**
220    * @return Indicate if an exception should be thrown if a document save fail.
221    * @since 6.2.6
222    * @since 6.4.2
223    */
 
224  15 toggle @PropertyName("Stop when document save fail")
225    @PropertyDescription("Indicate if an exception should be thrown if a document save fail")
226    public boolean isStoppedWhenSaveFail()
227    {
228  15 return this.stoppedWhenSaveFail;
229    }
230   
231    /**
232    * @param stoppedWhenSaveFail Indicate if an exception should be thrown if a document save fail.
233    * @since 6.2.6
234    * @since 6.4.2
235    */
 
236  5 toggle public void setStoppedWhenSaveFail(boolean stoppedWhenSaveFail)
237    {
238  5 this.stoppedWhenSaveFail = stoppedWhenSaveFail;
239    }
240    }