Kawai Wiki

Compare Revisions

Ignore whitespace Rev 85 → Rev 86

/trunk/src/main/java/org/kawai/dao/PageDAO.java
15,6 → 15,8
public Page loadByName(String name, Language lang);
public Page loadByName(String name, Language lang, int revision);
public Page loadByNameWithPreview(int userId, String name, Language lang);
public Page loadFrontPage(Language lang);
/trunk/src/main/java/org/kawai/dao/jdbc/JdbcPageDAO.java
36,12 → 36,31
@Override
public Page loadByName(String name, Language lang) {
return loadByName(name, lang, -1);
}
@Override
public Page loadByName(String name, Language lang, int revision) {
Page p = new Page();
p.setName(name);
p.setLanguageId(lang.getId());
p.setDeleted(false);
p = session.loadUnique(p);
 
if (p != null) {
if (revision > 0) {
Revision r = loadRevision(revision, name, lang);
if (r != null) {
p.setCreatedById(r.getUserId());
p.setCreatedOn(r.getCreatedOn());
p.setModifiedById(-1);
p.setModifiedOn(null);
p.setRevision(true);
p.setRevisionNumber(r.getRevision());
p.setTitle(r.getNewTitle());
p.setBody(r.getNewBody());
}
}
loadUsers(p);
}
return p;