<p>Create a bean.</p>
@param pAddParam additional param
@return M request(or) scoped bean
@throws Exception - an exception
509549
@Override
  public final M create(final Map<String, Object> pAddParam) throws Exception {
    M object = this.objectClass.newInstance();
    object.setIsNew(false);
    object.setIdDatabaseBirth(this.databaseId);
    return object;
  }
1081368
protected final PrCuOrSv<RS> lazyGetPrCuOrSv(final Map<String, Object> pAddParam) throws Exception {
    String beanName = PrCuOrSv.class.getSimpleName();
    @SuppressWarnings("unchecked")
    PrCuOrSv<RS> proc = (PrCuOrSv<RS>) this.processorsMap.get(beanName);
    if (proc == null) {
      proc = new PrCuOrSv<RS>();
      proc.setSrvOrm(getSrvOrm());
      proc.setCncOrd(getCncOrd());
      //assigning fully initialized object:
      this.processorsMap.put(beanName, proc);
      this.logger.info(null, FctBnTradeEntitiesProcessors.class, beanName + " has been created.");
    }
    return proc;
  }
813741
protected final PrCart<RS> lazyGetPrCart(
    final Map<String, Object> pAddParam) throws Exception {
    String beanName = PrCart.class.getSimpleName();
    @SuppressWarnings("unchecked")
    PrCart<RS> proc = (PrCart<RS>)
      this.processorsMap.get(beanName);
    if (proc == null) {
      proc = new PrCart<RS>();
      proc.setSrvOrm(getSrvOrm());
      proc.setSrvCart(getSrvShoppingCart());
      proc.setProcessorsFactory(this);
      //assigning fully initialized object:
      this.processorsMap.put(beanName, proc);
      this.logger.info(null, FctBnPublicTradeProcessors.class,
        beanName + " has been created.");
    }
    return proc;
  }
592031
@Override
  public final void process(final Map<String, Object> pAddParam,
    final IRequestData pRequestData) throws Exception {
    this.srvEntitiesPage.retrievePage(pAddParam, pRequestData);
  }
901957
@Override
  public final IEntityProcessor lazyGet(
    final Map<String, Object> pAddParam,
      final String pBeanName) throws Exception {
    IEntityProcessor proc =
      this.processorsMap.get(pBeanName);
    if (proc == null) {
      // locking:
      synchronized (this.processorsMap) {
        // make sure again whether it's null after locking:
        proc = this.processorsMap.get(pBeanName);
        if (proc == null) {
          if (pBeanName
            .equals(PrcEntityRetrieve.class.getSimpleName())) {
            proc = createPutPrcEntityRetrieve();
          } else if (pBeanName
            .equals(PrcMatchForeignLineCreate.class.getSimpleName())) {
            proc = createPutPrcMatchForeignLineCreate();
          } else if (pBeanName
            .equals(PrcCsvColumnCreate.class.getSimpleName())) {
            proc = createPutPrcCsvColumnCreate();
          } else if (pBeanName
            .equals(PrcEntityCreate.class.getSimpleName())) {
            proc = createPutPrcEntityCreate();
          } else if (pBeanName
            .equals(PrcEntityDelete.class.getSimpleName())) {
            proc = createPutPrcEntityDelete();
          } else if (pBeanName
            .equals(PrcEntityPbDelete.class.getSimpleName())) {
            proc = createPutPrcEntityPbDelete();
          } else if (pBeanName
            .equals(PrcEntityFDelete.class.getSimpleName())) {
            proc = createPutPrcEntityFDelete();
          } else if (pBeanName
            .equals(PrcEntityFSave.class.getSimpleName())) {
            proc = createPutPrcEntityFSave();
          } else if (pBeanName
            .equals(PrcEntityFfolDelete.class.getSimpleName())) {
            proc = createPutPrcEntityFfolDelete();
          } else if (pBeanName
            .equals(PrcEntityFfolSave.class.getSimpleName())) {
            proc = createPutPrcEntityFfolSave();
          } else if (pBeanName
            .equals(PrcEntityFolDelete.class.getSimpleName())) {
            proc = createPutPrcEntityFolDelete();
          } else if (pBeanName
            .equals(PrcEntityFolSave.class.getSimpleName())) {
            proc = createPutPrcEntityFolSave();
          } else if (pBeanName
            .equals(PrcEntityPbCopy.class.getSimpleName())) {
            proc = createPutPrcEntityPbCopy();
          } else if (pBeanName
            .equals(PrcEntityCopy.class.getSimpleName())) {
            proc = createPutPrcEntityCopy();
          } else if (pBeanName
            .equals(PrcEntityPbSave.class.getSimpleName())) {
            proc = createPutPrcEntityPbSave();
          } else if (pBeanName
            .equals(PrcEntityPbEditDelete.class.getSimpleName())) {
            proc = createPutPrcEntityPbEditDelete();
          } else if (pBeanName
            .equals(PrcEmailMsgSave.class.getSimpleName())) {
            proc = createPutPrcEmailMsgSave();
          } else if (pBeanName
            .equals(PrcEntitySave.class.getSimpleName())) {
            proc = createPutPrcEntitySave();
          }
        }
      }
    }
    if (!this.isItSubfactory && proc == null) {
      throw new ExceptionWithCode(ExceptionWithCode.CONFIGURATION_MISTAKE,
        "There is no entity processor with name " + pBeanName);
    }
    return proc;
  }
