package org.penny_craal.mairion.model;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQuery;

@Entity
@NamedQuery(name = "Task.selectAll", query = "SELECT t from Task t")
public class Task {
	@SuppressWarnings("unused")
	private static final long serialVersionUID = 1L;

	@Id
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	@Column(name = "task_pk", nullable = false)
	private Integer id;

	@Column(name = "description", nullable = false)
	private String description;

	@ManyToOne(optional = false)
	@JoinColumn(name = "user_id", nullable = false)
	private User owner;

	@Column(name = "status", nullable = false)
	private TaskStatus status = TaskStatus.unfinished;

	// Constructors
	public Task() {
		super();
	}

	public Task(String description) {
		this.description = description;
	}

	public Task(String description, User owner) {
		this.description = description;
		this.owner = owner;
	}

	// Getters and Setters
	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public User getOwner() {
		return owner;
	}

	public void setOwner(User user) {
		this.owner = user;
	}

	public TaskStatus getStatus() {
		return status;
	}

	public void setStatus(TaskStatus status) {
		this.status = status;
	}

	// Overrides
	@Override
	public String toString() {
		return id + " " + description;
	}

}

@@ -319,16 +319,58 @@
 edQuery;
+%0Aimport javax.validation.constraints.Size;
 %0A%0A@Entit
@@ -663,16 +663,210 @@
 er id;%0A%0A
+%09/**%0A%09 * The title of the task.%0A%09 */%0A%09@Size(max = 128)%0A%09@Column(name = %22title%22, nullable = false)%0A%09private String title = %22%22;%0A%0A%09/**%0A%09 * A longer description of the task.%0A%09 */%0A%09@Size(max = 8192)%0A
 %09@Column
@@ -933,16 +933,21 @@
 cription
+ = %22%22
 ;%0A%0A%09@Man
@@ -1212,55 +1212,37 @@
 ing 
-description) %7B%0A%09%09this.description = description
+title) %7B%0A%09%09this.title = title
 ;%0A%09%7D
@@ -1263,27 +1263,21 @@
 (String 
-description
+title
 , User o
@@ -1295,33 +1295,21 @@
 his.
-description = description
+title = title
 ;%0A%09%09
@@ -1680,24 +1680,284 @@
 status;%0A%09%7D%0A%0A
+%09public String getTitle() %7B%0A%09%09return title;%0A%09%7D%0A%0A%09public void setTitle(String title) %7B%0A%09%09this.title = title;%0A%09%7D%0A%0A%09public String getDescription() %7B%0A%09%09return description;%0A%09%7D%0A%0A%09public void setDescription(String description) %7B%0A%09%09this.description = description;%0A%09%7D%0A%0A
 %09// Override
@@ -2010,30 +2010,31 @@
 urn 
-id
+title
  + %22 
+(
 %22 + 
-description
+id + %22)%22
 ;%0A%09%7D

task title