com.ning.billing.subscription.api.user
Class DefaultSubscriptionBase

java.lang.Object
  extended by com.ning.billing.util.entity.EntityBase
      extended by com.ning.billing.subscription.api.user.DefaultSubscriptionBase
All Implemented Interfaces:
com.ning.billing.entitlement.api.Blockable, SubscriptionBase, Entity
Direct Known Subclasses:
SubscriptionDataRepair

public class DefaultSubscriptionBase
extends EntityBase
implements SubscriptionBase


Field Summary
protected  List<SubscriptionBaseEvent> events
           
 
Fields inherited from class com.ning.billing.util.entity.EntityBase
createdDate, id, updatedDate
 
Constructor Summary
DefaultSubscriptionBase(DefaultSubscriptionBase internalSubscription, SubscriptionBaseApiService apiService, com.ning.billing.clock.Clock clock)
           
DefaultSubscriptionBase(SubscriptionBuilder builder)
           
DefaultSubscriptionBase(SubscriptionBuilder builder, SubscriptionBaseApiService apiService, com.ning.billing.clock.Clock clock)
           
 
Method Summary
 boolean cancel(CallContext context)
           
 boolean cancelWithDate(org.joda.time.DateTime requestedDate, CallContext context)
           
 boolean cancelWithPolicy(BillingActionPolicy policy, CallContext context)
           
 boolean changePlan(String productName, BillingPeriod term, String priceList, CallContext context)
           
 boolean changePlanWithDate(String productName, BillingPeriod term, String priceList, org.joda.time.DateTime requestedDate, CallContext context)
           
 boolean changePlanWithPolicy(String productName, BillingPeriod term, String priceList, BillingActionPolicy policy, CallContext context)
           
 boolean equals(Object obj)
           
 long getActiveVersion()
           
 org.joda.time.DateTime getAlignStartDate()
           
 List<SubscriptionBaseTransition> getAllTransitions()
           
 List<SubscriptionBaseTransition> getBillingTransitions()
           
 UUID getBundleId()
           
 org.joda.time.DateTime getBundleStartDate()
           
 ProductCategory getCategory()
           
 org.joda.time.DateTime getChargedThroughDate()
           
 PlanPhase getCurrentPhase()
           
 org.joda.time.DateTime getCurrentPhaseStart()
           
 Plan getCurrentPlan()
           
 PriceList getCurrentPriceList()
           
 org.joda.time.DateTime getEndDate()
           
 List<SubscriptionBaseEvent> getEvents()
           
 org.joda.time.DateTime getFutureEndDate()
           
 SubscriptionBaseTransitionData getInitialTransitionForCurrentPlan()
           
 BillingPeriod getLastActiveBillingPeriod()
           
 ProductCategory getLastActiveCategory()
           
 Plan getLastActivePlan()
           
 PriceList getLastActivePriceList()
           
 Product getLastActiveProduct()
           
 long getLastEventOrderedId()
           
 org.joda.time.DateTime getPaidThroughDate()
           
 SubscriptionBaseTransition getPendingTransition()
           
 org.joda.time.DateTime getPlanChangeEffectiveDate(BillingActionPolicy policy)
           
 SubscriptionBaseTransition getPreviousTransition()
           
 com.ning.billing.entitlement.api.Entitlement.EntitlementSourceType getSourceType()
           
 org.joda.time.DateTime getStartDate()
           
 com.ning.billing.entitlement.api.Entitlement.EntitlementState getState()
           
 SubscriptionBaseTransitionData getTransitionFromEvent(SubscriptionBaseEvent event, int seqId)
           
 int hashCode()
           
 boolean isSubscriptionFutureCancelled()
           
 void rebuildTransitions(List<SubscriptionBaseEvent> inputEvents, Catalog catalog)
           
 boolean recreate(PlanPhaseSpecifier spec, org.joda.time.DateTime requestedDate, CallContext context)
           
 boolean uncancel(CallContext context)
           
 
Methods inherited from class com.ning.billing.util.entity.EntityBase
getCreatedDate, getId, getUpdatedDate, safeCompareTo
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.ning.billing.util.entity.Entity
getCreatedDate, getId, getUpdatedDate
 

Field Detail

events

protected List<SubscriptionBaseEvent> events
Constructor Detail

DefaultSubscriptionBase

public DefaultSubscriptionBase(SubscriptionBuilder builder)

DefaultSubscriptionBase

public DefaultSubscriptionBase(SubscriptionBuilder builder,
                               @Nullable
                               SubscriptionBaseApiService apiService,
                               @Nullable
                               com.ning.billing.clock.Clock clock)

DefaultSubscriptionBase

public DefaultSubscriptionBase(DefaultSubscriptionBase internalSubscription,
                               SubscriptionBaseApiService apiService,
                               com.ning.billing.clock.Clock clock)
Method Detail

getEvents

public List<SubscriptionBaseEvent> getEvents()

getBundleId

public UUID getBundleId()
Specified by:
getBundleId in interface SubscriptionBase

getStartDate

public org.joda.time.DateTime getStartDate()
Specified by:
getStartDate in interface SubscriptionBase

getState

public com.ning.billing.entitlement.api.Entitlement.EntitlementState getState()
Specified by:
getState in interface SubscriptionBase

getSourceType

public com.ning.billing.entitlement.api.Entitlement.EntitlementSourceType getSourceType()
Specified by:
getSourceType in interface SubscriptionBase

getCurrentPhase

public PlanPhase getCurrentPhase()
Specified by:
getCurrentPhase in interface SubscriptionBase

