示例#1
0
  /**
   *
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * Gets a CreditInfo from the database.
   *
   * @generated
   */
  public DWLResponse handleGetCreditInfobyPartyId(String PartyId, DWLControl control)
      throws Exception {
    DWLStatus status = new DWLStatus();
    DWLResponse response = createDWLResponse();

    BObjQuery bObjQuery = null;

    String asOfDate = (String) control.get(DWLControl.INQUIRE_AS_OF_DATE);

    // History data inquiry: if inquireAsOfDate field has value in request xml
    if (StringUtils.isNonBlank(asOfDate)) {
      Timestamp tsAsOfDate =
          getPITHistoryDate(
              asOfDate,
              AdditionsComponentID.ADDITIONS_COMPONENT,
              AdditionsErrorReasonCode.GETCREDITINFOBYPARTYID_INVALID_INQUIRE_AS_OF_DATE_FORMAT,
              status,
              control);

      bObjQuery =
          getBObjQueryFactory()
              .createCreditInfoBObjQuery(
                  CreditInfoBObjQuery.CREDIT_INFOBY_PARTY_ID_HISTORY_QUERY, control);
      bObjQuery.setParameter(0, DWLFunctionUtils.getLongFromString(PartyId));
      bObjQuery.setParameter(1, tsAsOfDate);
      bObjQuery.setParameter(2, tsAsOfDate);
    } else {
      bObjQuery =
          getBObjQueryFactory()
              .createCreditInfoBObjQuery(CreditInfoBObjQuery.CREDIT_INFOBY_PARTY_ID_QUERY, control);
      bObjQuery.setParameter(0, DWLFunctionUtils.getLongFromString(PartyId));
    }

    CreditInfoBObj o = (CreditInfoBObj) bObjQuery.getSingleResult();
    if (o == null) {
      return null;
    }

    if (o.getStatus() == null) {
      o.setStatus(status);
    }
    response.addStatus(o.getStatus());
    response.setData(o);

    return response;
  }