Skip to end of banner
Go to start of banner

Create a Payment Gateway

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 4 Next »

This section describes how a custom provisioning provider can be created.

 

What does this section cover?

Create a custom payment gateway

In order to create a custom payment gateway, you need to:

  1. Define the custom payment gateway in payment gateways metadata file.
  2. Create a custom enum to define authentication setting parameters. (optional)
  3. Create a custom business object class extending com.crm.businessobject.paymentgateway.CRMBOPaymentGatewaySettingBean.
  4. Create  a user interface class extending com.crm.process.paymentgateway.CRMUIPaymentGatewaySettingBean
  5. Create a custom process class extending com.crm.process.paymentgateway.CRMProcessPaymentGatewayBean
  6. Create a custom search page.
  7. Create a custom summary page for payment gateway requests.
  8. Create a custom data entry page for the payment gateway.
  9. Define the new menu options in menu options metadata file.
  10. Define a custom module in modules metadata file.

Note that all data object, business object, user interface and process class names should start with the custom project directory name:

For this example we assume that <custom_project> = payeezy 

1. Payment Gateways Metadata File

The new custom payment gateway must be defined in paymentgateways.xml file which is located under <custom_project>/src/main/resources/metadata/ directory. 

2. Provisioning Parameters Enum

This enum will be used to define the authentication setting parameters. Note that 'order' property will be used to define the parameter's order on the screen.

MYCOMPANYTucanoParameters
package payeezy.dataobject.paymentgateway.payeezy;
import com.crm.dataobject.ICRMLookupEnum;

public enum PayeezyParameter implements ICRMLookupEnum{
	
	MODE("key_mode", "String",1),
	TEST_URL("key_url", "String",2),
	TEST_MERCHANT_TOKEN("key_merchant_token", "String",3),
	TEST_TA_TOKEN("key_transarmor_token", "String",4),
	TEST_API_KEY("key_api_key", "String",5),
	TEST_API_SECRET("key_api_secret", "String",6),
	TEST_JS_SECURITY_KEY("key_js_security_key", "String",7),
	LIVE_URL("key_url", "String",2),
	LIVE_MERCHANT_TOKEN("key_merchant_token", "String",3),
	LIVE_TA_TOKEN("key_transarmor_token", "String",4),
	LIVE_API_KEY("key_api_key", "String",5),
	LIVE_API_SECRET("key_api_secret", "String",6),
	LIVE_JS_SECURITY_KEY("key_js_security_key", "String",7);

	private String label;
	private String type;
	private Integer order;
	 
	private PayeezyParameter(String label, String type, Integer order) {
		this.label = label;
		this.type = type;
		this.order = order;
	}
	@Override
	public String getLabel() {
		return label;
	}
	public String getType() {
		return type;
	}
	public Integer getOrder() {
		return order;
	}
}

To achieve that, when you create a new provisioning provider object (CRMDOProvProvider) you have to create new object of your provisioning parameters data object class and set it to the 'parameters' property of the CRMDOProvProvider object:

MYCOMPANYCRMBOTucanoProviderBean
/**
  * Constructs a TUCANO provisioning provider.
  * 
  * @param mainDTO - the main data object
  * @return a TUCANO provisioning provider
  * @throws Exception
  */
@Override
protected CRMDO constructDO(CRMDO mainDTO) throws Exception {
		
	CRMDOProvProvider provProvider = (CRMDOProvProvider)super.constructDO(mainDTO);
	MYCOMPANYTucanoParameters tucanoParameters = new MYCOMPANYTucanoParameters();	
	provProvider.setProvisioningParameters(tucanoParameters);
	...
	
	return provProvider;		
}

More details on creating a provisioning provider business object class can be found in the next section.

3. Provisioning Provider Business Object Class

The new custom business object class must extend com.crm.businessobject.provisioning.CRMBOProvProviderBean and implement com.crm.businessobject.ICRMBOProvisioningProvider interface and its five methods:

  1. getServiceCAID(CRMDOProvProvider provProvider,CRMDOProduct product) which should return a unique identification string (conditional access id) used by the provisioning provider to identify the given service.
  2. getSmartcardCAID(CRMDOProvProvider provProvider,CRMDOInstalledItem installedItem) which should return a unique identification string (conditional access id) used by the provisioning provider to identify the given smartcard.
  3. getSTBCAID(CRMDOProvProvider provProvider,CRMDOInstalledItem installedItem) which should return a unique identification string (conditional access id) used by the provisioning provider to identify the given set top box.
  4. setXMLFromObjects(CRMDOProvProvider provProvider) which should construct a string XML that will keep all information about the provider's connection parameters and set it to CRMDOProvProvider object's 'parameters' String property.
  5. setObjectsFromXML(CRMDOProvProvider provProvider) which should set CRMDOProvProvider object's connection parameter values using its 'parameters' String property value.

Other useful methods that you are recommended to implement are:

  1. public CRMDOProvProvider loadEffective()
  2. public CRMDOProvProvider loadEffective(Boolean applicationServerFiltering) 
  3. public CRMDOProvProvider load()

Methods you are recommended to override to add functionality:

  1. protected CRMDO constructDO(CRMDO mainDTO)
  2. protected LinkedHashMap<String, String> getMandatoryFields(CRMDO dto)
  3. protected void validateOnSaveProvisioningProviderServices(CRMDOProvProvider provProvider)
  4. protected void validateOnSaveProvisioningDistributors(CRMDOProvProvider provProvider)
  5. protected void validateOnSaveProvisioningProviderPhysicalGood(CRMDOProvProvider provProvider)
MYCOMPANYCRMBOTucanoProviderBean.java
public class MYCOMPANYCRMBOTucanoProviderBean extends CRMBOProvProviderBean implements ICRMBOProvisioningProvider  {

	@EJB private MYCOMPANYTucanoProviderXMLUtilBean tucanoProviderXMLUtilBean;
	@EJB private CRMBOProvProviderServiceBean provProviderServiceBean;
	@EJB private CRMValidatorBean validatorBean;
	@EJB private CRMBOProvisioningDistributorBean provisioningDistributorBean;
    /**
     * Default constructor. 
     */
    public MYCOMPANYCRMBOTucanoProviderBean() {
    	// do nothing
    }
    /**
     * Loads the effective TUCANO provisioning provider
     * @return the effective TUCANO provisioning provider
     * @throws Exception
     */
	public CRMDOProvProvider loadEffective() throws Exception {
		return loadEffective(MYCOMPANYCRMProcessTucanoProviderBean.PROVIDER_PROTOCOL);
	}
	
	/**
	 * Loads the effective TUCANO provisioning provider
	 * @param applicationServerFiltering - if set to true filters out the results based on the provisioning provider's allowed application servers
	 * @return the effective TUCANO provisioning provider
	 * @throws Exception
	 */
	public CRMDOProvProvider loadEffective(Boolean applicationServerFiltering) throws Exception {
		return loadEffective(MYCOMPANYCRMProcessTucanoProviderBean.PROVIDER_PROTOCOL, applicationServerFiltering);
	}
	/**
	 * Loads the TUCANO provisioning provider
	 * @return the TUCANO provisioning provider
	 * @throws Exception
	 */
	public CRMDOProvProvider load() throws Exception {
		return loadByProtocol(MYCOMPANYCRMProcessTucanoProviderBean.PROVIDER_PROTOCOL);
	}
	
	/**
     * Constructs a TUCANO provisioning provider.
     * 
     * @param mainDTO - the main data object
     * @return a TUCANO provisioning provider
     * @throws Exception
     */
	@Override
	protected CRMDO constructDO(CRMDO mainDTO) throws Exception {
		
		CRMDOProvProvider provProvider = (CRMDOProvProvider)super.constructDO(mainDTO);
		
		MYCOMPANYTucanoParameters tucanoParameters = new MYCOMPANYTucanoParameters();	
		provProvider.setProvisioningParameters(tucanoParameters);
		
		provProvider.setProtocol(MYCOMPANYCRMProcessTucanoProviderBean.PROVIDER_PROTOCOL);
		provProvider.setLifeCycleState(ProvProviderLifeCycleState.NOT_EFFECTIVE);
		provProvider = setDefaultSettings(provProvider);
		
		return provProvider;		
	}
    
	/**
     * Returns the mandatory fields of the given provisioning provider.
     * 
     * @param dto - the provisioning provider to return the mandatory fields for
     * @return the mandatory fields of the provisioning provider
     * @throws Exception
     */
	@Override
	protected LinkedHashMap<String, String> getMandatoryFields(CRMDO dto) throws Exception {
		
		LinkedHashMap<String, String> mandatoryFields = super.getMandatoryFields(dto);
		
		mandatoryFields.put("key_url", "provisioningParameters/url");
		mandatoryFields.put("key_identity_key", "provisioningParameters/identityKey");
		mandatoryFields.put("key_username", "provisioningParameters/username");
		mandatoryFields.put("key_password", "provisioningParameters/password");
		mandatoryFields.put("key_language_id", "provisioningParameters/languageID");
		mandatoryFields.put("key_default_product_id", "provisioningParameters/defaultProductID");
		mandatoryFields.put("key_stb_material_id", "provisioningParameters/stbMaterialID");
		mandatoryFields.put("key_provider_id", "provisioningParameters/providerID");
		mandatoryFields.put("key_tve_adapter", "provisioningParameters/tveAdapter");
		mandatoryFields.put("key_jwt_key", "provisioningParameters/jwtKey");
		mandatoryFields.put("key_jwt_expiration_time_in_seconds", "provisioningParameters/jwtExpirationTimeInSeconds");
		mandatoryFields.put("key_address_country", "provisioningParameters/addressCountry");
		
		return mandatoryFields;
	}
	
	/**
	 * Sets provisioning provider's connection parameter values using its 'parameters' String property value
	 * @param provProvider - the provisioning provider to set the objects to
	 * @return the updated provisioning provider
	 */
	public CRMDOProvProvider setObjectsFromXML(CRMDOProvProvider provProvider) throws Exception {
		if (provProvider.getParameters()!=null)
		{	
			provProvider = tucanoProviderXMLUtilBean.loadConnectionParametersFromXml(provProvider);
		}
		
		return provProvider;
	}
	/**
	 * Constructs a String XML that will keep all information about the provider's connection parameters and set it to CRMDOProvProvider object's 'parameters' String property
	 * @param provProvider - the provisioning provider to construct the XML for
	 * @return the updated provisioning provider
	 */
	public CRMDOProvProvider setXMLFromObjects(CRMDOProvProvider provProvider) throws Exception {
		if (provProvider!=null)
		{
			provProvider = tucanoProviderXMLUtilBean.convertConnectionParametersToXML(provProvider);
		}
		
		return provProvider;
	}
	/**
	 * Returns a unique identification string (conditional access id) used by the provisioning provider to identify the given service
	 * @param provProvider - the provisioning provider to get the service ca id for
	 * @param product - the product to get its service ca id
	 * @return the product's service ca id
	 */
	public String getServiceCAID(CRMDOProvProvider provProvider, CRMDOProduct product) throws Exception {
		String serviceCAID = null;
		
		CRMDOProvProviderService provProviderService = provProviderServiceBean.load(provProvider, product); 
		
		if (provProviderService!=null)
		{
			serviceCAID = provProviderService.getValue();
		}
		
		return serviceCAID;
	}
	/**
	 * Returns a unique identification string (conditional access id) used by the provisioning provider to identify the given smartcard
	 * @param provProvider - the provisioning provider to get the smartcard ca id for
	 * @param installedItem - the smartcard installed item to get its ca id
	 * @return the smartcard ca id
	 */
	public String getSmartcardCAID(CRMDOProvProvider provProvider, CRMDOInstalledItem installedItem) throws Exception {
		return installedItem.getAltCode();
	}
	/**
	 * Returns a unique identification string (conditional access id) used by the provisioning provider to identify the given set-top box
	 * @param provProvider - the provisioning provider to get the set-top box ca id for
	 * @param installedItem - the set-top box installed item to get its ca id
	 * @return the set-top box ca id
	 */
	public String getSTBCAID(CRMDOProvProvider provProvider, CRMDOInstalledItem installedItem) throws Exception {
		return installedItem.getAltCode();
	}
	
	/**
	 * Validates a provisioning provider service on save.
	 * 
	 * @param provProvider - the provisioning provider to validate it's provisioning provider service
	 * @throws Exception
	 */
	@Override
	@SuppressWarnings({ "unchecked", "rawtypes" })
	protected void validateOnSaveProvisioningProviderServices(CRMDOProvProvider provProvider) throws Exception, AtLeastOneRecordException, MandatoryFieldException, InvalidValueException {
		if(!ServiceUtil.isInitialized(provProvider.getServices())
			|| provProvider.getServices() == null
			|| provProvider.getServices().size() == 0)
		{
			provProvider.setServices(new HashSet(provProviderServiceBean.load(provProvider)));
		}
			
		if(provProvider.getServices() != null && provProvider.getServices().size() > 0)
		{
			Iterator<CRMDOProvProviderService> iterServices	= provProvider.getServices().iterator();
			
			while (iterServices.hasNext())
			{
				CRMDOProvProviderService service = (CRMDOProvProviderService) iterServices.next();
				
				CRMDOProduct product 				= service.getProduct();
				if (service.getIsDeleted()!=null && service.getIsDeleted().equals(new Integer(0)) && product.getType().getIsForProvision().equals(new Integer(1) ) )
				{
					if (service.getValue() == null)
					{
						throw new MandatoryFieldException(getCRMSession(), "key_provisioning_system_identifier");
					}
					
					if(!StringUtil.isNumeric(service.getValue()))
			    	{
						throw new InvalidValueException(null,"Provisioning System Identifier."+StringUtil.getNumericExceptionMessage(service.getValue()));
			    	}
				}
			}
			
			provProviderServiceBean.validateOnSave(new ArrayList<CRMDO>(provProvider.getServices()));
			
			validatorBean.validateUniqueRecord(
					"provisioning provider service", 
					new ArrayList<CRMDO>(provProvider.getServices()), 
					new String[]{"product.code"}, 
					new String[]{"service"});
			
		}
		else
		{
			throw new AtLeastOneRecordException(getCRMSession(), "key_service");
		}
	}
	
