Ejemplo n.º 1
0
  /**
   *
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * Updates the specified CreditInfo with new attribute values.
   *
   * @param theCreditInfoBObj The object that contains CreditInfo attribute values to be updated
   * @return DWLResponse containing a CreditInfoBObj of the updated object.
   * @exception Exception
   * @generated
   */
  public DWLResponse handleUpdateCreditInfo(CreditInfoBObj theCreditInfoBObj) throws Exception {

    DWLStatus status = theCreditInfoBObj.getStatus();

    if (status == null) {
      status = new DWLStatus();
      theCreditInfoBObj.setStatus(status);
    }

    // set lastupdatetxid with txnid from dwlcontrol
    theCreditInfoBObj
        .getEObjCreditInfo()
        .setLastUpdateTxId(new Long(theCreditInfoBObj.getControl().getTxnId()));
    Persistence theCreditInfoBObjPersistence =
        getBObjPersistenceFactory()
            .createCreditInfoBObjPersistence(
                CreditInfoBObjQuery.CREDIT_INFO_UPDATE, theCreditInfoBObj);
    theCreditInfoBObjPersistence.persistUpdate();

    DWLResponse response = createDWLResponse();
    response.setData(theCreditInfoBObj);
    response.setStatus(theCreditInfoBObj.getStatus());

    return response;
  }
Ejemplo n.º 2
0
  /**
   *
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * Adds a CreditInfo to the database.
   *
   * @param theCreditInfoBObj The object that contains CreditInfo attribute values.
   * @return DWLResponse containing a CreditInfoBObj object.
   * @exception Exception
   * @generated
   */
  public DWLResponse handleAddCreditInfo(CreditInfoBObj theCreditInfoBObj) throws Exception {
    DWLResponse response = null;
    DWLStatus status = theCreditInfoBObj.getStatus();
    if (status == null) {
      status = new DWLStatus();
      theCreditInfoBObj.setStatus(status);
    }

    String strPluggableID = null;

    try {
      // Pluggable Key Structure implementation
      strPluggableID = getSuppliedIdPKFromBObj(theCreditInfoBObj);

      if ((strPluggableID != null) && (strPluggableID.length() > 0)) {
        theCreditInfoBObj
            .getEObjCreditInfo()
            .setCreditInfopkId(FunctionUtils.getLongFromString(strPluggableID));
      } else {
        strPluggableID = null;
        theCreditInfoBObj.getEObjCreditInfo().setCreditInfopkId(null);
      }
      Persistence theCreditInfoBObjPersistence =
          getBObjPersistenceFactory()
              .createCreditInfoBObjPersistence(
                  CreditInfoBObjQuery.CREDIT_INFO_ADD, theCreditInfoBObj);
      theCreditInfoBObjPersistence.persistAdd();

      response = new DWLResponse();
      response.setData(theCreditInfoBObj);
      response.setStatus(theCreditInfoBObj.getStatus());
    } catch (Exception ex) {
      TCRMExceptionUtils.throwTCRMException(
          ex,
          new TCRMInsertException(ex.getMessage()),
          status,
          DWLStatus.FATAL,
          AdditionsComponentID.ADDITIONS_COMPONENT,
          TCRMErrorCode.INSERT_RECORD_ERROR,
          AdditionsErrorReasonCode.ADDCREDITINFO_FAILED,
          theCreditInfoBObj.getControl(),
          errHandler);
    }

    return response;
  }
Ejemplo n.º 3
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;
  }