Services Interface – Client Logic Implementation

All services should be exposed through their own xyzClientLogic class, and created as a Spring Bean. An xyzClientLogic class should be a subclass of the BaseClientLogic class, so it inherits the standard client logic methods.

To implement an xyzClientLogic class, import the required service interface and bean (or alias):
import com.sybase365.mobiliser.money.services.api.ITransactionEndpoint;    
    
private ITransactionEndpoint wsTransactionEndpoint;       

public void setWsTransactionEndpoint(ITransactionEndpoint wsTransactionEndpoint) {    
  this.wsTransactionEndpoint =
        wsTransactionEndpoint;   
}
Next, provide an access method that uses the new member field:
public   List <SimpleTransaction> findTransactions (    
  SearchTransactionCriteria criteria, Integer maxNumberToFetch )  
  throws Exception {    
    
  LOG.debug ("#  TransactionClientLogic.findTransactions ()");    
    
  List <SimpleTransaction> transactions = new ArrayList < SimpleTransaction >() ;    
    
  if (PortalUtils.exists(criteria.getCustomerId()))            
     request.setCustomerId(criteria.getCustomerId().longValue());          

  request.setFromDate(criteria.getFromDateXml());      
  request.setToDate(criteria.getToDateXml());      
  request.setMerchantOrderIdFilter(criteria.getOrderID());      
  request.setShowFaulty(criteria.getShowFaulty());      
  request.setStatusFilter(criteria.getTxnStatus());      
  request.setMaxRecords(maxNumberToFetch.intValue());      
  request.setJoinedCustomerId(criteria.getJoinedCustomerId());      
  request.setCustomerIsPayer(criteria.getConsumerIsPayer());      
  request.setShowInitial(criteria.getShowInitial());      
  request.setCaller(criteria.getCallerId());           
  FindTransactionsResponse response = wsTransactionEndpoint. findTransactions(request);              

  if (!evaluateMobiliserResponse(response))
  {            
    LOG.warn("# An error occurred while loading customer transactions");        
  }         
  return response.getTransactions();
         
 }   
} 
Using the getNewMobiliserRequest helper method ensures that all requests are formed with correct values for these properties:
public <Req extends MobiliserRequestType> 
   Req getNewMobiliserRequest(Class<Req> requestClass) 
   throws Exception {}
Using the evaluateNewMobiliserResponse helper method ensures that all responses are verified:
public <Resp extends MobiliserResponseType> 
   boolean evaluateMobiliserResponse(Resp response){ }
Using a Spring Bean for the xyzClientLogic class, defined in the section above, you can inject the client logic handler into a page to use, for example:
...
public class AddFunds extends BaseManageAccountsPage {       
  private static final long serialVersionUID = 1L;       
  @SpringBean(name = "systemAuthTransactionClientLogic")     
  public TransactionClientLogic transactionClientLogic;
...