Advertisement
adewaleA4

Service Issue

Aug 7th, 2015
192
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 8.84 KB | None | 0 0
  1. ************************************************ REQUEST  *****************************************************
  2. <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ws="http://ws.axefinance.longbridgetech.com/">
  3.    <soapenv:Header/>
  4.    <soapenv:Body>
  5.       <ws:CreateCollateral>
  6.          <!--Optional:-->
  7.          <transactionId>107725</transactionId>
  8.       </ws:CreateCollateral>
  9.    </soapenv:Body>
  10. </soapenv:Envelope>
  11.  
  12. ************************************************ REQUEST  END *****************************************************
  13.  
  14.  
  15. ************************************************ RESPONSE  *****************************************************
  16.  
  17. <S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
  18.    <S:Body>
  19.       <ns2:CreateCollateralResponse xmlns:ns2="http://ws.axefinance.longbridgetech.com/">
  20.          <return>
  21.             <errorMessage>The account does not exist.</errorMessage>
  22.             <mitigantID>4280</mitigantID>
  23.             <transactionID>107725</transactionID>
  24.          </return>
  25.          <return>
  26.             <errorMessage>Finacle System Error Occoured!!! Please contact System Administrator.</errorMessage>
  27.             <mitigantID>4278</mitigantID>
  28.             <transactionID>107725</transactionID>
  29.          </return>
  30.       </ns2:CreateCollateralResponse>
  31.    </S:Body>
  32. </S:Envelope>
  33. ************************************************ RESPONSE  END *****************************************************
  34.  
  35.  
  36. ************************************************ RESPONSE OBJ CLASS  *************************************************
  37.  
  38. public class CollateralResponse implements Serializable {
  39.  
  40.     private String ColtrlId ;
  41.     private String MitigantID;
  42.     private String TransactionID;
  43.     private String ErrorMessage;
  44.  
  45.     public CollateralResponse(String coltrlId, String mitigantID, String transactionID, String errorMessage) {
  46.         ColtrlId = coltrlId;
  47.         MitigantID = mitigantID;
  48.         TransactionID = transactionID;
  49.         ErrorMessage = errorMessage;
  50.     }
  51.  
  52.     public CollateralResponse() {
  53.     }
  54.  
  55.     public String getColtrlId() {
  56.         return ColtrlId;
  57.     }
  58.  
  59.     public void setColtrlId(String coltrlId) {
  60.         ColtrlId = coltrlId;
  61.     }
  62.  
  63.     public String getMitigantID() {
  64.         return MitigantID;
  65.     }
  66.  
  67.     public void setMitigantID(String mitigantID) {
  68.         MitigantID = mitigantID;
  69.     }
  70.  
  71.     public String getTransactionID() {
  72.         return TransactionID;
  73.     }
  74.  
  75.     public void setTransactionID(String transactionID) {
  76.         TransactionID = transactionID;
  77.     }
  78.  
  79.     public String getErrorMessage() {
  80.         return ErrorMessage;
  81.     }
  82.  
  83.     public void setErrorMessage(String errorMessage) {
  84.         ErrorMessage = errorMessage;
  85.     }
  86.  
  87.     @Override
  88.     public String toString() {
  89.         return "CollateralResponse{" +
  90.                 "ColtrlId='" + ColtrlId + '\'' +
  91.                 ", MitigantID='" + MitigantID + '\'' +
  92.                 ", TransactionID='" + TransactionID + '\'' +
  93.                 ", ErrorMessage='" + ErrorMessage + '\'' +
  94.                 '}';
  95.     }
  96. }
  97.  
  98. ************************************************ RESPONSE OBJ CLASS END *********************************************
  99.  
  100.  
  101.  
  102. ************************************************ SERVICE CLASS  ***************************************************
  103.  
  104. package com.longbridgetech.axefinance.ws;
  105.  
  106. import com.longbridgetech.axefinance.FinnacleIntegrator.functions.*;
  107. import com.longbridgetech.axefinance.domain.*;
  108. import com.longbridgetech.axefinance.domain.responses.CollateralResponse;
  109. import com.longbridgetech.axefinance.interfaces.AxeDBManager;
  110. import com.longbridgetech.axefinance.persistence.AxeDBManagerImpl;
  111. import com.longbridgetech.axefinance.persistence.TaskDAOImpl;
  112.  
  113. import com.longbridgetech.axefinance.tasks.CreateCIFTask;
  114. import org.apache.commons.lang3.StringUtils;
  115. import org.slf4j.Logger;
  116. import org.slf4j.LoggerFactory;
  117.  
  118. import javax.jws.WebMethod;
  119. import javax.jws.WebParam;
  120. import javax.jws.WebService;
  121. import java.util.ArrayList;
  122. import java.util.List;
  123.  
  124. /**
  125.  * Created by wale on 6/29/15.
  126.  */
  127. @WebService()
  128. public class AxeProcessorService {
  129.  
  130.     private final Logger logger  = LoggerFactory.getLogger(AxeProcessorService.class);
  131.  
  132.    
  133.  
  134.  
  135.     @WebMethod
  136.     public List<CollateralResponse> CreateCollateral(@WebParam(name="transactionId")String transactionId){
  137.  
  138.         FIResponse fiResponse = new FIResponse();
  139.  
  140.         AxeDBManager axeDBManager = new AxeDBManagerImpl();
  141.  
  142.         List<CollateralDetail> collateralDetails = axeDBManager.getCollateralDetails(transactionId);
  143.  
  144.         List<CollateralResponse> collateralResponses = new ArrayList<CollateralResponse>();
  145.  
  146.         for(CollateralDetail collateralDetail : collateralDetails) {
  147.  
  148.  
  149.  
  150.             if (collateralDetail == null) {
  151.                 CollateralResponse collateralResponse = new CollateralResponse();
  152.                 collateralResponse.setErrorMessage("Collateral Detail for Transaction ID " + transactionId + " was not found");
  153.                 collateralResponse.setTransactionID(transactionId);
  154.  
  155.                 logger.error("Collateral Detail for Transaction ID {}  was not found", transactionId);
  156.  
  157.                 collateralResponses.add(collateralResponse);
  158.  
  159.                 continue;
  160.  
  161.             }
  162.  
  163.             String collateralType = collateralDetail.getCollateralType();
  164.  
  165.             if (StringUtils.isBlank(collateralType)) {
  166.  
  167.                 CollateralResponse collateralResponse = new CollateralResponse();
  168.                 collateralResponse.setErrorMessage("Collateral Type was not specified in record with Mitigant ID " + collateralDetail.getMitigantID());
  169.                 collateralResponse.setTransactionID(transactionId);
  170.                 collateralResponse.setMitigantID(collateralDetail.getMitigantID());
  171.  
  172.  
  173.                 logger.error("Collateral Type was not specified in record with Mitigant ID " + collateralDetail.getMitigantID());
  174.  
  175.                 collateralResponses.add(collateralResponse);
  176.  
  177.                 continue;
  178.  
  179.             }
  180.  
  181.  
  182.             if (collateralType.equals("COLDEPOC")) {
  183.  
  184.                 DepColtrlAddData depColtrlAddData = new DepColtrlAddData(collateralDetail);
  185.  
  186.                 DepColtrlAdd depColtrlAdd = new DepColtrlAdd(depColtrlAddData);
  187.  
  188.                 fiResponse = depColtrlAdd.execute();
  189.  
  190.             } else if (collateralType.equals("COLMACH")) {
  191.  
  192.                 MachineryCollateralAddData machineryCollateralAddData = new MachineryCollateralAddData(collateralDetail);
  193.  
  194.                 MachineryColtrlAdd machineryColtrlAdd = new MachineryColtrlAdd(machineryCollateralAddData);
  195.  
  196.                 fiResponse = machineryColtrlAdd.execute();
  197.  
  198.             } else if (collateralType.equals("COLOTHRS")) {
  199.  
  200.                 OthersColtrlAddData othersColtrlAddData = new OthersColtrlAddData(collateralDetail);
  201.  
  202.                 OthersColtrlAdd othersColtrlAdd = new OthersColtrlAdd(othersColtrlAddData);
  203.  
  204.                 fiResponse = othersColtrlAdd.execute();
  205.  
  206.             } else if (collateralType.equals("COLPROPC")) {
  207.  
  208.                 ImmovPropColtrlAddData immovPropColtrlAddData = new ImmovPropColtrlAddData(collateralDetail);
  209.  
  210.                 ImmovPropColtrlAdd immovPropColtrlAdd = new ImmovPropColtrlAdd(immovPropColtrlAddData);
  211.  
  212.                 fiResponse = immovPropColtrlAdd.execute();
  213.  
  214.             } else if (collateralType.equals("COLSHARC")) {
  215.  
  216.                 TradableSecuritiesColtrlAddData tradableSecuritiesColtrlAddData = new TradableSecuritiesColtrlAddData(collateralDetail);
  217.                 TradableSecuritiesColtrlAdd tradableSecuritiesColtrlAdd = new TradableSecuritiesColtrlAdd(tradableSecuritiesColtrlAddData);
  218.  
  219.                 fiResponse = tradableSecuritiesColtrlAdd.execute();
  220.  
  221.             } else if (collateralType.equals("COLVEHIC")) {
  222.  
  223.                 VehiclesColtrlAddData vehiclesColtrlAddData = new VehiclesColtrlAddData(collateralDetail);
  224.  
  225.                 VehiclesColtrlAdd vehiclesColtrlAdd = new VehiclesColtrlAdd(vehiclesColtrlAddData);
  226.  
  227.                 fiResponse = vehiclesColtrlAdd.execute();
  228.  
  229.             }
  230.  
  231.             CollateralResponse collateralResponse  = new CollateralResponse();
  232.             collateralResponse.setTransactionID(transactionId);
  233.             collateralResponse.setMitigantID(collateralDetail.getMitigantID());
  234.  
  235.             if(fiResponse.isSuccessful()){
  236.                 collateralResponse.setColtrlId(fiResponse.getResponse());
  237.             }else{
  238.                 collateralResponse.setErrorMessage(fiResponse.getResponse());
  239.             }
  240.  
  241.             collateralResponses.add(collateralResponse);
  242.  
  243.  
  244.         }
  245.  
  246.  
  247.         logger.info("CreateCollateral complete {}",collateralResponses);
  248.  
  249.         return collateralResponses;
  250.     }
  251. }
  252.  
  253. ************************************************ SERVICE CLASS END *************************************************
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement