/** * <p>Retrieve a list of entities.</p> * @param pAddParam additional param * @param pQueryConditions Not NULL e.g. "where name='U1' ORDER BY id" * @return list of business objects * @throws Exception - an exception */ @Override public final List<T> retrieveListWithConditions( final Map<String, Object> pAddParam, final String pQueryConditions) throws Exception { return this.srvOrm.retrieveListWithConditions(this.entityClass, pQueryConditions); }
/** * <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>Convert String to Entity value.</p> * @param pItsIdStr ID string value * @param pClazz Entity class * @return Entity value * @throws Exception an exception **/ @Override public final T convert(final String pItsIdStr, final Class<T> pClazz) throws Exception { return srvOrm.retrieveEntityById(pClazz, pItsIdStr); }
/** * <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>Delete entity from DB.</p> * @param pAddParam additional param * @param pEntity entity * @throws Exception - an exception **/ @Override public final void deleteEntity(final Map<String, Object> pAddParam, final T pEntity) throws Exception { if (APersistableBase.class.isAssignableFrom(pEntity.getClass()) && !((APersistableBase) pEntity).getIdDatabaseBirth() .equals(getSrvOrm().getIdDatabase())) { throw new ExceptionWithCode(ExceptionWithCode.WRONG_PARAMETER, "can_not_delete_foreign_src"); } getSrvOrm().deleteEntity(this.entityClass, pEntity.getItsId()); }
List<SalesInvoiceTaxLine> sitl = getSrvOrm().retrieveListWithConditions( SalesInvoiceTaxLine.class, "where ITSOWNER=" + pOwnerId); countUpdatedSitl++; } else { sit = getSrvOrm().createEntityWithOwner( SalesInvoiceTaxLine.class, SalesInvoice.class, pOwnerId); getSrvAccSettings().lazyGetAccSettings().getRoundingMode())); if (sit.getIsNew()) { getSrvOrm().insertEntity(sit); } else { getSrvOrm().updateEntity(sit); getSrvOrm().deleteEntity(sitl.get(j));
final Wage pWage) throws Exception { List<WageTaxTableEmployee> wttel = getSrvOrm() .retrieveListWithConditions(WageTaxTableEmployee.class, "where EMPLOYEE=" + pWage.getEmployee().getItsId()); if (wttel != null && wttel.size() > 0) { getSrvOrm().deleteEntityWhere(WageTaxLine.class, "ITSOWNER=" + pWage.getItsId()); BigDecimal bigDecimal100 = new BigDecimal("100.00"); pWage.setItsLines(getSrvOrm().retrieveEntityOwnedlist(WageLine.class, Wage.class, pWage.getItsId())); Map<WageType, BigDecimal> empleeTotTaxLnMap = .retrieveEntity(wtte.getItsOwner().getTax())); .retrieveEntityOwnedlist(WageTaxTableLine.class, WageTaxTable.class, wtte.getItsOwner().getItsId())); .retrieveEntityOwnedlist(WageTaxTableType.class, WageTaxTable.class, wtte.getItsOwner().getItsId())); BigDecimal totalTaxableForTax = BigDecimal.ZERO; && totalWageYear .compareTo(wttl.getYearWageTo()) < 0) { WageTaxLine wtl = getSrvOrm().createEntity(WageTaxLine.class); wtl.setItsOwner(pWage); wtl.setAllowance(wtte.getAllowance());
/** * <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); }
setTransactionIsolation(ISrvDatabase.TRANSACTION_READ_UNCOMMITTED); this.srvDatabase.beginTransaction(); di = getSrvOrm().retrieveEntityWithConditions(DatabaseInfo.class, ""); String requestedDatabaseIdStr = (String) pAddParam .get("requestedDatabaseId"); entities = getSrvOrm().retrieveList(pEntityClass); } else { entities = getSrvOrm().retrieveListWithConditions(pEntityClass, conditions);
.retrieveEntityById(subaccClassUsed, pSubaccId); if (subaccUsed == null) { subaccUsed = (ASubaccountUsed) getSrvOrm() .createEntity(subaccClassUsed); ASubaccount subaccount = (ASubaccount) getSrvOrm() .createEntity(subaccClass); subaccount.setItsId(pSubaccId); subaccUsed.setSubaccount(subaccount); getSrvOrm().insertEntity(subaccUsed);
/** * <p>Retrieve owned list of entities for itsOwner. * E.g. invoices lines for invoice</p> * @param pAddParam additional param * @param pIdEntityItsOwner ID itsOwner * @return owned list of business objects * @throws Exception - an exception */ @Override public final List<GoodsLossLine> retrieveOwnedListById( final Map<String, Object> pAddParam, final Object pIdEntityItsOwner) throws Exception { return getSrvOrm().retrieveEntityOwnedlist(GoodsLossLine.class, GoodsLoss.class, pIdEntityItsOwner); }
/** * <p>Delete entity from DB.</p> * @param pAddParam additional param * @param pEntity entity * @throws Exception - an exception **/ @Override public final void deleteEntity(final Map<String, Object> pAddParam, final T pEntity) throws Exception { if (!pEntity.getIdDatabaseBirth().equals(getSrvOrm().getIdDatabase())) { throw new ExceptionWithCode(ExceptionWithCode.WRONG_PARAMETER, "can_not_delete_foreign_src"); } deleteEntity(pAddParam, pEntity.getItsId()); }
/** * <p>Retrieve a list of all entities.</p> * @param pAddParam additional param * @return list of all business objects * @throws Exception - an exception */ @Override public final List<T> retrieveList( final Map<String, Object> pAddParam) throws Exception { return this.srvOrm.retrieveList(this.entityClass); }
/** * <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>Delete entity from DB by given ID.</p> * @param pAddParam additional param * @param pId ID * @throws Exception - an exception **/ @Override public final void deleteEntity(final Map<String, Object> pAddParam, final Object pId) throws Exception { this.srvOrm.deleteEntity(this.entityClass, pId); }
/** * <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 AccountingEntry pEntity, final boolean isEntityDetached) throws Exception { if (pEntity.getIsNew()) { throw new ExceptionWithCode(ExceptionWithCode.FORBIDDEN, "forbidden_operation"); } else { AccountingEntry oldEntity = getSrvOrm().retrieveEntity(pEntity); oldEntity.setDescription(pEntity.getDescription()); getSrvOrm().updateEntity(oldEntity); } }
/** * <p>It prepares database after import.</p> * @param pAddParams additional params * @throws Exception - an exception **/ @Override public final void make( final Map<String, Object> pAddParams) throws Exception { this.replicationMethod.setLastDateReplication(new Date()); getSrvOrm().updateEntity(this.replicationMethod); }
/** * <p>Create entity with its owner e.g. invoice line * for invoice.</p> * @param pAddParam additional param * @param pIdEntityOwner entity owner ID * @return entity instance * @throws Exception - an exception **/ @Override public final T createEntityWithOwnerById(final Map<String, Object> pAddParam, final Object pIdEntityOwner) throws Exception { T entity = getSrvOrm().createEntityWithOwner(getEntityClass(), this.ownerClass, pIdEntityOwner); entity.setIsNew(true); return entity; }
/** * <p>Create entity.</p> * @param pAddParam additional param * @return entity instance * @throws Exception - an exception **/ @Override public final T createEntity( final Map<String, Object> pAddParam) throws Exception { T entity = this.srvOrm.createEntity(this.entityClass); entity.setIsNew(true); return entity; }
List<PurchaseReturnTaxLine> citl = getSrvOrm().retrieveListWithConditions( PurchaseReturnTaxLine.class, "where ITSOWNER=" + pOwnerId); countUpdatedSitl++; } else { cit = getSrvOrm().createEntityWithOwner( PurchaseReturnTaxLine.class, PurchaseReturn.class, pOwnerId); getSrvAccSettings().lazyGetAccSettings().getRoundingMode())); if (cit.getIsNew()) { getSrvOrm().insertEntity(cit); } else { getSrvOrm().updateEntity(cit); getSrvOrm().deleteEntity(citl.get(j));