use of org.onebusaway.users.model.properties.Bookmark in project onebusaway-application-modules by camsys.
the class UserPropertiesServiceV2Impl method updateStopBookmark.
@Override
public void updateStopBookmark(User user, int id, String name, List<String> stopIds, RouteFilter routeFilter) {
UserPropertiesV2 properties = getProperties(user);
if (!properties.isRememberPreferencesEnabled())
return;
List<Bookmark> bookmarks = properties.getBookmarks();
for (int index = 0; index < bookmarks.size(); index++) {
Bookmark bookmark = bookmarks.get(index);
if (bookmark.getId() == id) {
bookmark = new Bookmark(id, name, stopIds, routeFilter);
bookmarks.set(index, bookmark);
_userDao.saveOrUpdateUser(user);
return;
}
}
}
use of org.onebusaway.users.model.properties.Bookmark in project onebusaway-application-modules by camsys.
the class UserPropertiesServiceV2Impl method deleteStopBookmarks.
@Override
public void deleteStopBookmarks(User user, int id) {
UserPropertiesV2 properties = getProperties(user);
// either way.
if (!properties.isRememberPreferencesEnabled())
_log.warn("Attempt to delete bookmark for stateless user. They shouldn't have bookmarks in the first place. User=" + user.getId());
boolean modified = false;
for (Iterator<Bookmark> it = properties.getBookmarks().iterator(); it.hasNext(); ) {
Bookmark bookmark = it.next();
if (bookmark.getId() == id) {
it.remove();
modified = true;
}
}
if (modified)
_userDao.saveOrUpdateUser(user);
}
use of org.onebusaway.users.model.properties.Bookmark in project onebusaway-application-modules by camsys.
the class UserPropertiesServiceV3Impl method updateStopBookmark.
@Override
public void updateStopBookmark(User user, int id, String name, List<String> stopIds, RouteFilter routeFilter) {
UserPropertiesV3 properties = getProperties(user);
if (!properties.isRememberPreferencesEnabled())
return;
List<Bookmark> bookmarks = properties.getBookmarks();
for (int index = 0; index < bookmarks.size(); index++) {
Bookmark bookmark = bookmarks.get(index);
if (bookmark.getId() == id) {
bookmark = new Bookmark(id, name, stopIds, routeFilter);
bookmarks.set(index, bookmark);
_userDao.saveOrUpdateUser(user);
return;
}
}
}
use of org.onebusaway.users.model.properties.Bookmark in project onebusaway-application-modules by camsys.
the class UserPropertiesServiceV3Impl method deleteStopBookmarks.
@Override
public void deleteStopBookmarks(User user, int id) {
UserPropertiesV3 properties = getProperties(user);
// either way.
if (!properties.isRememberPreferencesEnabled())
_log.warn("Attempt to delete bookmark for stateless user. They shouldn't have bookmarks in the first place. User=" + user.getId());
boolean modified = false;
for (Iterator<Bookmark> it = properties.getBookmarks().iterator(); it.hasNext(); ) {
Bookmark bookmark = it.next();
if (bookmark.getId() == id) {
it.remove();
modified = true;
}
}
if (modified)
_userDao.saveOrUpdateUser(user);
}
use of org.onebusaway.users.model.properties.Bookmark in project onebusaway-application-modules by camsys.
the class UserPropertiesServiceV4Impl method deleteStopBookmarks.
@Override
public void deleteStopBookmarks(User user, int id) {
UserPropertiesV4 properties = getProperties(user);
if (!properties.isRememberPreferencesEnabled())
_log.warn("Attempt to delete bookmark for stateless user. They shouldn't have bookmarks in the first place. User=" + user.getId());
boolean modified = false;
for (Iterator<Bookmark> it = properties.getBookmarks().iterator(); it.hasNext(); ) {
Bookmark bookmark = it.next();
if (bookmark.getId() == id) {
it.remove();
modified = true;
}
}
if (modified)
_userDao.saveOrUpdateUser(user);
}
Aggregations