	/**
	 * Validates a provisioning distributor on save.
	 * 
	 * @param provProvider - the provisioning provider to validate it's provisioning distributor
	 * @throws Exception
	 */
	@Override
	@SuppressWarnings({ "unchecked", "rawtypes" })
	protected void validateOnSaveProvisioningDistributors(CRMDOProvProvider provProvider) throws Exception, AtLeastOneRecordException {
		if(!ServiceUtil.isInitialized(provProvider.getProvisioningDistributors())
			|| provProvider.getProvisioningDistributors() == null
			|| provProvider.getProvisioningDistributors().size() == 0)
		{
			provProvider.setProvisioningDistributors(new HashSet(provisioningDistributorBean.load(provProvider)));
		}
		
		if(provProvider.getProvisioningDistributors() != null && provProvider.getProvisioningDistributors().size() > 0)
		{
			Iterator<CRMDOProvisioningDistributor> iter = provProvider.getProvisioningDistributors().iterator();
			Boolean nonDeletedExists = new Boolean(false);
			
			while(iter.hasNext())
			{
				CRMDOProvisioningDistributor provisioningDistributor = (CRMDOProvisioningDistributor)iter.next();
				
				if(!provisioningDistributor.isDeleted())
				{
					if(nonDeletedExists)
					{
						throw new OnlyOneRecordException(getCRMSession(), "key_provisioning_distributor");
					}	
					
					nonDeletedExists = new Boolean(true);
				}	
			}	
			
			if(provProvider.getLifeCycleState() != null && provProvider.getLifeCycleState().equals(ProvProviderLifeCycleState.EFFECTIVE) && !nonDeletedExists)
			{
				throw new AtLeastOneRecordException(getCRMSession(), "key_provisioning_distributors");
			}	
			
			provisioningDistributorBean.validateOnSave(new ArrayList<CRMDO>(provProvider.getProvisioningDistributors()));
		}
		else
		{
			if(provProvider.getLifeCycleState() != null && provProvider.getLifeCycleState().equals(ProvProviderLifeCycleState.EFFECTIVE))
			{
				throw new AtLeastOneRecordException(getCRMSession(), "key_provisioning_distributors");
			}	
		}
	}
	
	/**
	 * Validates a provisioning provider physical good on save.
	 * 
	 * @param provProvider - the provisioning provider to validate it's physical good
	 * @throws Exception
	 */
	@Override
	protected void validateOnSaveProvisioningProviderPhysicalGood(CRMDOProvProvider provProvider) throws Exception, AtLeastOneRecordException {
		if (isCollectionModified(provProvider.getPhysicalGoods()))
		{
			Set<CRMDOProvProviderPhysicalGood> physicalGoods = provProvider.getPhysicalGoods();
			Iterator<CRMDOProvProviderPhysicalGood> physicalGoodIter = physicalGoods.iterator();
			int physicalGoodCounter = 0;
			
			while (physicalGoodIter.hasNext())
			{
				CRMDOProvProviderPhysicalGood physicalGood	= physicalGoodIter.next();
				
				if (physicalGood.getIsDeleted().equals(new Integer(0)))
				{
					physicalGoodCounter++;
				}
			}
			
			if (physicalGoodCounter == 0)
			{
				throw new AtLeastOneRecordException(getCRMSession(), "key_physical_good");
			}
		}
		
		super.validateOnSaveProvisioningProviderPhysicalGood(provProvider);
	}
	
	...
}

4. User Interface Classes

a. Provisioning Provider User Interface Class

The first user interface class that should be created is the provisioning provider's user interface class and should extend com.crm.process.provisioning.CRMUIProvProviderBean.

This class's methods will by called by the provisioning provider data entry page.

MYCOMPANYCRMUITucanoServiceProvider.java
public class MYCOMPANYCRMUITucanoServiceProviderBean extends CRMUIProvProviderBean {

	@EJB private CRMBOProvProviderServiceBean provProviderServiceBean;
	@EJB private CRMBOProvisioningDistributorBean provisioningDistributorBean;
	@EJB private MYCOMPANYCRMBOTucanoProviderBean tucanoProviderBean;
	@EJB private CRMBOSubscriptionTypeBean subscriptionTypeBean;
	@EJB private MYCOMPANYTucanoProviderXMLUtilBean tucanoProviderXMLUtilBean;
	@EJB private CRMBOProductBean productBean;
	@EJB private CRMBOProductTypeBean productTypeBean;
	@EJB private CRMBOProvProviderPhysicalGoodBean provProviderPhysicalGoodBean;	
	
    /**
     * Default constructor. 
     */
    public MYCOMPANYCRMUITucanoServiceProviderBean() {
    	// do nothing
    }
    
    /**
     * Loads the effective TUCANO provisioning provider
     * @return the effective TUCANO provisioning provider
     * @throws Exception
     */
    public CRMDOProvProvider loadForm() throws Exception {
    	
    	CRMDOProvProvider provProvider = (CRMDOProvProvider)tucanoProviderBean.loadEffective(false);
		
    	if (provProvider==null)
    	{
    		provProvider = (MYCOMPANYCRMDOProvProvider)tucanoProviderBean.load();
        	
        	if (provProvider==null)
        	{
        		provProvider = (CRMDOProvProvider)createButton();
        		Set<CRMDOProvisioningDistributor> provisioningDistributors = new HashSet<CRMDOProvisioningDistributor>();
        		CRMDOProvisioningDistributor provisioningDistributor = (CRMDOProvisioningDistributor) provisioningDistributorBean.construct(provProvider);
    			provisioningDistributors.add(provisioningDistributor);
        		provProvider.setProvisioningDistributors(provisioningDistributors);
        		
        	}
        	else
        	{
        		provProvider = tucanoProviderXMLUtilBean.loadConnectionParametersFromXml(provProvider);
        	}	
    	}
    	else
    	{
    		provProvider = tucanoProviderXMLUtilBean.loadConnectionParametersFromXml(provProvider);
    	}    	
		return provProvider;
    }
    /**
     * Loads a provisioning provider given its id
     * @param provProviderID - the provisioning provider id
     * @return the provisioning provider
     * @throws Exception
     */
	@SuppressWarnings({ "rawtypes", "unchecked" })
	public CRMDOProvProvider loadForm(String provProviderID) throws Exception {
    	
    	CRMDOProvProvider provProvider = (CRMDOProvProvider)tucanoProviderBean.load(provProviderID);
		provProvider.setPhysicalGoods(new HashSet(loadPhysicalGoodsTab(provProvider)));
		provProvider.setProvisioningDistributors(new HashSet(loadDistributorsTab(provProvider)));
		
		if(provProvider.getProvisioningDistributors().size()==0)
		{
			Set<CRMDOProvisioningDistributor> provisioningDistributors = new HashSet<CRMDOProvisioningDistributor>();
			CRMDOProvisioningDistributor provisioningDistributor= (CRMDOProvisioningDistributor) provisioningDistributorBean.construct(provProvider);
			provisioningDistributors.add(provisioningDistributor);
			provProvider.setProvisioningDistributors(provisioningDistributors);
		}
		provProvider = tucanoProviderXMLUtilBean.loadConnectionParametersFromXml(provProvider);
		
		return provProvider;
    }
    
