1. Project Clover database Tue Dec 20 2016 21:24:09 CET
  2. Package com.xpn.xwiki.criteria.impl

File ScopeFactory.java

 

Coverage histogram

../../../../../img/srcFileCovDistChart0.png
83% of files have more coverage

Code metrics

0
10
11
1
147
51
11
1.1
0.91
11
1

Classes

Class Line # Actions
ScopeFactory 25 10 0% 11 21
0.00%
 

Contributing tests

No tests hitting this source file were found.

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 com.xpn.xwiki.criteria.impl;
21   
22    /**
23    * Helper factory class for creating Scope objects in velocity
24    */
 
25    public class ScopeFactory
26    {
27    /**
28    * A scope that matches all pages within any space and any wiki
29    */
30    public static final Scope ALL_PAGES = createScope(Scope.PAGE_SCOPE, "", false);
31   
32    /**
33    * A scope that matches all spaces within any wiki
34    */
35    public static final Scope ALL_SPACES = createScope(Scope.SPACE_SCOPE, "", false);
36   
37    /**
38    * A scope that matches all wikis within the application
39    */
40    public static final Scope ALL_WIKIS = createScope(Scope.WIKI_SCOPE, "", false);
41   
42    /**
43    * A scope that matches the entire application as a unit
44    */
45    public static final Scope ALL = createScope(Scope.GLOBAL_SCOPE, "", false);
46   
 
47  0 toggle public ScopeFactory()
48    {
49    }
50   
51    /**
52    * @see Scope#Scope(int, String, boolean)
53    */
 
54  0 toggle public static Scope createScope(int type, String name, boolean deep)
55    {
56  0 return new Scope(type, name, deep);
57    }
58   
59    /**
60    * Creates a new scope associated with the specified page.
61    *
62    * @param pageName A page name
63    * @return A new Scope instance
64    */
 
65  0 toggle public static Scope createPageScope(String pageName)
66    {
67  0 return createScope(Scope.PAGE_SCOPE, pageName, false);
68    }
69   
70    /**
71    * Creates a new scope associated with the specified space and matching all its pages.
72    *
73    * @param spaceName A space name
74    * @return A new Scope instance
75    */
 
76  0 toggle public static Scope createSpaceScope(String spaceName)
77    {
78  0 return createSpaceScope(spaceName, true);
79    }
80   
81    /**
82    * Creates a new scope associated with the specified space.
83    *
84    * @param spaceName A space name
85    * @param deep <code>true</code> for matching all its pages; <code>false</code> for matching this space as a unit
86    * @return A new Scope instance
87    */
 
88  0 toggle public static Scope createSpaceScope(String spaceName, boolean deep)
89    {
90  0 return createScope(Scope.SPACE_SCOPE, spaceName, deep);
91    }
92   
93    /**
94    * Creates a new scope associated with the specified wiki and matching all its spaces.
95    *
96    * @param wikiName A wiki name
97    * @return A new Scope instance
98    */
 
99  0 toggle public static Scope createWikiScope(String wikiName)
100    {
101  0 return createWikiScope(wikiName, true);
102    }
103   
104    /**
105    * Creates a new scope associated with the specified wiki.
106    *
107    * @param wikiName A wiki name
108    * @param deep <code>true</code> for matching all its spaces; <code>false</code> for matching this wiki as a unit
109    * @return A new Scope instance
110    */
 
111  0 toggle public static Scope createWikiScope(String wikiName, boolean deep)
112    {
113  0 return createScope(Scope.WIKI_SCOPE, wikiName, deep);
114    }
115   
116    /**
117    * Helper method for accessing {@link #ALL_PAGES} static field in velocity
118    */
 
119  0 toggle public static Scope getALL_PAGES()
120    {
121  0 return ALL_PAGES;
122    }
123   
124    /**
125    * Helper method for accessing {@link #ALL_SPACES} static field in velocity
126    */
 
127  0 toggle public static Scope getALL_SPACES()
128    {
129  0 return ALL_SPACES;
130    }
131   
132    /**
133    * Helper method for accessing {@link #ALL_WIKIS} static field in velocity
134    */
 
135  0 toggle public static Scope getALL_WIKIS()
136    {
137  0 return ALL_WIKIS;
138    }
139   
140    /**
141    * Helper method for accessing {@link #ALL} static field in velocity
142    */
 
143  0 toggle public static Scope getALL()
144    {
145  0 return ALL;
146    }
147    }