/** * <p>Delete entity with NON-COMPLEX ID from DB.</p> * @param <T> entity type * @param <K> ID type * @param pEntity entity * @throws Exception - an exception **/ @Override public final <T> void deleteEntity( final T pEntity) throws Exception { TableSql tableSql = this.getTablesMap().get(pEntity.getClass() .getSimpleName()); Field fieldId = this.utlReflection.retrieveField(pEntity.getClass(), tableSql.getIdName()); fieldId.setAccessible(true); Object id = fieldId.get(pEntity); deleteEntity(pEntity.getClass(), id); }
/** * <p>Process entity request.</p> * @param pAddParam additional param, e.g. return this line's * document in "nextEntity" for farther process * @param pRequestData Request Data * @param pEntity Entity to process * @return Entity processed for farther process or null * @throws Exception - an exception **/ @Override public final T process( final Map<String, Object> pAddParam, final T pEntity, final IRequestData pRequestData) throws Exception { this.srvOrm.deleteEntity(pAddParam, pEntity); String ownerFieldName = this.srvOrm.getTablesMap() .get(pEntity.getClass().getSimpleName()).getOwnerFieldName(); Method getter = this.gettersRapiHolder .getFor(pEntity.getClass(), ownerFieldName); @SuppressWarnings("unchecked") T owner = (T) getter.invoke(pEntity); pAddParam.put("nameOwnerEntity", owner.getClass().getSimpleName()); pAddParam.put("nextEntity", owner); return null; }
"Can not delete file: " + fileToDel); this.srvOrm.deleteEntity(pAddParam, pEntity); String ownerFieldName = this.srvOrm.getTablesMap() .get(pEntity.getClass().getSimpleName()).getOwnerFieldName();