db: refactor Database.java, add javadoc

- add javadoc comments
- refactor some of the methods
Merge branch 'master' of ssh://github.com/d14123081/team4