/*
* Copyright 2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License")
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.agila.services.task;
import org.apache.agila.services.user.UserID;
import org.apache.agila.services.user.GroupID;
import org.apache.agila.engine.TokenID;
import org.apache.agila.engine.InstanceID;
import java.util.Date;
/**
* @hibernate.class table="bpm_task"
*
* @author <a href="mailto:geir@gluecode.com">Geir Magnusson Jr.</a>
* @version $Id: TaskImpl.java 38 2005-06-01 19:39:54Z chirino $
*/
public class TaskImpl implements Task {
private Integer taskKey;
private Integer userKey;
private Integer groupKey;
private Integer sourceTokenKey;
private Integer instanceKey;
private String desc;
private Date expiration;
private int status = Task.TASK_INCOMPLETE;
public TaskImpl() {
}
public TaskImpl(UserID userid, TokenID tokenID, InstanceID instanceID,
String desc, Date d, int status) {
setUserID(userid);
setSourceTokenID(tokenID);
setInstanceID(instanceID);
this.desc = desc;
this.expiration = d;
this.setStatus(status);
}
public TaskImpl(GroupID groupID, TokenID tokenID, InstanceID instanceID,
String desc, Date d, int status) {
setTeamID(groupID);
setSourceTokenID(tokenID);
setInstanceID(instanceID);
this.desc = desc;
this.expiration = d;
this.setStatus(status);
}
/**
* @hibernate.id generator-class="native" type="java.lang.Integer" column="id"
*/
public Integer getTaskKey() {
return taskKey;
}
public void setTaskKey(Integer taskKey) {
this.taskKey = taskKey;
}
/**
* @hibernate.property column="groupID" type="java.lang.Integer"
*/
public Integer getGroupKey() {
return groupKey;
}
public void setGroupKey(Integer groupKey) {
this.groupKey = groupKey;
}
/**
* @hibernate.property column="insanceID" type="java.lang.Integer"
*/
public Integer getInstanceKey() {
return instanceKey;
}
public void setInstanceKey(Integer instanceKey) {
this.instanceKey = instanceKey;
}
/**
* @hibernate.property column="tokenID" type="java.lang.Integer"
*/
public Integer getSourceTokenKey() {
return sourceTokenKey;
}
public void setSourceTokenKey(Integer sourceTokenKey) {
this.sourceTokenKey = sourceTokenKey;
}
/**
* @hibernate.property column="userID" type="java.lang.Integer"
*/
public Integer getUserKey() {
return userKey;
}
public void setUserKey(Integer userKey) {
this.userKey = userKey;
}
/**
* @hibernate.property column="description" length="255" type="java.lang.String"
*/
public String getTaskDescription() {
return this.desc;
}
public void setTaskDescription( String desc ) {
this.desc = desc;
}
/**
* @hibernate.property column="expiration" type="java.util.Date"
*/
public Date getTaskExpirationDate() {
return this.expiration;
}
public void setTaskExpirationDate( Date expiration ) {
this.expiration = expiration;
}
/**
* @hibernate.property column="status" type="int"
*/
public int getStatus() {
return status;
}
public void setStatus(int status) {
this.status = status;
}
// Helper methods to implement interface...
public int getTaskStatus() {
return this.status;
}
public void setTaskStatus(int status) {
this.status = status;
}
public TaskID getTaskID() {
return taskKey != null ? new TaskID(taskKey.intValue()) : null;
}
public void setTaskID(TaskID id) {
if (id == null) {
this.taskKey = null;
}
else {
this.taskKey = new Integer(id.getID());
}
}
public UserID getUserID() {
return userKey != null ? new UserID(userKey.intValue()) : null;
}
public void setUserID( UserID id ) {
if (id == null) {
this.userKey = null;
}
else {
this.userKey = new Integer(id.getID());
}
}
public GroupID getGroupID() {
return groupKey != null ? new GroupID(groupKey.intValue()) : null;
}
public void setTeamID(GroupID id) {
if (id == null) {
this.groupKey = null;
}
else {
this.groupKey = new Integer(id.getID());
}
}
public TokenID getSourceTokenID() {
return sourceTokenKey != null ? new TokenID(sourceTokenKey.intValue()) : null;
}
public void setSourceTokenID( TokenID id ) {
if (id == null) {
this.sourceTokenKey = null;
}
else {
this.sourceTokenKey = new Integer(id.getID());
}
}
public InstanceID getInstanceID() {
return instanceKey != null ? new InstanceID(instanceKey.intValue()) : null;
}
public void setInstanceID( InstanceID id ) {
if (id == null) {
this.instanceKey = null;
}
else {
this.instanceKey = new Integer(id.getID());
}
}
public String toString() {
return "Task : id = " + getTaskID() + " user = " + getUserID()
+ " desc = " + getTaskDescription();
}
}