/**
* Copyright 2009 Roland Foerther, Carl-Eric-Menzel, Olaf Siefart
*
* 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 com.senacor.domain.project;
import java.util.ArrayList;
import java.util.List;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.OrderBy;
import javax.persistence.Table;
import org.hibernate.annotations.Cascade;
import org.hibernate.annotations.CascadeType;
import com.senacor.core.bo.BusinessObject;
import com.senacor.domain.user.User;
@Entity
@Table
public class Task extends BusinessObject {
@Id
@GeneratedValue(strategy = GenerationType.TABLE)
private Long id;
@Column(name = "name", length = 50)
private String name;
private String beschreibung;
@ManyToOne
@JoinColumn(name = "worker")
private User worker;
@Enumerated(EnumType.STRING)
private TaskStatus status;
@OneToMany(fetch = FetchType.EAGER)
@OrderBy("name")
@Cascade( { CascadeType.ALL, CascadeType.DELETE_ORPHAN })
private List<Task> subtasks = new ArrayList<Task>();
// Getter / Setter
public TaskStatus getStatus() {
return status;
}
public void setStatus(TaskStatus status) {
this.status = status;
}
public String getBeschreibung() {
return beschreibung;
}
public void setBeschreibung(String beschreibung) {
this.beschreibung = beschreibung;
}
public List<Task> getSubtasks() {
return subtasks;
}
public void setSubtasks(List<Task> subtasks) {
this.subtasks = subtasks;
}
public User getWorker() {
return worker;
}
public void setWorker(User worker) {
this.worker = worker;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}