Пример #1
0
 public void loadUser(String username) {
   try {
     brainSystem.getBrainDB().loadUser(this, username);
   } catch (DBException e) {
     // TODO Auto-generated catch block
     e.printStackTrace();
   }
 }
Пример #2
0
 public UserLesson getUserLessonByLessonID(long lid) {
   UserLesson userLesson = null;
   try {
     userLesson = brainSystem.getBrainDB().getUserLessonByLessonID(this, lid);
   } catch (DBException e) {
     e.printStackTrace();
   }
   return userLesson;
 }
Пример #3
0
 public Vector<UserLesson> getLessons() {
   try {
     if ((userLessons == null) || (userLessons.size() == 0))
       userLessons = brainSystem.getBrainDB().getUserLessons(this);
   } catch (DBException e) {
     e.printStackTrace();
   }
   return userLessons;
 }
Пример #4
0
 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;
 }
Пример #5
0
 // 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;
 }