예제 #1
0
  @SuppressWarnings("unchecked")
  @Override
  public void afterPropertiesSet() throws Exception {
    List<TravelPlan> categories = m_travelPlanDao.findAllTravelPlan();

    for (TravelPlan travelPlan : categories) {
      m_travelPlans.put(travelPlan.getId(), travelPlan);
    }
  }
예제 #2
0
  @Override
  public List<TravelPlan> queryAllTravelPlans(int traveId) {
    ArrayList<TravelPlan> arrayList = new ArrayList<TravelPlan>(m_travelPlans.values());
    List<TravelPlan> result = new ArrayList<TravelPlan>();

    for (TravelPlan temp : arrayList) {
      if (temp.getTravelId() == traveId || traveId == 0) {
        result.add(temp);
      }
    }
    Collections.sort(result, new TravelPlanAscCompartor());
    return result;
  }
예제 #3
0
 @Override
 public int updateTravelPlan(TravelPlan travelPlan) {
   int id = m_travelPlanDao.update(travelPlan);
   if (id > 0) {
     m_travelPlans.put(travelPlan.getId(), travelPlan);
   }
   return id;
 }
예제 #4
0
 @Override
 public int insertTravelPlan(TravelPlan travelPlan) {
   int id = m_travelPlanDao.insert(travelPlan);
   if (id > 0) {
     m_travelPlans.put(travelPlan.getId(), travelPlan);
   }
   return id;
 }
예제 #5
0
 @Override
 public int compare(TravelPlan o1, TravelPlan o2) {
   return o2.getId() - o1.getId();
 }