summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDevan Goodwin <dgoodwin@redhat.com>2010-01-12 10:49:04 -0400
committerDevan Goodwin <dgoodwin@redhat.com>2010-01-12 11:11:40 -0400
commit413c74bb5ecbbeaf07388e1a4bc627987c7c00dd (patch)
tree880fd33673b1a26dd2968ca2ebbafa5d956840ff
parentcce8ef403329e63c2b59f98a2affa9dbb1e50f19 (diff)
downloadcandlepin-413c74bb5ecbbeaf07388e1a4bc627987c7c00dd.tar.gz
candlepin-413c74bb5ecbbeaf07388e1a4bc627987c7c00dd.tar.xz
candlepin-413c74bb5ecbbeaf07388e1a4bc627987c7c00dd.zip
Add Attribute class.
Attributes will represent hints on Products and EntitlementPools indicating what conditions must be satisfied for the entitlement to be granted.
-rw-r--r--proxy/src/main/java/org/fedoraproject/candlepin/model/Attribute.java39
-rw-r--r--proxy/src/main/java/org/fedoraproject/candlepin/model/EntitlementPool.java14
-rw-r--r--proxy/src/main/java/org/fedoraproject/candlepin/model/Product.java48
3 files changed, 65 insertions, 36 deletions
diff --git a/proxy/src/main/java/org/fedoraproject/candlepin/model/Attribute.java b/proxy/src/main/java/org/fedoraproject/candlepin/model/Attribute.java
new file mode 100644
index 0000000..0952206
--- /dev/null
+++ b/proxy/src/main/java/org/fedoraproject/candlepin/model/Attribute.java
@@ -0,0 +1,39 @@
+/**
+ * Copyright (c) 2009 Red Hat, Inc.
+ *
+ * This software is licensed to you under the GNU General Public License,
+ * version 2 (GPLv2). There is NO WARRANTY for this software, express or
+ * implied, including the implied warranties of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
+ * along with this software; if not, see
+ * http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
+ *
+ * Red Hat trademarks are not licensed under GPLv2. No permission is
+ * granted to use or replicate Red Hat trademarks that are incorporated
+ * in this software or its documentation.
+ */
+
+package org.fedoraproject.candlepin.model;
+
+public class Attribute {
+
+ private String name;
+ private String quantity;
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getQuantity() {
+ return quantity;
+ }
+
+ public void setQuantity(String quantity) {
+ this.quantity = quantity;
+ }
+
+}
diff --git a/proxy/src/main/java/org/fedoraproject/candlepin/model/EntitlementPool.java b/proxy/src/main/java/org/fedoraproject/candlepin/model/EntitlementPool.java
index b36e6bf..a10a620 100644
--- a/proxy/src/main/java/org/fedoraproject/candlepin/model/EntitlementPool.java
+++ b/proxy/src/main/java/org/fedoraproject/candlepin/model/EntitlementPool.java
@@ -15,6 +15,7 @@
package org.fedoraproject.candlepin.model;
import java.util.Date;
+import java.util.Set;
import javax.persistence.Column;
import javax.persistence.Entity;
@@ -25,6 +26,8 @@ import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
+import javax.persistence.Transient;
+import javax.persistence.UniqueConstraint;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;
@@ -69,6 +72,9 @@ public class EntitlementPool implements Persisted {
@Column(nullable = false)
private Date endDate;
+ @Transient
+ private Set<Attribute> attributes;
+
public EntitlementPool() {
}
@@ -197,4 +203,12 @@ public class EntitlementPool implements Persisted {
this.currentMembers = this.currentMembers + 1;
}
+ public Set<Attribute> getAttributes() {
+ return attributes;
+ }
+
+ public void setAttributes(Set<Attribute> attributes) {
+ this.attributes = attributes;
+ }
+
}
diff --git a/proxy/src/main/java/org/fedoraproject/candlepin/model/Product.java b/proxy/src/main/java/org/fedoraproject/candlepin/model/Product.java
index b1b8ad1..183a4b9 100644
--- a/proxy/src/main/java/org/fedoraproject/candlepin/model/Product.java
+++ b/proxy/src/main/java/org/fedoraproject/candlepin/model/Product.java
@@ -28,6 +28,7 @@ import javax.persistence.JoinTable;
import javax.persistence.OneToMany;
import javax.persistence.SequenceGenerator;
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;
@@ -65,6 +66,9 @@ public class Product implements Persisted {
inverseJoinColumns = @JoinColumn(name = "CHILD_PRODUCT_ID"))
private Set<Product> childProducts;
+ @Transient
+ private Set<Attribute> attributes;
+
/**
* Constructor
*
@@ -78,44 +82,25 @@ public class Product implements Persisted {
setName(name);
}
- /**
- * Default constructor
- */
public Product() {
}
- /**
- * @return the id
- */
public Long getId() {
return id;
}
- /**
- * @param id the id to set
- */
public void setId(Long id) {
this.id = id;
}
- /**
- * @return the childProducts
- */
public Set<Product> getChildProducts() {
return childProducts;
}
- /**
- * @param childProducts the childProducts to set
- */
public void setChildProducts(Set<Product> childProducts) {
this.childProducts = childProducts;
}
- /**
- * Add a child of this Product.
- * @param p to add
- */
public void addChildProduct(Product p) {
if (this.childProducts == null) {
this.childProducts = new HashSet<Product>();
@@ -123,42 +108,33 @@ public class Product implements Persisted {
this.childProducts.add(p);
}
- /**
- * @return Returns the label.
- */
public String getLabel() {
return label;
}
- /**
- * @param labelIn The label to set.
- */
public void setLabel(String labelIn) {
label = labelIn;
}
- /**
- * {@inheritDoc}
- */
@Override
public String toString() {
return "Product [label = " + label + "]";
}
- /**
- * Returns the name of the object.
- * @return the name of the object.
- */
public String getName() {
return name;
}
- /**
- * Set the name of the model object.
- * @param name name of the object
- */
public void setName(String name) {
this.name = name;
}
+ public Set<Attribute> getAttributes() {
+ return attributes;
+ }
+
+ public void setAttributes(Set<Attribute> attributes) {
+ this.attributes = attributes;
+ }
+
}