Search in sources :

Example 1 with RecentProjectRecord

use of edu.stanford.bmir.protege.web.server.project.RecentProjectRecord in project webprotege by protegeproject.

the class UserActivityManager method addRecentProject.

public void addRecentProject(@Nonnull UserId userId, @Nonnull ProjectId projectId, long timestamp) {
    if (userId.isGuest()) {
        return;
    }
    UserActivityRecord record = getByUserId(userId);
    List<RecentProjectRecord> recentProjects = record.getRecentProjects().stream().filter(recentProject -> !recentProject.getProjectId().equals(projectId)).sorted().collect(toList());
    recentProjects.add(0, new RecentProjectRecord(projectId, timestamp));
    UserActivityRecord replacement = new UserActivityRecord(record.getUserId(), record.getLastLogin(), record.getLastLogout(), recentProjects);
    save(replacement);
}
Also used : UserActivityRecord(edu.stanford.bmir.protege.web.server.user.UserActivityRecord) RecentProjectRecord(edu.stanford.bmir.protege.web.server.project.RecentProjectRecord)

Aggregations

RecentProjectRecord (edu.stanford.bmir.protege.web.server.project.RecentProjectRecord)1 UserActivityRecord (edu.stanford.bmir.protege.web.server.user.UserActivityRecord)1