@Override public int updateTravelPlan(TravelPlan travelPlan) { int id = m_travelPlanDao.update(travelPlan); if (id > 0) { m_travelPlans.put(travelPlan.getId(), travelPlan); } return id; }
@Override public int insertTravelPlan(TravelPlan travelPlan) { int id = m_travelPlanDao.insert(travelPlan); if (id > 0) { m_travelPlans.put(travelPlan.getId(), travelPlan); } return id; }
@Override public int deleteTravelPlan(int travelPlanId) { int id = m_travelPlanDao.delete(travelPlanId); if (id > 0) { m_travelPlans.remove(travelPlanId); } return id; }
@SuppressWarnings("unchecked") @Override public void afterPropertiesSet() throws Exception { List<TravelPlan> categories = m_travelPlanDao.findAllTravelPlan(); for (TravelPlan travelPlan : categories) { m_travelPlans.put(travelPlan.getId(), travelPlan); } }
@Override public TravelPlan findTravelPlan(int travelPlanId) { TravelPlan travelPlan = m_travelPlans.get(travelPlanId); if (travelPlan == null) { TravelPlan temp = m_travelPlanDao.findById(travelPlanId); if (temp != null) { m_travelPlans.put(travelPlanId, temp); } return temp; } return travelPlan; }