Esempio n. 1
0
  /**
   * Loans (and legacy insurance) disbursement data submit routine<br>
   * Disburses one account at a time to a specific folder
   *
   * @return returns the loans xml as a string
   */
  public BaseServiceResponse disburse(LoansXML request, BaseServiceResponse response)
      throws ServiceException {
    // use this to get a handle on the IFS share stored inside the connection element
    initialize(BayServConstants.rpgService, response);
    // initialise the XML context
    try {
      if (disbursementCtx == null) disbursementCtx = JAXBContext.newInstance(LoansXML.class);
      if (errorCtx == null) errorCtx = JAXBContext.newInstance(ERRORSXML.class);
    } catch (JAXBException e) {
      throw new ServiceException(ErrorCodes.RPG006, e);
    }

    // put the result into exactus filesystem via AS400
    String loanReference = saveDisbursementFile(request, PATH_LOAN);

    // sleep
    DateUtils.sleep(1);

    // call the RPG to read the result and throw an error if there is one
    try {
      disburseRPG.execute(EProductType.LOAN, loanReference);
    } catch (ServiceException e) {
      // see if there's an error file
      response.setError(true);
      response.getErrors().addAll(findErrorXML(request, PATH_LOAN));
    }

    response.setXmlData(new XMLData());
    response.getXmlData().setXml(renderDisbursementXML(request));

    return response;
  }
Esempio n. 2
0
  /** Initializes the environment from services configuration for a {@link BaseServiceResponse} */
  protected void initialize(String targetService, BaseServiceResponse response)
      throws ServiceException {

    initialize(targetService);

    if (response != null) {
      response.setEnvironment(environment);
      response.setService(targetService);
      if (environmentConfig != null) {
        response.setLogType(environmentConfig.getLogging());
        response.setPersistenceType(environmentConfig.getPersistence());
      } else {
        response.setLogType(ELogStrategy.NOT_SPECIFIED);
        response.setPersistenceType(EPersistenceStrategy.NOT_SPECIFIED);
      }
      response.setLogRoot(logRootTarget);
      response.setLogRequest(environmentConfig.isLogRequest());
      response.setLogResponse(environmentConfig.isLogResponse());
    }
  }