killbill-memoizeit

#306: "retired" option is removed.

11/13/2015 12:55:57 PM

Details

diff --git a/catalog/src/main/java/org/killbill/billing/catalog/DefaultPlan.java b/catalog/src/main/java/org/killbill/billing/catalog/DefaultPlan.java
index 0c1bc14..52e02e7 100644
--- a/catalog/src/main/java/org/killbill/billing/catalog/DefaultPlan.java
+++ b/catalog/src/main/java/org/killbill/billing/catalog/DefaultPlan.java
@@ -21,7 +21,6 @@ import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Date;
 import java.util.Iterator;
-import java.util.List;
 
 import javax.xml.bind.annotation.XmlAccessType;
 import javax.xml.bind.annotation.XmlAccessorType;
@@ -32,7 +31,6 @@ import javax.xml.bind.annotation.XmlID;
 import javax.xml.bind.annotation.XmlIDREF;
 
 import org.joda.time.DateTime;
-
 import org.killbill.billing.ErrorCode;
 import org.killbill.billing.catalog.api.BillingPeriod;
 import org.killbill.billing.catalog.api.CatalogApiException;
@@ -53,9 +51,6 @@ public class DefaultPlan extends ValidatingConfig<StandaloneCatalog> implements 
     @XmlID
     private String name;
 
-    @XmlAttribute(required = false)
-    private Boolean retired;
-
     //TODO MDW Validation - effectiveDateForExistingSubscriptons > catalog effectiveDate
     @XmlElement(required = false)
     private Date effectiveDateForExistingSubscriptons;
@@ -81,12 +76,10 @@ public class DefaultPlan extends ValidatingConfig<StandaloneCatalog> implements 
 
     public DefaultPlan() {
         initialPhases = new DefaultPlanPhase[0];
-        retired = false;
     }
 
     public DefaultPlan(final String planName, final DefaultPlan in, final PlanPhasePriceOverride[] overrides) {
         this.name = planName;
-        this.retired = in.isRetired();
         this.effectiveDateForExistingSubscriptons = in.getEffectiveDateForExistingSubscriptons();
         this.product = (DefaultProduct) in.getProduct();
         this.initialPhases = new DefaultPlanPhase[in.getInitialPhases().length];
@@ -129,11 +122,6 @@ public class DefaultPlan extends ValidatingConfig<StandaloneCatalog> implements 
     }
 
     @Override
-    public boolean isRetired() {
-        return retired;
-    }
-
-    @Override
     public DefaultPlanPhase getFinalPhase() {
         return finalPhase;
     }
@@ -243,11 +231,6 @@ public class DefaultPlan extends ValidatingConfig<StandaloneCatalog> implements 
         return this;
     }
 
-    public DefaultPlan setRetired(final boolean retired) {
-        this.retired = retired;
-        return this;
-    }
-
     public DefaultPlan setPlansAllowedInBundle(final Integer plansAllowedInBundle) {
         this.plansAllowedInBundle = plansAllowedInBundle;
         return this;
@@ -304,16 +287,12 @@ public class DefaultPlan extends ValidatingConfig<StandaloneCatalog> implements 
         if (product != null ? !product.equals(that.product) : that.product != null) {
             return false;
         }
-        if (retired != null ? !retired.equals(that.retired) : that.retired != null) {
-            return false;
-        }
         return true;
     }
 
     @Override
     public int hashCode() {
         int result = name != null ? name.hashCode() : 0;
-        result = 31 * result + (retired != null ? retired.hashCode() : 0);
         result = 31 * result + (effectiveDateForExistingSubscriptons != null ? effectiveDateForExistingSubscriptons.hashCode() : 0);
         result = 31 * result + (initialPhases != null ? Arrays.hashCode(initialPhases) : 0);
         result = 31 * result + (finalPhase != null ? finalPhase.hashCode() : 0);
@@ -323,7 +302,7 @@ public class DefaultPlan extends ValidatingConfig<StandaloneCatalog> implements 
 
     @Override
     public String toString() {
-        return "DefaultPlan [name=" + name + ", retired=" + retired + ", effectiveDateForExistingSubscriptons="
+        return "DefaultPlan [name=" + name + ", effectiveDateForExistingSubscriptons="
                 + effectiveDateForExistingSubscriptons + ", product=" + product + ", initialPhases="
                 + Arrays.toString(initialPhases) + ", finalPhase=" + finalPhase + ", plansAllowedInBundle="
                 + plansAllowedInBundle + "]";
diff --git a/catalog/src/main/java/org/killbill/billing/catalog/DefaultPriceList.java b/catalog/src/main/java/org/killbill/billing/catalog/DefaultPriceList.java
index c17d6ee..7d7903d 100644
--- a/catalog/src/main/java/org/killbill/billing/catalog/DefaultPriceList.java
+++ b/catalog/src/main/java/org/killbill/billing/catalog/DefaultPriceList.java
@@ -40,9 +40,6 @@ public class DefaultPriceList extends ValidatingConfig<StandaloneCatalog> implem
     @XmlID
     private String name;
 
-    @XmlAttribute(required = false)
-    private Boolean retired = false;
-
     @XmlElementWrapper(name = "plans", required = true)
     @XmlIDREF
     @XmlElement(name = "plan", required = true)
@@ -61,11 +58,6 @@ public class DefaultPriceList extends ValidatingConfig<StandaloneCatalog> implem
         return plans;
     }
 
-    @Override
-    public boolean isRetired() {
-        return retired;
-    }
-
     /* (non-Javadoc)
       * @see org.killbill.billing.catalog.IPriceList#getName()
       */
@@ -113,11 +105,6 @@ public class DefaultPriceList extends ValidatingConfig<StandaloneCatalog> implem
         return count;
     }
 
