/** * <p>Retrieve 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 T retrieveEntityById(final Map<String, Object> pAddParam, final Object pId) throws Exception { addAccSettingsIntoAttrs(pAddParam); return getSrvOrm().retrieveEntityById(getEntityClass(), pId); }
/** * <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 { T entity = retrieveEntityById(pAddParam, pId); deleteEntity(pAddParam, entity); } }
/** * <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(getEntityClass(), pEntity.getItsId()); }
/** * <p>Refresh entity from DB by given entity with ID.</p> * @param pEntity entity * @return entity or null * @throws Exception - an exception **/ @Override public final T retrieveEntity(final Map<String, Object> pAddParam, final T pEntity) throws Exception { addAccSettingsIntoAttrs(pAddParam); return getSrvOrm().retrieveEntityById(getEntityClass(), pEntity.getItsId()); }