    public CRMDOProvProvider createButton() throws Exception {
    	return createButton(CRMProcessTucanoProviderBean.PROVIDER_PROTOCOL);
    }
 
    /**
     * Creates a new provisioning provider with the given protocol
     * @param protocol - the protocol to create the provisioning provider for
     * @return the new provisioning provider
     * @throws Exception
     */
    public CRMDOProvProvider createButton(String protocol) throws Exception {
    	
    	CRMDOProvProviderprovProvider = null;
    	
    	if (protocol!=null)
    	{    	
	    	if (protocol.equals(MYCOMPANYCRMProcessTucanoProviderBean.PROVIDER_PROTOCOL))
	    	{
	    		provProvider = (CRMDOProvProvider)tucanoProviderBean.construct();
	    	}
    	}
    	
    	return provProvider;
    }
    /**
     * Saves the given provisioning provider
     * @param provProvider - the provisioning provider to save
     * @return the saved provisioning provider
     * @throws Exception
     */
    public CRMDOProvProvider saveButton(CRMDOProvProvider provProvider) throws Exception {
    	
    	String provProviderProtocol = provProvider.getProtocol();
    	
    	if (provProviderProtocol.equals(MYCOMPANYCRMProcessTucanoProviderBean.PROVIDER_PROTOCOL))
    	{
    		tucanoProviderBean.validateConnectionParameters(provProvider);
    	
    		return (CRMDOProvProvider)tucanoProviderBean.validateAndSave(provProvider);	
    	}
    	
    	return provProvider;
    }
    
    /**
     * Loads the given provisioning provider
     * @param provProvider - the provisioning provider to load
     * @return the provisioning provider
     * @throws Exception
     */
	public CRMDOProvProvider editButton(CRMDOProvProvider provProvider) throws Exception {
		return (provProvider!=null && !provProvider.isNew()) ? loadForm(provProvider.getId()) : loadForm();
	}
	/**
	 * Deletes the given provisioning provider
	 * @param provProvider - the provisioning provider to delete
	 * @return the deleted provisioning provider
	 * @throws Exception
	 */
	public CRMDOProvProvider deleteButton(CRMDOProvProvider provProvider) throws Exception {
		
		String provProviderProtocol = provProvider.getProtocol();
    	
    	if (provProviderProtocol.equals(MYCOMPANYCRMProcessTucanoProviderBean.PROVIDER_PROTOCOL))
    	{
    		return (CRMDOProvProvider)tucanoProviderBean.validateAndDelete(provProvider);
    	}
    	
		return provProvider;
	}
	
	/**
	 * Adds a list of set-top-boxes to the provisioning provider.
	 * 
	 * @param  provProvider		        the provisioning provider related with the physical goods
	 * @param  productTypeIds			a list of product IDs
	 * @return                       	a list of the provisioning provider physical goods added
	 * @throws Exception
	 */
	public ArrayList<CRMDO> addSetTopBoxButton (CRMDOProvProvider provProvider, ArrayList<String> productTypeIds) throws Exception { 
		
		String className = productTypeBean.getDOName();
		String primaryId = "id";
		String propertyName = "productType";
		
		ArrayList<CRMDO> smartcards = provProviderPhysicalGoodBean.construct(provProvider, null, className, primaryId,propertyName, productTypeIds,	null);
	
		for(int i = 0; i < smartcards.size(); i++)
		{
			CRMDOProvProviderPhysicalGood smartcard = (CRMDOProvProviderPhysicalGood)smartcards.get(i);
			smartcard.setValue(ProvProviderPhysicalGood.DECODER);
		}
		
		return smartcards;
	}
}

b. Provisioning Request User Interface Class

The second user interface class that should be created is the provisioning provider's user interface class and should extend com.crm.process.provisioning.CRMUIProvisioningRequestBean.

This class's methods will by called by the provisioning provider requests summary pages.

MYCOMPANYCRMUITucanoServiceProvisioningRequest.java
public class MYCOMPANYCRMUITucanoServiceProvisioningRequestBean extends CRMUIProvisioningRequestBean {
    public MYCOMPANYCRMUITucanoServiceProvisioningRequestBean() {
    	// do nothing
    }
    	
    /**
     * Loads the provisioning request type options.
     *  
     * @return the provisioning request type options
     * @throws Exception
     */
    public LookupBuilder getTypeOptions() throws Exception {
    	return getTypeOptions(null);
    }
    
    /**
     * Loads the provisioning request type options.
     *  
     * @param emptyValue - an empty value for type 
     * @return the provisioning request type options
     * @throws Exception
     */
    public LookupBuilder getTypeOptions(String emptyValue) throws Exception {
    		
    	LookupBuilder builder = new LookupBuilder();
    		
    	if (emptyValue!=null)
    	{
    		builder.build("", emptyValue);
    	}
    	MYCOMPANYProvisioningRequestTypeCode[] requestTypes = MYCOMPANYProvisioningRequestTypeCode.values();
    		
   		for (int i=0; i<requestTypes.length; i++)
   		{
   			MYCOMPANYProvisioningRequestTypeCode requestType = requestTypes[i];
   			builder.build(requestType.toString(), requestType.getLabel());
   		}
    		
   		return builder;
   	}	
}

5. Provisioning Provider Process Class

a. Create Class and Implement a Method for Each Action

Use @Stateless(mappedName = "ejb/MYCOMPANYCRMProcessTucanoProvider") to define the mapped name of the provisioning provider EJB. The mapped name should match the one defined in provisioningproviders.xml metadata file.

The new process class must extend com.crm.process.provisioning.CRMProcessProviderBean and implement the following methods (which are defined as abstract in CRMProcessProviderBean parent class):

