diff options
Diffstat (limited to 'proxy/code/src/org/fedoraproject/candlepin/model/Entitlement.java')
-rw-r--r-- | proxy/code/src/org/fedoraproject/candlepin/model/Entitlement.java | 70 |
1 files changed, 44 insertions, 26 deletions
diff --git a/proxy/code/src/org/fedoraproject/candlepin/model/Entitlement.java b/proxy/code/src/org/fedoraproject/candlepin/model/Entitlement.java index 446e78d..f6c50db 100644 --- a/proxy/code/src/org/fedoraproject/candlepin/model/Entitlement.java +++ b/proxy/code/src/org/fedoraproject/candlepin/model/Entitlement.java @@ -17,6 +17,18 @@ package org.fedoraproject.candlepin.model; import java.util.Date; import java.util.List; +import javax.persistence.CascadeType; +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.JoinTable; +import javax.persistence.ManyToOne; +import javax.persistence.OneToMany; +import javax.persistence.Table; +import javax.persistence.Transient; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlRootElement; @@ -40,51 +52,62 @@ import javax.xml.bind.annotation.XmlTransient; */ @XmlRootElement @XmlAccessorType(XmlAccessType.PROPERTY) -public class Entitlement extends BaseModel { +@Entity +@Table(name="cp_entitlement") +public class Entitlement { + @Id + @GeneratedValue(strategy=GenerationType.AUTO) + private Long id; + + @ManyToOne + @JoinColumn(nullable=false) private Owner owner; - private EntitlementPool pool; - private List<Entitlement> childEntitlements; + @ManyToOne + @JoinColumn(nullable=false) + private EntitlementPool pool; + private Date startDate; - /** - * default ctor - */ public Entitlement() { - super(null); } /** - * @return the org + * @return the id */ - @XmlTransient - public Owner getOwner() { - return owner; + public Long getId() { + return id; } /** - * @param ownerIn the owner to set + * @param id the id to set */ - public void setOwner(Owner ownerIn) { - this.owner = ownerIn; + public void setId(Long id) { + this.id = id; } + public Entitlement(EntitlementPool poolIn, Owner ownerIn, Date startDateIn) { + pool = poolIn; + owner = ownerIn; + startDate = startDateIn; + } + /** - * @return the childEntitlements + * @return the owner */ - public List<Entitlement> getChildEntitlements() { - return childEntitlements; + @XmlTransient + public Owner getOwner() { + return owner; } /** - * @param childEntitlements the childEntitlements to set + * @param ownerIn the owner to set */ - public void setChildEntitlements(List<Entitlement> childEntitlements) { - this.childEntitlements = childEntitlements; + public void setOwner(Owner ownerIn) { + this.owner = ownerIn; } - /** * @return Returns the product. */ @@ -92,7 +115,6 @@ public class Entitlement extends BaseModel { return this.pool.getProduct(); } - /** * @return Returns the pool. */ @@ -100,7 +122,6 @@ public class Entitlement extends BaseModel { return pool; } - /** * @param poolIn The pool to set. */ @@ -108,7 +129,6 @@ public class Entitlement extends BaseModel { pool = poolIn; } - /** * @return Returns the startDate. */ @@ -116,13 +136,11 @@ public class Entitlement extends BaseModel { return startDate; } - /** * @param startDateIn The startDate to set. */ public void setStartDate(Date startDateIn) { startDate = startDateIn; } - } |