Search in sources :

Example 1 with UserPropertiesV3

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

the class UserPropertiesMigrationImpl method getV3PropertiesFromV4.

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

Example 2 with UserPropertiesV3

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

the class UserPropertiesMigrationImpl method getV3Properties.

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

Example 3 with UserPropertiesV3

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

the class UserPropertiesServiceV3Impl method setDefaultLocation.

@Override
public void setDefaultLocation(User user, String locationName, double lat, double lon) {
    UserPropertiesV3 properties = getProperties(user);
    if (!properties.isRememberPreferencesEnabled())
        return;
    properties.setDefaultLocationName(locationName);
    properties.setDefaultLocationLat(lat);
    properties.setDefaultLocationLon(lon);
    _userDao.saveOrUpdateUser(user);
}
Also used : UserPropertiesV3(org.onebusaway.users.model.properties.UserPropertiesV3)

Example 4 with UserPropertiesV3

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

the class UserPropertiesServiceV3Impl method getProperties.

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

Example 5 with UserPropertiesV3

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

the class UserPropertiesServiceV3Impl method authorizeApi.

@Override
public void authorizeApi(User user, long minApiRequestInterval) {
    UserPropertiesV3 properties = getProperties(user);
    properties.setMinApiRequestInterval(minApiRequestInterval);
    _userDao.saveOrUpdateUser(user);
}
Also used : UserPropertiesV3(org.onebusaway.users.model.properties.UserPropertiesV3)

Aggregations

UserPropertiesV3 (org.onebusaway.users.model.properties.UserPropertiesV3)17 Bookmark (org.onebusaway.users.model.properties.Bookmark)6 UserPropertiesV2 (org.onebusaway.users.model.properties.UserPropertiesV2)3 Test (org.junit.Test)2 UserProperties (org.onebusaway.users.model.UserProperties)2 RouteFilter (org.onebusaway.users.model.properties.RouteFilter)2 IOException (java.io.IOException)1 ArrayList (java.util.ArrayList)1 GET (javax.ws.rs.GET)1 Path (javax.ws.rs.Path)1 Produces (javax.ws.rs.Produces)1 WebApplicationException (javax.ws.rs.WebApplicationException)1 Response (javax.ws.rs.core.Response)1 JsonGenerationException (org.codehaus.jackson.JsonGenerationException)1 JsonMappingException (org.codehaus.jackson.map.JsonMappingException)1 BookmarkBean (org.onebusaway.users.client.model.BookmarkBean)1 UserIndex (org.onebusaway.users.model.UserIndex)1 UserIndexKey (org.onebusaway.users.model.UserIndexKey)1 UserPropertiesV1 (org.onebusaway.users.model.UserPropertiesV1)1 UserPropertiesV4 (org.onebusaway.users.model.properties.UserPropertiesV4)1