-    public DefaultPriceList setRetired(final boolean retired) {
-        this.retired = retired;
-        return this;
-    }
-
     public DefaultPriceList setName(final String name) {
         this.name = name;
         return this;
@@ -145,9 +132,6 @@ public class DefaultPriceList extends ValidatingConfig<StandaloneCatalog> implem
         if (!Arrays.equals(plans, that.plans)) {
             return false;
         }
-        if (retired != null ? !retired.equals(that.retired) : that.retired != null) {
-            return false;
-        }
 
         return true;
     }
@@ -155,7 +139,6 @@ public class DefaultPriceList extends ValidatingConfig<StandaloneCatalog> implem
     @Override
     public int hashCode() {
         int result = name != null ? name.hashCode() : 0;
-        result = 31 * result + (retired != null ? retired.hashCode() : 0);
         result = 31 * result + (plans != null ? Arrays.hashCode(plans) : 0);
         return result;
     }
diff --git a/catalog/src/main/java/org/killbill/billing/catalog/DefaultProduct.java b/catalog/src/main/java/org/killbill/billing/catalog/DefaultProduct.java
index e813ee1..9c0c1fd 100644
--- a/catalog/src/main/java/org/killbill/billing/catalog/DefaultProduct.java
+++ b/catalog/src/main/java/org/killbill/billing/catalog/DefaultProduct.java
@@ -16,6 +16,9 @@
 
 package org.killbill.billing.catalog;
 
+import java.net.URI;
+import java.util.Arrays;
+
 import javax.xml.bind.annotation.XmlAccessType;
 import javax.xml.bind.annotation.XmlAccessorType;
 import javax.xml.bind.annotation.XmlAttribute;
@@ -23,10 +26,7 @@ import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.XmlElementWrapper;
 import javax.xml.bind.annotation.XmlID;
 import javax.xml.bind.annotation.XmlIDREF;
-import java.net.URI;
-import java.util.Arrays;
 
-import org.killbill.billing.catalog.api.BillingPeriod;
 import org.killbill.billing.catalog.api.Limit;
 import org.killbill.billing.catalog.api.Product;
 import org.killbill.billing.catalog.api.ProductCategory;
@@ -41,9 +41,6 @@ public class DefaultProduct extends ValidatingConfig<StandaloneCatalog> implemen
     @XmlID
     private String name;
 
-    @XmlAttribute(required = false)
-    private Boolean retired = false;
-
     @XmlElement(required = true)
     private ProductCategory category;
 
@@ -70,11 +67,6 @@ public class DefaultProduct extends ValidatingConfig<StandaloneCatalog> implemen
     }
 
     @Override
-    public boolean isRetired() {
-        return retired;
-    }
-
-    @Override
     public ProductCategory getCategory() {
         return category;
     }
