From e279bce9f3da55a46f5b1a14bbadbf0dccc1d43e Mon Sep 17 00:00:00 2001 From: Devan Goodwin Date: Tue, 24 Nov 2009 16:25:59 -0400 Subject: Drop Product UUID. --- .../org/fedoraproject/candlepin/model/Product.java | 28 ---------------------- .../candlepin/model/ProductFactory.java | 10 ++++---- .../candlepin/model/test/ConsumerTest.java | 3 +-- .../candlepin/model/test/OwnerTest.java | 2 +- .../candlepin/model/test/TestUtil.java | 2 +- .../candlepin/resource/EntitlementResource.java | 6 ++--- .../resource/test/EntitlementResourceTest.java | 5 +--- 7 files changed, 12 insertions(+), 44 deletions(-) diff --git a/proxy/code/src/org/fedoraproject/candlepin/model/Product.java b/proxy/code/src/org/fedoraproject/candlepin/model/Product.java index 9172c70..115213c 100644 --- a/proxy/code/src/org/fedoraproject/candlepin/model/Product.java +++ b/proxy/code/src/org/fedoraproject/candlepin/model/Product.java @@ -51,9 +51,6 @@ public class Product { @Column(nullable=false) private String name; - // TODO: Drop this? - private String uuid; - // TODO @Transient private List childProducts; @@ -78,14 +75,6 @@ public class Product { public Product() { } - /** - * Create product with UUID - * @param uuid unique id for the product - */ - public Product(String uuid) { - setUuid(uuid); - } - /** * @return the id */ @@ -162,7 +151,6 @@ public class Product { * Returns the name of the object. * @return the name of the object. */ - @Column(nullable=false) public String getName() { return name; } @@ -175,20 +163,4 @@ public class Product { this.name = name; } - /** - * Returns the unique id of the model object. - * @return the unique id of the model object. - */ - public String getUuid() { - return uuid; - } - - /** - * Sets the unique id of the model object. - * @param uuid unique id of the model. - */ - public void setUuid(String uuid) { - this.uuid = uuid; - } - } diff --git a/proxy/code/src/org/fedoraproject/candlepin/model/ProductFactory.java b/proxy/code/src/org/fedoraproject/candlepin/model/ProductFactory.java index 8b686f6..52d11e4 100644 --- a/proxy/code/src/org/fedoraproject/candlepin/model/ProductFactory.java +++ b/proxy/code/src/org/fedoraproject/candlepin/model/ProductFactory.java @@ -44,29 +44,29 @@ public class ProductFactory extends ObjectFactory { // TODO: Move this all into the DB for definition // Create some Products - Product rhel = new Product(BaseModel.generateUUID()); + Product rhel = new Product(); rhel.setName("Red Hat Enterprise Linux"); rhel.setLabel("rhel"); this.store(rhel); - Product jboss = new Product(BaseModel.generateUUID()); + Product jboss = new Product(); jboss.setName("JBoss Application Server"); jboss.setLabel("jboss-as"); this.store(jboss); - Product virt = new Product(BaseModel.generateUUID()); + Product virt = new Product(); virt.setName("RHEL Virtualization"); virt.setLabel("rhel-virt"); rhel.addChildProduct(virt); this.store(virt); - Product cluster = new Product(BaseModel.generateUUID()); + Product cluster = new Product(); cluster.setName("RHEL Cluster-Storage"); cluster.setLabel("rhel-cluster"); rhel.addChildProduct(cluster); this.store(cluster); - Product jbossdev = new Product(BaseModel.generateUUID()); + Product jbossdev = new Product(); jbossdev.setName("JBoss Developer Studio (v1) for Linux"); this.store(jbossdev); diff --git a/proxy/code/src/org/fedoraproject/candlepin/model/test/ConsumerTest.java b/proxy/code/src/org/fedoraproject/candlepin/model/test/ConsumerTest.java index 99d4242..6ad75b8 100644 --- a/proxy/code/src/org/fedoraproject/candlepin/model/test/ConsumerTest.java +++ b/proxy/code/src/org/fedoraproject/candlepin/model/test/ConsumerTest.java @@ -14,7 +14,6 @@ */ package org.fedoraproject.candlepin.model.test; -import org.fedoraproject.candlepin.model.BaseModel; import org.fedoraproject.candlepin.model.Consumer; import org.fedoraproject.candlepin.model.Owner; import org.fedoraproject.candlepin.model.Product; @@ -30,7 +29,7 @@ public class ConsumerTest { public void testConsumedProduct() throws Exception { Owner o = TestUtil.createOwner(); - Product rhel = new Product(BaseModel.generateUUID()); + Product rhel = new Product(); rhel.setName("Red Hat Enterprise Linux"); Consumer c = TestUtil.createConsumer(o); diff --git a/proxy/code/src/org/fedoraproject/candlepin/model/test/OwnerTest.java b/proxy/code/src/org/fedoraproject/candlepin/model/test/OwnerTest.java index fe89b50..efd0fbf 100644 --- a/proxy/code/src/org/fedoraproject/candlepin/model/test/OwnerTest.java +++ b/proxy/code/src/org/fedoraproject/candlepin/model/test/OwnerTest.java @@ -67,7 +67,7 @@ public class OwnerTest extends ModelTestFixture { public void testObjectRelationships() throws Exception { Owner owner = new Owner("test-owner"); // Product - Product rhel = new Product(BaseModel.generateUUID()); + Product rhel = new Product(); rhel.setName("Red Hat Enterprise Linux"); // User diff --git a/proxy/code/src/org/fedoraproject/candlepin/model/test/TestUtil.java b/proxy/code/src/org/fedoraproject/candlepin/model/test/TestUtil.java index 7ad0bb6..4df1984 100644 --- a/proxy/code/src/org/fedoraproject/candlepin/model/test/TestUtil.java +++ b/proxy/code/src/org/fedoraproject/candlepin/model/test/TestUtil.java @@ -51,7 +51,7 @@ public class TestUtil { } public static Product createProduct() { - Product rhel = new Product(BaseModel.generateUUID()); + Product rhel = new Product(); rhel.setName("Red Hat Enterprise Linux"); ObjectFactory.get().store(rhel); return rhel; diff --git a/proxy/code/src/org/fedoraproject/candlepin/resource/EntitlementResource.java b/proxy/code/src/org/fedoraproject/candlepin/resource/EntitlementResource.java index 27887f6..139309f 100644 --- a/proxy/code/src/org/fedoraproject/candlepin/resource/EntitlementResource.java +++ b/proxy/code/src/org/fedoraproject/candlepin/resource/EntitlementResource.java @@ -139,16 +139,16 @@ public class EntitlementResource extends BaseResource { /** * Check to see if a given Consumer is entitled to given Product * @param consumerUuid consumerUuid to check if entitled or not - * @param productUuid productUuid to check if entitled or not + * @param productId productUuid to check if entitled or not * @return boolean if entitled or not */ @GET @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML }) @Path("/has") public boolean hasEntitlement(@PathParam("consumer_uuid") String consumerUuid, - @PathParam("product_uuid") String productUuid) { + @PathParam("product_id") String productId) { Consumer c = (Consumer) validateObjectInput(consumerUuid, Consumer.class); - Product p = (Product) validateObjectInput(productUuid, Product.class); + Product p = (Product) validateObjectInput(productId, Product.class); for (Entitlement e : c.getEntitlements()) { if (e.getProduct().equals(p)) { return true; diff --git a/proxy/code/src/org/fedoraproject/candlepin/resource/test/EntitlementResourceTest.java b/proxy/code/src/org/fedoraproject/candlepin/resource/test/EntitlementResourceTest.java index 7d75d05..c6f4eab 100644 --- a/proxy/code/src/org/fedoraproject/candlepin/resource/test/EntitlementResourceTest.java +++ b/proxy/code/src/org/fedoraproject/candlepin/resource/test/EntitlementResourceTest.java @@ -47,9 +47,6 @@ public class EntitlementResourceTest { private Product product; private EntitlementPool ep; - /** - * {@inheritDoc} - */ @Before public void setUp() throws Exception { consumer = TestUtil.createConsumer(); @@ -73,7 +70,7 @@ public class EntitlementResourceTest { EntitlementResource eapi = new EntitlementResource(); Form f = new Form(); f.add("consumer_uuid", consumer.getUuid()); - f.add("product_uuid", product.getUuid()); + f.add("product_id", product.getId()); String cert = (String) eapi.entitle(consumer, product); assertNotNull(cert); -- cgit