1. Project Clover database Tue Dec 20 2016 21:24:09 CET
  2. Package org.xwiki.security.authorization.cache.internal

File DefaultSecurityShadowEntry.java

 

Coverage histogram

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

Code metrics

4
11
5
1
86
45
7
0.64
2.2
5
1.4

Classes

Class Line # Actions
DefaultSecurityShadowEntry 33 11 0% 7 13
0.3535%
 

Contributing tests

This file is covered by 16 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   
21    package org.xwiki.security.authorization.cache.internal;
22   
23    import org.apache.commons.lang3.builder.HashCodeBuilder;
24    import org.xwiki.security.SecurityReference;
25    import org.xwiki.security.UserSecurityReference;
26    import org.xwiki.security.authorization.cache.SecurityShadowEntry;
27   
28    /**
29    * Default implementation of the security shadow entry.
30    *
31    * @version $Id: 7a3762c27c90f2b64930b7d8754422074a5bd083 $
32    */
 
33    public class DefaultSecurityShadowEntry implements SecurityShadowEntry
34    {
35    /** The wiki where the user is shadowed. */
36    private SecurityReference wikiReference;
37   
38    /** The user/group shadowed by this entry. */
39    private UserSecurityReference user;
40   
41    /**
42    * Build a new shadow entry from given references.
43    * @param user The user shadowed by this entry.
44    * @param wikiReference The wiki where the user is shadowed.
45    */
 
46  30 toggle DefaultSecurityShadowEntry(UserSecurityReference user, SecurityReference wikiReference) {
47  30 this.user = user;
48  30 this.wikiReference = wikiReference;
49    }
50   
 
51  38 toggle @Override
52    public SecurityReference getWikiReference()
53    {
54  38 return wikiReference;
55    }
56   
 
57  97 toggle @Override
58    public SecurityReference getReference()
59    {
60  97 return user;
61    }
62   
 
63  0 toggle @Override
64    public boolean equals(Object object)
65    {
66  0 if (object == this) {
67  0 return true;
68    }
69  0 if (!(object instanceof SecurityShadowEntry)) {
70  0 return false;
71    }
72  0 SecurityShadowEntry other = (SecurityShadowEntry) object;
73   
74  0 return this.getReference().equals(other.getReference())
75    && this.getWikiReference().equals(other.getWikiReference());
76    }
77   
 
78  0 toggle @Override
79    public int hashCode()
80    {
81  0 return new HashCodeBuilder()
82    .append(this.getWikiReference())
83    .append(this.getReference())
84    .toHashCode();
85    }
86    }