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.LinkedHashMap;
19  
20  import javax.persistence.Column;
21  import javax.persistence.Entity;
22  import javax.persistence.Id;
23  import javax.persistence.PrePersist;
24  import javax.persistence.PreUpdate;
25  import javax.persistence.Table;
26  
27  import org.apache.ojb.broker.PersistenceBroker;
28  import org.apache.ojb.broker.PersistenceBrokerException;
29  import org.kuali.rice.kew.doctype.bo.DocumentTypeEBO;
30  import org.kuali.rice.kim.bo.role.KimResponsibility;
31  import org.kuali.rice.kim.bo.types.dto.AttributeSet;
32  import org.kuali.rice.kns.bo.PersistableBusinessObjectBase;
33  
34  /**
35   * This is a description of what this class does - jonathan don't forget to fill this in. 
36   * 
37   * @author Kuali Rice Team (rice.collab@kuali.org)
38   *
39   */
40  @Entity
41  @Table(name="KRIM_RSP_T")
42  public class ReviewResponsibility extends PersistableBusinessObjectBase {
43  
44  	private static final long serialVersionUID = 1L;
45  
46  	public static final String ACTION_DETAILS_AT_ROLE_MEMBER_LEVEL_FIELD_NAME = "actionDetailsAtRoleMemberLevel";
47  	// standard responsibility attributes 
48  	@Id
49  	@Column(name="RSP_ID")
50  	protected String responsibilityId;
51  	protected String namespaceCode;
52  	protected String name;
53  	protected String description;
54  	protected boolean active;
55  
56  	// review responsibility standard properties
57  	protected String documentTypeName;
58  	protected String routeNodeName;
59  	protected boolean actionDetailsAtRoleMemberLevel;
60  	protected boolean required;
61  	protected String qualifierResolverProvidedIdentifier;
62  
63  	protected DocumentTypeEBO documentType;
64  	
65  	public ReviewResponsibility() {
66  	}
67  	
68  	public ReviewResponsibility( KimResponsibility resp ) {
69  		loadFromKimResponsibility(resp);
70  	}
71  	
72  	public void loadFromKimResponsibility( KimResponsibility resp ) {
73      	setResponsibilityId( resp.getResponsibilityId() );
74      	setNamespaceCode( resp.getNamespaceCode() );
75      	setName( resp.getName() );
76      	setDescription( resp.getDescription() );
77      	setActive( resp.isActive() );
78      	AttributeSet respDetails = resp.getDetails();
79      	setDocumentTypeName( respDetails.get( KimAttributes.DOCUMENT_TYPE_NAME ) );
80      	setRouteNodeName( respDetails.get( KimAttributes.ROUTE_NODE_NAME ) );
81      	setActionDetailsAtRoleMemberLevel( Boolean.valueOf( respDetails.get( KimAttributes.ACTION_DETAILS_AT_ROLE_MEMBER_LEVEL ) ) );
82      	setRequired( Boolean.valueOf( respDetails.get( KimAttributes.REQUIRED ) ) );
83      	setQualifierResolverProvidedIdentifier( respDetails.get( KimAttributes.QUALIFIER_RESOLVER_PROVIDED_IDENTIFIER ) );
84  	}
85  	
86  	/**
87  	 * @return the responsibilityId
88  	 */
89  	public String getResponsibilityId() {
90  		return this.responsibilityId;
91  	}
92  
93  	/**
94  	 * @param responsibilityId the responsibilityId to set
95  	 */
96  	public void setResponsibilityId(String responsibilityId) {
97  		this.responsibilityId = responsibilityId;
98  	}
99  
100 	/**
101 	 * @return the namespaceCode
102 	 */
103 	public String getNamespaceCode() {
104 		return this.namespaceCode;
105 	}
106 
107 	/**
108 	 * @param namespaceCode the namespaceCode to set
109 	 */
110 	public void setNamespaceCode(String namespaceCode) {
111 		this.namespaceCode = namespaceCode;
112 	}
113 
114 	/**
115 	 * @return the name
116 	 */
117 	public String getName() {
118 		return this.name;
119 	}
120 
121 	/**
122 	 * @param name the name to set
123 	 */
124 	public void setName(String name) {
125 		this.name = name;
126 	}
127 
128 	/**
129 	 * @return the description
130 	 */
131 	public String getDescription() {
132 		return this.description;
133 	}
134 
135 	/**
136 	 * @param description the description to set
137 	 */
138 	public void setDescription(String description) {
139 		this.description = description;
140 	}
141 
142 	/**
143 	 * @return the active
144 	 */
145 	public boolean isActive() {
146 		return this.active;
147 	}
148 
149 	/**
150 	 * @param active the active to set
151 	 */
152 	public void setActive(boolean active) {
153 		this.active = active;
154 	}
155 
156 	/**
157 	 * @return the documentTypeName
158 	 */
159 	public String getDocumentTypeName() {
160 		return this.documentTypeName;
161 	}
162 
163 	/**
164 	 * @param documentTypeName the documentTypeName to set
165 	 */
166 	public void setDocumentTypeName(String documentTypeName) {
167 		this.documentTypeName = documentTypeName;
168 	}
169 
170 	/**
171 	 * @return the routeNodeName
172 	 */
173 	public String getRouteNodeName() {
174 		return this.routeNodeName;
175 	}
176 
177 	/**
178 	 * @param routeNodeName the routeNodeName to set
179 	 */
180 	public void setRouteNodeName(String routeNodeName) {
181 		this.routeNodeName = routeNodeName;
182 	}
183 
184 	/**
185 	 * @return the actionDetailsAtRoleMemberLevel
186 	 */
187 	public boolean isActionDetailsAtRoleMemberLevel() {
188 		return this.actionDetailsAtRoleMemberLevel;
189 	}
190 
191 	/**
192 	 * @param actionDetailsAtRoleMemberLevel the actionDetailsAtRoleMemberLevel to set
193 	 */
194 	public void setActionDetailsAtRoleMemberLevel(
195 			boolean actionDetailsAtRoleMemberLevel) {
196 		this.actionDetailsAtRoleMemberLevel = actionDetailsAtRoleMemberLevel;
197 	}
198 
199 	/**
200 	 * @return the required
201 	 */
202 	public boolean isRequired() {
203 		return this.required;
204 	}
205 
206 	/**
207 	 * @param required the required to set
208 	 */
209 	public void setRequired(boolean required) {
210 		this.required = required;
211 	}
212 
213 	/**
214 	 * @return the qualifierResolverProvidedIdentifier
215 	 */
216 	public String getQualifierResolverProvidedIdentifier() {
217 		return this.qualifierResolverProvidedIdentifier;
218 	}
219 
220 	/**
221 	 * @param qualifierResolverProvidedIdentifier the qualifierResolverProvidedIdentifier to set
222 	 */
223 	public void setQualifierResolverProvidedIdentifier(
224 			String qualifierResolverProvidedIdentifier) {
225 		this.qualifierResolverProvidedIdentifier = qualifierResolverProvidedIdentifier;
226 	}
227 
228 	@SuppressWarnings("unchecked")
229 	@Override
230 	protected LinkedHashMap toStringMapper() {
231 		LinkedHashMap<String,Object> m = new LinkedHashMap<String, Object>();
232 		m.put("responsibilityId", responsibilityId);
233 		m.put("namespaceCode", namespaceCode);
234 		m.put("name", name);
235 		m.put("active", active);
236 		m.put("documentTypeName", documentTypeName);
237 		m.put("routeNodeName", routeNodeName);
238 		m.put("required", required);
239 		m.put("actionDetailsAtRoleMemberLevel", actionDetailsAtRoleMemberLevel);
240 		m.put("qualifierResolverProvidedIdentifier", qualifierResolverProvidedIdentifier);
241 		return m;
242 	}
243 
244 	public void refresh() {
245 		// do nothing - not a persistable object
246 	}
247 	
248 	@Override
249 	public void refreshNonUpdateableReferences() {
250 		// do nothing - not a persistable object
251 	}
252 	@Override
253 	public void refreshReferenceObject(String referenceObjectName) {
254 		// do nothing - not a persistable object
255 	}
256 
257 	/**
258 	 * This overridden method ...
259 	 * 
260 	 * @see org.kuali.rice.kns.bo.PersistableBusinessObjectBase#beforeInsert()
261 	 */
262 	@Override
263 	@PrePersist
264 	public void beforeInsert() {
265 		throw new UnsupportedOperationException( "This object should never be persisted.");
266 	}
267 	
268 	/**
269 	 * This overridden method ...
270 	 * 
271 	 * @see org.kuali.rice.kns.bo.PersistableBusinessObjectBase#beforeUpdate()
272 	 */
273 	@Override
274 	@PreUpdate
275 	public void beforeUpdate() {
276 		throw new UnsupportedOperationException( "This object should never be persisted.");
277 	}
278 	
279 	/**
280 	 * This overridden method ...
281 	 * 
282 	 * @see org.kuali.rice.kns.bo.PersistableBusinessObjectBase#beforeInsert(org.apache.ojb.broker.PersistenceBroker)
283 	 */
284 	@Override
285 	public void beforeInsert(PersistenceBroker persistenceBroker)
286 			throws PersistenceBrokerException {
287 		throw new UnsupportedOperationException( "This object should never be persisted.");
288 	}
289 	
290 	/**
291 	 * This overridden method ...
292 	 * 
293 	 * @see org.kuali.rice.kns.bo.PersistableBusinessObjectBase#beforeUpdate(org.apache.ojb.broker.PersistenceBroker)
294 	 */
295 	@Override
296 	public void beforeUpdate(PersistenceBroker persistenceBroker) {
297 		throw new UnsupportedOperationException( "This object should never be persisted.");
298 	}
299 
300 	/**
301 	 * This overridden method ...
302 	 * 
303 	 * @see org.kuali.rice.kns.bo.PersistableBusinessObjectBase#beforeDelete(org.apache.ojb.broker.PersistenceBroker)
304 	 */
305 	@Override
306 	public void beforeDelete(PersistenceBroker persistenceBroker)
307 			throws PersistenceBrokerException {
308 		throw new UnsupportedOperationException( "This object should never be persisted.");
309 	}
310 
311 	public DocumentTypeEBO getDocumentType() {
312 		return this.documentType;
313 	}
314 
315 	public void setDocumentType(DocumentTypeEBO documentType) {
316 		this.documentType = documentType;
317 	}
318 }