Search in sources :

Example 11 with UserPropertiesV4

use of org.onebusaway.users.model.properties.UserPropertiesV4 in project onebusaway-application-modules by camsys.

the class UserPropertiesServiceV4Impl method updateApiKeyContactInfo.

@Override
public void updateApiKeyContactInfo(User user, String contactName, String contactCompany, String contactEmail, String contactDetails) {
    UserPropertiesV4 properties = getProperties(user);
    properties.setContactName(contactName);
    properties.setContactCompany(contactCompany);
    properties.setContactEmail(contactEmail);
    properties.setContactDetails(contactDetails);
    user.setProperties(properties);
    _userDao.saveOrUpdateUser(user);
}
Also used : UserPropertiesV4(org.onebusaway.users.model.properties.UserPropertiesV4)

Example 12 with UserPropertiesV4

use of org.onebusaway.users.model.properties.UserPropertiesV4 in project onebusaway-application-modules by camsys.

the class UserPropertiesServiceV4Impl method disableUser.

@Override
public void disableUser(User user) {
    UserPropertiesV4 properties = getProperties(user);
    properties.setDisabled(true);
    user.setProperties(properties);
    _userDao.saveOrUpdateUser(user);
}
Also used : UserPropertiesV4(org.onebusaway.users.model.properties.UserPropertiesV4)

Example 13 with UserPropertiesV4

use of org.onebusaway.users.model.properties.UserPropertiesV4 in project onebusaway-application-modules by camsys.

the class UserPropertiesServiceV4Impl method resetUser.

@Override
public void resetUser(User user) {
    user.setProperties(new UserPropertiesV4());
    _userDao.saveOrUpdateUser(user);
    _lastSelectedStopService.clearLastSelectedStopForUser(user.getId());
}
Also used : UserPropertiesV4(org.onebusaway.users.model.properties.UserPropertiesV4)

Example 14 with UserPropertiesV4

use of org.onebusaway.users.model.properties.UserPropertiesV4 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)

Example 15 with UserPropertiesV4

use of org.onebusaway.users.model.properties.UserPropertiesV4 in project onebusaway-application-modules by camsys.

the class UserPropertiesServiceV4Impl method activateUser.

@Override
public void activateUser(User user) {
    UserPropertiesV4 properties = getProperties(user);
    properties.setDisabled(false);
    user.setProperties(properties);
    _userDao.saveOrUpdateUser(user);
}
Also used : UserPropertiesV4(org.onebusaway.users.model.properties.UserPropertiesV4)

Aggregations

UserPropertiesV4 (org.onebusaway.users.model.properties.UserPropertiesV4)16 Bookmark (org.onebusaway.users.model.properties.Bookmark)4 UserProperties (org.onebusaway.users.model.UserProperties)2 Date (java.util.Date)1 HashSet (java.util.HashSet)1 BookmarkBean (org.onebusaway.users.client.model.BookmarkBean)1 User (org.onebusaway.users.model.User)1 UserIndex (org.onebusaway.users.model.UserIndex)1 UserPropertiesV1 (org.onebusaway.users.model.UserPropertiesV1)1 UserRole (org.onebusaway.users.model.UserRole)1 UserPropertiesV2 (org.onebusaway.users.model.properties.UserPropertiesV2)1 UserPropertiesV3 (org.onebusaway.users.model.properties.UserPropertiesV3)1