1. Project Clover database Tue Dec 20 2016 21:24:09 CET
  2. Package org.xwiki.wiki.provisioning

File WikiProvisioningJobRequest.java

 

Coverage histogram

../../../../img/srcFileCovDistChart6.png
69% of files have more coverage

Code metrics

4
23
10
1
159
72
12
0.52
2.3
10
1.2

Classes

Class Line # Actions
WikiProvisioningJobRequest 35 23 0% 12 15
0.594594659.5%
 

Contributing tests

This file is covered by 1 test. .

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.wiki.provisioning;
21   
22    import java.util.List;
23   
24    import org.apache.commons.lang3.builder.EqualsBuilder;
25    import org.apache.commons.lang3.builder.HashCodeBuilder;
26    import org.xwiki.job.AbstractRequest;
27    import org.xwiki.model.reference.DocumentReference;
28   
29    /**
30    * Base class for {@link org.xwiki.job.Request} implementations used by wiki provisioners.
31    *
32    * @since 5.3M2
33    * @version $Id: 6c9307e74389704c7ef4ebb6e16ace17b70fbf71 $
34    */
 
35    public class WikiProvisioningJobRequest extends AbstractRequest
36    {
37    /**
38    * Name of the property that stores the id of the wiki to provision.
39    */
40    public static final String PROPERTY_WIKI_ID = "wikiprovisioning.wikiId";
41   
42    /**
43    * Name of the property that stores the property used by the provisioning job.
44    */
45    public static final String PROPERTY_PROVISIONING_JOB_PARAMETER = "wikiprovisioning.parameter";
46   
47    /**
48    * Name of the property that stores the user that is provisioning the wiki.
49    */
50    public static final String PROPERTY_PROVISIONING_USER = "wikiprovisioning.user";
51   
52    /**
53    * Constructor.
54    * @param id id of the job request
55    * @param wikiId id of the wiki to provision
56    * @param parameter the parameter to be used by the provisioning job
57    * @deprecated use {@link #WikiProvisioningJobRequest(List, String, Object, DocumentReference)}
58    */
 
59  0 toggle @Deprecated
60    public WikiProvisioningJobRequest(List<String> id, String wikiId, Object parameter)
61    {
62  0 setId(id);
63  0 setWikiId(wikiId);
64  0 setProvisioningJobParameter(parameter);
65    }
66   
67    /**
68    * Constructor.
69    * @param id id of the job request
70    * @param wikiId id of the wiki to provision
71    * @param parameter the parameter to be used by the provisioning job
72    * @param provisioningUser the user who executes the provisioning job
73    * @since 6.3M1
74    */
 
75  2 toggle public WikiProvisioningJobRequest(List<String> id, String wikiId, Object parameter,
76    DocumentReference provisioningUser)
77    {
78  2 setId(id);
79  2 setWikiId(wikiId);
80  2 setProvisioningJobParameter(parameter);
81  2 setProvisioningUser(provisioningUser);
82    }
83   
84    /**
85    * @param wikiId if of the wiki to provision
86    */
 
87  2 toggle public void setWikiId(String wikiId)
88    {
89  2 setProperty(PROPERTY_WIKI_ID, wikiId);
90    }
91   
92    /**
93    * @return the id of the wiki to provision
94    */
 
95  4 toggle public String getWikiId()
96    {
97  4 return getProperty(PROPERTY_WIKI_ID);
98    }
99   
100    /**
101    * @param parameter the parameter to be used by the provisioning job
102    */
 
103  2 toggle public void setProvisioningJobParameter(Object parameter)
104    {
105  2 setProperty(PROPERTY_PROVISIONING_JOB_PARAMETER, parameter);
106    }
107   
108    /**
109    * @return the parameter to be used by the provisioning job
110    */
 
111  4 toggle public Object getProvisioningJobParameter()
112    {
113  4 return getProperty(PROPERTY_PROVISIONING_JOB_PARAMETER);
114    }
115   
116    /**
117    * @param userReference the user who executes the provisioning job
118    * @since 6.3M1
119    */
 
120  2 toggle public void setProvisioningUser(DocumentReference userReference)
121    {
122  2 setProperty(PROPERTY_PROVISIONING_USER, userReference);
123    }
124   
125    /**
126    * @return the user who executes the provisioning job
127    * @since 6.3M1
128    */
 
129  0 toggle public DocumentReference getProvisioningUser()
130    {
131  0 return getProperty(PROPERTY_PROVISIONING_USER);
132    }
133   
 
134  2 toggle @Override
135    public boolean equals(Object o)
136    {
137  2 if (this == o) {
138  0 return true;
139    }
140   
141  2 if (!(o instanceof WikiProvisioningJobRequest)) {
142  0 return false;
143    }
144   
145  2 WikiProvisioningJobRequest r = (WikiProvisioningJobRequest) o;
146  2 return new EqualsBuilder().append(r.getId(), getId()).append(r.getWikiId(), getWikiId()).append(
147    r.getProvisioningJobParameter(), getProvisioningJobParameter()).isEquals();
148    }
149   
 
150  0 toggle @Override
151    public int hashCode()
152    {
153  0 HashCodeBuilder builder = new HashCodeBuilder();
154  0 builder.append(getId());
155  0 builder.append(getWikiId()).append(getProvisioningJobParameter());
156  0 return builder.hashCode();
157    }
158   
159    }