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