1. Project Clover database Sat Feb 2 2019 06:45:20 CET
  2. Package org.xwiki.rendering.macro.include

File IncludeMacroParameters.java

 

Coverage histogram

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

Code metrics

0
10
9
2
162
64
9
0.9
1.11
4.5
1

Classes

Class Line # Actions
IncludeMacroParameters 33 10 0% 9 4
0.789473778.9%
IncludeMacroParameters.Context 38 0 - 0 0
-1.0 -
 

Contributing tests

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