killbill-uncached

tags for account

12/7/2011 6:03:30 PM

Details

diff --git a/account/src/main/java/com/ning/billing/account/api/DefaultAccount.java b/account/src/main/java/com/ning/billing/account/api/DefaultAccount.java
index fa99fb0..fd7c46d 100644
--- a/account/src/main/java/com/ning/billing/account/api/DefaultAccount.java
+++ b/account/src/main/java/com/ning/billing/account/api/DefaultAccount.java
@@ -20,7 +20,7 @@ import com.ning.billing.catalog.api.Currency;
 
 import java.util.UUID;
 
-public class DefaultAccount extends CustomizableEntityBase implements Account {
+public class DefaultAccount extends CustomizableEntityBase implements Account, Taggable {
     public final static String OBJECT_TYPE = "Account";
 
     private final String externalKey;
@@ -30,6 +30,7 @@ public class DefaultAccount extends CustomizableEntityBase implements Account {
     private final String phone;
     private final Currency currency;
     private final int billCycleDay;
+    private final TagStore tags;
 
     public DefaultAccount(AccountData data) {
         this(UUID.randomUUID(), data.getExternalKey(), data.getEmail(), data.getName(),
@@ -46,6 +47,8 @@ public class DefaultAccount extends CustomizableEntityBase implements Account {
         this.phone = phone;
         this.currency = currency;
         this.billCycleDay = billCycleDay;
+
+        this.tags = new TagStore(id, getObjectName());
     }
 
     @Override
diff --git a/account/src/main/java/com/ning/billing/account/api/Taggable.java b/account/src/main/java/com/ning/billing/account/api/Taggable.java
new file mode 100644
index 0000000..2038dc6
--- /dev/null
+++ b/account/src/main/java/com/ning/billing/account/api/Taggable.java
@@ -0,0 +1,27 @@
+/*
+ * Copyright 2010-2011 Ning, Inc.
+ *
+ * Ning licenses this file to you under the Apache License, version 2.0
+ * (the "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at:
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ */
+
+package com.ning.billing.account.api;
+
+import org.joda.time.DateTime;
+
+public interface Taggable {
+    public boolean hasTag(String tagName);
+    public void addTag(TagDescription description, String addedBy, DateTime dateAdded);
+    public void removeTag(TagDescription description);
+    public boolean generateInvoice();
+    public boolean processPayment();
+}