/** * <p> * Synchronize entity (that just read) with entity in database. * It just check if it's new. * </p> * @param pEntity object * @param pAddParam additional params * @return isNew if entity exist in database (need update) * @throws Exception - an exception **/ @Override public final boolean sync(final Object pEntity, final Map<String, Object> pAddParam) throws Exception { Object entityPbDb = getSrvOrm().retrieveEntity(pEntity); return entityPbDb == null; }
.retrieveEntity(pEntity.getAccCredit())); if (pEntity.getAccCredit().getSubaccType() != null && pEntity.getSubaccCreditId() == null) { .retrieveEntity(pEntity.getAccDebit())); if (pEntity.getAccDebit().getSubaccType() != null && pEntity.getSubaccDebitId() == null) {
.retrieveEntity(wtte.getItsOwner().getTax()));
pEntity.setService(getSrvOrm().retrieveEntity(pEntity.getService())); SalesInvoice itsOwner = getSrvOrm().retrieveEntityById( SalesInvoice.class, pEntity.getItsOwner().getItsId());
/** * <p> * Synchronize IHasVersion. * </p> * @param pEntity object * @param pAddParam additional params * @return isNew if entity exist in database (need update) * @throws Exception - an exception **/ @Override public final boolean sync(final Object pEntity, final Map<String, Object> pAddParam) throws Exception { IHasVersion entityPb = (IHasVersion) pEntity; IHasVersion entityPbDb = getSrvOrm().retrieveEntity(entityPb); boolean isNew = true; if (entityPbDb != null) { entityPb.setItsVersion(entityPbDb.getItsVersion()); isNew = false; } return isNew; }
pEntity.setService(getSrvOrm().retrieveEntity(pEntity.getService())); PurchaseInvoice itsOwner = getSrvOrm().retrieveEntityById( PurchaseInvoice.class, pEntity.getItsOwner().getItsId());
/** * <p>Make save preparations before insert/update block if it's need.</p> * @param pAddParam additional param * @param pEntity entity * @throws Exception - an exception **/ @Override public final void makeFirstPrepareForSave(final Map<String, Object> pAddParam, final PrepaymentTo pEntity) throws Exception { //BeigeORM refresh: pEntity.setAccCash(getSrvOrm() .retrieveEntity(pEntity.getAccCash())); if (pEntity.getAccCash().getSubaccType() != null && pEntity.getSubaccCashId() == null) { throw new ExceptionWithCode(ExceptionWithCode.WRONG_PARAMETER, "select_subaccount"); } }
pEntity.setInvItem(getSrvOrm().retrieveEntity(pEntity.getInvItem())); if (!(InvItem.MATERIAL_ID.equals(pEntity.getInvItem().getItsType() .getItsId()) || InvItem.MERCHANDISE_ID.equals(pEntity.getInvItem()
/** * <p>Make save preparations before insert/update block if it's need.</p> * @param pAddParam additional param * @param pEntity entity * @throws Exception - an exception **/ @Override public final void makeFirstPrepareForSave(final Map<String, Object> pAddParam, final PrepaymentFrom pEntity) throws Exception { //BeigeORM refresh: pEntity.setAccCash(getSrvOrm() .retrieveEntity(pEntity.getAccCash())); if (pEntity.getAccCash().getSubaccType() != null && pEntity.getSubaccCashId() == null) { throw new ExceptionWithCode(ExceptionWithCode.WRONG_PARAMETER, "select_subaccount"); } }
pEntity.setInvItem(getSrvOrm().retrieveEntity(pEntity.getInvItem())); BeginningInventory itsOwner = getSrvOrm().retrieveEntityById( BeginningInventory.class, pEntity.getItsOwner().getItsId());
/** * <p>Make save preparations before insert/update block if it's need.</p> * @param pAddParam additional param * @param pEntity entity * @throws Exception - an exception **/ @Override public final void makeFirstPrepareForSave(final Map<String, Object> pAddParam, final PaymentTo pEntity) throws Exception { //BeigeORM refresh: pEntity.setAccCash(getSrvOrm() .retrieveEntity(pEntity.getAccCash())); if (pEntity.getAccCash().getSubaccType() != null && pEntity.getSubaccCashId() == null) { throw new ExceptionWithCode(ExceptionWithCode.WRONG_PARAMETER, "select_subaccount"); } PurchaseInvoice purchaseInvoice = getSrvOrm().retrieveEntity(pEntity .getPurchaseInvoice()); if (!purchaseInvoice.getHasMadeAccEntries() || purchaseInvoice.getReversedId() != null) { throw new ExceptionWithCode(ExceptionWithCode.WRONG_PARAMETER, "purchase_invoice_must_be_accounted"); } pEntity.setPurchaseInvoice(purchaseInvoice); }
BigDecimal totalTaxes = BigDecimal.ZERO; pEntity.setInvItem(getSrvOrm().retrieveEntity(pEntity.getInvItem())); 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 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); } }
pEntity.setInvItem(getSrvOrm().retrieveEntity(pEntity.getInvItem())); SalesReturn itsOwner = getSrvOrm().retrieveEntityById( SalesReturn.class, pEntity.getItsOwner().getItsId());
/** * <p>Create entity with its itsOwner e.g. invoice line * for invoice.</p> * @param pAddParam additional param * @param pEntityItsOwner itsOwner * @return entity instance * @throws Exception - an exception **/ @Override public final PurchaseReturnLine createEntityWithOwner( final Map<String, Object> pAddParam, final PurchaseReturn pEntityItsOwner) throws Exception { PurchaseReturnLine entity = new PurchaseReturnLine(); entity.setIsNew(true); entity.setIdDatabaseBirth(getSrvOrm().getIdDatabase()); //BeigeORM refresh: PurchaseReturn entityItsOwner = getSrvOrm() .retrieveEntity(pEntityItsOwner); entity.setItsOwner(entityItsOwner); return entity; }
getSrvAccSettings().lazyGetAccSettings().getRoundingMode())); pEntity.setPurchaseInvoiceLine(getSrvOrm().retrieveEntity(pEntity .getPurchaseInvoiceLine())); if (pEntity.getPurchaseInvoiceLine() == null) {
/** * <p>Make save preparations before insert/update block if it's need.</p> * @param pAddParam additional param * @param pEntity entity * @throws Exception - an exception **/ @Override public final void makeFirstPrepareForSave(final Map<String, Object> pAddParam, final PaymentFrom pEntity) throws Exception { //BeigeORM refresh: pEntity.setAccCash(getSrvOrm() .retrieveEntity(pEntity.getAccCash())); if (pEntity.getAccCash().getSubaccType() != null && pEntity.getSubaccCashId() == null) { throw new ExceptionWithCode(ExceptionWithCode.WRONG_PARAMETER, "select_subaccount"); } SalesInvoice purchaseInvoice = getSrvOrm().retrieveEntity(pEntity .getSalesInvoice()); if (!purchaseInvoice.getHasMadeAccEntries() || purchaseInvoice.getReversedId() != null) { throw new ExceptionWithCode(ExceptionWithCode.WRONG_PARAMETER, "purchase_invoice_must_be_accounted"); } pEntity.setSalesInvoice(purchaseInvoice); }
final PurchaseInvoice pEntity) throws Exception { if (pEntity.getPrepaymentTo() != null) { pEntity.setPrepaymentTo(getSrvOrm().retrieveEntity(pEntity .getPrepaymentTo())); if (pEntity.getReversedId() == null && pEntity.getPrepaymentTo()
final SalesInvoice pEntity) throws Exception { if (pEntity.getPrepaymentFrom() != null) { pEntity.setPrepaymentFrom(getSrvOrm().retrieveEntity(pEntity .getPrepaymentFrom())); if (pEntity.getReversedId() == null && pEntity.getPrepaymentFrom()
"tax_wrong"); pEntity.setTax(getSrvOrm().retrieveEntity(pEntity.getTax())); //SQL refresh if (!(ETaxType.SALES_TAX_INITEM.equals(pEntity.getTax().getItsType()) || ETaxType.SALES_TAX_OUTITEM.equals(pEntity.getTax().getItsType()))) {