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;
}
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;
}
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);
}
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;
}
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());
}
Aggregations