Update session for the same user.

This commit is contained in:
Paulo Gustavo Veiga 2012-11-14 20:44:59 -03:00
parent 6560973237
commit 07c8a1d8c7
3 changed files with 8 additions and 1 deletions

View File

@ -41,4 +41,6 @@ public interface LockManager {
@NotNull @NotNull
LockInfo lock(@NotNull Mindmap mindmap, @NotNull User user) throws WiseMappingException; LockInfo lock(@NotNull Mindmap mindmap, @NotNull User user) throws WiseMappingException;
long generateSession();
} }

View File

@ -114,6 +114,11 @@ class LockManagerImpl implements LockManager {
return this.lock(mindmap, user, System.nanoTime()); return this.lock(mindmap, user, System.nanoTime());
} }
@Override
public long generateSession() {
return System.nanoTime();
}
@Override @Override
@NotNull @NotNull
public LockInfo lock(@NotNull Mindmap mindmap, @NotNull User user, long session) throws WiseMappingException { public LockInfo lock(@NotNull Mindmap mindmap, @NotNull User user, long session) throws WiseMappingException {

View File

@ -163,7 +163,7 @@ public class MindmapController {
} else { } else {
final LockInfo lock = lockManager.lock(mindmap, collaborator); final LockInfo lock = lockManager.lock(mindmap, collaborator);
model.addAttribute("lockTimestamp", lock.getTimestamp()); model.addAttribute("lockTimestamp", lock.getTimestamp());
model.addAttribute(LOCK_SESSION_ATTRIBUTE, lock.getSession()); model.addAttribute(LOCK_SESSION_ATTRIBUTE, lockManager.generateSession());
} }
model.addAttribute("lockInfo", lockManager.getLockInfo(mindmap)); model.addAttribute("lockInfo", lockManager.getLockInfo(mindmap));
} }