Search in sources :

Example 11 with UserPropertiesV2

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

the class UserPropertiesMigrationImpl method getV2Properties.

private UserPropertiesV2 getV2Properties(UserPropertiesV1 v1) {
    UserPropertiesV2 v2 = new UserPropertiesV2();
    v2.setRememberPreferencesEnabled(v1.isRememberPreferencesEnabled());
    v2.setDefaultLocationLat(v1.getDefaultLocationLat());
    v2.setDefaultLocationLon(v1.getDefaultLocationLon());
    v2.setDefaultLocationName(v1.getDefaultLocationName());
    int index = 0;
    for (String stopId : v1.getBookmarkedStopIds()) {
        Bookmark bookmark = new Bookmark(index++, null, Arrays.asList(stopId), new RouteFilter());
        v2.getBookmarks().add(bookmark);
    }
    return v2;
}
Also used : Bookmark(org.onebusaway.users.model.properties.Bookmark) UserPropertiesV2(org.onebusaway.users.model.properties.UserPropertiesV2) RouteFilter(org.onebusaway.users.model.properties.RouteFilter)

Example 12 with UserPropertiesV2

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

the class UserPropertiesMigrationImpl method getV2PropertiesFromV3.

private UserPropertiesV2 getV2PropertiesFromV3(UserPropertiesV3 v3) {
    UserPropertiesV2 v2 = new UserPropertiesV2();
    v2.setRememberPreferencesEnabled(v3.isRememberPreferencesEnabled());
    v2.setDefaultLocationLat(v3.getDefaultLocationLat());
    v2.setDefaultLocationLon(v3.getDefaultLocationLon());
    v2.setDefaultLocationName(v3.getDefaultLocationName());
    v2.setBookmarks(v3.getBookmarks());
    v2.setMinApiRequestInterval(v3.getMinApiRequestInterval());
    v2.setReadSituationIdsWithReadTime(v3.getReadSituationIdsWithReadTime());
    return v2;
}
Also used : UserPropertiesV2(org.onebusaway.users.model.properties.UserPropertiesV2)

Example 13 with UserPropertiesV2

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

the class UserPropertiesServiceV2Impl method setRememberUserPreferencesEnabled.

@Override
public void setRememberUserPreferencesEnabled(User user, boolean rememberPreferencesEnabled) {
    UserPropertiesV2 properties = getProperties(user);
    properties.setRememberPreferencesEnabled(rememberPreferencesEnabled);
    if (!rememberPreferencesEnabled)
        properties.clear();
    _userDao.saveOrUpdateUser(user);
}
Also used : UserPropertiesV2(org.onebusaway.users.model.properties.UserPropertiesV2)

Example 14 with UserPropertiesV2

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

the class UserPropertiesServiceV2Impl method getProperties.

/**
 **
 * Private Methods
 ***
 */
private UserPropertiesV2 getProperties(User user) {
    UserProperties props = user.getProperties();
    UserPropertiesV2 v2 = _userPropertiesMigration.migrate(props, UserPropertiesV2.class);
    if (props != v2)
        user.setProperties(v2);
    return v2;
}
Also used : UserProperties(org.onebusaway.users.model.UserProperties) UserPropertiesV2(org.onebusaway.users.model.properties.UserPropertiesV2)

Example 15 with UserPropertiesV2

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

the class UserPropertiesServiceV2Impl method resetUser.

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

Aggregations

UserPropertiesV2 (org.onebusaway.users.model.properties.UserPropertiesV2)21 Bookmark (org.onebusaway.users.model.properties.Bookmark)9 Test (org.junit.Test)8 UserPropertiesV1 (org.onebusaway.users.model.UserPropertiesV1)4 RouteFilter (org.onebusaway.users.model.properties.RouteFilter)4 Date (java.util.Date)3 User (org.onebusaway.users.model.User)3 UserPropertiesV3 (org.onebusaway.users.model.properties.UserPropertiesV3)3 UserIndex (org.onebusaway.users.model.UserIndex)2 UserIndexKey (org.onebusaway.users.model.UserIndexKey)2 UserProperties (org.onebusaway.users.model.UserProperties)2 Calendar (java.util.Calendar)1 BookmarkBean (org.onebusaway.users.client.model.BookmarkBean)1 UserRole (org.onebusaway.users.model.UserRole)1 UserPropertiesV4 (org.onebusaway.users.model.properties.UserPropertiesV4)1