Search in sources :

Example 6 with BookmarkBean

use of org.onebusaway.users.client.model.BookmarkBean in project onebusaway-application-modules by camsys.

the class UserPropertiesServiceV4Impl method getUserAsBean.

@Override
public UserBean getUserAsBean(User user, UserBean bean) {
    UserPropertiesV4 properties = getProperties(user);
    bean.setRememberPreferencesEnabled(properties.isRememberPreferencesEnabled());
    bean.setHasDefaultLocation(properties.hasDefaultLocationLat() && properties.hasDefaultLocationLon());
    bean.setDefaultLocationName(properties.getDefaultLocationName());
    bean.setDefaultLocationLat(properties.getDefaultLocationLat());
    bean.setDefaultLocationLon(properties.getDefaultLocationLon());
    bean.setContactName(properties.getContactName());
    bean.setContactCompany(properties.getContactCompany());
    bean.setContactEmail(properties.getContactEmail());
    bean.setContactDetails(properties.getContactDetails());
    bean.setDisabled(properties.isDisabled());
    List<String> stopIds = _lastSelectedStopService.getLastSelectedStopsForUser(user.getId());
    bean.setLastSelectedStopIds(stopIds);
    for (Bookmark bookmark : properties.getBookmarks()) {
        BookmarkBean bookmarkBean = new BookmarkBean();
        bookmarkBean.setId(bookmark.getId());
        bookmarkBean.setName(bookmark.getName());
        bookmarkBean.setStopIds(bookmark.getStopIds());
        bookmarkBean.setRouteFilter(getRouteFilterAsBean(bookmark.getRouteFilter()));
        bean.addBookmark(bookmarkBean);
    }
    bean.setMinApiRequestInterval(properties.getMinApiRequestInterval());
    Map<String, Long> readServiceAlerts = properties.getReadSituationIdsWithReadTime();
    if (readServiceAlerts == null)
        readServiceAlerts = Collections.emptyMap();
    bean.setReadServiceAlerts(readServiceAlerts);
    return bean;
}
Also used : Bookmark(org.onebusaway.users.model.properties.Bookmark) BookmarkBean(org.onebusaway.users.client.model.BookmarkBean) UserPropertiesV4(org.onebusaway.users.model.properties.UserPropertiesV4)

Aggregations

BookmarkBean (org.onebusaway.users.client.model.BookmarkBean)6 Bookmark (org.onebusaway.users.model.properties.Bookmark)3 ArrayList (java.util.ArrayList)1 BookmarkWithStopsBean (org.onebusaway.presentation.model.BookmarkWithStopsBean)1 UserBean (org.onebusaway.users.client.model.UserBean)1 UserPropertiesV1 (org.onebusaway.users.model.UserPropertiesV1)1 RouteFilter (org.onebusaway.users.model.properties.RouteFilter)1 UserPropertiesV2 (org.onebusaway.users.model.properties.UserPropertiesV2)1 UserPropertiesV3 (org.onebusaway.users.model.properties.UserPropertiesV3)1 UserPropertiesV4 (org.onebusaway.users.model.properties.UserPropertiesV4)1