/** * <p>Geter for database ID.</p> * @return ID database **/ @Override public final int getIdDatabase() { return this.srvDatabase.getIdDatabase(); }
/** * <p>Init database birth and ID birth of entity.</p> * @param pEntity entity * @throws Exception an exception **/ public final void initPersistableBase(final Object pEntity) throws Exception { Field fieldIdDbBirth = getUtlReflection().retrieveField(pEntity.getClass(), APersistableBase.ID_DATABASE_BIRTH_NAME); fieldIdDbBirth.setAccessible(true); if (getSrvDatabase() != null) { //for test purpose, otherwise it must be set fieldIdDbBirth.set(pEntity, getSrvDatabase().getIdDatabase()); } Field fieldIdBirth = getUtlReflection().retrieveField(pEntity.getClass(), APersistableBase.ID_BIRTH_NAME); fieldIdBirth.setAccessible(true); fieldIdBirth.set(pEntity, null); }
/** * <p>Create entity.</p> * @param pAddParam additional param * @return entity instance * @throws Exception - an exception **/ @Override public final AccountingEntry createEntity( final Map<String, Object> pAddParam) throws Exception { AccountingEntry entity = new AccountingEntry(); entity.setIdDatabaseBirth(getSrvDatabase().getIdDatabase()); entity.setSourceDatabaseBirth(getSrvDatabase().getIdDatabase()); entity.setIsNew(true); entity.setItsDate(new Date()); addAccSettingsIntoAttrs(pAddParam); return entity; }
if (requestedDatabaseId != null) { if (Integer.parseInt(requestedDatabaseId) == getSrvDatabase().getIdDatabase()) { throw new ExceptionWithCode(ExceptionWithCode.WRONG_PARAMETER, "requested_database_must_be_different");
/** * <p>Retrieve copy of entity from DB by given ID.</p> * @param pAddParam additional param * @param pId ID * @return entity or null * @throws Exception - an exception **/ @Override public final AccountingEntry retrieveCopyEntity( final Map<String, Object> pAddParam, final Object pId) throws Exception { AccountingEntry entity = getSrvOrm().retrieveCopyEntity( AccountingEntry.class, pId); if (!entity.getIdDatabaseBirth() .equals(getSrvOrm().getIdDatabase())) { throw new ExceptionWithCode(ExceptionWithCode.WRONG_PARAMETER, "can_not_make_entry_for_foreign_src"); } entity.setIdDatabaseBirth(getSrvDatabase().getIdDatabase()); entity.setSourceDatabaseBirth(getSrvDatabase().getIdDatabase()); entity.setIsNew(true); addAccSettingsIntoAttrs(pAddParam); return entity; }
entity.setIdDatabaseBirth(getSrvDatabase().getIdDatabase()); entity.setSourceDatabaseBirth(getSrvDatabase().getIdDatabase()); entity.setIsNew(true); entity.setItsDate(new Date());
do { AccountingEntry accEntry = new AccountingEntry(); accEntry.setIdDatabaseBirth(getSrvDatabase().getIdDatabase()); if (itsDateLong == null) { itsDateLong = getSrvDatabase().getSrvRecordRetriever()
for (AccountingEntry source : sources) { if (!source.getIdDatabaseBirth() .equals(getSrvDatabase().getIdDatabase())) { throw new ExceptionWithCode(ExceptionWithCode.WRONG_PARAMETER, "can_not_reverse_foreign_acconting_entries"); accEntry.setIdDatabaseBirth(getSrvDatabase().getIdDatabase()); accEntry.setSourceType(pReversing.constTypeCode()); Long reversingDocId = pReversing.getItsId();