Add Subscription Service
- g_sakkas (Unlicensed)
- Former user (Deleted)
Owned by g_sakkas (Unlicensed)
The following example shows the addition of multiple products to a subscription. The service can be either created as draft or effective based on the classification code you select.
Â
addService.java Expand source
@EJB private CRMProcessSubscriptionServiceCreationBean processSubscriptionServiceCreationBean; public CRMDOSubscriptionAction addServiceAsEffective(CRMDOSubscription subscription,ArrayList<CRMDOProduct> products){ //create the subscription service creation data object SubscriptionServiceCreation subscriptionServiceCreation = processSubscriptionServiceCreationBean.constructSubscriptionServiceCreation(subscription); //if the classification code is set to ADD_SERVICE then the product will be added as effective //if the classification code is set to ADD_SERVICE_AS_DRAFT then the product will be added as draft subscriptionServiceCreation.setClassificationCode(SubscriptionActionClassificationCode.ADD_SERVICE); //the list of the products that will be added on the subscription Set<SubscriptionActionProduct> servicesToBeProcessed = new HashSet<SubscriptionActionProduct>(); for (int i=0;i<products.size();i++) { CRMDOProduct product = (CRMDOProduct)products.get(i); //create a new subscription action product data object and define the product the will be processed SubscriptionActionProduct subscriptionActionProduct =new SubscriptionActionProduct(); subscriptionActionProduct.setIsDeleted(new Integer(0)); subscriptionActionProduct.setProduct(product); subscriptionActionProduct.setIsSelected(new Integer(1)); //if you need to distribute the specified product, you need to set the provisioning distributor to the subscription action product //if you need to distribute the specified product to more than one distributors, you have to create as many subscription action products as the number of distributors, with the same product and the different distributor //subscriptionActionProduct.setProvisioningDistributor(provisioningDistributor); servicesToBeProcessed.add(subscriptionActionProduct); } subscriptionServiceCreation.setServicesToBeProcessed(servicesToBeProcessed); //submit the subscription service creation data object in order for the new product to be added on the subscription. //the subscription action data object is the object which contains all the information about the action you perform on the subscription CRMDOSubscriptionAction subscriptionAction = processSubscriptionServiceCreationBean.submit(subscriptionServiceCreation); Â return subscriptionAction; }