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

File MemberCandidacy.java

 

Coverage histogram

../../../../img/srcFileCovDistChart4.png
78% of files have more coverage

Code metrics

0
29
24
3
292
128
24
0.83
1.21
8
1

Classes

Class Line # Actions
MemberCandidacy 29 29 0% 24 32
0.396226439.6%
MemberCandidacy.CandidateType 34 0 - 0 0
-1.0 -
MemberCandidacy.Status 49 0 - 0 0
-1.0 -
 

Contributing tests

This file is covered by 23 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.wiki.user;
21   
22    import java.util.Date;
23   
24    /**
25    * Represents the invitation or the request to join a wiki.
26    * @since 5.3M2
27    * @version $Id: d29d45ac8a05b6b9d55c29120afca34edf8196ec $
28    */
 
29    public class MemberCandidacy
30    {
31    /**
32    * Type of the candidacy.
33    */
 
34    public enum CandidateType
35    {
36    /**
37    * An admin has invited the user to join the wiki.
38    */
39    INVITATION,
40    /**
41    * The user has requested to join the wiki.
42    */
43    REQUEST
44    }
45   
46    /**
47    * Status of the candidacy.
48    */
 
49    public enum Status
50    {
51    /**
52    * The candidacy is waiting to be reviewed.
53    */
54    PENDING,
55    /**
56    * The candidacy has been accepted.
57    */
58    ACCEPTED,
59    /**
60    * The candidacy has been rejected.
61    */
62    REJECTED
63    }
64   
65    private int id;
66   
67    private String wikiId;
68   
69    private String userId;
70   
71    private String userComment;
72   
73    private String adminId;
74   
75    private String adminComment;
76   
77    private String adminPrivateComment;
78   
79    private CandidateType type;
80   
81    private Status status;
82   
83    private Date dateOfCreation;
84   
85    private Date dateOfClosure;
86   
87    /**
88    * Constructor.
89    */
 
90  3 toggle public MemberCandidacy()
91    {
92  3 this.status = Status.PENDING;
93  3 this.dateOfCreation = new Date();
94    }
95   
96    /**
97    * Constructor.
98    *
99    * @param wikiId Id of the wiki to join
100    * @param userId Id of the user who ask to join or the user to invite
101    * @param type type of candidacy
102    */
 
103  22 toggle public MemberCandidacy(String wikiId, String userId, CandidateType type)
104    {
105  22 this.wikiId = wikiId;
106  22 this.userId = userId;
107  22 this.type = type;
108  22 this.status = Status.PENDING;
109  22 this.dateOfCreation = new Date();
110    }
111   
112    /**
113    * @param id Id to set
114    */
 
115  3 toggle public void setId(int id)
116    {
117  3 this.id = id;
118    }
119   
120    /**
121    * @return the id of the candidacy
122    */
 
123  3 toggle public int getId()
124    {
125  3 return id;
126    }
127   
128    /**
129    * @return id of the wiki to join
130    */
 
131  19 toggle public String getWikiId()
132    {
133  19 return wikiId;
134    }
135   
136    /**
137    * @param wikiId id of the wiki to join
138    */
 
139  0 toggle public void setWikiId(String wikiId)
140    {
141  0 this.wikiId = wikiId;
142    }
143   
144    /**
145    * The user is the person who ask or has been invited to join the wiki.
146    * @return id of the user
147    */
 
148  22 toggle public String getUserId()
149    {
150  22 return userId;
151    }
152   
153    /**
154    * @param userId id of the user
155    */
 
156  0 toggle public void setUserId(String userId)
157    {
158  0 this.userId = userId;
159    }
160   
161    /**
162    * The admin is the person who has sent the invitation or who review the join request.
163    * @return the id of the Admin
164    */
 
165  0 toggle public String getAdminId()
166    {
167  0 return adminId;
168    }
169   
170    /**
171    * @param adminId if of the admin
172    */
 
173  0 toggle public void setAdminId(String adminId)
174    {
175  0 this.adminId = adminId;
176    }
177   
178    /**
179    * Message of the user which motivates his request or message about his acceptance/refusal of the invitation.
180    * @return the user comment
181    */
 
182  0 toggle public String getUserComment()
183    {
184  0 return userComment;
185    }
186   
187    /**
188    * @param userComment the user comment
189    */
 
190  0 toggle public void setUserComment(String userComment)
191    {
192  0 this.userComment = userComment;
193    }
194   
195    /**
196    * Message of the admin that goes along the invitation or about his acceptance/refusal of the request.
197    * @return the admin comment
198    */
 
199  0 toggle public String getAdminComment()
200    {
201  0 return adminComment;
202    }
203   
204    /**
205    * @param adminComment the admin comment
206    */
 
207  0 toggle public void setAdminComment(String adminComment)
208    {
209  0 this.adminComment = adminComment;
210    }
211   
212    /**
213    * Private message about the candidacy that only the admin can see.
214    * @return the private message
215    */
 
216  4 toggle public String getAdminPrivateComment()
217    {
218  4 return adminPrivateComment;
219    }
220   
221    /**
222    * @param adminPrivateComment the private message
223    */
 
224  7 toggle public void setAdminPrivateComment(String adminPrivateComment)
225    {
226  7 this.adminPrivateComment = adminPrivateComment;
227    }
228   
229    /**
230    * @param type the type of candidacy
231    */
 
232  0 toggle public void setType(CandidateType type)
233    {
234  0 this.type = type;
235    }
236   
237    /**
238    * @return the type of candidacy
239    */
 
240  0 toggle public CandidateType getType()
241    {
242  0 return type;
243    }
244   
245    /**
246    * @return the status of the request
247    */
 
248  0 toggle public Status getStatus()
249    {
250  0 return status;
251    }
252   
253    /**
254    * @param status the status to set
255    */
 
256  0 toggle public void setStatus(Status status)
257    {
258  0 this.status = status;
259    }
260   
261    /**
262    * @return the date of the creation of this candidacy
263    */
 
264  0 toggle public Date getDateOfCreation()
265    {
266  0 return dateOfCreation;
267    }
268   
269    /**
270    * @param dateOfCreation the date of the creation of this candidacy
271    */
 
272  0 toggle public void setDateOfCreation(Date dateOfCreation)
273    {
274  0 this.dateOfCreation = dateOfCreation;
275    }
276   
277    /**
278    * @return the date this candidacy has been closed.
279    */
 
280  0 toggle public Date getDateOfClosure()
281    {
282  0 return dateOfClosure;
283    }
284   
285    /**
286    * @param dateOfClosure the date this candidacy has been closed.
287    */
 
288  0 toggle public void setDateOfClosure(Date dateOfClosure)
289    {
290  0 this.dateOfClosure = dateOfClosure;
291    }
292    }