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

File XARInputProperties.java

 

Coverage histogram

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

Code metrics

2
13
12
2
223
86
13
1
1.08
6
1.08

Classes

Class Line # Actions
XARInputProperties 35 13 0% 13 6
0.777777877.8%
XARInputProperties.SourceType 43 0 - 0 0
-1.0 -
 

Contributing tests

This file is covered by 74 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.xar.input;
21   
22    import org.xwiki.filter.input.InputSource;
23    import org.xwiki.filter.xml.input.XMLInputProperties;
24    import org.xwiki.model.reference.EntityReferenceSet;
25    import org.xwiki.properties.annotation.PropertyDescription;
26    import org.xwiki.properties.annotation.PropertyHidden;
27    import org.xwiki.properties.annotation.PropertyName;
28   
29    /**
30    * XAR input properties.
31    *
32    * @version $Id: 9a4eec092ef518b1dd5bf16b64989f3f90627d17 $
33    * @since 6.2M1
34    */
 
35    public class XARInputProperties extends XMLInputProperties
36    {
37    /**
38    * The type of the {@link InputSource}.
39    *
40    * @version $Id: 9a4eec092ef518b1dd5bf16b64989f3f90627d17 $
41    * @since 9.0RC1
42    */
 
43    public enum SourceType
44    {
45    /**
46    * A XAR package.
47    */
48    XAR,
49   
50    /**
51    * A document as XML.
52    */
53    DOCUMENT,
54   
55    /**
56    * An attachment as XML.
57    */
58    ATTACHMENT,
59   
60    /**
61    * A class as XML.
62    */
63    CLASS,
64   
65    /**
66    * A class property as XML.
67    */
68    CLASSPROPERTY,
69   
70    /**
71    * An object as XML.
72    */
73    OBJECT,
74   
75    /**
76    * An object property as XML.
77    */
78    OBJECTPROPERTY
79    }
80   
81    /**
82    * @see #getEntities()
83    */
84    private EntityReferenceSet entities;
85   
86    /**
87    * @see #getSourceType()
88    */
89    private SourceType sourceType;
90   
91    /**
92    * @see #isWithHistory()
93    */
94    private boolean withHistory = true;
95   
96    /**
97    * @see #isWithExtension()
98    */
99    private boolean withExtension = true;
100   
101    /**
102    * @see #getObjectPropertyType()
103    */
104    private String objectPropertyType;
105   
106    /**
107    * @return The entities to take into account or skip
108    */
 
109  43628 toggle @PropertyName("Entities")
110    @PropertyDescription("The entities to take into account or skip")
111    // TODO: implement Converter for EntityReferenceSet
112    @PropertyHidden
113    public EntityReferenceSet getEntities()
114    {
115  43628 return this.entities;
116    }
117   
118    /**
119    * @param entities The entities to take into account or skip
120    */
 
121  7 toggle public void setEntities(EntityReferenceSet entities)
122    {
123  7 this.entities = entities;
124    }
125   
126    /**
127    * @return Indicate if events should be generated for history
128    */
 
129  7836 toggle @PropertyName("With history")
130    @PropertyDescription("Indicate if events should be generated for history")
131    public boolean isWithHistory()
132    {
133  7836 return this.withHistory;
134    }
135   
136    /**
137    * @param withHistory Indicate if events should be generated for history
138    */
 
139  7640 toggle public void setWithHistory(boolean withHistory)
140    {
141  7640 this.withHistory = withHistory;
142    }
143   
144    /**
145    * @return the type of the source
146    * @since 9.0RC1
147    */
 
148  12837 toggle public SourceType getSourceType()
149    {
150  12837 return this.sourceType;
151    }
152   
153    /**
154    * @param sourceType the type of the source
155    * @since 9.0RC1
156    */
 
157  12635 toggle public void setSourceType(SourceType sourceType)
158    {
159  12635 this.sourceType = sourceType;
160    }
161   
162    /**
163    * @return true if the input should be forced as document
164    * @deprecated since 9.0RC1, use {@link #getSourceType()} instead
165    */
 
166  12826 toggle @PropertyName("Force document")
167    @PropertyDescription("Force considering the input stream as a document")
168    @Deprecated
169    public boolean isForceDocument()
170    {
171  12826 return this.sourceType == SourceType.DOCUMENT;
172    }
173   
174    /**
175    * @param forceDocument true if the input should be forced as document
176    * @deprecated since 9.0RC1, use {@link #setSourceType(SourceType)} instead
177    */
 
178  1 toggle @Deprecated
179    public void setForceDocument(boolean forceDocument)
180    {
181  1 if (forceDocument) {
182  0 this.sourceType = SourceType.DOCUMENT;
183    }
184    }
185   
186    /**
187    * @return true indicates if extension event should be generated if possible
188    * @since 6.2M1
189    */
 
190  161 toggle @PropertyName("Indicates if extension event should be generated if possible")
191    @PropertyDescription("Indicates if extension event should be generated if possible")
192    public boolean isWithExtension()
193    {
194  161 return this.withExtension;
195    }
196   
197    /**
198    * @param withExtension indicates if extension event should be generated if possible
199    * @since 6.2M1
200    */
 
201  0 toggle public void setWithExtension(boolean withExtension)
202    {
203  0 this.withExtension = withExtension;
204    }
205   
206    /**
207    * @return the type of the object property to parse
208    * @since 9.0RC1
209    */
 
210  163 toggle public String getObjectPropertyType()
211    {
212  163 return this.objectPropertyType;
213    }
214   
215    /**
216    * @param objectPropertyType the type of the object property to parse
217    * @since 9.0RC1
218    */
 
219  0 toggle public void setObjectPropertyType(String objectPropertyType)
220    {
221  0 this.objectPropertyType = objectPropertyType;
222    }
223    }