View Javadoc
1   /**
2    * Copyright 2005-2015 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.io.Serializable;
19  import java.util.HashMap;
20  import java.util.Map;
21  import java.util.UUID;
22  
23  import javax.persistence.Column;
24  import javax.persistence.Id;
25  import javax.persistence.MappedSuperclass;
26  import javax.persistence.PrePersist;
27  import javax.persistence.Transient;
28  
29  import org.apache.commons.lang.StringUtils;
30  import org.kuali.rice.kew.api.KewApiConstants;
31  import org.kuali.rice.kew.api.util.CodeTranslator;
32  
33  
34  /**
35   * Ad Hoc Route Recipient Business Object
36   *
37   * TODO we should not be referencing kew constants from this class and wedding ourselves to that workflow application
38   *
39   * @author Kuali Rice Team (rice.collab@kuali.org)
40   */
41  @SuppressWarnings("deprecation")
42  @MappedSuperclass
43  public class AdHocRouteRecipient implements Serializable {
44      private static final long serialVersionUID = -6499610180752232494L;
45  
46      private static Map<String, String> actionRequestCds = null;
47      public static final Integer PERSON_TYPE = new Integer(0);
48      public static final Integer WORKGROUP_TYPE = new Integer(1);
49  
50      @Id
51      @Column(name="DOC_HDR_ID",length=14)
52      protected String documentNumber;
53  
54      @Id
55  	@Column(name="RECIP_TYP_CD",length=1)
56  	protected Integer type;
57  
58      @Id
59  	@Column(name="ACTN_RQST_CD",length=30)
60  	protected String actionRequested = KewApiConstants.ACTION_REQUEST_APPROVE_REQ;
61  
62      @Id
63  	@Column(name="ACTN_RQST_RECIP_ID",length=70)
64  	protected String id; // can be networkId or group id
65  
66      // This is just here so we don't need to change the data model
67      @Column(name="OBJ_ID", length=36, nullable = false)
68      @Deprecated
69      private String objectId;
70  
71      @Transient
72      @Deprecated
73      private Integer versionNumber;
74  
75      @Transient
76      protected String name;
77  
78      public String getActionRequested() {
79          return actionRequested;
80      }
81  
82      public void setActionRequested(String actionRequested) {
83          this.actionRequested = actionRequested;
84      }
85  
86      public String getId() {
87          return id;
88      }
89  
90      public void setId(String id) {
91          this.id = id;
92      }
93  
94      public String getName() {
95          return name;
96      }
97  
98      public void setName(String name) {
99          this.name = name;
100     }
101 
102     public Integer getType() {
103         return type;
104     }
105 
106     public void setType(Integer type) {
107         this.type = type;
108     }
109 
110     public void setdocumentNumber (String documentNumber){
111         this.documentNumber = documentNumber;
112     }
113 
114     public String getdocumentNumber (){
115         return documentNumber;
116     }
117 
118     public String getActionRequestedValue() {
119         String actionRequestedValue = null;
120         if (StringUtils.isNotBlank(getActionRequested())) {
121             if ( actionRequestCds == null ) {
122                 Map<String,String> temp = new HashMap<String, String>();
123                 temp.putAll(CodeTranslator.arLabels);
124                 actionRequestCds = temp;
125             }
126             actionRequestedValue = (String) actionRequestCds.get(getActionRequested());
127         }
128 
129         return actionRequestedValue;
130     }
131 
132     @PrePersist
133     @Deprecated
134     public void prePersist() {
135         objectId = UUID.randomUUID().toString();
136     }
137 
138     @Deprecated
139     public void refresh() {
140         // Do nothing - just here since we needed to implement BusinessObject
141     }
142 
143     @Deprecated
144     public Integer getVersionNumber() {
145         return this.versionNumber;
146     }
147 
148     @Deprecated
149     public void setVersionNumber(Integer versionNumber) {
150         this.versionNumber = versionNumber;
151     }
152 }