@@ -191,14 +183,9 @@ public class DefaultProduct extends ValidatingConfig<StandaloneCatalog> implemen
         return this;
     }
 
-    public DefaultProduct setRetired(final boolean retired) {
-        this.retired = retired;
-        return this;
-    }
-
     @Override
     public String toString() {
-        return "DefaultProduct [name=" + name + ", retired=" + retired + ", category=" + category + ", included="
+        return "DefaultProduct [name=" + name + ", category=" + category + ", included="
                 + Arrays.toString(included) + ", available=" + Arrays.toString(available) + ", catalogName="
                 + catalogName + "]";
     }
@@ -232,9 +219,6 @@ public class DefaultProduct extends ValidatingConfig<StandaloneCatalog> implemen
         if (name != null ? !name.equals(that.name) : that.name != null) {
             return false;
         }
-        if (retired != null ? !retired.equals(that.retired) : that.retired != null) {
-            return false;
-        }
 
         return true;
     }
@@ -242,7 +226,6 @@ public class DefaultProduct extends ValidatingConfig<StandaloneCatalog> implemen
     @Override
     public int hashCode() {
         int result = name != null ? name.hashCode() : 0;
-        result = 31 * result + (retired != null ? retired.hashCode() : 0);
         result = 31 * result + (category != null ? category.hashCode() : 0);
         result = 31 * result + (included != null ? Arrays.hashCode(included) : 0);
         result = 31 * result + (available != null ? Arrays.hashCode(available) : 0);
diff --git a/catalog/src/main/java/org/killbill/billing/catalog/plugin/StandaloneCatalogMapper.java b/catalog/src/main/java/org/killbill/billing/catalog/plugin/StandaloneCatalogMapper.java
index af8617d..b8335b0 100644
--- a/catalog/src/main/java/org/killbill/billing/catalog/plugin/StandaloneCatalogMapper.java
+++ b/catalog/src/main/java/org/killbill/billing/catalog/plugin/StandaloneCatalogMapper.java
@@ -382,7 +382,6 @@ public class StandaloneCatalogMapper {
         final DefaultPriceList result = new DefaultPriceList();
         result.setName(input.getName());
         result.setPlans(toFilterDefaultPlans(ImmutableList.copyOf(input.getPlans())));
-        result.setRetired(input.isRetired());
         return result;
     }
 
@@ -393,7 +392,6 @@ public class StandaloneCatalogMapper {
         final PriceListDefault result = new PriceListDefault();
         result.setName(input.getName());
         result.setPlans(toFilterDefaultPlans(ImmutableList.copyOf(input.getPlans())));
-        result.setRetired(input.isRetired());
         return result;
     }
 
@@ -414,7 +412,6 @@ public class StandaloneCatalogMapper {
         result.setCatalogName(catalogName);
         result.setCatagory(input.getCategory());
         result.setName(input.getName());
-        result.setRetired(input.isRetired());
         return result;
     }
 
@@ -430,7 +427,6 @@ public class StandaloneCatalogMapper {
         }
         final DefaultPlan result = new DefaultPlan();
         result.setName(input.getName());
-        result.setRetired(input.isRetired());
         result.setEffectiveDateForExistingSubscriptons(input.getEffectiveDateForExistingSubscriptons());
         result.setFinalPhase(toDefaultPlanPhase(input.getFinalPhase()));
         result.setInitialPhases(toDefaultPlanPhases(ImmutableList.copyOf(input.getInitialPhases())));
diff --git a/catalog/src/main/java/org/killbill/billing/catalog/StandaloneCatalog.java b/catalog/src/main/java/org/killbill/billing/catalog/StandaloneCatalog.java
index 93dc2c7..0d02237 100644
--- a/catalog/src/main/java/org/killbill/billing/catalog/StandaloneCatalog.java
+++ b/catalog/src/main/java/org/killbill/billing/catalog/StandaloneCatalog.java
@@ -347,9 +347,9 @@ public class StandaloneCatalog extends ValidatingConfig<StandaloneCatalog> imple
         final Plan plan = createOrFindCurrentPlan(specifier.getProductName(), specifier.getBillingPeriod(), specifier.getPriceListName(), null);
         final DefaultPriceList priceList = findCurrentPriceList(specifier.getPriceListName());
 
-        return (!product.isRetired()) &&
-               (!plan.isRetired()) &&
-               (!priceList.isRetired());
+        return (product != null) &&
+               (plan != null) &&
+               (priceList != null);
     }
 
     @Override
