public class HubUtils {
public static void initView(HubForm hubForm, WebUser user) throws Exception {
WebUserPreferences preferences = user.getWebPreferences();
HubView prefView = HubView.valueOf(preferences.getResourceBrowserViewMode());
String viewStr = hubForm.getView();
if (viewStr == null) {
hubForm.setView(prefView.name());
}
HubView view = HubView.valueOf(hubForm.getView().toUpperCase());
if (view != prefView) {
preferences.setResourceBrowserViewMode(view.name()); // Save new preference.
}
}