use of org.apereo.portal.PortalException in project uPortal by Jasig.
the class UserLayoutHelperImpl method resetStylesheetUserPreferencesForProfile.
private void resetStylesheetUserPreferencesForProfile(IPerson person, IUserProfile profile) {
try {
// Structure
final IStylesheetDescriptor sDescriptor = stylesheetDescriptorDao.getStylesheetDescriptor(profile.getStructureStylesheetId());
logger.debug("Obtained the following IStylesheetDescriptor for person [{}] and profile='{}': [{}]", person, profile.getProfileFname(), sDescriptor);
final IStylesheetUserPreferences sPreferences = stylesheetUserPreferencesDao.getStylesheetUserPreferences(sDescriptor, person, profile);
logger.debug("Obtained the following IStylesheetUserPreferences for descriptor [{}], person [{}], and profile='{}': [{}]", sDescriptor, person, profile.getProfileFname(), sPreferences);
if (sPreferences != null) {
stylesheetUserPreferencesDao.deleteStylesheetUserPreferences(sPreferences);
}
// Theme
final IStylesheetDescriptor tDescriptor = stylesheetDescriptorDao.getStylesheetDescriptor(profile.getThemeStylesheetId());
logger.debug("Obtained the following IStylesheetDescriptor for person [{}] and profile='{}': [{}]", person, profile.getProfileFname(), tDescriptor);
final IStylesheetUserPreferences tPreferences = stylesheetUserPreferencesDao.getStylesheetUserPreferences(tDescriptor, person, profile);
logger.debug("Obtained the following IStylesheetUserPreferences for descriptor [{}], person [{}], and profile='{}': [{}]", tDescriptor, person, profile.getProfileFname(), tPreferences);
if (tPreferences != null) {
stylesheetUserPreferencesDao.deleteStylesheetUserPreferences(tPreferences);
}
logger.info("resetStylesheetUserPreferencesForProfile complete for person [{}] and profile='{}'", person, profile.getProfileFname());
} catch (Exception e) {
logger.error("Error during resetStylesheetUserPreferencesForProfile for person [{}] and profile='{}'", person, profile.getProfileFname(), e);
throw new PortalException("Error during resetStylesheetUserPreferencesForProfile", e);
}
}
use of org.apereo.portal.PortalException in project uPortal by Jasig.
the class UserLayoutHelperImpl method resetUserLayoutForProfileByName.
private void resetUserLayoutForProfileByName(IPerson person, IUserProfile profile) {
try {
// Finally set the layout id to 0. This orphans the existing layout but it will be
// replaced by the default
// when the user logs in
profile.setLayoutId(0);
// persist the change
userLayoutStore.updateUserProfile(person, profile);
logger.info("resetUserLayoutForProfileByName complete for person [{}] and profile='{}'", person, profile.getProfileFname());
} catch (Exception e) {
logger.error("Error during resetUserLayoutForProfileByName for person [{}] and profile='{}'", person, profile.getProfileFname(), e);
throw new PortalException("Error during resetUserLayoutForProfileByName", e);
}
}
use of org.apereo.portal.PortalException in project uPortal by Jasig.
the class TransientUserLayoutManagerWrapper method getTransientNode.
/**
* Return an IUserLayoutChannelDescription by way of nodeId
*
* @param nodeId the node (subscribe) id to get the channel for.
* @return a <code>IUserLayoutNodeDescription</code>
*/
private IUserLayoutChannelDescription getTransientNode(String nodeId) throws PortalException {
// get fname from subscribe id
final String fname = getFname(nodeId);
if (null == fname || fname.equals("")) {
return null;
}
try {
// check cache first
IPortletDefinition chanDef = mChanMap.get(nodeId);
if (null == chanDef) {
chanDef = PortletDefinitionRegistryLocator.getPortletDefinitionRegistry().getPortletDefinitionByFname(fname);
mChanMap.put(nodeId, chanDef);
}
return createUserLayoutChannelDescription(nodeId, chanDef);
} catch (Exception e) {
throw new PortalException("Failed to obtain channel definition using fname: " + fname);
}
}
use of org.apereo.portal.PortalException in project uPortal by Jasig.
the class TransientUserLayoutManagerWrapper method getChannelDefinition.
/**
* Given a subscribe Id, return a ChannelDefinition.
*
* @param subId the subscribe id for the ChannelDefinition.
* @return a <code>ChannelDefinition</code>
*/
protected IPortletDefinition getChannelDefinition(String subId) throws PortalException {
IPortletDefinition chanDef = mChanMap.get(subId);
if (null == chanDef) {
String fname = getFname(subId);
if (log.isDebugEnabled())
log.debug("TransientUserLayoutManagerWrapper>>getChannelDefinition, " + "attempting to get a channel definition using functional name: " + fname);
try {
chanDef = PortletDefinitionRegistryLocator.getPortletDefinitionRegistry().getPortletDefinitionByFname(fname);
} catch (Exception e) {
throw new PortalException("Failed to get channel information " + "for subscribeId: " + subId);
}
mChanMap.put(subId, chanDef);
}
return chanDef;
}
use of org.apereo.portal.PortalException in project uPortal by Jasig.
the class TransientUserLayoutManagerWrapper method getSubscribeId.
/**
* Given an functional name, return its subscribe id.
*
* @param fname the functional name to lookup
* @return the fname's subscribe id.
*/
public String getSubscribeId(String fname) throws PortalException {
// see if a given subscribe id is already in the map
String subId = mFnameMap.get(fname);
if (subId == null) {
// see if a given subscribe id is already in the layout
subId = man.getSubscribeId(fname);
}
// assign a new transient channel id
if (subId == null) {
try {
IPortletDefinition chanDef = PortletDefinitionRegistryLocator.getPortletDefinitionRegistry().getPortletDefinitionByFname(fname);
if (chanDef != null) {
// assign a new id
subId = getNextSubscribeId();
mFnameMap.put(fname, subId);
mSubIdMap.put(subId, fname);
mChanMap.put(subId, chanDef);
}
} catch (Exception e) {
log.error("TransientUserLayoutManagerWrapper::getSubscribeId() : " + "an exception encountered while trying to obtain " + "ChannelDefinition for fname \"" + fname + "\" : " + e);
subId = null;
}
}
return subId;
}
Aggregations