@Override
  public final void makeOtherEntries(final Map<String, Object> pAddParam,
    final GoodsLoss pEntity, final IRequestData pRequestData,
      final boolean pIsNew) throws Exception {
    String actionAdd = pRequestData.getParameter("actionAdd");
    if ("makeAccEntries".equals(actionAdd)
      && pEntity.getReversedId() != null) {
      //reverse none-reversed lines:
      GoodsLossLine gll = new GoodsLossLine();
      GoodsLoss reversed = new GoodsLoss();
      reversed.setItsId(pEntity.getReversedId());
      gll.setItsOwner(reversed);
      List<GoodsLossLine> reversedLines = getSrvOrm().
        retrieveListForField(pAddParam, gll, "itsOwner");
      String langDef = (String) pAddParam.get("langDef");
      for (GoodsLossLine reversedLine : reversedLines) {
        if (reversedLine.getReversedId() == null) {
          GoodsLossLine reversingLine = new GoodsLossLine();
          reversingLine.setIdDatabaseBirth(getSrvOrm().getIdDatabase());
          reversingLine.setReversedId(reversedLine.getItsId());
          reversingLine.setInvItem(reversedLine.getInvItem());
          reversingLine.setUnitOfMeasure(reversedLine.getUnitOfMeasure());
          reversingLine.setItsQuantity(reversedLine.getItsQuantity()
            .negate());
          reversingLine.setIsNew(true);
          reversingLine.setItsOwner(pEntity);
          reversingLine.setDescription(getSrvI18n()
            .getMsg("reversed_n", langDef) + reversedLine
              .getIdDatabaseBirth() + "-" + reversedLine.getItsId()); //local
          getSrvOrm().insertEntity(pAddParam, reversingLine);
          reversingLine.setIsNew(false);
          getSrvWarehouseEntry().reverseDraw(pAddParam, reversingLine);
          getSrvCogsEntry().reverseDraw(pAddParam, reversingLine,
            pEntity.getItsDate(), pEntity.getItsId());
          String descr;
          if (reversedLine.getDescription() == null) {
            descr = "";
          } else {
            descr = reversedLine.getDescription();
          }
          reversedLine.setDescription(descr + " " + getSrvI18n()
            .getMsg("reversing_n", langDef) + reversingLine.getIdDatabaseBirth()
              + "-" + reversingLine.getItsId());
          reversedLine.setReversedId(reversingLine.getItsId());
          getSrvOrm().updateEntity(pAddParam, reversedLine);
        }
      }
    }
  }
@ Override public final void makeOtherEntries ( final Map < String , Object > pAddParam , final GoodsLoss pEntity , final IRequestData pRequestData , final boolean pIsNew ) throws Exception { String actionAdd = pRequestData . getParameter ( "actionAdd" ) ; if ( "makeAccEntries" . equals ( actionAdd ) && pEntity . getReversedId ( ) != null ) { GoodsLossLine gll = new GoodsLossLine ( ) ; GoodsLoss reversed = new GoodsLoss ( ) ; reversed . setItsId ( pEntity . getReversedId ( ) ) ; gll . setItsOwner ( reversed ) ; List < GoodsLossLine > reversedLines = getSrvOrm ( ) . retrieveListForField ( pAddParam , gll , "itsOwner" ) ; String langDef = ( String ) pAddParam . get ( "langDef" ) ; for ( GoodsLossLine reversedLine : reversedLines ) { if ( reversedLine . getReversedId ( ) == null ) { GoodsLossLine reversingLine = new GoodsLossLine ( ) ; reversingLine . setIdDatabaseBirth ( getSrvOrm ( ) . getIdDatabase ( ) ) ; reversingLine . setReversedId ( reversedLine . getItsId ( ) ) ; reversingLine . setInvItem ( reversedLine . getInvItem ( ) ) ; reversingLine . setUnitOfMeasure ( reversedLine . getUnitOfMeasure ( ) ) ; reversingLine . setItsQuantity ( reversedLine . getItsQuantity ( ) . negate ( ) ) ; reversingLine . setIsNew ( true ) ; reversingLine . setItsOwner ( pEntity ) ; reversingLine . setDescription ( getSrvI18n ( ) . getMsg ( "reversed_n" , langDef ) + reversedLine . getIdDatabaseBirth ( ) + "-" + reversedLine . getItsId ( ) ) ; getSrvOrm ( ) . insertEntity ( pAddParam , reversingLine ) ; reversingLine . setIsNew ( false ) ; getSrvWarehouseEntry ( ) . reverseDraw ( pAddParam , reversingLine ) ; getSrvCogsEntry ( ) . reverseDraw ( pAddParam , reversingLine , pEntity . getItsDate ( ) , pEntity . getItsId ( ) ) ; String descr ; if ( reversedLine . getDescription ( ) == null ) { descr = "" ; } else { descr = reversedLine . getDescription ( ) ; } reversedLine . setDescription ( descr + " " + getSrvI18n ( ) . getMsg ( "reversing_n" , langDef ) + reversingLine . getIdDatabaseBirth ( ) + "-" + reversingLine . getItsId ( ) ) ; reversedLine . setReversedId ( reversingLine . getItsId ( ) ) ; getSrvOrm ( ) . updateEntity ( pAddParam , reversedLine ) ; } } } }
<p>Make other entries include reversing if it's need when save.</p>
@param pAddParam additional param
@param pEntity entity
@param pRequestData Request Data
@param pIsNew if entity was new
@throws Exception - an exception