@EJB private CRMProcessSubscriptionServiceRemoveBean processSubscriptionServiceRemoveBean;
public CRMDOSubscriptionAction removeService(CRMDOSubscription subscription,ArrayList<CRMDOProduct> products){
//create the subscription service remove data object
SubscriptionServiceRemove subscriptionServiceRemove = processSubscriptionServiceRemoveBean.constructSubscriptionServiceRemove(subscription);
//The applicable classification for that action are:REGRET_SERVICE,CANCEL_SERVICE,UNDO_ADD_SERVICE
//the list of the productproducts that will be removed from 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 where you will define the product that will be removed by the action
SubscriptionActionProduct subscriptionActionProduct =new SubscriptionActionProduct();
//load the related subscription service
CRMDOSubscriptionService subscriptionService = subscriptionServiceBean.load(subscription, product);
subscriptionActionProduct.setIsDeleted(new Integer(0));
subscriptionActionProduct.setProduct(product);
subscriptionActionProduct.setSubService(subscriptionService);
subscriptionActionProduct.setIsSelected(new Integer(1));
servicesToBeProcessed.add(subscriptionActionProduct);
}
subscriptionServiceRemove.setServicesToBeProcessed(servicesToBeProcessed);
//submit the subscription service remove data object in order to remove the product from subscription
//As a result is the subscription action
data
object.
//the subscription action data object is the object which contains all the information about the action you perform on the subscription
CRMDOSubscriptionAction subscriptionAction = processSubscriptionServiceRemoveBean.submit(subscriptionServiceRemove);
return subscriptionAction;
}
|