Note that the value of PORVIDER_PROTOCOL must be the same as <provproviderprotocol> tag's value as defined in provisioningproviders.xml 


  1. public String getProtocol()

    MYCOMPANYCRMProcessTucanoProviderBean.java
    @Stateless(mappedName = "ejb/MYCOMPANYCRMProcessTucanoProvider")
    @LocalBean
    public class MYCOMPANYCRMProcessTucanoProviderBean extends CRMProcessProviderBean {
    	
    	public static String PROVIDER_PROTOCOL = "TUCANO";
    	
        /**
         * Default constructor. 
         */
    	public MYCOMPANYCRMProcessTucanoProviderBean() {
            super();
        }
    	public String getProtocol() throws Exception {
    		return PROVIDER_PROTOCOL;
    	}
    	...
    }
  2. public CRMDOProvProvider setObjectsFromXML(CRMDOProvProvider provProvider)

    This method is called whenever loadProvider(), loadEffectiveProvider(String protocol) and loadEffectiveProvider(String protocol , Boolean applicationServerFiltering) methods of CRMProcessProviderBean are called.

    MYCOMPANYCRMProcessTucanoProvider.java
    public class MYCOMPANYCRMProcessTucanoProviderBean extends CRMProcessProviderBean {
    
    	@EJB private MYCOMPANYCRMBOTucanoProviderBean tucanoProviderBean;
    	...
    	public CRMDOProvProvider setObjectsFromXML(CRMDOProvProvider provProvider) throws Exception {
    		
    		provProvider = tucanoProviderBean.setObjectsFromXML(provProvider);
    		
    		return provProvider;
    	}
    	...
    }
  3. public void processAddServiceSubscriptionAction(CRMDOSubscriptionAction subscriptionAction, ArrayList<ProviderService> providerServices, ArrayList<ProviderInstalledItem> providerInstalledItems)

    This method is called whenever an 'Add Service' subscription action is executed.

    MYCOMPANYCRMProcessTucanoProvider.java
    public class MYCOMPANYCRMProcessTucanoProviderBean extends CRMProcessProviderBean {
    	...
    	@Override
    	public void processAddServiceSubscriptionAction(CRMDOSubscriptionAction subscriptionAction,ArrayList<ProviderService> providerServices, ArrayList<ProviderInstalledItem> providerInstalledItems)throws Exception {
    		
    		CRMDOProvProvider provProvider = loadProvider();
    		CRMDOSubscription subscription = subscriptionAction.getSubscription();
    		activateTucanoServices(subscriptionAction, provProvider, subscription, providerServices);
    	}
    	...
    }
  4. public void processAmendBundleServiceSubscriptionAction(CRMDOSubscriptionAction subscriptionAction, ArrayList<ProviderService> removedProviderServices, ArrayList<ProviderService> addedProviderServices)

    This method is called whenever an 'Amend Bundled' subscription action is executed.

    MYCOMPANYCRMProcessTucanoProvider.java
    public class MYCOMPANYCRMProcessTucanoProviderBean extends CRMProcessProviderBean {
    	...
    	@Override
    	public void processAmendBundleServiceSubscriptionAction(CRMDOSubscriptionAction subscriptionAction,ArrayList<ProviderService> removedProviderServices, ArrayList<ProviderService> addedProviderServices)
    			throws Exception {
    		...
    	}
    	...
    }
  5. public void processRemoveServiceSubscriptionAction(CRMDOSubscriptionAction subscriptionAction, ArrayList<ProviderService> removedProviderServices, ArrayList<ProviderService> addedProviderServices)

    This method is called whenever a 'Remove Service' subscription action is executed.

    MYCOMPANYCRMProcessTucanoProvider.java
    public class MYCOMPANYCRMProcessTucanoProviderBean extends CRMProcessProviderBean {
    	...
    	@Override
    	public void processRemoveServiceSubscriptionAction(CRMDOSubscriptionAction subscriptionAction,ArrayList<ProviderService> removedProviderServices, ArrayList<ProviderService> addedProviderServices)throws Exception {
    		CRMDOProvProvider provProvider = loadProvider();
    		CRMDOSubscription subscription = subscriptionAction.getSubscription();
    		
    		//addedProviderServices in case of regret the swap  
    		//The "Activating an AlphaNetworks Tucano Services Process" is performed for the services that will be restored (i.e. the services that the subscriber had before the service swap)
    		activateTucanoServices(subscriptionAction, provProvider, subscription, addedProviderServices);
    		
    		ArrayList<ProviderService> authorisedServices = getAuthorisedServices(removedProviderServices);
    		deactivateTucanoServices(subscriptionAction, provProvider, subscription, authorisedServices);
    	}
    	...
    }
  6. public void processSwapServiceSubscriptionAction(CRMDOSubscriptionAction subscriptionAction, ArrayList<ProviderService> removedProviderServices, ArrayList<ProviderService> addedProviderServices)

    This method is called whenever a 'Swap Service' subscription action is executed.

    MYCOMPANYCRMProcessTucanoProvider.java
    public class MYCOMPANYCRMProcessTucanoProviderBean extends CRMProcessProviderBean {
    	...
    	@Override
    	public void processSwapServiceSubscriptionAction(CRMDOSubscriptionAction subscriptionAction, ArrayList<ProviderService> removedProviderServices, ArrayList<ProviderService> addedProviderServices) throws Exception {
    		CRMDOProvProvider provProvider = loadProvider();
    		CRMDOSubscription subscription = subscriptionAction.getSubscription();
    		
    		ArrayList<ProviderService> effectiveServices = getEffectiveServices(addedProviderServices);
    		activateTucanoServices(subscriptionAction, provProvider, subscription, effectiveServices);
    		
    		ArrayList<ProviderService> authorisedServices = getAuthorisedServices(removedProviderServices);
    		deactivateTucanoServices(subscriptionAction, provProvider, subscription, authorisedServices);
    	}
    	...
    }
  7. public void processStartServiceSubscriptionAction(CRMDOSubscriptionAction subscriptionAction, ArrayList<ProviderService> providerServices)

    This method is called whenever a 'Start Service' subscription action is executed.

    MYCOMPANYCRMProcessTucanoProvider.java
    public class MYCOMPANYCRMProcessTucanoProviderBean extends CRMProcessProviderBean {
    	...
    	@Override
    	public void processStartServiceSubscriptionAction(CRMDOSubscriptionAction subscriptionAction, ArrayList<ProviderService> providerServices) throws Exception {
    		CRMDOProvProvider provProvider = loadProvider();
    		CRMDOSubscription subscription = subscriptionAction.getSubscription();
    		activateTucanoServices(subscriptionAction, provProvider, subscription, providerServices);
    	}
    	...
    }
  8. public void processStopServiceSubscriptionAction(CRMDOSubscriptionAction subscriptionAction, ArrayList<ProviderService> providerServices)

    This method is called whenever a 'Stop Service' subscription action is executed.

    MYCOMPANYCRMProcessTucanoProvider.java
    public class MYCOMPANYCRMProcessTucanoProviderBean extends CRMProcessProviderBean {
    	...
    	@Override
    	public void processStopServiceSubscriptionAction(CRMDOSubscriptionAction subscriptionAction,ArrayList<ProviderService> providerServices) throws Exception {
    		CRMDOProvProvider provProvider = loadProvider();
    		CRMDOSubscription subscription = subscriptionAction.getSubscription();
    		deactivateTucanoServices(subscriptionAction, provProvider, subscription, providerServices);
    	}
    	...
    }
  9. public void processAddInstalledItemSubscriptionAction(CRMDOSubscriptionAction subscriptionAction, ArrayList<ProviderInstalledItem> providerInstalledItems)

    This method is called whenever an 'Add Installed Item' subscription action is executed.

    MYCOMPANYCRMProcessTucanoProvider.java
    public class MYCOMPANYCRMProcessTucanoProviderBean extends CRMProcessProviderBean {
    	...
    	@Override
    	public void processAddInstalledItemSubscriptionAction(CRMDOSubscriptionAction subscriptionAction, ArrayList<ProviderInstalledItem> providerInstalledItems) throws Exception {
    		CRMDOProvProvider provProvider = loadProvider();
    		CRMDOSubscription subscription = subscriptionAction.getSubscription();
    		addTucanoSTBs(subscriptionAction, provProvider, subscription, providerInstalledItems);
    		
    	}
    	...
    }
  10. public void processRemoveInstalledItemSubscriptionAction(CRMDOSubscriptionAction subscriptionAction, ArrayList<ProviderInstalledItem> providerInstalledItems)

    This method is called whenever a 'Remove Installed Item' subscription action is executed.

    MYCOMPANYCRMProcessTucanoProvider.java
    public class MYCOMPANYCRMProcessTucanoProviderBean extends CRMProcessProviderBean {
    	...
    	@Override
    	public void processRemoveInstalledItemSubscriptionAction(CRMDOSubscriptionAction subscriptionAction, ArrayList<ProviderInstalledItem> providerInstalledItems) throws Exception {
    		CRMDOProvProvider provProvider = loadProvider();
    		CRMDOSubscription subscription = subscriptionAction.getSubscription();
    		removeTucanoSTBs(subscriptionAction, provProvider, subscription, providerInstalledItems);
    		if(subscription.getLifeCycleState()==null)
    		{
    			subscription.setLifeCycleState(subscriptionBean.getLifeCycleState(subscription, getCurrentDate()));
    		}
    		if(subscription.getLifeCycleState()!=null 
    				&& (subscription.getLifeCycleState().equals(SubscriptionLifeCycleState.CANCELLED) 
    						|| subscription.getLifeCycleState().equals(SubscriptionLifeCycleState.REGRETTED) )
    				&& !installedItemExists(subscription, provProvider))
    		{
    			updateSubscriptionProvisioningParameter(PROVIDER_PROTOCOL, subscription, USERNAME, null, subscription.getNumber(), SubProvProviderLifeCycleState.CANCELLED);
    		}	
    	}
    	...
    }
  11. public void processSwapInstalledItemSubscriptionAction(CRMDOSubscriptionAction subscriptionAction, ArrayList<ProviderInstalledItem> removedProviderInstalledItems, ArrayList<ProviderInstalledItem> addedProviderInstalledItems)

    This method is called whenever a 'Swap Installed Item' subscription action is executed.

    MYCOMPANYCRMProcessTucanoProvider.java
    public class MYCOMPANYCRMProcessTucanoProviderBean extends CRMProcessProviderBean {
    	...
    	@Override
    	public void processSwapInstalledItemSubscriptionAction(CRMDOSubscriptionAction subscriptionAction, ArrayList<ProviderInstalledItem> removedProviderInstalledItems,ArrayList<ProviderInstalledItem> addedProviderInstalledItems) throws Exception {
    		
    		CRMDOProvProvider provProvider = loadProvider();
    		CRMDOSubscription subscription = subscriptionAction.getSubscription();
    		addTucanoSTBs(subscriptionAction, provProvider, subscription, addedProviderInstalledItems);
    		
    		removeTucanoSTBs(subscriptionAction, provProvider, subscription, removedProviderInstalledItems);
    	}
    	...
    }
  12. public void processChangeSubscriptionDistributionSubscriptionAction(CRMDOSubscriptionAction subscriptionAction, ArrayList<ProviderService> removedProviderServices, ArrayList<ProviderInstalledItem> removedProviderInstalledItems, ArrayList<ProviderService> addedProviderServices, ArrayList<ProviderInstalledItem> addedProviderInstalledItems)

    This method is called whenever a 'Change Subscription Distribution' subscription action is executed.

    MYCOMPANYCRMProcessTucanoProvider.java
    public class MYCOMPANYCRMProcessTucanoProviderBean extends CRMProcessProviderBean {
    	...
    	@Override
    	public void processChangeSubscriptionDistributionSubscriptionAction(CRMDOSubscriptionAction subscriptionAction,
    																		ArrayList<ProviderService> removedProviderServices,
    																		ArrayList<ProviderInstalledItem> removedProviderInstalledItems,
    																		ArrayList<ProviderService> addedProviderServices,
    																		ArrayList<ProviderInstalledItem> addedProviderInstalledItems) throws Exception {
    		CRMDOProvProvider provProvider = loadProvider();
    		CRMDOSubscription subscription = subscriptionAction.getSubscription();
    		
    		activateTucanoServices(subscriptionAction, provProvider, subscription, addedProviderServices);
    		
    		deactivateTucanoServices(subscriptionAction, provProvider, subscription, removedProviderServices);
    		addTucanoSTBs(subscriptionAction, provProvider, subscription, addedProviderInstalledItems);
    		
    		removeTucanoSTBs(subscriptionAction, provProvider, subscription, removedProviderInstalledItems);
    	}
    	...
    }
  13. public void processBecomeSubscriberSubscriptionAction(CRMDOSubscriptionAction subscriptionAction, ArrayList<ProviderService> providerServices, ArrayList<ProviderInstalledItem> providerInstalledItems)

    This method is called whenever a 'Become Subscriber' subscription action is executed.

    MYCOMPANYCRMProcessTucanoProvider.java
    public class MYCOMPANYCRMProcessTucanoProviderBean extends CRMProcessProviderBean {
    	...
    	@Override
    	public void processBecomeSubscriberSubscriptionAction(CRMDOSubscriptionAction subscriptionAction,
    														  ArrayList<ProviderService> providerServices, 
    														  ArrayList<ProviderInstalledItem> providerInstalledItems) throws Exception {
    		
    		CRMDOProvProvider provProvider = loadProvider();
    		CRMDOSubscription subscription = subscriptionAction.getSubscription();
    		
    		createNewTucanoAccount(subscriptionAction, provProvider, subscription, providerServices, providerInstalledItems);
    	}
    	...
    }
  14. public void processActivateSubscriptionAction(CRMDOSubscriptionAction subscriptionAction, ArrayList<ProviderService> providerServices)

    This method is called whenever an 'Activate Subscription' subscription action is executed.

    MYCOMPANYCRMProcessTucanoProvider.java
    public class MYCOMPANYCRMProcessTucanoProviderBean extends CRMProcessProviderBean {
    	...
    	@Override
    	public void processActivateSubscriptionAction(CRMDOSubscriptionAction subscriptionAction, ArrayList<ProviderService> providerServices) throws Exception {
    		
    		CRMDOProvProvider provProvider = loadProvider();
    		CRMDOSubscription subscription = subscriptionAction.getSubscription();
    		
    		activateTucanoServices(subscriptionAction, provProvider, subscription, providerServices);
    	}
    	...
    }
  15. public void processDeactivateSubscriptionAction(CRMDOSubscriptionAction subscriptionAction, ArrayList<ProviderService> providerServices)

    This method is called whenever a 'Deactivate Subscription' subscription action is executed.

    MYCOMPANYCRMProcessTucanoProvider.java
    public class MYCOMPANYCRMProcessTucanoProviderBean extends CRMProcessProviderBean {
    	...
    	@Override
    	public void processDeactivateSubscriptionAction(CRMDOSubscriptionAction subscriptionAction, ArrayList<ProviderService> providerServices) throws Exception {
    		
    		CRMDOProvProvider provProvider = loadProvider();
    		CRMDOSubscription subscription = subscriptionAction.getSubscription();
    		deactivateTucanoServices(subscriptionAction, provProvider, subscription, providerServices);
    	}
    	...
    }
  16. public void processTerminateSubscriptionAction(CRMDOSubscriptionAction subscriptionAction, ArrayList<ProviderService> providerServices)

    This method is called whenever a 'Terminate Subscription' subscription action is executed.

    MYCOMPANYCRMProcessTucanoProvider.java
    public class MYCOMPANYCRMProcessTucanoProviderBean extends CRMProcessProviderBean {
    	public static String PROVIDER_PROTOCOL = "TUCANO";
    	public static String USERNAME = "USERNAME";
    	...
    	@Override
    	public void processTerminateSubscriptionAction(CRMDOSubscriptionAction subscriptionAction, ArrayList<ProviderService> providerServices) throws Exception {
    		CRMDOProvProvider provProvider = loadProvider();
    		CRMDOSubscription subscription = subscriptionAction.getSubscription();
    		deactivateTucanoServices(subscriptionAction, provProvider, subscription, providerServices);
    		
    		if(!installedItemExists(subscription, provProvider))
    		{
    			updateSubscriptionProvisioningParameter(PROVIDER_PROTOCOL, subscription, USERNAME, null, subscription.getNumber(), SubProvProviderLifeCycleState.CANCELLED);
    		}
    	}
    	...
    }
  17. public void processRestSubscriptionAction(CRMDOSubscriptionAction subscriptionAction, ArrayList<ProviderService> providerServices)

    This method is called whenever a 'Rest Subscription' subscription action is executed.

    MYCOMPANYCRMProcessTucanoProvider.java
    public class MYCOMPANYCRMProcessTucanoProviderBean extends CRMProcessProviderBean {
    	...
    	@Override
    	public void processRestSubscriptionAction(CRMDOSubscriptionAction subscriptionAction,ArrayList<ProviderService> providerServices) throws Exception {
    		CRMDOProvProvider provProvider = loadProvider();
    		CRMDOSubscription subscription = subscriptionAction.getSubscription();
    		deactivateTucanoServices(subscriptionAction, provProvider, subscription, providerServices);
    		
    	}
    	...
    }
  18. public void processEndSubscriptionRestingSubscriptionAction(CRMDOSubscriptionAction subscriptionAction, ArrayList<ProviderService> providerServices)

    This method is called whenever an 'End Subscription Resting' subscription action is executed.

    MYCOMPANYCRMProcessTucanoProvider.java
    public class MYCOMPANYCRMProcessTucanoProviderBean extends CRMProcessProviderBean {
    	...
    	@Override
    	public void processEndSubscriptionRestingSubscriptionAction(CRMDOSubscriptionAction subscriptionAction, ArrayList<ProviderService> providerServices) throws Exception {
    		CRMDOProvProvider provProvider = loadProvider();
    		CRMDOSubscription subscription = subscriptionAction.getSubscription();
    		activateTucanoServices(subscriptionAction, provProvider, subscription, providerServices);
    		
    	}
    	...
    }
  19. public void processShortTermActivationSubscriptionAction(CRMDOSubscriptionAction subscriptionAction, ArrayList<ProviderService> providerServices)

    This method is called whenever a 'Short Term Activation' subscription action is executed.

    MYCOMPANYCRMProcessTucanoProvider.java
    public class MYCOMPANYCRMProcessTucanoProviderBean extends CRMProcessProviderBean {
    	...
    	@Override
    	public void processShortTermActivationSubscriptionAction(CRMDOSubscriptionAction subscriptionAction, ArrayList<ProviderService> providerServices) throws Exception {
    		
    		CRMDOProvProvider provProvider = loadProvider();
    		CRMDOSubscription subscription = subscriptionAction.getSubscription();
    		activateTucanoServices(subscriptionAction, provProvider, subscription, providerServices);	
    	}
    	...
    }
  20. public void processEndShortTermActivationSubscriptionAction(CRMDOSubscriptionAction subscriptionAction, ArrayList<ProviderService> providerServices)

    This method is called whenever an 'End Short Term Activation' subscription action is executed.

    MYCOMPANYCRMProcessTucanoProvider.java
    public class MYCOMPANYCRMProcessTucanoProviderBean extends CRMProcessProviderBean {
    	...
    	@Override
    	public void processEndShortTermActivationSubscriptionAction(CRMDOSubscriptionAction subscriptionAction, ArrayList<ProviderService> providerServices) throws Exception {
    		CRMDOProvProvider provProvider = loadProvider();
    		CRMDOSubscription subscription = subscriptionAction.getSubscription();
    		deactivateTucanoServices(subscriptionAction, provProvider, subscription, providerServices);
    		
    	}
    	...
    }
  21. public void processShortTermDeactivationSubscriptionAction(CRMDOSubscriptionAction subscriptionAction, ArrayList<ProviderService> providerServices)

    This method is called whenever a 'Short Term Deactivation' subscription action is executed.

    MYCOMPANYCRMProcessTucanoProvider.java
    public class MYCOMPANYCRMProcessTucanoProviderBean extends CRMProcessProviderBean {
    	...
    	@Override
    	public void processShortTermDeactivationSubscriptionAction(CRMDOSubscriptionAction subscriptionAction, ArrayList<ProviderService> providerServices) throws Exception {
    		CRMDOProvProvider provProvider = loadProvider();
    		CRMDOSubscription subscription = subscriptionAction.getSubscription();
    		deactivateTucanoServices(subscriptionAction, provProvider, subscription, providerServices);	
    	}
    	...
    }
  22. public void processEndShortTermDeactivationSubscriptionAction(CRMDOSubscriptionAction subscriptionAction, ArrayList<ProviderService> providerServices)

    This method is called whenever an 'End Short Term Deactivation' subscription action is executed.

    MYCOMPANYCRMProcessTucanoProvider.java
    public class MYCOMPANYCRMProcessTucanoProviderBean extends CRMProcessProviderBean {
    	...
    	@Override
    	public void processEndShortTermDeactivationSubscriptionAction(CRMDOSubscriptionAction subscriptionAction, ArrayList<ProviderService> providerServices) throws Exception {
    		CRMDOProvProvider provProvider = loadProvider();
    		CRMDOSubscription subscription = subscriptionAction.getSubscription();
    		activateTucanoServices(subscriptionAction, provProvider, subscription, providerServices);
    	}
    	...
    }
  23.  public void processAddServiceUsageSubscriptionAction(CRMDOSubscriptionAction subscriptionAction, ArrayList<ProviderUsageDataRecord> protocolProviderUdrs)

    This method is called whenever an 'Add Service Usage' subscription action is executed.

    MYCOMPANYCRMProcessTucanoProvider.java
    public class MYCOMPANYCRMProcessTucanoProviderBean extends CRMProcessProviderBean {
    	...
    	@Override
    	public void processAddServiceUsageSubscriptionAction(CRMDOSubscriptionAction subscriptionAction,ArrayList<ProviderUsageDataRecord> protocolProviderUdrs) throws Exception {
    		...
    	}
    	...
    }
  24. public void processCancelledUDRs(ArrayList<ProviderUsageDataRecord> providerUsageDataRecords)

    This method is called whenever a 'Cancel UDR' action is executed.

    MYCOMPANYCRMProcessTucanoProvider.java
    public class MYCOMPANYCRMProcessTucanoProviderBean extends CRMProcessProviderBean {
    	...
    	@Override
    	public void processCancelledUDRs(ArrayList<ProviderUsageDataRecord> providerUsageDataRecords) throws Exception {
    		...
    	}
    	...
    }
  25. public void processResetSubscription(CRMDOProvProvider provProvider, CRMDOSubscription subscription)

    This method is callled whenever a 'Reset Subscription' subscription action is executed.

    MYCOMPANYCRMProcessTucanoProvider.java
    public class MYCOMPANYCRMProcessTucanoProviderBean extends CRMProcessProviderBean {
    	...
    	@Override
    	public void processResetSubscription(CRMDOProvProvider provProvider, CRMDOSubscription subscription) throws Exception {
    		String processName = ProvisioningRequestProcessName.RESET.toString();
    		
    		if(!isSubscriptionProvisioned(subscription.getId()) && ifSubscriptionServiceProvisionedExists(subscription.getId(), provProvider.getId()))
    		{
    			createNewTucanoAccount(provProvider, subscription, null, null, processName, null);
    		}
    		ArrayList<ProviderService> providerServicesForDeactivation = getProviderServicesForDeactivation(subscription, provProvider);
    		
    		if(providerServicesForDeactivation != null && providerServicesForDeactivation.size() > 0)
    		{
    			deactivateTucanoServices(provProvider, subscription, providerServicesForDeactivation, processName, null);
    		}	
    		
    		ArrayList<ProviderService> providerServicesForActivation = getProviderServicesForActivation(subscription, provProvider);
    		
    		if(providerServicesForActivation != null && providerServicesForActivation.size() > 0)
    		{
    			activateTucanoServices(provProvider, subscription, providerServicesForActivation, processName, null);
    		}
    		
    		ArrayList<ProviderInstalledItem> providerInstalledItemsForActivation = getProviderInstalledItemsForActivation(subscription, provProvider);
    		
    		if(providerInstalledItemsForActivation != null && providerInstalledItemsForActivation.size() > 0)
    		{
    			addTucanoSTBs(provProvider, subscription, providerInstalledItemsForActivation, processName, null);
    		}
    		
    		ArrayList<ProviderInstalledItem> providerInstalledItemsForDeactivation = getProviderInstalledItemsForDeactivation(subscription, provProvider);
    		
    		if(providerInstalledItemsForDeactivation != null && providerInstalledItemsForDeactivation.size() > 0)
    		{
    			removeTucanoSTBs(provProvider, subscription, providerInstalledItemsForDeactivation, processName, null);
    		}
    	}
    	...
    }

