package org.fedorahosted.flies.repository.model;

import javax.persistence.DiscriminatorColumn;
import javax.persistence.DiscriminatorType;
import javax.persistence.Entity;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;

import org.fedorahosted.flies.core.model.AbstractFliesEntity;
import org.hibernate.envers.Audited;
import org.hibernate.envers.NotAudited;
import org.hibernate.validator.NotEmpty;

@Entity
@Inheritance(strategy=InheritanceType.SINGLE_TABLE)
@DiscriminatorColumn(
    name="type",
    discriminatorType=DiscriminatorType.STRING
)
@Audited
public abstract class ContainerItem extends AbstractFliesEntity{
	
	private String name;
	private ContainerItem parent;
	private ProjectContainer container;
	
	@NotEmpty
	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}
	
	@ManyToOne
	@JoinColumn(name="parent_id")
	public ContainerItem getParent() {
		return parent;
	}
	
	public void setParent(ContainerItem parent) {
		this.parent = parent;
	}
	
	@ManyToOne
	@JoinColumn(name="container_id")
	@NotAudited
	public ProjectContainer getContainer() {
		return container;
	}
	
	public void setContainer(ProjectContainer container) {
		this.container = container;
	}
}

@@ -378,24 +378,68 @@
 liesEntity;%0A
+import org.hibernate.annotations.NaturalId;%0A
 import org.h
@@ -455,32 +455,32 @@
 envers.Audited;%0A
-
 import org.hiber
@@ -495,32 +495,71 @@
 ers.NotAudited;%0A
+import org.hibernate.validator.Length;%0A
 import org.hiber
@@ -582,16 +582,56 @@
 otEmpty;
+%0Aimport org.hibernate.validator.NotNull;
 %0A%0A@Entit
@@ -848,16 +848,39 @@
 tity%7B%0A%09%0A
+%09private String resId;%0A
 %09private
@@ -893,16 +893,18 @@
 g name;%0A
+%09%0A
 %09private
@@ -965,16 +965,171 @@
 iner;%0A%09%0A
+%09@NaturalId%0A%09@Length(max=255)%0A%09@NotEmpty%0A%09public String getResId() %7B%0A%09%09return resId;%0A%09%7D%0A%09%0A%09public void setResId(String resId) %7B%0A%09%09this.resId = resId;%0A%09%7D%0A%09%0A
 %09@NotEmp
@@ -1419,32 +1419,32 @@
 %7D%0A%09%0A%09@ManyToOne%0A
-
 %09@JoinColumn(nam
@@ -1461,16 +1461,28 @@
 er_id%22)%0A
+%09@NaturalId%0A
 %09@NotAud

add resource id to ContainerItem