001 /**
002 * Copyright 2004-2012 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.hr.time.task;
017
018 import java.sql.Date;
019 import java.sql.Timestamp;
020
021 import org.apache.commons.lang.StringUtils;
022 import org.kuali.hr.core.KPMEConstants;
023 import org.kuali.hr.time.HrBusinessObject;
024 import org.kuali.hr.time.service.base.TkServiceLocator;
025 import org.kuali.hr.time.workarea.WorkArea;
026
027 public class Task extends HrBusinessObject {
028 public static final String CACHE_NAME = KPMEConstants.APPLICATION_NAMESPACE_CODE + "/" + "Task";
029 /**
030 *
031 */
032 private static final long serialVersionUID = 1L;
033
034 private String tkTaskId;
035 private Long task;
036 private Long workArea;
037 private String tkWorkAreaId;
038 private String description;
039 private String userPrincipalId;
040 private String administrativeDescription;
041 private WorkArea workAreaObj;
042 private String workAreaDescription;
043
044 public String getDescription()
045 {
046 return description;
047 }
048
049 public void setDescription(String desc)
050 {
051 this.description = desc;
052 }
053
054 public String getUserPrincipalId(){
055 return userPrincipalId;
056 }
057
058 public void setUserPrincipalId(String pid)
059 {
060 this.userPrincipalId = pid;
061 }
062
063 public String getAdministrativeDescription(){
064 return administrativeDescription;
065 }
066
067 public void setAdministrativeDescription(String addesc)
068 {
069 this.administrativeDescription = addesc;
070 }
071
072 public String getTkTaskId() {
073 return tkTaskId;
074 }
075
076 public void setTkTaskId(String tkTaskId) {
077 this.tkTaskId = tkTaskId;
078 }
079
080 public Long getTask() {
081 return task;
082 }
083
084 public void setTask(Long task) {
085 this.task = task;
086 }
087
088 public Long getWorkArea() {
089 if (this.getTkWorkAreaId() != null && workArea == null) {
090 WorkArea wa = TkServiceLocator.getWorkAreaService().getWorkArea(this.getTkWorkAreaId());
091 this.setWorkArea((wa != null) ? wa.getWorkArea() : null);
092 }
093
094 return workArea;
095 }
096
097 public void setWorkArea(Long workArea) {
098 this.workArea = workArea;
099 }
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 }