1. Project Clover database Tue Dec 20 2016 21:24:09 CET
  2. Package org.xwiki.rendering.macro.include

File IncludeMacroParameters.java

 

Coverage histogram

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

Code metrics

0
8
8
2
145
52
8
1
1
4
1

Classes

Class Line # Actions
IncludeMacroParameters 31 8 0% 8 4
0.7575%
IncludeMacroParameters.Context 36 0 - 0 0
-1.0 -
 

Contributing tests

This file is covered by 8 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.rendering.macro.include;
21   
22    import org.xwiki.model.EntityType;
23    import org.xwiki.properties.annotation.PropertyDescription;
24   
25    /**
26    * Parameters for the {@link org.xwiki.rendering.internal.macro.include.IncludeMacro} Macro.
27    *
28    * @version $Id: 9eb82bd49cf6ecfc7f01a7e4341506fb92f2959d $
29    * @since 1.6M1
30    */
 
31    public class IncludeMacroParameters
32    {
33    /**
34    * @version $Id: 9eb82bd49cf6ecfc7f01a7e4341506fb92f2959d $
35    */
 
36    public enum Context
37    {
38    /**
39    * Macro executed in its own context.
40    */
41    NEW,
42   
43    /**
44    * Macro executed in the context of the current page.
45    */
46    CURRENT
47    }
48   
49    /**
50    * @see #getReference()
51    */
52    private String reference;
53   
54    /**
55    * @see #getType()
56    */
57    private EntityType type = EntityType.DOCUMENT;
58   
59    /**
60    * Defines whether the included page is executed in its separated execution context or whether it's executed in the
61    * context of the current page.
62    */
63    private Context context = Context.CURRENT;
64   
65    /**
66    * @see #getSection()
67    */
68    private String section;
69   
70    /**
71    * @param reference the reference of the resource to include
72    * @since 3.4M1
73    */
 
74  962 toggle @PropertyDescription("the reference of the resource to display")
75    public void setReference(String reference)
76    {
77  962 this.reference = reference;
78    }
79   
80    /**
81    * @return the reference of the resource to include
82    * @since 3.4M1
83    */
 
84  1956 toggle public String getReference()
85    {
86  1956 return this.reference;
87    }
88   
89    /**
90    * @return the type of the reference
91    * @since 3.4M1
92    */
 
93  29 toggle @PropertyDescription("the type of the reference")
94    public EntityType getType()
95    {
96  29 return this.type;
97    }
98   
99    /**
100    * @param type the type of the reference
101    * @since 3.4M1
102    */
 
103  0 toggle public void setType(EntityType type)
104    {
105  0 this.type = type;
106    }
107   
108    /**
109    * @param context defines whether the included page is executed in its separated execution context or whether it's
110    * executed in the context of the current page.
111    */
 
112  4 toggle @PropertyDescription("defines whether the included page is executed in its separated execution context"
113    + " or whether it's executed in the context of the current page")
114    public void setContext(Context context)
115    {
116  4 this.context = context;
117    }
118   
119    /**
120    * @return defines whether the included page is executed in its separated execution context or whether it's executed
121    * in the context of the current page.
122    */
 
123  990 toggle public Context getContext()
124    {
125  990 return this.context;
126    }
127   
128    /**
129    * @param sectionId see {@link #getSection()}
130    */
 
131  0 toggle @PropertyDescription("an optional id of a section to include in the specified document")
132    public void setSection(String sectionId)
133    {
134  0 this.section = sectionId;
135    }
136   
137    /**
138    * @return the optional id of a section to include in the referenced document. If not specified the whole document
139    * is included.
140    */
 
141  990 toggle public String getSection()
142    {
143  990 return this.section;
144    }
145    }