use of org.apereo.portal.user.IUserInstance in project uPortal by Jasig.
the class PortletWindowRegistryImpl method storePortletWindow.
@Override
public void storePortletWindow(HttpServletRequest request, IPortletWindow portletWindow) {
if (isDisablePersistentWindowStates(request)) {
return;
}
final IUserInstance userInstance = this.userInstanceManager.getUserInstance(request);
final IPerson person = userInstance.getPerson();
if (person.isGuest()) {
//Never persist things for the guest user, just rely on in-memory storage
return;
}
final IStylesheetDescriptor themeStylesheetDescriptor = this.getThemeStylesheetDescriptor(request);
final WindowState windowState = portletWindow.getWindowState();
final IPortletEntity portletEntity = portletWindow.getPortletEntity();
final WindowState entityWindowState = portletEntity.getWindowState(themeStylesheetDescriptor);
//If the window and entity states are different
if (windowState != entityWindowState && !windowState.equals(entityWindowState)) {
final WindowState defaultWindowState = this.getDefaultWindowState(themeStylesheetDescriptor);
//If a window state is set and is one of the persistent states set it on the entity
if (!defaultWindowState.equals(windowState) && persistentWindowStates.contains(windowState)) {
portletEntity.setWindowState(themeStylesheetDescriptor, windowState);
} else //If not remove the state from the entity
if (entityWindowState != null) {
portletEntity.setWindowState(themeStylesheetDescriptor, null);
}
//Persist the modified entity
this.portletEntityRegistry.storePortletEntity(request, portletEntity);
}
}
use of org.apereo.portal.user.IUserInstance in project uPortal by Jasig.
the class BaseTransformerSource method getStylesheetDescriptor.
protected IStylesheetDescriptor getStylesheetDescriptor(HttpServletRequest request) {
final IUserInstance userInstance = this.userInstanceManager.getUserInstance(request);
final IUserPreferencesManager preferencesManager = userInstance.getPreferencesManager();
final long id = this.getStylesheetDescriptorId(preferencesManager);
return this.stylesheetDescriptorDao.getStylesheetDescriptor(id);
}
use of org.apereo.portal.user.IUserInstance in project uPortal by Jasig.
the class UserLayoutStoreComponent method getUserLayoutManager.
/** Get the {@link IUserLayoutManager} for the user making the request */
protected IUserLayoutManager getUserLayoutManager(HttpServletRequest request) {
final IUserInstance userInstance = this.userInstanceManager.getUserInstance(request);
final IUserPreferencesManager preferencesManager = userInstance.getPreferencesManager();
return preferencesManager.getUserLayoutManager();
}
use of org.apereo.portal.user.IUserInstance in project uPortal by Jasig.
the class MobileUrlNodeSyntaxHelper method getPortletForFolderName.
/* (non-Javadoc)
* @see org.apereo.portal.url.IUrlNodeSyntaxHelper#getPortletForFolderName(javax.servlet.http.HttpServletRequest, java.lang.String, java.lang.String)
*/
@Override
public IPortletWindowId getPortletForFolderName(HttpServletRequest request, String targetedLayoutNodeId, String folderName) {
final IUserInstance userInstance = this.userInstanceManager.getUserInstance(request);
final String fname;
final IPortletEntity portletEntity;
final int seperatorIndex = folderName.indexOf(PORTLET_PATH_ELEMENT_SEPERATOR);
if (seperatorIndex <= 0 || seperatorIndex + 1 == folderName.length()) {
fname = folderName;
portletEntity = this.portletEntityRegistry.getOrCreatePortletEntityByFname(request, userInstance, fname);
} else {
fname = folderName.substring(0, seperatorIndex);
final String subscribeId = folderName.substring(seperatorIndex + 1);
portletEntity = this.portletEntityRegistry.getOrCreatePortletEntityByFname(request, userInstance, fname, subscribeId);
}
if (portletEntity != null) {
final IPortletEntityId portletEntityId = portletEntity.getPortletEntityId();
final IPortletWindow portletWindow = this.portletWindowRegistry.getOrCreateDefaultPortletWindow(request, portletEntityId);
return portletWindow.getPortletWindowId();
} else {
this.logger.warn(targetedLayoutNodeId + " node for portlet of folder " + folderName + " can't be targeted by the request.");
return null;
}
}
use of org.apereo.portal.user.IUserInstance in project uPortal by Jasig.
the class PortalHttpServletRequestWrapper method getLocale.
/* (non-Javadoc)
* @see org.apereo.portal.url.AbstractHttpServletRequestWrapper#getLocale()
*/
@Override
public Locale getLocale() {
if (super.getSession(false) == null) {
return super.getLocale();
}
final IUserInstance userInstance = this.userInstanceManager.getUserInstance(this.getWrappedRequest());
final LocaleManager localeManager = userInstance.getLocaleManager();
final Locale[] locales = localeManager.getLocales();
return locales[0];
}
Aggregations