View Javadoc

1   /**
2    * Copyright 2004-2012 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.hr.time.task;
17  
18  import java.sql.Date;
19  import java.sql.Timestamp;
20  
21  import org.apache.commons.lang.StringUtils;
22  import org.kuali.hr.core.KPMEConstants;
23  import org.kuali.hr.time.HrBusinessObject;
24  import org.kuali.hr.time.service.base.TkServiceLocator;
25  import org.kuali.hr.time.workarea.WorkArea;
26  
27  public class Task extends HrBusinessObject {
28      public static final String CACHE_NAME = KPMEConstants.APPLICATION_NAMESPACE_CODE + "/" + "Task";
29      /**
30       *
31       */
32      private static final long serialVersionUID = 1L;
33  
34      private String tkTaskId;
35      private Long task;
36      private Long workArea;
37      private String tkWorkAreaId;
38      private String description;
39      private String userPrincipalId;
40      private String administrativeDescription;
41  	private WorkArea workAreaObj;
42  	private String workAreaDescription;
43  
44      public String getDescription()
45      {
46      return description;
47      }
48  
49      public void setDescription(String desc)
50      {
51      	this.description = desc;
52      }
53  
54      public String getUserPrincipalId(){
55      	return userPrincipalId;
56      }
57  
58      public void setUserPrincipalId(String pid)
59      {
60      	this.userPrincipalId = pid;
61      }
62  
63      public String getAdministrativeDescription(){
64      	return administrativeDescription;
65      }
66  
67      public void setAdministrativeDescription(String addesc)
68      {
69      	this.administrativeDescription = addesc;
70      }
71  
72  	public String getTkTaskId() {
73  		return tkTaskId;
74  	}
75  
76  	public void setTkTaskId(String tkTaskId) {
77  		this.tkTaskId = tkTaskId;
78  	}
79  
80  	public Long getTask() {
81  		return task;
82  	}
83  
84  	public void setTask(Long task) {
85  		this.task = task;
86  	}
87  
88  	public Long getWorkArea() {
89  		if (this.getTkWorkAreaId() != null &&  workArea == null) {
90          	WorkArea wa = TkServiceLocator.getWorkAreaService().getWorkArea(this.getTkWorkAreaId());
91          	this.setWorkArea((wa != null) ? wa.getWorkArea() : null);
92  		}
93  		
94  		return workArea;
95  	}
96  
97  	public void setWorkArea(Long workArea) {
98  		this.workArea = workArea;
99  	}
100 
101 	public String getTkWorkAreaId() {
102 		return tkWorkAreaId;
103 	}
104 
105 	public void setTkWorkAreaId(String tkWorkAreaId) {
106 		this.tkWorkAreaId = tkWorkAreaId;
107 	}
108 
109     public Date getEffectiveDate() {
110         return effectiveDate;
111     }
112 
113     public void setEffectiveDate(Date effectiveDate) {
114         this.effectiveDate = effectiveDate;
115     }
116 
117     public boolean isActive() {
118         return active;
119     }
120 
121     public void setActive(boolean active) {
122         this.active = active;
123     }
124 
125     public Timestamp getTimestamp() {
126         return timestamp;
127     }
128 
129     public void setTimestamp(Timestamp timestamp) {
130         this.timestamp = timestamp;
131     }
132 
133 	public String getWorkAreaDescription() { 
134 		if (this.getTkWorkAreaId() != null && StringUtils.isEmpty(workAreaDescription)) {
135         	WorkArea wa = TkServiceLocator.getWorkAreaService().getWorkArea(this.getTkWorkAreaId());
136         	this.setWorkAreaDescription((wa != null) ? wa.getDescription() : "");
137 		}
138 		return workAreaDescription;
139 	}
140 	
141 	public void setWorkAreaDescription(String workAreaDescription) {
142 		this.workAreaDescription = workAreaDescription;
143 	}
144 
145 	@Override
146 	public String getUniqueKey() {
147 		return workArea + "_" + task;
148 	}
149 
150 	public WorkArea getWorkAreaObj() {
151 		return workAreaObj;
152 	}
153 
154 	public void setWorkAreaObj(WorkArea workAreaObj) {
155 		this.workAreaObj = workAreaObj;
156 	}
157 
158 	@Override
159 	public String getId() {
160 		return getTkTaskId();
161 	}
162 
163 	@Override
164 	public void setId(String id) {
165 		setTkTaskId(id);
166 	}
167 
168 }