/** * Saves a filterCategoryBean in the database * * @param filterCategoryBean * @return */ @Override public Integer save(TReportCategoryBean reportCategoryBean) { TReportCategory filterCategory; try { filterCategory = BaseTReportCategory.createTReportCategory(reportCategoryBean); filterCategory.save(); return filterCategory.getObjectID(); } catch (Exception e) { LOGGER.error("Saving of a filterCategory failed with " + e.getMessage()); return null; } }
/** * Converts a list of TReportCategory torque objects to a list of TReportCategoryBean objects * * @param torqueList * @return */ private static List<TReportCategoryBean> convertTorqueListToBeanList( List<TReportCategory> torqueList) { List<TReportCategoryBean> beanList = new ArrayList<TReportCategoryBean>(); TReportCategory reportCategory; if (torqueList != null) { Iterator<TReportCategory> itrTorqueList = torqueList.iterator(); while (itrTorqueList.hasNext()) { reportCategory = itrTorqueList.next(); beanList.add(reportCategory.getBean()); } } return beanList; }
/** * Loads a filterCategoryBean by primary key * * @param objectID * @return */ @Override public TReportCategoryBean loadByPrimaryKey(Integer objectID) { TReportCategory reportCategory = null; try { reportCategory = retrieveByPK(objectID); } catch (Exception e) { LOGGER.warn( "Loading of a reportCategory by primary key " + objectID + " failed with " + e.getMessage()); LOGGER.debug(ExceptionUtils.getStackTrace(e)); } if (reportCategory != null) { return reportCategory.getBean(); } return null; }
/** * Deletes the reportCategoryBean satisfying a certain criteria together with the dependent * database entries * * @param crit * @throws TorqueException */ public static void doDelete(Criteria crit) throws TorqueException { List list = null; try { list = doSelect(crit); } catch (TorqueException e) { LOGGER.error( "Getting the list of TReportCategoryBean to be deleted failed with " + e.getMessage()); throw e; } if (list != null && !list.isEmpty()) { Iterator<TReportCategory> iter = list.iterator(); TReportCategory filterCategory = null; while (iter.hasNext()) { filterCategory = iter.next(); ReflectionHelper.delete(deletePeerClasses, deleteFields, filterCategory.getObjectID()); } } }