View Javadoc

1   /**
2    * Copyright 2005-2013 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.krad.bo;
17  
18  import org.apache.commons.lang.StringUtils;
19  import org.kuali.rice.kew.api.KewApiConstants;
20  import org.kuali.rice.kew.api.util.CodeTranslator;
21  
22  import javax.persistence.Column;
23  import javax.persistence.Id;
24  import javax.persistence.MappedSuperclass;
25  import javax.persistence.Transient;
26  import java.util.Map;
27  
28  
29  /**
30   * TODO we should not be referencing kew constants from this class and wedding ourselves to that workflow application Ad Hoc Route
31   * Recipient Business Object
32   *
33   * @author Kuali Rice Team (rice.collab@kuali.org)
34   */
35  @MappedSuperclass
36  public class AdHocRouteRecipient extends PersistableBusinessObjectBase {
37      private static final long serialVersionUID = -6499610180752232494L;
38  
39      private static Map actionRequestCds;
40      public static final Integer PERSON_TYPE = new Integer(0);
41      public static final Integer WORKGROUP_TYPE = new Integer(1);
42  
43      @Id
44  	@Column(name="RECIP_TYP_CD")
45  	protected Integer type;
46  
47      @Id
48  	@Column(name="ACTN_RQST_CD")
49  	protected String actionRequested;
50  
51      @Id
52  	@Column(name="ACTN_RQST_RECIP_ID")
53  	protected String id; // can be networkId or group id
54  
55      @Transient
56      protected String name;
57  
58      @Column(name="DOC_HDR_ID")
59  	protected String documentNumber;
60  
61      public AdHocRouteRecipient() {
62          // set some defaults that can be overridden
63          this.actionRequested = KewApiConstants.ACTION_REQUEST_APPROVE_REQ;
64          this.versionNumber = new Long(1);
65      }
66  
67      public String getActionRequested() {
68          return actionRequested;
69      }
70  
71      public void setActionRequested(String actionRequested) {
72          this.actionRequested = actionRequested;
73      }
74  
75      public String getId() {
76          return id;
77      }
78  
79      public void setId(String id) {
80          this.id = id;
81      }
82  
83      public String getName() {
84          return name;
85      }
86  
87      public void setName(String name) {
88          this.name = name;
89      }
90  
91      public Integer getType() {
92          return type;
93      }
94  
95      public void setType(Integer type) {
96          this.type = type;
97      }
98  
99      public void setdocumentNumber (String documentNumber){
100         this.documentNumber = documentNumber;
101     }
102 
103     public String getdocumentNumber (){
104         return documentNumber;
105     }
106 
107     public String getActionRequestedValue() {
108         String actionRequestedValue = null;
109         if (StringUtils.isNotBlank(getActionRequested())) {
110             actionRequestCds.clear();
111             actionRequestCds.putAll(CodeTranslator.arLabels);
112             actionRequestedValue = (String) actionRequestCds.get(getActionRequested());
113         }
114 
115         return actionRequestedValue;
116     }
117 }