final Resource subject = VirtuserHandler.getSubject();
final Statement personalHistoryStmt = subject
.getProperty(HISTORY.personalHistory);
Model result = JenaUtil.getExpandedResource(subject, 2);
if (personalHistoryStmt != null) {
Seq personalHistory = personalHistoryStmt.getSeq();
addTitles(personalHistory, result);
}
// it would be nice if this could be writte to the model
// before the next page is requested, respectively before the
// CookieSetResponse checks
// if a new cookie should be set
// TODO think if CookieSetResponse could/should check in the queue for
// actions affecting subject or if have a subject-used threadlocale
// would be useful
new Thread() {
public void run() {
Model model = subject.getModel();
model.enterCriticalSection(ModelLock.WRITE);
try {
Set allreadyInSeq = new HashSet();
Seq personalHistory = subject.getModel().createSeq();
allreadyInSeq.add(currentPage);
personalHistory.add(currentPage);
if (personalHistoryStmt != null) {
Seq oldPersonalHistory = personalHistoryStmt.getSeq();
for (int i = 1; i <= oldPersonalHistory.size(); i++) {
if (i == 7) {
break;
}
Resource current = oldPersonalHistory
.getResource(i);
if (!allreadyInSeq.contains(current)) {
personalHistory.add(current);
allreadyInSeq.add(current);
}
}
oldPersonalHistory.removeProperties();
}
StmtIterator phStmts = subject
.listProperties(HISTORY.personalHistory);
Set stmtsToRemove = new HashSet();
while (phStmts.hasNext()) {