/** * <p>Save entity 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 T pEntity, final boolean isEntityDetached) throws Exception { if (pEntity.getIsNew()) { this.srvOrm.insertEntity(pEntity); } else { this.srvOrm.updateEntity(pEntity); } srvAccSettings.clearAccSettings(); }
/** * <p>Save entity 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 T pEntity, final boolean isEntityDetached) throws Exception { if (pEntity.getIsNew()) { this.srvOrm.insertEntity(pEntity); } else { if (APersistableBase.class.isAssignableFrom(pEntity.getClass()) && !((APersistableBase) pEntity).getIdDatabaseBirth() .equals(getSrvOrm().getIdDatabase())) { throw new ExceptionWithCode(ExceptionWithCode.WRONG_PARAMETER, "can_not_change_foreign_src"); } this.srvOrm.updateEntity(pEntity); } }
/** * <p>Save entity 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 T pEntity, final boolean isEntityDetached) throws Exception { if (pEntity.getIsNew()) { getSrvOrm().insertEntity(pEntity); } else { if (APersistableBase.class.isAssignableFrom(pEntity.getClass()) && !((APersistableBase) pEntity).getIdDatabaseBirth() .equals(getSrvOrm().getIdDatabase())) { throw new ExceptionWithCode(ExceptionWithCode.WRONG_PARAMETER, "can_not_change_foreign_src"); } getSrvOrm().updateEntity(pEntity); } }
/** * <p>Lazy getter for balanceAtAllDirtyCheck.</p> * @return BalanceAtAllDirtyCheck * @throws Exception - an exception **/ public final synchronized BalanceAtAllDirtyCheck lazyGetBalanceAtAllDirtyCheck() throws Exception { if (this.balanceAtAllDirtyCheck == null) { this.balanceAtAllDirtyCheck = getSrvOrm() .retrieveEntityById(BalanceAtAllDirtyCheck.class, 1L); if (this.balanceAtAllDirtyCheck == null) { this.balanceAtAllDirtyCheck = new BalanceAtAllDirtyCheck(); this.balanceAtAllDirtyCheck.setItsId(1L); getSrvOrm().insertEntity(this.balanceAtAllDirtyCheck); } } return this.balanceAtAllDirtyCheck; }
/** * <p>Save entity 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 AccountingEntries pEntity, final boolean isEntityDetached) throws Exception { if (!pEntity.getIdDatabaseBirth() .equals(getSrvOrm().getIdDatabase())) { throw new ExceptionWithCode(ExceptionWithCode.WRONG_PARAMETER, "can_not_change_foreign_src"); } if (pEntity.getIsNew()) { getSrvOrm().insertEntity(pEntity); } else { getSrvOrm().updateEntity(pEntity); } }
/** * <p>Save entity 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 T pEntity, final boolean isEntityDetached) throws Exception { if (pEntity.getIsNew()) { getSrvOrm().insertEntity(pEntity); } else { getSrvOrm().updateEntity(pEntity); } for (IHandlerModelChanged<ReplicationAccMethod> replAccMethChangedHandler : this.replAccMethChangedHandlers) { replAccMethChangedHandler.handleModelChanged(pEntity.getItsOwner()); } }
getSrvOrm().insertEntity(pEntity); } else { getSrvOrm().updateEntity(pEntity);
subaccount.setItsId(pSubaccId); subaccUsed.setSubaccount(subaccount); getSrvOrm().insertEntity(subaccUsed);
/** * <p>Save entity 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 ReplicationAccMethod pEntity, final boolean isEntityDetached) throws Exception { if (pEntity.getRequestedDatabaseId() == getSrvOrm().getIdDatabase()) { throw new ExceptionWithCode(ExceptionWithCode.WRONG_PARAMETER, "requested_database_must_be_different"); } if (pEntity.getIsNew()) { getSrvOrm().insertEntity(pEntity); } else { getSrvOrm().updateEntity(pEntity); } for (IHandlerModelChanged<ReplicationAccMethod> replAccMethChangedHandler : this.replAccMethChangedHandlers) { replAccMethChangedHandler.handleModelChanged(pEntity); } }
/** * <p> * Read entities from stream (by given reader) and insert them * into DB with no changes. DB must be emptied before coping. * </p> * @param pReader Reader * @param pAddParam additional params * @throws Exception - an exception **/ @Override public final void readAndStoreEntities(final Reader pReader, final Map<String, Object> pAddParam) throws Exception { try { this.srvDatabase.setIsAutocommit(false); this.srvDatabase. setTransactionIsolation(ISrvDatabase.TRANSACTION_READ_UNCOMMITTED); this.srvDatabase.beginTransaction(); while (this.utilXml.readUntilStart(pReader, "entity")) { Object entity = this.srvEntityReader.read(pReader, null); this.srvOrm.insertEntity(entity); } this.srvDatabase.commitTransaction(); } catch (Exception ex) { this.srvDatabase.rollBackTransaction(); throw ex; } finally { this.srvDatabase.releaseResources(); } }
/** * <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 AdditionCostLine pEntity, final boolean isEntityDetached) throws Exception { if (pEntity.getItsTotal().doubleValue() == 0d) { throw new ExceptionWithCode(ExceptionWithCode.WRONG_PARAMETER, "total_is_0"); } ManufacturingProcess itsOwner = getSrvOrm().retrieveEntityById( ManufacturingProcess.class, pEntity.getItsOwner().getItsId()); if (itsOwner.getIsComplete()) { throw new ExceptionWithCode(ExceptionWithCode.WRONG_PARAMETER, "attempt_to_change_completed_manufacturing_process"); } pEntity.setItsOwner(itsOwner); if (pEntity.getIsNew()) { getSrvOrm().insertEntity(pEntity); } else { getSrvOrm().updateEntity(pEntity); } updateOwner(pEntity); }
/** * <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 WageLine pEntity, final boolean isEntityDetached) throws Exception { if (pEntity.getGrossWage().doubleValue() == 0d) { throw new ExceptionWithCode(ExceptionWithCode.WRONG_PARAMETER, "total_is_0"); } Wage itsOwner = getSrvOrm().retrieveEntityById( Wage.class, pEntity.getItsOwner().getItsId()); pEntity.setItsOwner(itsOwner); if (pEntity.getItsOwner().getHasMadeAccEntries()) { throw new ExceptionWithCode(ExceptionWithCode.FORBIDDEN, "attempt_to_change_accounted_document"); } if (pEntity.getIsNew()) { getSrvOrm().insertEntity(pEntity); } else { getSrvOrm().updateEntity(pEntity); } updateOwner(pEntity); }
final boolean isEntityDetached) throws Exception { if (pEntity.getIsNew()) { getSrvOrm().insertEntity(pEntity); } else { Account oldAcc = getSrvOrm().retrieveEntityById(Account.class,
/** * <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 SubaccountLine pEntity, final boolean isEntityDetached) throws Exception { Account itsOwner = getSrvOrm().retrieveEntityById( Account.class, pEntity.getItsOwner().getItsId()); pEntity.setItsOwner(itsOwner); if (!pEntity.getSubaccType().equals(pEntity .getItsOwner().getSubaccType())) { throw new ExceptionWithCode(ExceptionWithCode.WRONG_PARAMETER, "wrong_paramaters"); } if (pEntity.getIsNew()) { getSrvOrm().insertEntity(pEntity); registerSubaccountUsedIfExist(pEntity.getSubaccType(), pEntity.getSubaccId()); } else { getSrvOrm().updateEntity(pEntity); } }
/** * <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"); } }
getSrvOrm().insertEntity(wr); } else { String where = "INVITEM=" + wr.getInvItem().getItsId()
+ reversedLine.getIdDatabaseBirth() + "-" getSrvOrm().insertEntity(reversingLine); getSrvWarehouseEntry().reverseDraw(pAddParam, reversingLine); getSrvCogsEntry().reverseDraw(pAddParam, reversingLine,
getSrvOrm().insertEntity(pEntity); } else { getSrvOrm().updateEntity(pEntity);
.lazyGetAccSettings().getRoundingMode())); die.setDescription(makeDescription(pEntity, die)); this.srvOrm.insertEntity(die); pSource.setTheRest(pSource.getTheRest().subtract(pQuantityToDraw)); this.srvOrm.updateEntity(pSource);
multiply(die.getItsQuantity())); die.setDescription(makeDescription(pEntity)); getSrvOrm().insertEntity(die);