1292978
@Override
  public final Object read(final Map<String, Object> pAddParam,
    final T pObject, final String pFieldName) throws Exception {
    Method fldGetter = this.gettersMap.get(pFieldName);
    return fldGetter.invoke(pObject);
  }
1277003
protected final PrcItemPage<RS> lazyGetPrcItemPage(
    final Map<String, Object> pAddParam) throws Exception {
    String beanName = PrcItemPage.class.getSimpleName();
    @SuppressWarnings("unchecked")
    PrcItemPage<RS> proc = (PrcItemPage<RS>)
      this.processorsMap.get(beanName);
    if (proc == null) {
      proc = new PrcItemPage<RS>();
      proc.setSrvOrm(getSrvOrm());
      proc.setSrvCart(getSrvShoppingCart());
      proc.setBuySr(getBuySr());
      proc.setLogger(getLogger());
      //assigning fully initialized object:
      this.processorsMap.put(beanName, proc);
      this.logger.info(null, FctBnPublicTradeProcessors.class,
        beanName + " has been created.");
    }
    return proc;
  }
769115
protected final PrLog<RS> lazyGetPrLog(
    final Map<String, Object> pAddParam) throws Exception {
    String beanName = PrLog.class.getSimpleName();
    @SuppressWarnings("unchecked")
    PrLog<RS> proc = (PrLog<RS>)
      this.processorsMap.get(beanName);
    if (proc == null) {
      proc = new PrLog<RS>();
      proc.setSrvOrm(getSrvOrm());
      proc.setSrvDb(getSrvDatabase());
      proc.setLog(getSecLog());
      proc.setSrvCart(getSrvShoppingCart());
      proc.setProcFac(this);
      proc.setBuySr(getBuySr());
      //assigning fully initialized object:
      this.processorsMap.put(beanName, proc);
      this.logger.info(null, FctBnPublicTradeProcessors.class,
        beanName + " has been created.");
    }
    return proc;
  }
520406
protected final PrBur<RS> lazyGetPrBur(
    final Map<String, Object> pAddParam) throws Exception {
    String beanName = PrBur.class.getSimpleName();
    @SuppressWarnings("unchecked")
    PrBur<RS> proc = (PrBur<RS>)
      this.processorsMap.get(beanName);
    if (proc == null) {
      proc = new PrBur<RS>();
      proc.setSrvOrm(getSrvOrm());
      proc.setSrvDb(getSrvDatabase());
      proc.setLog(getLogger());
      proc.setProcFac(this);
      proc.setBuySr(getBuySr());
      //assigning fully initialized object:
      this.processorsMap.put(beanName, proc);
      this.logger.info(null, FctBnPublicTradeProcessors.class,
        beanName + " has been created.");
    }
    return proc;
  }