b. Create and Process Provisioning Requests

In the following example, you can see how a provisioning request for adding services, can be created and processed.

MYCOMPANYCRMBOTucanoProviderBean.java
public class MYCOMPANYCRMProcessTucanoProviderBean extends CRMProcessProviderBean {
	...
	private CRMDOProvisioningRequest processActivateOptionsProvisioningRequest(		CRMDOProvProvider provProvider, 
																					CRMDOSubscription subscription,
																					CRMDOSubProvProviderParameter subProvProviderParameter,
																					ArrayList<ProviderService> providerServices,
																					String processName, 
																					String processID,
																					TucanoAuthenticationToken tucanoAuthenticationToken) throws Exception {
		
		//The provisioning request parameters to be created 
		HashMap<String,Object> parameterValues = new HashMap<String,Object>();
 
		//The subscription provisioning parameter
		parameterValues.put(ProvisioningRequestParameterType.SUB_PROVISIONING_PARAMETER_ID.toString(), subProvProviderParameter);
		
		//A list of service CA IDs
		ArrayList<Integer> optionIds = new ArrayList<Integer>();
	    ArrayList<CRMDOSubProvisioningDistribution> subProvDistributions = new ArrayList<CRMDOSubProvisioningDistribution>();
		for(int i=0; i<providerServices.size(); i++)
		{
			optionIds.add(new Integer(tucanoProviderBean.getServiceCAID(provProvider,providerServices.get(i).getProduct())));
			subProvDistributions.add(providerServices.get(i).getSubProvisioningDistribution());
		}
 
		//The subscription provisioning distributor linked with the service
		parameterValues.put(ProvisioningRequestParameterType.SERVICE_CA_ID.toString(),optionIds);
		//The subscription service CA ID
		parameterValues.put(ProvisioningRequestParameterType.SERVICE_SUB_PROVISIONING_DISTRIBUTION_ID.toString(),subProvDistributions);
		
		//Create and save the porvisioning request and provisioning request parameters
		CRMDOProvisioningRequest provisioningRequest = createProvisioningRequest(	provProvider,
																					ProvisioningRequestTypeCode.ACTIVATE_OPTIONS.toString(), 
																					getCurrentDate(), 
																					parameterValues, 
																					"addOptions", 
																					null, 
																					processName, 
																					processID, 
																					subscription);
		
		Boolean success = false;
		String request = null;
		String result = null;
		
		//Send request to TUCANO and set values of request, success and result
		{...}
		//
		
		if(success)
		{
			provisioningRequest.setRequest(request+" / "result);
			completeProvisioningRequest(request+" / "result, getCurrentDate(),subProvDistributions,null,null,null,null);
		}
		else
		{
			rejectProvisioningRequest(provisioningRequest, result, subProvDistributions,null,null,null,null);
		}
		
		return provisioningRequest;
	}
	...
}

6. Summary Pages

You will need to create one main summary page for provisioning requests, and two that will be used by the main as drill-downs: one for provisioning request parameters and one for provisioning request process information.

For more information on creating custom summary pages go to Customize Summary Pages.

a. Provisioning Requests

b. Provisioning Request Parameters

c. Provisioning Request Process Information

7. Data Entry Page

You will need to create one data entry page for the provisioning provider. For more information on creating custom data entry pages go to Customize Data Entry Pages.

8. Menu Options Metadata File

A new custom module should be defined in modules.xml file. For more information on customising modules metadata file, go to Customize Menu Options Metadata.

9. Modules Metadata File

The new menu options should be defined in menuoptions.xml file. For more information on customising menu options metadata file, go to Customize Modules Metadata.

  • No labels