View Javadoc

1   /*
2    * Copyright 2007-2009 The Kuali Foundation
3    *
4    * Licensed under the Educational Community License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    * http://www.opensource.org/licenses/ecl2.php
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package org.kuali.rice.kim.bo.impl;
17  
18  import java.util.List;
19  
20  import org.apache.commons.lang.StringUtils;
21  import org.kuali.rice.kim.bo.Person;
22  import org.kuali.rice.kim.bo.role.impl.KimPermissionImpl;
23  import org.kuali.rice.kim.util.KimConstants;
24  import org.kuali.rice.kns.util.TypedArrayList;
25  
26  /**
27   * @author Kuali Rice Team (rice.collab@kuali.org)
28   */
29  public class PermissionImpl extends KimPermissionImpl {
30  
31  	private static final long serialVersionUID = 1L;
32  	
33  	List<RoleImpl> assignedToRoles = new TypedArrayList(RoleImpl.class);
34  	
35  	protected String assignedToRoleNamespaceForLookup;
36  	protected String assignedToRoleNameForLookup;
37  	protected RoleImpl assignedToRole;
38  	protected String assignedToPrincipalNameForLookup;
39  	protected Person assignedToPrincipal;
40  	protected String assignedToGroupNamespaceForLookup;
41  	protected String assignedToGroupNameForLookup;
42  	protected GroupImpl assignedToGroup;
43  	protected String attributeName;
44  	protected String attributeValue;
45  	protected String detailCriteria;
46  	
47  	/**
48  	 * @return the assignedToRoles
49  	 */
50  	public String getAssignedToRolesToDisplay() {
51  		StringBuffer assignedToRolesToDisplay = new StringBuffer();
52  		for(RoleImpl roleImpl: assignedToRoles){
53  			assignedToRolesToDisplay.append(getRoleDetailsToDisplay(roleImpl));
54  		}
55  		return StringUtils.chomp( assignedToRolesToDisplay.toString(), KimConstants.KimUIConstants.COMMA_SEPARATOR);
56  	}
57  
58  	public String getRoleDetailsToDisplay(RoleImpl roleImpl){
59  		return roleImpl.getNamespaceCode().trim()+" "+roleImpl.getRoleName().trim()+KimConstants.KimUIConstants.COMMA_SEPARATOR;
60  	}
61  	
62  	/**
63  	 * @return the assignedToGroupNameForLookup
64  	 */
65  	public String getAssignedToGroupNameForLookup() {
66  		return this.assignedToGroupNameForLookup;
67  	}
68  
69  	/**
70  	 * @param assignedToGroupNameForLookup the assignedToGroupNameForLookup to set
71  	 */
72  	public void setAssignedToGroupNameForLookup(String assignedToGroupNameForLookup) {
73  		this.assignedToGroupNameForLookup = assignedToGroupNameForLookup;
74  	}
75  
76  	/**
77  	 * @return the assignedToGroupNamespaceForLookup
78  	 */
79  	public String getAssignedToGroupNamespaceForLookup() {
80  		return this.assignedToGroupNamespaceForLookup;
81  	}
82  
83  	/**
84  	 * @param assignedToGroupNamespaceForLookup the assignedToGroupNamespaceForLookup to set
85  	 */
86  	public void setAssignedToGroupNamespaceForLookup(
87  			String assignedToGroupNamespaceForLookup) {
88  		this.assignedToGroupNamespaceForLookup = assignedToGroupNamespaceForLookup;
89  	}
90  
91  	/**
92  	 * @return the assignedToPrincipalNameForLookup
93  	 */
94  	public String getAssignedToPrincipalNameForLookup() {
95  		return this.assignedToPrincipalNameForLookup;
96  	}
97  
98  	/**
99  	 * @param assignedToPrincipalNameForLookup the assignedToPrincipalNameForLookup to set
100 	 */
101 	public void setAssignedToPrincipalNameForLookup(
102 			String assignedToPrincipalNameForLookup) {
103 		this.assignedToPrincipalNameForLookup = assignedToPrincipalNameForLookup;
104 	}
105 
106 	/**
107 	 * @return the assignedToRoleNameForLookup
108 	 */
109 	public String getAssignedToRoleNameForLookup() {
110 		return this.assignedToRoleNameForLookup;
111 	}
112 
113 	/**
114 	 * @param assignedToRoleNameForLookup the assignedToRoleNameForLookup to set
115 	 */
116 	public void setAssignedToRoleNameForLookup(String assignedToRoleNameForLookup) {
117 		this.assignedToRoleNameForLookup = assignedToRoleNameForLookup;
118 	}
119 
120 	/**
121 	 * @return the assignedToRoleNamespaceForLookup
122 	 */
123 	public String getAssignedToRoleNamespaceForLookup() {
124 		return this.assignedToRoleNamespaceForLookup;
125 	}
126 
127 	/**
128 	 * @param assignedToRoleNamespaceForLookup the assignedToRoleNamespaceForLookup to set
129 	 */
130 	public void setAssignedToRoleNamespaceForLookup(
131 			String assignedToRoleNamespaceForLookup) {
132 		this.assignedToRoleNamespaceForLookup = assignedToRoleNamespaceForLookup;
133 	}
134 
135 	/**
136 	 * @return the attributeValue
137 	 */
138 	public String getAttributeValue() {
139 		return this.attributeValue;
140 	}
141 
142 	/**
143 	 * @param attributeValue the attributeValue to set
144 	 */
145 	public void setAttributeValue(String attributeValue) {
146 		this.attributeValue = attributeValue;
147 	}
148 
149 	/**
150 	 * @return the assignedToRoles
151 	 */
152 	public List<RoleImpl> getAssignedToRoles() {
153 		return this.assignedToRoles;
154 	}
155 
156 	/**
157 	 * @param assignedToRoles the assignedToRoles to set
158 	 */
159 	public void setAssignedToRoles(List<RoleImpl> assignedToRoles) {
160 		this.assignedToRoles = assignedToRoles;
161 	}
162 
163 	/**
164 	 * @return the assignedToGroup
165 	 */
166 	public GroupImpl getAssignedToGroup() {
167 		return this.assignedToGroup;
168 	}
169 
170 	/**
171 	 * @param assignedToGroup the assignedToGroup to set
172 	 */
173 	public void setAssignedToGroup(GroupImpl assignedToGroup) {
174 		this.assignedToGroup = assignedToGroup;
175 	}
176 
177 	/**
178 	 * @return the assignedToPrincipal
179 	 */
180 	public Person getAssignedToPrincipal() {
181 		return this.assignedToPrincipal;
182 	}
183 
184 	/**
185 	 * @param assignedToPrincipal the assignedToPrincipal to set
186 	 */
187 	public void setAssignedToPrincipal(Person assignedToPrincipal) {
188 		this.assignedToPrincipal = assignedToPrincipal;
189 	}
190 
191 	/**
192 	 * @return the assignedToRole
193 	 */
194 	public RoleImpl getAssignedToRole() {
195 		return this.assignedToRole;
196 	}
197 
198 	/**
199 	 * @param assignedToRole the assignedToRole to set
200 	 */
201 	public void setAssignedToRole(RoleImpl assignedToRole) {
202 		this.assignedToRole = assignedToRole;
203 	}
204 
205 	public String getDetailCriteria() {
206 		return this.detailCriteria;
207 	}
208 
209 	public void setDetailCriteria(String detailCriteria) {
210 		this.detailCriteria = detailCriteria;
211 	}
212 
213 	/**
214 	 * @return the attributeName
215 	 */
216 	public String getAttributeName() {
217 		return this.attributeName;
218 	}
219 
220 	/**
221 	 * @param attributeName the attributeName to set
222 	 */
223 	public void setAttributeName(String attributeName) {
224 		this.attributeName = attributeName;
225 	}
226 
227 }