public void loadUser(String username) { try { brainSystem.getBrainDB().loadUser(this, username); } catch (DBException e) { // TODO Auto-generated catch block e.printStackTrace(); } }
public UserLesson getUserLessonByLessonID(long lid) { UserLesson userLesson = null; try { userLesson = brainSystem.getBrainDB().getUserLessonByLessonID(this, lid); } catch (DBException e) { e.printStackTrace(); } return userLesson; }
public Vector<UserLesson> getLessons() { try { if ((userLessons == null) || (userLessons.size() == 0)) userLessons = brainSystem.getBrainDB().getUserLessons(this); } catch (DBException e) { e.printStackTrace(); } return userLessons; }
public int getScore() { int ret = 0; try { ret = BrainSystem.getBrainSystem().getBrainDB().getUserScore(this); } catch (DBException e) { // TODO Auto-generated catch block e.printStackTrace(); } return ret; }
// TODO: schlechter code, besser gleich an die DB public boolean hasLesson(Lesson lesson) { try { Vector<UserLesson> lessons = getLessons(); Iterator<UserLesson> it = lessons.iterator(); while (it.hasNext()) { UserLesson userLesson = it.next(); if (userLesson.getLesson().getId() == lesson.getId()) return true; } } catch (DBException e) { // TODO Auto-generated catch block e.printStackTrace(); } return false; }