Esempio n. 1
0
  private void addChargeToContext(ChargeType charge, ExchangeContext context, int blockIndex) {
    context.setVariable("SupplierBillID_" + blockIndex, charge.getSupplierBillID());
    context.setVariable("UnifiedPayerId_" + blockIndex, charge.getUnifiedPayerIdentifier());
    context.setVariable(
        "BillDate_" + blockIndex, charge.getBillDate().toGregorianCalendar().getTime());
    context.setVariable("SupplierOrgInfoName_" + blockIndex, charge.getSupplierOrgInfo().getName());
    context.setVariable("SupplierOrgInfoINN_" + blockIndex, charge.getSupplierOrgInfo().getINN());
    context.setVariable("SupplierOrgInfoKPP_" + blockIndex, charge.getSupplierOrgInfo().getKPP());
    context.setVariable(
        "SupplierOrgAccountKind_" + blockIndex, charge.getSupplierOrgInfo().getAccount().getKind());
    context.setVariable(
        "SupplierOrgAccountNumber_" + blockIndex,
        charge.getSupplierOrgInfo().getAccount().getAccount());
    context.setVariable(
        "SupplierOrgAccountBankName_" + blockIndex,
        charge.getSupplierOrgInfo().getAccount().getBank().getName());
    context.setVariable(
        "SupplierOrgAccountBankBIK_" + blockIndex,
        charge.getSupplierOrgInfo().getAccount().getBank().getBIK());
    context.setVariable("ChargeChangeStatus_" + blockIndex, charge.getChangeStatus());
    context.setVariable("ChargeKBK_" + blockIndex, charge.getKBK());
    context.setVariable("ChargeOKATO_" + blockIndex, charge.getOKATO());
    context.setVariable("ChargeTreasureBranch_" + blockIndex, charge.getTreasureBranch());
    context.setVariable("budgetStatus_" + blockIndex, charge.getBudgetIndex().getStatus());
    context.setVariable("budgetPurpose_" + blockIndex, charge.getBudgetIndex().getPurpose());
    context.setVariable(
        "budgetPaymentType_" + blockIndex, charge.getBudgetIndex().getPaymentType());
    context.setVariable("budgetTaxPeriod_" + blockIndex, charge.getBudgetIndex().getTaxPeriod());
    context.setVariable(
        "budgetTaxDocNumber_" + blockIndex, charge.getBudgetIndex().getTaxDocNumber());
    context.setVariable("budgetTaxDocDate_" + blockIndex, charge.getBudgetIndex().getTaxDocDate());
    context.setVariable("TotalAmount_" + blockIndex, charge.getTotalAmount());
    if (charge.getAdditionalData() != null) {
      context.setVariable("additionalData_" + blockIndex, (long) charge.getAdditionalData().size());
      int additionalDataIdx = 0;
      for (Bill.AdditionalData additionalData : charge.getAdditionalData()) {
        additionalDataIdx++;
        context.setVariable(
            "additionalDataKey_" + blockIndex + "_" + additionalDataIdx, additionalData.getName());
        context.setVariable(
            "additionalDataValue_" + blockIndex + "_" + additionalDataIdx,
            additionalData.getValue());
      }
    } else {
      context.setVariable("additionalData_" + blockIndex, 0l);
    }
    if (charge.getSupplierOrgInfo().getAddresses() != null) {
      int addressIdx = 0;
      context.setVariable(
          "SupplierOrgAddress_" + blockIndex,
          (long) charge.getSupplierOrgInfo().getAddresses().getAddress().size());
      for (AddressType address : charge.getSupplierOrgInfo().getAddresses().getAddress()) {
        addressIdx++;
        context.setVariable("addressType_" + blockIndex + "_" + addressIdx, address.getKind());
        context.setVariable("addressView_" + blockIndex + "_" + addressIdx, address.getView());
      }
    } else {
      context.setVariable("SupplierOrgAddress_" + blockIndex, 0l);
    }

    if (charge.getSupplierOrgInfo().getContacts() != null) {
      int contactIdx = 0;
      context.setVariable(
          "SupplierOrgContact_" + blockIndex,
          (long) charge.getSupplierOrgInfo().getContacts().getContact().size());
      for (ContactInfoType contact : charge.getSupplierOrgInfo().getContacts().getContact()) {
        contactIdx++;
        context.setVariable("contactType_" + blockIndex + "_" + contactIdx, contact.getKind());
        context.setVariable("contactValue_" + blockIndex + "_" + contactIdx, contact.getValue());
        context.setVariable(
            "contactComment_" + blockIndex + "_" + contactIdx, contact.getComment());
      }
    } else {
      context.setVariable("SupplierOrgContact_" + blockIndex, 0l);
    }
  }