summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDevan Goodwin <dgoodwin@redhat.com>2009-11-06 13:57:59 -0400
committerDevan Goodwin <dgoodwin@redhat.com>2009-11-06 13:57:59 -0400
commitbcbad6c3f69fd1044e017e50071f40755b5c7885 (patch)
treee833d85754eb7d6e852c405a9a3e1a04470517ae
parent8d167b75c4cc028dedd5d99f94cdf8f27bb25c16 (diff)
downloadcandlepin-bcbad6c3f69fd1044e017e50071f40755b5c7885.tar.gz
candlepin-bcbad6c3f69fd1044e017e50071f40755b5c7885.tar.xz
candlepin-bcbad6c3f69fd1044e017e50071f40755b5c7885.zip
Begin mapping Product's to the db.
-rw-r--r--proxy/code/src/org/fedoraproject/candlepin/model/ConsumerType.java2
-rw-r--r--proxy/code/src/org/fedoraproject/candlepin/model/Product.java44
2 files changed, 38 insertions, 8 deletions
diff --git a/proxy/code/src/org/fedoraproject/candlepin/model/ConsumerType.java b/proxy/code/src/org/fedoraproject/candlepin/model/ConsumerType.java
index b5bb510..d7d2274 100644
--- a/proxy/code/src/org/fedoraproject/candlepin/model/ConsumerType.java
+++ b/proxy/code/src/org/fedoraproject/candlepin/model/ConsumerType.java
@@ -27,6 +27,8 @@ import javax.xml.bind.annotation.XmlRootElement;
/**
* Represents the type of consumer.
+ *
+ * TODO: Examples?
*/
@XmlRootElement
@XmlAccessorType(XmlAccessType.PROPERTY)
diff --git a/proxy/code/src/org/fedoraproject/candlepin/model/Product.java b/proxy/code/src/org/fedoraproject/candlepin/model/Product.java
index b05b168..b588091 100644
--- a/proxy/code/src/org/fedoraproject/candlepin/model/Product.java
+++ b/proxy/code/src/org/fedoraproject/candlepin/model/Product.java
@@ -17,6 +17,12 @@ package org.fedoraproject.candlepin.model;
import java.util.LinkedList;
import java.util.List;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+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;
@@ -26,9 +32,14 @@ import javax.xml.bind.annotation.XmlRootElement;
*/
@XmlRootElement
@XmlAccessorType(XmlAccessType.PROPERTY)
+@Entity
+@Table(name="cp_product")
public class Product extends BaseModel {
+ private Long id;
private String label;
+
+ // TODO:
private List<Product> childProducts;
/**
@@ -46,8 +57,25 @@ public class Product extends BaseModel {
}
/**
+ * @return the id
+ */
+ @Id
+ @GeneratedValue(strategy=GenerationType.AUTO)
+ public Long getId() {
+ return id;
+ }
+
+ /**
+ * @param id the id to set
+ */
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ /**
* @return the childProducts
*/
+ @Transient
public List<Product> getChildProducts() {
return childProducts;
}
@@ -70,14 +98,14 @@ public class Product extends BaseModel {
this.childProducts.add(p);
}
- /**
- * Get the list of compatible consumer types
- * @return list of compatible consumer types
- */
- public List<String> getCompatibleConsumerTypes() {
-
- return null;
- }
+// /**
+// * Get the list of compatible consumer types
+// * @return list of compatible consumer types
+// */
+// public List<String> getCompatibleConsumerTypes() {
+//
+// return null;
+// }
/**