Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * Copyright 2010-2013 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.entitlement.api;
 
 
 import java.util.List;
 import java.util.UUID;

Primary API to manage the creation and retrieval of Entitlement.
 
 public interface EntitlementApi {

    
Create a new entitlement for that account.

The PlanPhaseSpecifier should refer to a ProductCategory.BASE of ProductCategory.STANDALONE.

Parameters:
accountId the account id
spec the product specification for that new entitlement
externalKey the external key for that entitlement-- which must be unique in the system
effectiveDate the date at which the entitlement should start
context the context
Returns:
a new entitlement
Throws:
EntitlementApiException if the system fail to create the Entitlement.
 
     public Entitlement createBaseEntitlement(UUID accountIdPlanPhaseSpecifier specString externalKeyLocalDate effectiveDateCallContext context)
             throws EntitlementApiException;

    
Adds an ADD_ON entitlement to previously created entitlement.

The PlanPhaseSpecifier should refer to a ProductCategory.ADD_ON. The new entitlement will be bundled using the externalKey that was specified when creating the base entitlement.

Parameters:
bundleId the id of the bundle
spec the product specification for that new entitlement
effectiveDate the date at which the entitlement should start
context the context
Returns:
a new entitlement
Throws:
EntitlementApiException if the system fail to create the Entitlement
 
     public Entitlement addEntitlement(UUID bundleIdPlanPhaseSpecifier specLocalDate effectiveDateCallContext context)
             throws EntitlementApiException;


    
Simulate a change of product for the BP on that bundle and return the effect it would have on the existing ADD_ON-- if any.

Parameters:
bundleId the id of the bundle
targetProductName the target product name for the BP
effectiveDate the date at which the change would occur
context the context
Returns:
the status for the existing ADD_ON Entitlement
Throws:
EntitlementApiException if this operation is not carried on a base plan.
 
     public List<EntitlementAOStatusDryRungetDryRunStatusForChange(UUID bundleIdfinal String targetProductNamefinal LocalDate effectiveDatefinal TenantContext context)
             throws EntitlementApiException;


    
Will pause all entitlements associated with the base entitlement. If there are no ADD_ONN this is only the base entitlement.

Parameters:
bundleId
effectiveDate
context
Throws:
EntitlementApiException if the system fail to find the base Entitlement
 
     public void pause(UUID bundleIdLocalDate effectiveDateCallContext context)
             throws EntitlementApiException;


    
Will resume all entitlements associated with the base entitlement. If there are no ADD_ONN this is only the base entitlement.

Parameters:
bundleId
effectiveDate
context
Throws:
EntitlementApiException if the system fail to find the base Entitlement
    public void resume(UUID bundleIdLocalDate effectiveDateCallContext context)
            throws EntitlementApiException;

    
Will add a blocking event for the specified service associated with the base entitlement.

Parameters:
bundleId the id of the bundle
serviceName the name of the service
effectiveDate the date at which the operation should occur
blockBilling whether this event should block billing
blockEntitlement whether this event should block entitlement
blockChange whether this event should block any change
context the context
Throws:
EntitlementApiException if the system fail to find the base Entitlement public void block(UUID bundleId, String serviceName, LocalDate effectiveDate, boolean blockBilling, boolean blockEntitlement, boolean blockChange, CallContext context) throws EntitlementApiException;


    
Will unblock all entitlements associated with the base entitlement. If there are no ADD_ONN this is only the base entitlement.

Parameters:
bundleId the id of the bundle
serviceName the name of the service
effectiveDate the date at which the operation should occur
context the context
Throws:
EntitlementApiException if the system fail to find the base Entitlement public void unblock(UUID bundleId, String serviceName, LocalDate effectiveDate, CallContext context) throws EntitlementApiException;


    
Retrieves an Entitlement using its id.

Parameters:
id the id of the entitlement
context the context
Returns:
the entitlement
Throws:
EntitlementApiException if the entitlement does not exist
    public Entitlement getEntitlementForId(UUID idTenantContext contextthrows EntitlementApiException;

    
Retrieves all the Entitlement attached to the base entitlement.

Parameters:
bundleId the id of the bundle
context the context
Returns:
a list of entitlements
Throws:
EntitlementApiException if the entitlement does not exist
    public List<EntitlementgetAllEntitlementsForBundle(UUID bundleIdTenantContext context)
            throws EntitlementApiException;

    
Retrieves all the Entitlement for a given account and matching an external key.

Parameters:
accountId the account id
externalKey the external key
context the context
Returns:
a list of entitlements
Throws:
EntitlementApiException if the account does not exist
    public List<EntitlementgetAllEntitlementsForAccountIdAndExternalKey(UUID accountIdString externalKeyTenantContext context)
            throws EntitlementApiException;

    
Retrieves all the Entitlement for a given account.

Parameters:
accountId the account id
context the context
Returns:
a list of entitlements
Throws:
EntitlementApiException if the account does not exist
    public List<EntitlementgetAllEntitlementsForAccountId(UUID accountIdTenantContext contextthrows EntitlementApiException;

    
Transfer all the Entitlement For the source account and matching the external key to the destination account.

The date is interpreted by the system to be in the timezone specified at the destination Account.

The Entitlement on the source account will be cancelled at effective date and the Entitlement on the destination account will be created at the effectiveDate.

Parameters:
sourceAccountId the unique id for the account on which the bundle will be transferred For
destAccountId the unique id for the account on which the bundle will be transferred to
externalKey the externalKey for the bundle
effectiveDate the date at which this transfer should occur
context the user context
Returns:
the id of the newly created bundle for the destination account
Throws:
EntitlementApiException if the system could not transfer the entitlements
    public UUID transferEntitlements(final UUID sourceAccountIdfinal UUID destAccountIdfinal String externalKeyfinal LocalDate effectiveDate,
                                     final CallContext context)
            throws EntitlementApiException;

    
Transfer all the Entitlement for the source account and matching the external key to the destination account.

The date is interpreted by the system to be in the timezone specified at the destination Account.

The Entitlement on the source account will be cancelled at effective date and the Entitlement on the destination account will be created at the effectiveDate. The billingPolicy will be used to override the default billing behavior for the cancellation of the subscriptions on the source account.

Parameters:
sourceAccountId the unique id for the account on which the bundle will be transferred For
destAccountId the unique id for the account on which the bundle will be transferred to
externalKey the externalKey for the bundle
effectiveDate the date at which this transfer should occur
billingPolicy the override billing policy
context the user context
Returns:
the id of the newly created base entitlement for the destination account
Throws:
EntitlementApiException if the system could not transfer the entitlements
    public UUID transferEntitlementsOverrideBillingPolicy(final UUID sourceAccountIdfinal UUID destAccountIdfinal String externalKeyfinal LocalDate effectiveDate,
                                                          final BillingActionPolicy billingPolicyfinal CallContext context)
            throws EntitlementApiException;
New to GrepCode? Check out our FAQ X