diff --git a/catalog/src/test/java/org/killbill/billing/catalog/MockPriceList.java b/catalog/src/test/java/org/killbill/billing/catalog/MockPriceList.java
index 9937687..aa5a993 100644
--- a/catalog/src/test/java/org/killbill/billing/catalog/MockPriceList.java
+++ b/catalog/src/test/java/org/killbill/billing/catalog/MockPriceList.java
@@ -22,7 +22,6 @@ public class MockPriceList extends DefaultPriceList {
 
     public MockPriceList() {
         setName(PriceListSet.DEFAULT_PRICELIST_NAME);
-        setRetired(false);
         setPlans(MockPlan.createAll());
     }
 }

pom.xml 2(+1 -1)

diff --git a/pom.xml b/pom.xml
index 4d1d1da..6262d48 100644
--- a/pom.xml
+++ b/pom.xml
@@ -21,7 +21,7 @@
     <parent>
         <artifactId>killbill-oss-parent</artifactId>
         <groupId>org.kill-bill.billing</groupId>
-        <version>0.66</version>
+        <version>0.67-SNAPSHOT</version>
     </parent>
     <artifactId>killbill</artifactId>
     <version>0.15.10-SNAPSHOT</version>
diff --git a/util/src/test/java/org/killbill/billing/mock/MockPlan.java b/util/src/test/java/org/killbill/billing/mock/MockPlan.java
index a5e03ec..0b5e92d 100644
--- a/util/src/test/java/org/killbill/billing/mock/MockPlan.java
+++ b/util/src/test/java/org/killbill/billing/mock/MockPlan.java
@@ -21,7 +21,6 @@ import java.util.Iterator;
 import java.util.UUID;
 
 import org.joda.time.DateTime;
-
 import org.killbill.billing.catalog.api.BillingPeriod;
 import org.killbill.billing.catalog.api.CatalogApiException;
 import org.killbill.billing.catalog.api.PhaseType;
@@ -93,11 +92,6 @@ public class MockPlan implements Plan {
     }
 
     @Override
-    public boolean isRetired() {
-        return false;
-    }
-
-    @Override
     public DateTime dateOfFirstRecurringNonZeroCharge(final DateTime subscriptionStartDate, PhaseType initialPhaseType) {
         throw new UnsupportedOperationException();
     }
diff --git a/util/src/test/java/org/killbill/billing/mock/MockPriceList.java b/util/src/test/java/org/killbill/billing/mock/MockPriceList.java
index 0cbe34f..3fddaf9 100644
--- a/util/src/test/java/org/killbill/billing/mock/MockPriceList.java
+++ b/util/src/test/java/org/killbill/billing/mock/MockPriceList.java
@@ -25,25 +25,18 @@ import org.killbill.billing.catalog.api.Product;
 
 public class MockPriceList implements PriceList {
     private final String name;
-    private final Boolean isRetired;
     private final Plan plan;
 
     public MockPriceList() {
-        this(false, UUID.randomUUID().toString(), new MockPlan());
+        this(UUID.randomUUID().toString(), new MockPlan());
     }
 
-    public MockPriceList(final Boolean retired, final String name, final Plan plan) {
-        isRetired = retired;
+    public MockPriceList(final String name, final Plan plan) {
         this.name = name;
         this.plan = plan;
     }
 
     @Override
-    public boolean isRetired() {
-        return isRetired;
-    }
-
-    @Override
     public String getName() {
         return name;
     }
diff --git a/util/src/test/java/org/killbill/billing/mock/MockProduct.java b/util/src/test/java/org/killbill/billing/mock/MockProduct.java
index 3eec119..046c18a 100644
--- a/util/src/test/java/org/killbill/billing/mock/MockProduct.java
+++ b/util/src/test/java/org/killbill/billing/mock/MockProduct.java
@@ -60,11 +60,6 @@ public class MockProduct implements Product {
     }
 
     @Override
-    public boolean isRetired() {
-        throw new UnsupportedOperationException();
-    }
-
-    @Override
     public Product[] getAvailable() {
         return available;
     }