getCurrentPlan

public Plan getCurrentPlan()
Specified by:
getCurrentPlan in interface SubscriptionBase

getCurrentPriceList

public PriceList getCurrentPriceList()
Specified by:
getCurrentPriceList in interface SubscriptionBase

getEndDate

public org.joda.time.DateTime getEndDate()
Specified by:
getEndDate in interface SubscriptionBase

getFutureEndDate

public org.joda.time.DateTime getFutureEndDate()
Specified by:
getFutureEndDate in interface SubscriptionBase

recreate

public boolean recreate(PlanPhaseSpecifier spec,
                        org.joda.time.DateTime requestedDate,
                        CallContext context)
                 throws SubscriptionBaseApiException
Throws:
SubscriptionBaseApiException

cancel

public boolean cancel(CallContext context)
               throws SubscriptionBaseApiException
Specified by:
cancel in interface SubscriptionBase
Throws:
SubscriptionBaseApiException

cancelWithDate

public boolean cancelWithDate(org.joda.time.DateTime requestedDate,
                              CallContext context)
                       throws SubscriptionBaseApiException
Specified by:
cancelWithDate in interface SubscriptionBase
Throws:
SubscriptionBaseApiException

cancelWithPolicy

public boolean cancelWithPolicy(BillingActionPolicy policy,
                                CallContext context)
                         throws SubscriptionBaseApiException
Specified by:
cancelWithPolicy in interface SubscriptionBase
Throws:
SubscriptionBaseApiException

uncancel

public boolean uncancel(CallContext context)
                 throws SubscriptionBaseApiException
Specified by:
uncancel in interface SubscriptionBase
Throws:
SubscriptionBaseApiException

changePlan

public boolean changePlan(String productName,
                          BillingPeriod term,
                          String priceList,
                          CallContext context)
                   throws SubscriptionBaseApiException
Specified by:
changePlan in interface SubscriptionBase
Throws:
SubscriptionBaseApiException

changePlanWithDate

public boolean changePlanWithDate(String productName,
                                  BillingPeriod term,
                                  String priceList,
                                  org.joda.time.DateTime requestedDate,
                                  CallContext context)
                           throws SubscriptionBaseApiException
Specified by:
changePlanWithDate in interface SubscriptionBase
Throws:
SubscriptionBaseApiException

changePlanWithPolicy

public boolean changePlanWithPolicy(String productName,
                                    BillingPeriod term,
                                    String priceList,
                                    BillingActionPolicy policy,
                                    CallContext context)
                             throws SubscriptionBaseApiException
Specified by:
changePlanWithPolicy in interface SubscriptionBase
Throws:
SubscriptionBaseApiException

getPendingTransition

public SubscriptionBaseTransition getPendingTransition()
Specified by:
getPendingTransition in interface SubscriptionBase

getLastActiveProduct

public Product getLastActiveProduct()
Specified by:
getLastActiveProduct in interface SubscriptionBase

getLastActivePriceList

public PriceList getLastActivePriceList()
Specified by:
getLastActivePriceList in interface SubscriptionBase

getLastActiveCategory

public ProductCategory getLastActiveCategory()
Specified by:
getLastActiveCategory in interface SubscriptionBase

getLastActivePlan

public Plan getLastActivePlan()
Specified by:
getLastActivePlan in interface SubscriptionBase

getLastActiveBillingPeriod

public BillingPeriod getLastActiveBillingPeriod()
Specified by:
getLastActiveBillingPeriod in interface SubscriptionBase

getPreviousTransition

public SubscriptionBaseTransition getPreviousTransition()
Specified by:
getPreviousTransition in interface SubscriptionBase

getCategory

public ProductCategory getCategory()
Specified by:
getCategory in interface SubscriptionBase

getBundleStartDate

public org.joda.time.DateTime getBundleStartDate()

getChargedThroughDate

public org.joda.time.DateTime getChargedThroughDate()
Specified by:
getChargedThroughDate in interface SubscriptionBase

getPaidThroughDate

public org.joda.time.DateTime getPaidThroughDate()
Specified by:
getPaidThroughDate in interface SubscriptionBase

getAllTransitions

public List<SubscriptionBaseTransition> getAllTransitions()
Specified by:
getAllTransitions in interface SubscriptionBase

hashCode

public int hashCode()
Overrides:
hashCode in class EntityBase

equals

public boolean equals(Object obj)
Overrides:
equals in class EntityBase

getTransitionFromEvent

public SubscriptionBaseTransitionData getTransitionFromEvent(SubscriptionBaseEvent event,
                                                             int seqId)

getAlignStartDate

public org.joda.time.DateTime getAlignStartDate()

getLastEventOrderedId

public long getLastEventOrderedId()

getActiveVersion

public long getActiveVersion()

getBillingTransitions

public List<SubscriptionBaseTransition> getBillingTransitions()

getInitialTransitionForCurrentPlan

public SubscriptionBaseTransitionData getInitialTransitionForCurrentPlan()

isSubscriptionFutureCancelled

public boolean isSubscriptionFutureCancelled()

getPlanChangeEffectiveDate

public org.joda.time.DateTime getPlanChangeEffectiveDate(BillingActionPolicy policy)

getCurrentPhaseStart

public org.joda.time.DateTime getCurrentPhaseStart()

rebuildTransitions

public void rebuildTransitions(List<SubscriptionBaseEvent> inputEvents,
                               Catalog catalog)


Copyright © 2010-2013. All Rights Reserved.