/** * <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>Make other entries include reversing if it's need when save.</p> * @param pAddParam additional param * @param pEntity entity * @param pIsNew if entity was new * @throws Exception - an exception **/ @Override public final void makeOtherEntries(final Map<String, Object> pAddParam, final PaymentFrom pEntity, final boolean pIsNew) throws Exception { @SuppressWarnings("unchecked") Map<String, String[]> parameterMap = (Map<String, String[]>) pAddParam. get("parameterMap"); if (parameterMap.get("actionAdd") != null && "makeAccEntries".equals(parameterMap.get("actionAdd")[0])) { this.srvSalesInvoice.calculateTotalPayment(pEntity .getSalesInvoice()); getSrvOrm().updateEntity(pEntity.getSalesInvoice()); } }
/** * <p>Make other entries include reversing if it's need when save.</p> * @param pAddParam additional param * @param pEntity entity * @param pIsNew if entity was new * @throws Exception - an exception **/ @Override public final void makeOtherEntries(final Map<String, Object> pAddParam, final PaymentTo pEntity, final boolean pIsNew) throws Exception { @SuppressWarnings("unchecked") Map<String, String[]> parameterMap = (Map<String, String[]>) pAddParam. get("parameterMap"); if (parameterMap.get("actionAdd") != null && "makeAccEntries".equals(parameterMap.get("actionAdd")[0])) { this.srvPurchaseInvoice.calculateTotalPayment(pEntity .getPurchaseInvoice()); getSrvOrm().updateEntity(pEntity.getPurchaseInvoice()); } }
/** * <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>Update InvItemTaxCategory.</p> * @param pAddParam additional param * @param pId InvItemTaxCategory ID * @throws Exception - an exception **/ public final void updateInvItemTaxCategory( final Map<String, Object> pAddParam, final Long pId) throws Exception { List<InvItemTaxCategoryLine> ptl = getSrvOrm() .retrieveEntityOwnedlist(InvItemTaxCategoryLine.class, InvItemTaxCategory.class, pId); StringBuffer sb = new StringBuffer(""); int i = 0; for (InvItemTaxCategoryLine pt : ptl) { if (i++ > 0) { sb.append(", "); } sb.append(pt.getTax().getItsName() + " " + pt.getItsPercentage() + "%"); } InvItemTaxCategory itsOwner = getSrvOrm() .retrieveEntityById(InvItemTaxCategory.class, pId); itsOwner.setTaxesDescription(sb.toString()); getSrvOrm().updateEntity(itsOwner); } }
/** * <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>Insert immutable line into DB.</p> * @param pEntity entity * @throws Exception - an exception **/ public final void updateOwner( final WageLine pEntity) throws Exception { String query = "select sum(GROSSWAGE) as GROSSWAGE from " + WageLine.class .getSimpleName().toUpperCase() + " where ITSOWNER=" + pEntity.getItsOwner().getItsId(); Double total = getSrvDatabase().evalDoubleResult(query, "GROSSWAGE"); if (total == null) { total = 0d; } pEntity.getItsOwner().setItsTotal(BigDecimal.valueOf(total).setScale( getSrvAccSettings().lazyGetAccSettings().getPricePrecision(), getSrvAccSettings().lazyGetAccSettings().getRoundingMode())); getSrvOrm().updateEntity(pEntity.getItsOwner()); }
/** * <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()); } }
/** * <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); } }
pItsOwner.setItsTotal(pItsOwner.getSubtotal(). add(pItsOwner.getTotalTaxes())); getSrvOrm().updateEntity(pItsOwner); if (getSrvAccSettings().lazyGetAccSettings() .getIsExtractSalesTaxFromPurchase()) {
pItsOwner.setItsTotal(pItsOwner.getSubtotal(). add(pItsOwner.getTotalTaxes())); getSrvOrm().updateEntity(pItsOwner); if (getSrvAccSettings().lazyGetAccSettings() .getIsExtractSalesTaxFromSales()) {
/** * <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>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 pEntity entity * @throws Exception - an exception **/ public final void updateOwner( final AdditionCostLine pEntity) throws Exception { String query = "select sum(ITSTOTAL) as ITSTOTAL from" + " ADDITIONCOSTLINE where ITSOWNER=" + pEntity.getItsOwner().getItsId(); Double total = getSrvDatabase().evalDoubleResult(query, "ITSTOTAL"); pEntity.getItsOwner().setTotalAdditionCost(BigDecimal.valueOf(total)); pEntity.getItsOwner().setItsTotal(pEntity.getItsOwner() .getTotalMaterialsCost().add(pEntity.getItsOwner() .getTotalAdditionCost())); pEntity.getItsOwner().setItsCost(pEntity.getItsOwner().getItsTotal() .divide(pEntity.getItsOwner().getItsQuantity(), getSrvAccSettings().lazyGetAccSettings().getCostPrecision(), getSrvAccSettings().lazyGetAccSettings().getRoundingMode())); getSrvOrm().updateEntity(pEntity.getItsOwner()); }
/** * <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); }
/** * <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); } }
.setCurrentBalanceDate(new Date(157766400000L)); lazyGetBalanceAtAllDirtyCheck().setIsPeriodChanged(true); getSrvOrm().updateEntity(lazyGetBalanceAtAllDirtyCheck());
.getManufacturingProcess().getTheRest() .subtract(pEntity.getItsQuantity())); getSrvOrm().updateEntity(pEntity.getManufacturingProcess()); UseMaterialEntry die = new UseMaterialEntry(); die.setItsDate(pEntity.getItsDate());