entity.setItsQuantity(entity.getItsQuantity().negate()); entity.setItsTotal(entity.getItsTotal().negate()); } else {
/** * <p>Process entity request.</p> * @param pAddParam additional param, e.g. return this line's * document in "nextEntity" for farther process * @param pRequestData Request Data * @param pEntity Entity to process * @return Entity processed for farther process or null * @throws Exception - an exception **/ @Override public final BeginningInventoryLine process( final Map<String, Object> pAddParam, final BeginningInventoryLine pEntityPb, final IRequestData pRequestData) throws Exception { BeginningInventoryLine entity = this.prcAccEntityPbCopy .process(pAddParam, pEntityPb, pRequestData); if (entity.getReversedId() != null) { throw new ExceptionWithCode(ExceptionWithCode.FORBIDDEN, "attempt_to_reverse_reversed"); } entity.setReversedId(pEntityPb.getItsId()); entity.setItsQuantity(entity.getItsQuantity().negate()); entity.setItsTotal(entity.getItsTotal().negate()); return entity; }
final IRequestData pRequestData) throws Exception { if (pEntity.getIsNew()) { if (pEntity.getItsQuantity().doubleValue() <= 0 && pEntity.getReversedId() == null) { throw new ExceptionWithCode(ExceptionWithCode.WRONG_PARAMETER, pEntity.getItsOwner().setItsVersion(ownerVersion); pEntity.setItsQuantity(pEntity.getItsQuantity().setScale( getSrvAccSettings().lazyGetAccSettings(pAddParam) .getQuantityPrecision(), getSrvAccSettings() .lazyGetAccSettings(pAddParam).getCostPrecision(), getSrvAccSettings() .lazyGetAccSettings(pAddParam).getRoundingMode())); pEntity.setTheRest(pEntity.getItsQuantity()); pEntity.setItsTotal(pEntity.getItsQuantity().multiply(pEntity .getItsCost()).setScale(getSrvAccSettings() .lazyGetAccSettings(pAddParam).getCostPrecision(), getSrvAccSettings() "attempt_to_reverse_reversed"); if (!reversed.getItsQuantity().equals(reversed.getTheRest())) { throw new ExceptionWithCode(ExceptionWithCode .WRONG_PARAMETER, "where_is_withdrawals_from_this_source");
final boolean isEntityDetached) throws Exception { if (pEntity.getIsNew()) { if (pEntity.getItsQuantity().doubleValue() <= 0 && pEntity.getReversedId() == null) { throw new ExceptionWithCode(ExceptionWithCode.WRONG_PARAMETER, pEntity.setItsOwner(itsOwner); pEntity.setItsQuantity(pEntity.getItsQuantity().setScale( getSrvAccSettings().lazyGetAccSettings().getQuantityPrecision(), getSrvAccSettings().lazyGetAccSettings().getRoundingMode())); .lazyGetAccSettings().getCostPrecision(), getSrvAccSettings() .lazyGetAccSettings().getRoundingMode())); pEntity.setTheRest(pEntity.getItsQuantity()); pEntity.setItsTotal(pEntity.getItsTotal().setScale(getSrvAccSettings() .lazyGetAccSettings().getCostPrecision(), getSrvAccSettings() "attempt_to_reverse_reversed"); if (!reversed.getItsQuantity().equals(reversed.getTheRest())) { throw new ExceptionWithCode(ExceptionWithCode .WRONG_PARAMETER, "where_is_withdrawals_from_this_source");
for (BeginningInventoryLine reversedLine : reversedLines) { if (reversedLine.getReversedId() == null) { if (!reversedLine.getItsQuantity() .equals(reversedLine.getTheRest())) { throw new ExceptionWithCode(ExceptionWithCode.WRONG_PARAMETER, reversingLine.setUnitOfMeasure(reversedLine.getUnitOfMeasure()); reversingLine.setItsCost(reversedLine.getItsCost()); reversingLine.setItsQuantity(reversedLine.getItsQuantity() .negate()); reversingLine.setItsTotal(reversedLine.getItsTotal().negate());
for (BeginningInventoryLine reversedLine : reversedLines) { if (reversedLine.getReversedId() == null) { if (!reversedLine.getItsQuantity() .equals(reversedLine.getTheRest())) { throw new ExceptionWithCode(ExceptionWithCode.WRONG_PARAMETER, reversingLine.setUnitOfMeasure(reversedLine.getUnitOfMeasure()); reversingLine.setItsCost(reversedLine.getItsCost()); reversingLine.setItsQuantity(reversedLine.getItsQuantity() .negate()); reversingLine.setItsTotal(reversedLine.getItsTotal().negate());