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

File XARInputProperties.java

 

Coverage histogram

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

Code metrics

0
12
12
2
221
84
12
1
1
6
1

Classes

Class Line # Actions
XARInputProperties 35 12 0% 12 6
0.7575%
XARInputProperties.SourceType 43 0 - 0 0
-1.0 -
 

Contributing tests

This file is covered by 63 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: 89ae38accbe1c2e7c642166bba517bb4dc29c7cb $
33    * @since 6.2M1
34    */
 
35    public class XARInputProperties extends XMLInputProperties
36    {
37    /**
38    * The type of the {@link InputSource}.
39    *
40    * @version $Id: 89ae38accbe1c2e7c642166bba517bb4dc29c7cb $
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  15299 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  15299 return this.entities;
116    }
117   
118    /**
119    * @param entities The entities to take into account or skip
120    */
 
121  6 toggle public void setEntities(EntityReferenceSet entities)
122    {
123  6 this.entities = entities;
124    }
125   
126    /**
127    * @return Indicate if events should be generated for history
128    */
 
129  2681 toggle @PropertyName("With history")
130    @PropertyDescription("Indicate if events should be generated for history")
131    public boolean isWithHistory()
132    {
133  2681 return this.withHistory;
134    }
135   
136    /**
137    * @param withHistory Indicate if events should be generated for history
138    */
 
139  2527 toggle public void setWithHistory(boolean withHistory)
140    {
141  2527 this.withHistory = withHistory;
142    }
143   
144    /**
145    * @return the type of the source
146    * @since 9.0RC1
147    */
 
148  4426 toggle public SourceType getSourceType()
149    {
150  4423 return this.sourceType;
151    }
152   
153    /**
154    * @param sourceType the type of the source
155    * @since 9.0RC1
156    */
 
157  4268 toggle public void setSourceType(SourceType sourceType)
158    {
159  4268 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  4424 toggle @PropertyName("Force document")
167    @PropertyDescription("Force considering the input stream as a document")
168    @Deprecated
169    public boolean isForceDocument()
170    {
171  4424 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  0 toggle @Deprecated
179    public void setForceDocument(boolean forceDocument)
180    {
181  0 this.sourceType = SourceType.DOCUMENT;
182    }
183   
184    /**
185    * @return true indicates if extension event should be generated if possible
186    * @since 6.2M1
187    */
 
188  134 toggle @PropertyName("Indicates if extension event should be generated if possible")
189    @PropertyDescription("Indicates if extension event should be generated if possible")
190    public boolean isWithExtension()
191    {
192  134 return this.withExtension;
193    }
194   
195    /**
196    * @param withExtension indicates if extension event should be generated if possible
197    * @since 6.2M1
198    */
 
199  0 toggle public void setWithExtension(boolean withExtension)
200    {
201  0 this.withExtension = withExtension;
202    }
203   
204    /**
205    * @return the type of the object property to parse
206    * @since 9.0RC1
207    */
 
208  136 toggle public String getObjectPropertyType()
209    {
210  136 return this.objectPropertyType;
211    }
212   
213    /**
214    * @param objectPropertyType the type of the object property to parse
215    * @since 9.0RC1
216    */
 
217  0 toggle public void setObjectPropertyType(String objectPropertyType)
218    {
219  0 this.objectPropertyType = objectPropertyType;
220    }
221    }