private void sortTopiclistByDate(List<Topic> _list) { List<String> toSort = new ArrayList<String>(); for (Topic topic : _list) { if (topic.getLastupdate() != null && topic.getLastupdate().length() >= 10) toSort.add(topic.getLastupdate()); else { topic.setLastupdate(topic.getDate()); toSort.add(topic.getLastupdate()); } } List<Integer> seqs = new ArrayList<Integer>(); seqs = CONSTANT.sortDatesDesc(toSort); List<Topic> sortedTopiclist = new ArrayList<Topic>(); for (Integer seq : seqs) sortedTopiclist.add(_list.get(seq)); this.setTopiclist(sortedTopiclist); }
private void updateTopicTime(int _topicid, String _updatetime) { Topic topic = new Topic(); try { topic = bm.loadTopicById(_topicid); } catch (ClassNotFoundException e) { e.printStackTrace(); } catch (SQLException e) { e.printStackTrace(); } topic.setLastupdate(_updatetime); try { bm.update(topic); } catch (ClassNotFoundException e) { e.printStackTrace(); } catch (SQLException e) { e.printStackTrace(); } }