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

File ObjectPolicyType.java

 

Coverage histogram

../../../../img/srcFileCovDistChart10.png
0% of files have more coverage

Code metrics

2
6
3
1
85
20
4
0.67
2
3
1.33

Classes

Class Line # Actions
ObjectPolicyType 49 6 0% 4 0
1.0100%
 

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   
21    package com.xpn.xwiki.web;
22   
23    /**
24    * Enumeration of supported object policy types. A object policy type is an
25    * implementation on how to manage parameters in the query string that wants to
26    * modify objects in page. They are usually on the form of
27    * 'Space.PageClass_0_prop. In the default implementation of XWiki, these
28    * parameters will initialize values of properties of existing object (see
29    * 'UPDATE').
30    *
31    * The second implementation, called 'UDPATE_OR_CREATE' will also create objects
32    * if they don't exist. For example, let's take a page that contains one object
33    * Space.PageClass. Given the following parameters:
34    * <ul>
35    * <li>Space.PageClass_0_prop=abc</li>
36    * <li>Space.PageClass_1_prop=def</li>
37    * <li>Space.PageClass_2_prop=ghi</li>
38    * <li>Space.PageClass_6_prop=jkl</li>
39    * </ul>
40    *
41    * The object number 0 will have it's property initialized with 'abc'. The
42    * objects number 1 and 2 will be created and respectively initialized with
43    * 'def' and 'ghi'. The final parameter will be ignored since the number doesn't
44    * refer to a following number.
45    *
46    * @version $Id: 582f673d6f7b2626ccc237ac182329f102bbc0ce $
47    * @since 7.0RC1
48    */
 
49    public enum ObjectPolicyType {
50    /** Only update objects. */
51    UPDATE("update"),
52   
53    /** Update and/or create objects. */
54    UPDATE_OR_CREATE("updateOrCreate");
55   
56    /** Name that is used in HTTP parameters to specify the object policy. */
57    private final String name;
58   
59    /**
60    * @param name The string name corresponding to the object policy type.
61    */
 
62  52 toggle ObjectPolicyType(String name) {
63  52 this.name = name;
64    }
65   
66    /**
67    * @return The string name corresponding to the object policy type.
68    */
 
69  3677 toggle public String getName() {
70  3677 return this.name;
71    }
72   
73    /**
74    * @param name The string name corresponding to the object policy type.
75    * @return The ObjectPolicyType corresponding to the parameter 'name'.
76    */
 
77  1840 toggle public static ObjectPolicyType forName(String name) {
78  1840 for (ObjectPolicyType type : values()) {
79  3678 if (type.getName().equals(name)) {
80  36 return type;
81    }
82    }
83  1804 return null;
84    }
85    }