1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 package org.apache.directory.api.ldap.aci;
21
22
23 import java.util.Collection;
24 import java.util.Collections;
25
26
27
28
29
30
31
32
33 public class UserPermission extends Permission
34 {
35
36 private final Collection<ProtectedItem> protectedItems;
37
38
39
40
41
42
43
44
45
46
47
48
49
50 public UserPermission( Integer precedence, Collection<GrantAndDenial> grantsAndDenials,
51 Collection<ProtectedItem> protectedItems )
52 {
53 super( precedence, grantsAndDenials );
54
55 this.protectedItems = Collections.unmodifiableCollection( protectedItems );
56 }
57
58
59
60
61
62
63
64 public Collection<ProtectedItem> getProtectedItems()
65 {
66 return protectedItems;
67 }
68
69
70
71
72
73 @Override
74 public String toString()
75 {
76 StringBuilder buf = new StringBuilder();
77
78 buf.append( "{ " );
79
80 if ( getPrecedence() != null )
81 {
82 buf.append( "precedence " );
83 buf.append( getPrecedence() );
84 buf.append( ", " );
85 }
86
87 buf.append( "protectedItems { " );
88
89 boolean isFirst = true;
90
91 for ( ProtectedItem item : protectedItems )
92 {
93 if ( isFirst )
94 {
95 isFirst = false;
96 }
97 else
98 {
99 buf.append( ", " );
100 }
101
102 buf.append( item.toString() );
103 }
104
105 buf.append( " }, grantsAndDenials { " );
106
107 isFirst = true;
108
109 for ( GrantAndDenial grantAndDenial : getGrantsAndDenials() )
110 {
111 if ( isFirst )
112 {
113 isFirst = false;
114 }
115 else
116 {
117 buf.append( ", " );
118 }
119
120 buf.append( grantAndDenial.toString() );
121 }
122
123 buf.append( " } }" );
124
125 return buf.toString();
126 }
127 }