001 /*
002 * Copyright 2007-2009 The Kuali Foundation
003 *
004 * Licensed under the Educational Community License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 * http://www.opensource.org/licenses/ecl2.php
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016 package org.kuali.rice.kim.bo.impl;
017
018 import java.util.LinkedHashMap;
019
020 import javax.persistence.Column;
021 import javax.persistence.Entity;
022 import javax.persistence.Id;
023 import javax.persistence.PrePersist;
024 import javax.persistence.PreUpdate;
025 import javax.persistence.Table;
026
027 import org.apache.ojb.broker.PersistenceBroker;
028 import org.apache.ojb.broker.PersistenceBrokerException;
029 import org.kuali.rice.kew.doctype.bo.DocumentTypeEBO;
030 import org.kuali.rice.kim.bo.role.KimResponsibility;
031 import org.kuali.rice.kim.bo.types.dto.AttributeSet;
032 import org.kuali.rice.kns.bo.PersistableBusinessObjectBase;
033
034 /**
035 * This is a description of what this class does - jonathan don't forget to fill this in.
036 *
037 * @author Kuali Rice Team (rice.collab@kuali.org)
038 *
039 */
040 @Entity
041 @Table(name="KRIM_RSP_T")
042 public class ReviewResponsibility extends PersistableBusinessObjectBase {
043
044 private static final long serialVersionUID = 1L;
045
046 public static final String ACTION_DETAILS_AT_ROLE_MEMBER_LEVEL_FIELD_NAME = "actionDetailsAtRoleMemberLevel";
047 // standard responsibility attributes
048 @Id
049 @Column(name="RSP_ID")
050 protected String responsibilityId;
051 protected String namespaceCode;
052 protected String name;
053 protected String description;
054 protected boolean active;
055
056 // review responsibility standard properties
057 protected String documentTypeName;
058 protected String routeNodeName;
059 protected boolean actionDetailsAtRoleMemberLevel;
060 protected boolean required;
061 protected String qualifierResolverProvidedIdentifier;
062
063 protected DocumentTypeEBO documentType;
064
065 public ReviewResponsibility() {
066 }
067
068 public ReviewResponsibility( KimResponsibility resp ) {
069 loadFromKimResponsibility(resp);
070 }
071
072 public void loadFromKimResponsibility( KimResponsibility resp ) {
073 setResponsibilityId( resp.getResponsibilityId() );
074 setNamespaceCode( resp.getNamespaceCode() );
075 setName( resp.getName() );
076 setDescription( resp.getDescription() );
077 setActive( resp.isActive() );
078 AttributeSet respDetails = resp.getDetails();
079 setDocumentTypeName( respDetails.get( KimAttributes.DOCUMENT_TYPE_NAME ) );
080 setRouteNodeName( respDetails.get( KimAttributes.ROUTE_NODE_NAME ) );
081 setActionDetailsAtRoleMemberLevel( Boolean.valueOf( respDetails.get( KimAttributes.ACTION_DETAILS_AT_ROLE_MEMBER_LEVEL ) ) );
082 setRequired( Boolean.valueOf( respDetails.get( KimAttributes.REQUIRED ) ) );
083 setQualifierResolverProvidedIdentifier( respDetails.get( KimAttributes.QUALIFIER_RESOLVER_PROVIDED_IDENTIFIER ) );
084 }
085
086 /**
087 * @return the responsibilityId
088 */
089 public String getResponsibilityId() {
090 return this.responsibilityId;
091 }
092
093 /**
094 * @param responsibilityId the responsibilityId to set
095 */
096 public void setResponsibilityId(String responsibilityId) {
097 this.responsibilityId = responsibilityId;
098 }
099
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 }