1147143
@Override
  public final void process(final Map<String, Object> pAddParam,
    final IRequestData pRequestData) throws Exception {
    String taxDestIdStr = pRequestData.getParameter("taxDestId");
    Long taxDestId = Long.parseLong(taxDestIdStr);
    String itemIdStr = pRequestData.getParameter("itemId");
    Long itemId = Long.parseLong(itemIdStr);
    String nmEnt = pRequestData.getParameter("nmEnt");
    String destTaxItemLnNm;
    String itemNm;
    if (SalesInvoiceServiceLine.class.getSimpleName().equals(nmEnt)) {
      destTaxItemLnNm = DestTaxServSelLn.class.getSimpleName().toUpperCase();
      itemNm = ServiceToSale.class.getSimpleName().toUpperCase();
    } else if (PurchaseInvoiceServiceLine.class.getSimpleName().equals(nmEnt)) {
      destTaxItemLnNm = DestTaxServPurchLn.class.getSimpleName().toUpperCase();
      itemNm = ServicePurchased.class.getSimpleName().toUpperCase();
    } else if (PurchaseInvoiceLine.class.getSimpleName().equals(nmEnt)
      || SalesInvoiceLine.class.getSimpleName().equals(nmEnt)
        || SalesReturnLine.class.getSimpleName().equals(nmEnt)
          || PurchaseReturnLine.class.getSimpleName().equals(nmEnt)) {
      destTaxItemLnNm = DestTaxGoodsLn.class.getSimpleName().toUpperCase();
      itemNm = InvItem.class.getSimpleName().toUpperCase();
    } else {
      throw new ExceptionWithCode(ExceptionWithCode.WRONG_PARAMETER,
        "Wrong line type " + nmEnt);
    }
    String query = lazyGetQueryRevealTaxCat();
    query = query.replace(":ITEMNM", itemNm);
    query = query.replace(":DESTTAXITEMLNNM", destTaxItemLnNm);
    query = query.replace(":ITEMID", itemId.toString());
    query = query.replace(":TAXDESTID", taxDestId.toString());
    InvItemTaxCategory taxCategory = new InvItemTaxCategory();
    IRecordSet<RS> recordSet = null;
    AccSettings as = (AccSettings) pAddParam.get("accSet");
    RoundingMode rounding = as.getSalTaxRoundMode();
    try {
      this.srvDatabase.setIsAutocommit(false);
      this.srvDatabase.setTransactionIsolation(ISrvDatabase
        .TRANSACTION_READ_UNCOMMITTED);
      this.srvDatabase.beginTransaction();
      recordSet = getSrvDatabase().retrieveRecords(query);
      if (recordSet.moveToFirst()) {
        Long dtlId = recordSet.getLong("DTLID");
        Integer tdrm = null;
        Long tcId = recordSet.getLong("DTCID");
        String tcd = null;
        String tcn = null;
        Double tcRate = null;
        if (dtlId == null) {
          tcn = recordSet.getString("OTCNAME");
          tcd = recordSet.getString("OTCDESCR");
          tcId = recordSet.getLong("OTCID");
          tcRate = recordSet.getDouble("OTCRATE");
        } else if (tcId != null) {
          tdrm = recordSet.getInteger("DTRM");
          tcd = recordSet.getString("DTCDESCR");
          tcn = recordSet.getString("DTCNAME");
          tcRate = recordSet.getDouble("DTCRATE");
        }
        taxCategory.setItsId(tcId);
        taxCategory.setItsName(tcn);
        taxCategory.setTaxesDescription(tcd);
        if (tdrm != null) {
          rounding = RoundingMode.class.getEnumConstants()[tdrm];
        }
        if (tcRate != null) {
          taxCategory.setAggrOnlyPercent(BigDecimal.valueOf(tcRate));
        }
        if (recordSet.moveToNext()) {
          throw new ExceptionWithCode(ExceptionWithCode.SOMETHING_WRONG,
    "There are multiply tax category results for item id/tax dest.id/entity: "
      + itemId + "/" + taxDestId + "/" + nmEnt);
        }
      }
      this.srvDatabase.commitTransaction();
    } catch (Exception ex) {
      this.srvDatabase.rollBackTransaction();
      throw ex;
    } finally {
      if (recordSet != null) {
        recordSet.close();
      }
      this.srvDatabase.releaseResources();
    }
    pRequestData.setAttribute("taxRounding", rounding);
    pRequestData.setAttribute("taxCategory", taxCategory);
  }
851547
protected final PrcEmailMsgSave<RS> createPutPrcEmailMsgSave(
    final Map<String, Object> pAddParam) throws Exception {
    @SuppressWarnings("unchecked")
    PrcEmailMsgSave<RS> proc = (PrcEmailMsgSave<RS>)
      this.fctBnEntitiesProcessors
        .lazyGet(pAddParam, PrcEmailMsgSave.class.getSimpleName());
    //assigning fully initialized object:
    this.processorsMap.put(PrcEmailMsgSave.class.getSimpleName(), proc);
    return proc;
  }
542032
protected final PrcPaymentFromGfr<RS> createPutPrcPaymentFromGfr(
    final Map<String, Object> pAddParam) throws Exception {
    PrcPaymentFromGfr<RS> proc = new PrcPaymentFromGfr<RS>();
    @SuppressWarnings("unchecked")
    IEntityProcessor<PaymentFrom, Long> procDlg =
      (IEntityProcessor<PaymentFrom, Long>)
        lazyGetPrcAccDocGetForReverse(pAddParam);
    proc.setPrcAccDocGetForReverse(procDlg);
    proc.setSrvTypeCode(getSrvTypeCode());
    //assigning fully initialized object:
    this.processorsMap.put(PrcPaymentFromGfr.class.getSimpleName(), proc);
    return proc;
  }
