sapservicecontractbol Extension

The sapservicecontractbol extension provides the back-end services to interact with SAP CRM to fetch, renew, and terminate service contracts.

Overview

The sapservicecontractbol extension makes RFC calls and uses GenIL API to interact with SAP CRM to fetch, renew, and terminate service contracts. The extension provides implementation to fulfill service contract related requests coming from the sapservicecontractfacades extension. This extension uses DTOs to transfer results of RFC calls and GENIL API to the façade layer.

Business Object Layer

All beans for the sapservicecontractbol extension are defined in the sapservicecontractbol-spring.xml spring configuration file.

SapServiceContractBackendBusinessObject is the starting point for calling SAP CRM to get the service contract.

Method

Description

SearchResultList getServiceContractsForCustomer(String UID, PageableData pageableData, final boolean reload)

Get all service Contracts From CRM backend for current customer

getServiceContractsForIBase(final String uid, final String iBaseID)

Get the service contracts related to an IBase from CRM backend for current customer

ServiceContractSearchResult getServiceContractDetails(String contractId)

Get the contract details for the given contract ID

boolean isBackendDown();

Check if back-end connection is down or not

String renewContract(String guid)

Renew service contract for given contract guid

String terminateContractItem(final String contractGuid, final String itemGuid)

Terminate service contract item for given contract guid and item guid

String renewItem(final String contractGuid, final String itemGuid)

Renew service contract item for given contract guid and item guid

The default implementation of this service is DefaultSapServiceContractBackendBusinessObject.

<alias alias="sapCrmbackendBusinessObject" name="sapCrmbackendBusinessObject" />
<bean id="sapCrmbackendBusinessObject" parent="sapCoreBusinessObject" class="com.sap.hybris.sapservicecontractbol.backendbusinessobject.impl.DefaultSapServiceContractBackendBusinessObject" scope="sapSession">
	<property name="moduleConfigurationAccess" ref="sapServiceContractConfigurationAccess" />
	<property name="sessionService" ref="sessionService"></property>
</bean>

This class uses SapCRMServiceContractBackend to manage the connection between SAP CRM and SAP Commerce Cloud and to call the API to fetch, renew, and terminate service contracts based on various search parameters.

Method

Description

SearchResultList getContracts(final String uId, final String queryParam)

Get contracts for the given customer ID

getContractsForIBase(final String uid, final String iBaseID)

Get contracts for an IBase by making call to CRM backend

ServiceContractSearchResult getContractsforContractId(final String contractId)

Get the contract details for the given contract ID

boolean isBackendDown();

Check if back-end connection is down or not

String renewContract(String guid)

Renew service contract for the given contract GUID

String terminateContractItem(final String contractGuid)

Terminate service contract item for given contract GUID and item GUID

String renewItem(final String contractGuid, final String itemGuid)

Renew service contract item for given contract GUID and item GUID

public List<SortData> getSearchSort()

Get the sort options for the pageable data

The default implementation is DefaultSapCRMServiceContractBackend.

<alias name="defaultSapCRMServiceContractBackend" alias="sapCRMServiceContractBackend" />
<bean id="defaultSapCRMServiceContractBackend"  class="com.sap.hybris.sapservicecontractbol.service.backend.impl.DefaultSapCRMServiceContractBackend" scope="sapSession" parent="sapCoreBackendObjectJCo">
	<property name="moduleConfigurationAccess" ref="sapServiceContractConfigurationAccess" />
	<property name="managedConnectionFactory" ref="sapCoreJCoManagedConnectionFactory" />
	<property name="defaultConnectionName" value="JCoStatefulServiceUser" />
	<property name="defaultDestinationName"	value="#{baseStoreService.getCurrentBaseStore().getSAPConfiguration().getSapServiceContract_RFCDestination()?.getRfcDestinationName()}" />
	<property name="userService" ref="userService" />
	<property name="baseStoreService" ref="baseStoreService" />
	<property name="i18nService" ref="i18nService" />
	<property name="jcoFunctionTerminate" value="CRM_HYB_SC_TERMINATE" />
	<property name="jcoFuntionRenew" value="CRM_HYB_SC_QUOTATION_CREATE" />
	<property name="jcoFuntionItemRenew" value="CRM_HYB_SC_EXTEND_I" /> </bean>

This class is responsible for connection handling between SAP CRM and SAP Commerce Cloud. It contains methods to fetch the list of contracts, renew, and terminate the service contracts and to check status of back-end connection. This class makes use of JCoManagedConnectionFactory to establish connection.

BOL layer uses following pojo’s to handle and transfer results of GENIL and RFC calls:

Interface

Default Implementation

Description

SearchResultList

DefaultSearchResultList

BOL representation of contract search results and provide implementation for various operations on it

ServiceContractGenilContainer

DefaultServiceContractGenilContainer

DTO to hold all the contract data coming from BOL layer

ServiceContractSearchResult

DefaultServiceContractSearchResult

DTO to store service contract details coming from SAP CRM

ServiceContractItemResult

DefaultServiceContractItemResult

DTO to store service contract item details coming from SAP CRM

The service contract implementation of the comparator class ServiceContractSearchResultComparator implements omparator<ServiceContractSearchResult>.

The comparator class overrides Compare(obj O1,obj O2) for the UI based sorting of the result on various parameters such as Start Date, End Date, Contract ID, Status, Net Value, and so on.

The SapServiceContractFactory class uses the GenericFactory instance to return the bean of SapServiceContractBackendBusinessObject using the getBean method as genericFactory.getBean("sapCrmbackendBusinessObject").