use of org.apereo.portal.portlet.om.IPortletDefinition in project uPortal by Jasig.
the class RequestAttributeServiceImpl method getExpectedUserAttributes.
/**
* Get the list of user attributes the portlet expects.
*
* @param request The current request.
* @param portletWindow The window to get the expected user attributes for.
* @return The List of expected user attributes for the portlet
*/
protected List<? extends UserAttribute> getExpectedUserAttributes(HttpServletRequest request, final IPortletWindow portletWindow) {
final IPortletEntity portletEntity = portletWindow.getPortletEntity();
final IPortletDefinition portletDefinition = portletEntity.getPortletDefinition();
final PortletApplicationDefinition portletApplicationDescriptor = this.portletDefinitionRegistry.getParentPortletApplicationDescriptor(portletDefinition.getPortletDefinitionId());
return portletApplicationDescriptor.getUserAttributes();
}
use of org.apereo.portal.portlet.om.IPortletDefinition in project uPortal by Jasig.
the class PortletCategoryRegistryImpl method getChildPortlets.
/* (non-Javadoc)
* @see org.apereo.portal.portlet.registry.IPortletCategoryRegistry#getChildChannels(org.apereo.portal.portlet.om.PortletCategory)
*/
@Override
public Set<IPortletDefinition> getChildPortlets(PortletCategory parent) {
String parentKey = String.valueOf(parent.getId());
IEntityGroup parentGroup = GroupService.findGroup(parentKey);
Set<IPortletDefinition> portletDefs = new HashSet<IPortletDefinition>();
for (IGroupMember gm : parentGroup.getChildren()) {
if (!gm.isGroup()) {
IPortletDefinition portletDefinition = portletDefinitionRegistry.getPortletDefinition(gm.getKey());
if (portletDefinition != null) {
portletDefs.add(portletDefinition);
} else {
// This isn't supposed to happen.
log.warn("Failed to obtain a portletDefinition for groupMember '" + gm.getUnderlyingEntityIdentifier() + "'; this circumstance probably means a portlet was deleted " + "in a way that didn't clean up details like categpry memberships " + "and permissions; all interfaces that delete portlets should go " + "through IPortletPublishingService.removePortletDefinition(); " + "memberships for this missing portlet will be removed.");
// Delete existing category memberships for this portlet
for (IEntityGroup group : gm.getParentGroups()) {
group.removeChild(gm);
group.update();
}
}
}
}
return portletDefs;
}
use of org.apereo.portal.portlet.om.IPortletDefinition in project uPortal by Jasig.
the class PortletDefinitionRegistryImpl method getParentPortletApplicationDescriptor.
/* (non-Javadoc)
* @see org.apereo.portal.portlet.registry.IPortletDefinitionRegistry#getParentPortletApplicationDescriptor(org.apereo.portal.portlet.om.IPortletDefinitionId)
*/
@Override
public PortletApplicationDefinition getParentPortletApplicationDescriptor(IPortletDefinitionId portletDefinitionId) {
final IPortletDefinition portletDefinition = this.getPortletDefinition(portletDefinitionId);
if (portletDefinition == null) {
return null;
}
final Tuple<String, String> portletDescriptorKeys = this.getPortletDescriptorKeys(portletDefinition);
final PortletRegistryService portletRegistryService = this.portalDriverContainerServices.getPortletRegistryService();
try {
return portletRegistryService.getPortletApplication(portletDescriptorKeys.first);
} catch (PortletContainerException e) {
this.logger.warn("No portlet application descriptor could be found likely not deployed. For portlet definition: " + portletDefinition, e);
return null;
}
}
use of org.apereo.portal.portlet.om.IPortletDefinition in project uPortal by Jasig.
the class PortletDefinitionAttributeSource method getAdditionalAttributes.
@Override
public final Iterator<Attribute> getAdditionalAttributes(HttpServletRequest request, HttpServletResponse response, StartElement event) {
final QName eventName = event.getName();
final String localEventName = eventName.getLocalPart();
// Only pay attention to channel events
if (!IUserLayoutManager.CHANNEL.equals(localEventName)) {
return null;
}
final Collection<Attribute> attributes = new LinkedList<Attribute>();
// Add the portlet's portlet name and either the webapp URL or framework flag to the list of
// attributes.
final Attribute fnameAttribute = event.getAttributeByName(PORTLET_FNAME_ATTR_NAME);
if (fnameAttribute != null) {
final String fname = fnameAttribute.getValue();
IPortletDefinition def = portletDefinitionDao.getPortletDefinitionByFname(fname);
if (def == null) {
this.logger.warn("Cannot get portlet definition attributes. No portlet definition found for fname: '" + fname + "'.");
} else {
IPortletDescriptorKey descriptorKey = def.getPortletDescriptorKey();
attributes.add(xmlEventFactory.createAttribute(PORTLET_NAME_ATTRIBUTE, descriptorKey.getPortletName()));
attributes.add(xmlEventFactory.createAttribute(PORTLET_LIFECYCLE_ATTRIBUTE, def.getLifecycleState().toString()));
if (descriptorKey.isFrameworkPortlet()) {
attributes.add(xmlEventFactory.createAttribute(FRAMEWORK_PORTLET_ATTRIBUTE, "true"));
} else {
attributes.add(xmlEventFactory.createAttribute(WEBAPP_NAME_ATTRIBUTE, descriptorKey.getWebAppName()));
}
}
}
return attributes.iterator();
}
use of org.apereo.portal.portlet.om.IPortletDefinition in project uPortal by Jasig.
the class RenderOnWebFlagSetPredicate method test.
@Override
public boolean test(final HttpServletRequest request) {
try {
final IPortletDefinition portletDefinition = utils.getPortletDefinitionFromServletRequest(request);
Iterator<IPortletPreference> iterator = portletDefinition.getPortletPreferences().iterator();
while (iterator.hasNext()) {
IPortletPreference cur = iterator.next();
if ("renderOnWeb".equalsIgnoreCase(cur.getName())) {
return cur.getValues() != null && cur.getValues().length == 1 && Boolean.parseBoolean(cur.getValues()[0]);
}
}
} catch (Exception e) {
logger.error("Failed to process renderOnWeb check for redirect during pipeline. Failing gracefully by returning false.", e);
}
return false;
}
Aggregations