package org.fedorahosted.flies.entity.resources;

import javax.persistence.Column;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.MappedSuperclass;

@MappedSuperclass
public abstract class AbstractTextUnitTemplate extends AbstractTextUnit{

	private boolean obsolete;
	
	private Integer position;

	private String resourceId;

	private Document document;

	
	public boolean isObsolete() {
		return obsolete;
	}
	
	public void setObsolete(boolean obsolete) {
		this.obsolete = obsolete;
	}

	public Integer getPosition() {
		return position;
	}
	
	public void setPosition(Integer position) {
		this.position = position;
	}

	@Column(name="resource_id")
	//@NaturalId
	public String getResourceId() {
		return resourceId;
	}
	
	public void setResourceId(String resourceId) {
		this.resourceId = resourceId;
	}
	
	@ManyToOne
	@JoinColumn(name="document_id")
	//@NaturalId
	public Document getDocument() {
		return document;
	}
	
	public void setDocument(Document document) {
		this.document = document;
	}
	
}

@@ -193,16 +193,98 @@
 class;%0A%0A
+import org.hibernate.validator.NotEmpty;%0Aimport org.hibernate.validator.NotNull;%0A%0A
 @MappedS
@@ -484,16 +484,26 @@
 ent;%0A%0A%09%0A
+%09@NotNull%0A
 %09public 
@@ -759,16 +759,27 @@
 on;%0A%09%7D%0A%0A
+%09@NotEmpty%0A
 %09@Column
@@ -955,18 +955,28 @@
 eId;%0A%09%7D%0A
-
 %09%0A
+%09@NotNull%0A
 %09@ManyTo

make the following TextUnit fields mandatory: obsolete, resourceId, document