@Override
  public final void makeFirstPrepareForSave(final Map<String, Object> pAddParam,
    final PaymentTo pEntity, final IRequestData pRequestData) throws Exception {
    //BeigeORM refresh:
    pEntity.setAccCash(getSrvOrm()
      .retrieveEntity(pAddParam, pEntity.getAccCash()));
    if (pEntity.getAccCash().getSubaccType() != null
      && pEntity.getSubaccCashId() == null) {
      throw new ExceptionWithCode(ExceptionWithCode.WRONG_PARAMETER,
        "select_subaccount");
    }
    if (pEntity.getPurchaseInvoice() != null) {
      PurchaseInvoice purchaseInvoice = getSrvOrm()
        .retrieveEntity(pAddParam, pEntity.getPurchaseInvoice());
      if (!purchaseInvoice.getHasMadeAccEntries()
        || purchaseInvoice.getReversedId() != null) {
        throw new ExceptionWithCode(ExceptionWithCode.WRONG_PARAMETER,
          "purchase_invoice_must_be_accounted");
      }
      pEntity.setPurchaseInvoice(purchaseInvoice);
    }
  }
@ Override public final void makeFirstPrepareForSave ( final Map < String , Object > pAddParam , final PaymentTo pEntity , final IRequestData pRequestData ) throws Exception { pEntity . setAccCash ( getSrvOrm ( ) . retrieveEntity ( pAddParam , pEntity . getAccCash ( ) ) ) ; if ( pEntity . getAccCash ( ) . getSubaccType ( ) != null && pEntity . getSubaccCashId ( ) == null ) { throw new ExceptionWithCode ( ExceptionWithCode . WRONG_PARAMETER , "select_subaccount" ) ; } if ( pEntity . getPurchaseInvoice ( ) != null ) { PurchaseInvoice purchaseInvoice = getSrvOrm ( ) . retrieveEntity ( pAddParam , pEntity . getPurchaseInvoice ( ) ) ; if ( ! purchaseInvoice . getHasMadeAccEntries ( ) || purchaseInvoice . getReversedId ( ) != null ) { throw new ExceptionWithCode ( ExceptionWithCode . WRONG_PARAMETER , "purchase_invoice_must_be_accounted" ) ; } pEntity . setPurchaseInvoice ( purchaseInvoice ) ; } }
<p>Make save preparations before insert/update block if it's need.</p>
@param pAddParam additional param
@param pEntity entity
@param pRequestData Request Data
@throws Exception - an exception