package com.github.aureliano.edocs.domain.entity;

import java.util.Date;

import com.github.aureliano.edocs.common.persistence.IEntity;

public class Attachment implements IEntity<Attachment> {

	private Integer id;
	private String name;
	private Date uploadTime;
	private Document document;
	
	public Attachment() {}

	public Integer getId() {
		return id;
	}

	public Attachment withId(Integer id) {
		this.id = id;
		return this;
	}

	public String getName() {
		return name;
	}

	public Attachment withName(String name) {
		this.name = name;
		return this;
	}

	public Date getUploadTime() {
		return uploadTime;
	}

	public Attachment withUploadTime(Date uploadTime) {
		this.uploadTime = uploadTime;
		return this;
	}
	
	public Document getDocument() {
		return document;
	}
	
	public Attachment withDocument(Document document) {
		this.document = document;
		return this;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((id == null) ? 0 : id.hashCode());
		result = prime * result + ((name == null) ? 0 : name.hashCode());
		result = prime * result + ((uploadTime == null) ? 0 : uploadTime.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Attachment other = (Attachment) obj;
		if (id == null) {
			if (other.id != null)
				return false;
		} else if (!id.equals(other.id))
			return false;
		if (name == null) {
			if (other.name != null)
				return false;
		} else if (!name.equals(other.name))
			return false;
		if (uploadTime == null) {
			if (other.uploadTime != null)
				return false;
		} else if (!uploadTime.equals(other.uploadTime))
			return false;
		return true;
	}
}
@@ -68,16 +68,209 @@
 .Date;%0A%0A
+import com.github.aureliano.edocs.annotation.validation.NotEmpty;%0Aimport com.github.aureliano.edocs.annotation.validation.NotNull;%0Aimport com.github.aureliano.edocs.annotation.validation.Size;%0A
 import c
@@ -323,16 +323,16 @@
 Entity;%0A
-
 %0Apublic 
@@ -616,32 +616,70 @@
 eturn this;%0A%09%7D%0A%0A
+%09@NotEmpty%0A%09@Size(min = 5, max = 250)%0A
 %09public String g
@@ -786,24 +786,34 @@
 n this;%0A%09%7D%0A%0A
+%09@NotNull%0A
 %09public Date
@@ -955,25 +955,34 @@
 rn this;%0A%09%7D%0A
-%09
+%0A%09@NotNull
 %0A%09public Doc

Add validation annotations.