1272718
protected final InvoiceReportPdf<RS, WI>
    lazyGetInvoiceReportPdf(
      final Map<String, Object> pAddParam) throws Exception {
    @SuppressWarnings("unchecked")
    InvoiceReportPdf<RS, WI> rep =
      (InvoiceReportPdf<RS, WI>)
        this.reportersMap
          .get(InvoiceReportPdf.class.getSimpleName());
    if (rep == null) {
      rep = new InvoiceReportPdf<RS, WI>();
      rep.setSrvAccSettings(getSrvAccSettings());
      rep.setSrvNumberToString(getSrvNumberToString());
      rep.setSrvI18n(getSrvI18n());
      rep.setSrvOrm(getSrvOrm());
      rep.setPdfFactory(this.pdfFactory);
      //assigning fully initialized object:
      this.reportersMap.put(InvoiceReportPdf.class.getSimpleName(), rep);
    }
    return rep;
  }
12165
protected final PrcPurchaseReturnLineCreate<RS>
    lazyGetPrcPurchaseReturnLineCreate(
      final Map<String, Object> pAddParam) throws Exception {
    @SuppressWarnings("unchecked")
    PrcPurchaseReturnLineCreate<RS> proc = (PrcPurchaseReturnLineCreate<RS>)
      this.processorsMap.get(PrcPurchaseReturnLineCreate.class.getSimpleName());
    if (proc == null) {
      proc = new PrcPurchaseReturnLineCreate<RS>();
      @SuppressWarnings("unchecked")
      PrcEntityCreate<RS, PurchaseReturnLine, Long> procDlg =
        (PrcEntityCreate<RS, PurchaseReturnLine, Long>)
          this.fctBnEntitiesProcessors
            .lazyGet(pAddParam, PrcEntityCreate.class.getSimpleName());
      proc.setPrcEntityCreate(procDlg);
      //assigning fully initialized object:
      this.processorsMap
        .put(PrcPurchaseReturnLineCreate.class.getSimpleName(), proc);
    }
    return proc;
  }
1189334
@Override
  public final T fromString(final Map<String, Object> pAddParam,
    final String pStrVal) throws Exception {
    if (pStrVal == null || "".equals(pStrVal)) {
      return null;
    }
    T object = this.objectClass.newInstance();
    for (String fldValStr : pStrVal.split(",")) {
      int eqIdx = fldValStr.indexOf("=");
      String fldName = fldValStr.substring(0, eqIdx);
      String cnvrtName = this.fieldConverterNamesHolder.getFor(this.objectClass,
        fldName);
      if (cnvrtName != null) { // e.g. transient field
        IConverterToFromString cnvrt = this.fieldsConvertersFatory
          .lazyGet(null, cnvrtName);
        Method fldSetter = this.settersRapiHolder
          .getFor(this.objectClass, fldName);
        String strVal = fldValStr.substring(eqIdx + 1);
        Object fldVal = cnvrt.fromString(pAddParam, strVal);
        fldSetter.invoke(object, fldVal);
      }
    }
    return object;
  }
1229994
@Override
    protected T createInstance() throws Exception {
        for (final String beanName : this.delegateBeanNames) {
            try {
                final T bean;
                if (this.type == null) {
                    bean = (T) this.getBeanFactory().getBean(beanName);
                } else {
                    bean = this.getBeanFactory().getBean(beanName, this.type);
                }

                if (this.logger.isInfoEnabled()) {
                    this.logger.info("Loaded bean for name " + beanName);
                }

                return bean;
            } catch (final Exception e) {
                final String msg =
                        "Failed to load bean '"
                                + beanName
                                + "' from ApplicationContext"
                                + (this.type != null ? " expecting type: " + this.type : "")
                                + ". Will try to load the next bean in the list instead. Error message from the attempt to load this bean ('"
                                + beanName
                                + "'): ";

                if (this.logger.isDebugEnabled()) {
                    this.logger.debug(msg, e);
                } else if (this.logger.isInfoEnabled()) {
                    this.logger.info(
                            msg + " " + e.getMessage() + " (enable debug for stack trace)");
                }
            }
        }

        throw new BeanCreationException(
                "None of the configured bean names could be loaded. BeanNames: "
                        + this.delegateBeanNames);
    }
836122
@Override
  public final String fromString(final Map<String, Object> pAddParam,
    final String pStrVal) throws Exception {
    if (pStrVal == null || "".equals(pStrVal)) {
      return null;
    }
    return pStrVal;
  }