killbill-uncached

analytics: merge event type and category into event column Signed-off-by:

4/10/2013 6:25:14 PM

Details

diff --git a/osgi-bundles/bundles/analytics/src/main/java/com/ning/billing/osgi/bundles/analytics/api/BusinessSubscriptionTransition.java b/osgi-bundles/bundles/analytics/src/main/java/com/ning/billing/osgi/bundles/analytics/api/BusinessSubscriptionTransition.java
index fb2e8da..4a1f6ed 100644
--- a/osgi-bundles/bundles/analytics/src/main/java/com/ning/billing/osgi/bundles/analytics/api/BusinessSubscriptionTransition.java
+++ b/osgi-bundles/bundles/analytics/src/main/java/com/ning/billing/osgi/bundles/analytics/api/BusinessSubscriptionTransition.java
@@ -30,8 +30,7 @@ public class BusinessSubscriptionTransition extends BusinessEntityBase {
     private final UUID subscriptionId;
 
     private final DateTime requestedTimestamp;
-    private final String eventType;
-    private final String category;
+    private final String event;
 
     private final String prevProductName;
     private final String prevProductType;
@@ -76,8 +75,7 @@ public class BusinessSubscriptionTransition extends BusinessEntityBase {
         this.subscriptionId = bstModelDao.getSubscriptionId();
 
         this.requestedTimestamp = bstModelDao.getRequestedTimestamp();
-        this.eventType = bstModelDao.getEventType();
-        this.category = bstModelDao.getCategory();
+        this.event = bstModelDao.getEvent();
 
         this.prevProductName = bstModelDao.getPrevProductName();
         this.prevProductType = bstModelDao.getPrevProductType();
@@ -125,12 +123,8 @@ public class BusinessSubscriptionTransition extends BusinessEntityBase {
         return requestedTimestamp;
     }
 
-    public String getEventType() {
-        return eventType;
-    }
-
-    public String getCategory() {
-        return category;
+    public String getEvent() {
+        return event;
     }
 
     public String getPrevProductName() {
@@ -249,8 +243,7 @@ public class BusinessSubscriptionTransition extends BusinessEntityBase {
         sb.append(", bundleExternalKey='").append(bundleExternalKey).append('\'');
         sb.append(", subscriptionId=").append(subscriptionId);
         sb.append(", requestedTimestamp=").append(requestedTimestamp);
-        sb.append(", eventType='").append(eventType).append('\'');
-        sb.append(", category='").append(category).append('\'');
+        sb.append(", event='").append(event).append('\'');
         sb.append(", prevProductName='").append(prevProductName).append('\'');
         sb.append(", prevProductType='").append(prevProductType).append('\'');
         sb.append(", prevProductCategory='").append(prevProductCategory).append('\'');
@@ -302,10 +295,7 @@ public class BusinessSubscriptionTransition extends BusinessEntityBase {
         if (bundleId != null ? !bundleId.equals(that.bundleId) : that.bundleId != null) {
             return false;
         }
-        if (category != null ? !category.equals(that.category) : that.category != null) {
-            return false;
-        }
-        if (eventType != null ? !eventType.equals(that.eventType) : that.eventType != null) {
+        if (event != null ? !event.equals(that.event) : that.event != null) {
             return false;
         }
         if (nextBillingPeriod != null ? !nextBillingPeriod.equals(that.nextBillingPeriod) : that.nextBillingPeriod != null) {
@@ -406,8 +396,7 @@ public class BusinessSubscriptionTransition extends BusinessEntityBase {
         result = 31 * result + (bundleExternalKey != null ? bundleExternalKey.hashCode() : 0);
         result = 31 * result + (subscriptionId != null ? subscriptionId.hashCode() : 0);
         result = 31 * result + (requestedTimestamp != null ? requestedTimestamp.hashCode() : 0);
-        result = 31 * result + (eventType != null ? eventType.hashCode() : 0);
-        result = 31 * result + (category != null ? category.hashCode() : 0);
+        result = 31 * result + (event != null ? event.hashCode() : 0);
         result = 31 * result + (prevProductName != null ? prevProductName.hashCode() : 0);
         result = 31 * result + (prevProductType != null ? prevProductType.hashCode() : 0);
         result = 31 * result + (prevProductCategory != null ? prevProductCategory.hashCode() : 0);
diff --git a/osgi-bundles/bundles/analytics/src/main/java/com/ning/billing/osgi/bundles/analytics/dao/model/BusinessSubscriptionTransitionModelDao.java b/osgi-bundles/bundles/analytics/src/main/java/com/ning/billing/osgi/bundles/analytics/dao/model/BusinessSubscriptionTransitionModelDao.java
index 3ad50b7..351c879 100644
--- a/osgi-bundles/bundles/analytics/src/main/java/com/ning/billing/osgi/bundles/analytics/dao/model/BusinessSubscriptionTransitionModelDao.java
+++ b/osgi-bundles/bundles/analytics/src/main/java/com/ning/billing/osgi/bundles/analytics/dao/model/BusinessSubscriptionTransitionModelDao.java
@@ -39,10 +39,8 @@ public class BusinessSubscriptionTransitionModelDao extends BusinessModelDaoBase
     private UUID bundleId;
     private String bundleExternalKey;
     private UUID subscriptionId;
-
     private DateTime requestedTimestamp;
-    private String eventType;
-    private String category;
+    private String event;
 
     private String prevProductName;
     private String prevProductType;
@@ -107,8 +105,7 @@ public class BusinessSubscriptionTransitionModelDao extends BusinessModelDaoBase
         this.subscriptionId = subscriptionId;
 
         this.requestedTimestamp = requestedTimestamp;
-        this.eventType = event.getEventType().toString();
-        this.category = event.getCategory() != null ? event.getCategory().toString() : null;
+        this.event = event.toString();
 
         if (previousSubscription != null) {
             this.prevProductName = previousSubscription.getProductName();
@@ -211,12 +208,8 @@ public class BusinessSubscriptionTransitionModelDao extends BusinessModelDaoBase
         return requestedTimestamp;
     }
 
-    public String getEventType() {
-        return eventType;
-    }
-
-    public String getCategory() {
-        return category;
+    public String getEvent() {
+        return event;
     }
 
     public String getPrevProductName() {
@@ -336,8 +329,7 @@ public class BusinessSubscriptionTransitionModelDao extends BusinessModelDaoBase
         sb.append(", bundleExternalKey='").append(bundleExternalKey).append('\'');
         sb.append(", subscriptionId=").append(subscriptionId);
         sb.append(", requestedTimestamp=").append(requestedTimestamp);
-        sb.append(", eventType='").append(eventType).append('\'');
-        sb.append(", category='").append(category).append('\'');
+        sb.append(", event='").append(event).append('\'');
         sb.append(", prevProductName='").append(prevProductName).append('\'');
         sb.append(", prevProductType='").append(prevProductType).append('\'');
         sb.append(", prevProductCategory='").append(prevProductCategory).append('\'');
@@ -389,10 +381,7 @@ public class BusinessSubscriptionTransitionModelDao extends BusinessModelDaoBase
         if (bundleId != null ? !bundleId.equals(that.bundleId) : that.bundleId != null) {
             return false;
         }
-        if (category != null ? !category.equals(that.category) : that.category != null) {
-            return false;
-        }
-        if (eventType != null ? !eventType.equals(that.eventType) : that.eventType != null) {
+        if (event != null ? !event.equals(that.event) : that.event != null) {
             return false;
         }
         if (nextBillingPeriod != null ? !nextBillingPeriod.equals(that.nextBillingPeriod) : that.nextBillingPeriod != null) {
@@ -497,8 +486,7 @@ public class BusinessSubscriptionTransitionModelDao extends BusinessModelDaoBase
         result = 31 * result + (bundleExternalKey != null ? bundleExternalKey.hashCode() : 0);
         result = 31 * result + (subscriptionId != null ? subscriptionId.hashCode() : 0);
         result = 31 * result + (requestedTimestamp != null ? requestedTimestamp.hashCode() : 0);
-        result = 31 * result + (eventType != null ? eventType.hashCode() : 0);
-        result = 31 * result + (category != null ? category.hashCode() : 0);
+        result = 31 * result + (event != null ? event.hashCode() : 0);
         result = 31 * result + (prevProductName != null ? prevProductName.hashCode() : 0);
         result = 31 * result + (prevProductType != null ? prevProductType.hashCode() : 0);
         result = 31 * result + (prevProductCategory != null ? prevProductCategory.hashCode() : 0);
diff --git a/osgi-bundles/bundles/analytics/src/test/java/com/ning/billing/osgi/bundles/analytics/api/TestBusinessSubscriptionTransition.java b/osgi-bundles/bundles/analytics/src/test/java/com/ning/billing/osgi/bundles/analytics/api/TestBusinessSubscriptionTransition.java
index 30b2c66..be667ab 100644
--- a/osgi-bundles/bundles/analytics/src/test/java/com/ning/billing/osgi/bundles/analytics/api/TestBusinessSubscriptionTransition.java
+++ b/osgi-bundles/bundles/analytics/src/test/java/com/ning/billing/osgi/bundles/analytics/api/TestBusinessSubscriptionTransition.java
@@ -57,8 +57,7 @@ public class TestBusinessSubscriptionTransition extends AnalyticsTestSuiteNoDB {
         Assert.assertEquals(businessSubscriptionTransition.getBundleExternalKey(), subscriptionTransitionModelDao.getBundleExternalKey());
         Assert.assertEquals(businessSubscriptionTransition.getSubscriptionId(), subscriptionTransitionModelDao.getSubscriptionId());
         Assert.assertEquals(businessSubscriptionTransition.getRequestedTimestamp(), subscriptionTransitionModelDao.getRequestedTimestamp());
-        Assert.assertEquals(businessSubscriptionTransition.getEventType(), subscriptionTransitionModelDao.getEventType());
-        Assert.assertEquals(businessSubscriptionTransition.getCategory(), subscriptionTransitionModelDao.getCategory());
+        Assert.assertEquals(businessSubscriptionTransition.getEvent(), subscriptionTransitionModelDao.getEvent());
 
         Assert.assertNull(businessSubscriptionTransition.getPrevProductName());
         Assert.assertNull(businessSubscriptionTransition.getPrevProductType());
diff --git a/osgi-bundles/bundles/analytics/src/test/java/com/ning/billing/osgi/bundles/analytics/dao/model/TestBusinessSubscriptionTransitionModelDao.java b/osgi-bundles/bundles/analytics/src/test/java/com/ning/billing/osgi/bundles/analytics/dao/model/TestBusinessSubscriptionTransitionModelDao.java
index 3ba1271..1ade98c 100644
--- a/osgi-bundles/bundles/analytics/src/test/java/com/ning/billing/osgi/bundles/analytics/dao/model/TestBusinessSubscriptionTransitionModelDao.java
+++ b/osgi-bundles/bundles/analytics/src/test/java/com/ning/billing/osgi/bundles/analytics/dao/model/TestBusinessSubscriptionTransitionModelDao.java
@@ -53,8 +53,7 @@ public class TestBusinessSubscriptionTransitionModelDao extends AnalyticsTestSui
         Assert.assertEquals(subscriptionTransitionModelDao.getBundleExternalKey(), bundle.getExternalKey());
         Assert.assertEquals(subscriptionTransitionModelDao.getSubscriptionId(), subscriptionTransition.getSubscriptionId());
         Assert.assertEquals(subscriptionTransitionModelDao.getRequestedTimestamp(), requestedTimestamp);
-        Assert.assertEquals(subscriptionTransitionModelDao.getEventType(), event.getEventType().toString());
-        Assert.assertEquals(subscriptionTransitionModelDao.getCategory(), event.getCategory().toString());
+        Assert.assertEquals(subscriptionTransitionModelDao.getEvent(), event.toString());
 
         Assert.assertNull(subscriptionTransitionModelDao.getPrevProductName());
         Assert.assertNull(subscriptionTransitionModelDao.getPrevProductType());