getSrvOrm().insertEntity(pAddParam, pEntity); pEntity.setIsNew(false); this.srvWarehouseEntry.move(pAddParam, pEntity, pEntity .getWarehouseSiteFrom(), pEntity.getWarehouseSiteTo());
/** * <p>Insert immutable line into DB.</p> * @param pAddParam additional param * @param pEntity entity * @param isEntityDetached ignored * @throws Exception - an exception **/ @Override public final void saveEntity(final Map<String, Object> pAddParam, final MoveItemsLine pEntity, final boolean isEntityDetached) throws Exception { if (pEntity.getIsNew()) { if (pEntity.getItsQuantity().doubleValue() <= 0) { throw new ExceptionWithCode(ExceptionWithCode.WRONG_PARAMETER, "quantity_less_or_equal_zero"); } pEntity.setItsQuantity(pEntity.getItsQuantity().setScale( getSrvAccSettings().lazyGetAccSettings().getQuantityPrecision(), getSrvAccSettings().lazyGetAccSettings().getRoundingMode())); getSrvOrm().insertEntity(pEntity); MoveItems itsOwner = getSrvOrm().retrieveEntityById( MoveItems.class, pEntity.getItsOwner().getItsId()); pEntity.setItsOwner(itsOwner); srvWarehouseEntry.move(pAddParam, pEntity, pEntity .getWarehouseSiteFrom(), pEntity.getWarehouseSiteTo()); } else { throw new ExceptionWithCode(ExceptionWithCode.FORBIDDEN, "edit_not_allowed"); } }