Collection<PortletDefinition> filteredPortletDefinitions = filterPortletDefinitionsBySecurityAccess(searchedPortletDefinitions, JetspeedActions.MASK_VIEW, servletRequest);
pdBeans.setTotalSize(filteredPortletDefinitions.size());
for (PortletDefinition pd : (Collection<PortletDefinition>) PaginationUtils.subCollection(filteredPortletDefinitions, beginIndex, maxResults))
{
pdBeanList.add(new PortletDefinitionBean(pd));
}
}
else
{
if (StringUtils.isBlank(applicationName) && StringUtils.isBlank(definitionName))
{
Collection<PortletDefinition> pds = filterPortletDefinitionsBySecurityAccess(portletRegistry.getAllDefinitions(), JetspeedActions.MASK_VIEW, servletRequest);
pdBeans.setTotalSize(pds.size());
for (PortletDefinition pd : (Collection<PortletDefinition>) PaginationUtils.subCollection(pds, beginIndex, maxResults))
{
pdBeanList.add(new PortletDefinitionBean(pd));
}
}
else
{
PortletApplication pa = portletRegistry.getPortletApplication(applicationName, true);
if (pa != null)
{
if (StringUtils.isBlank(definitionName))
{
Collection<PortletDefinition> pds = filterPortletDefinitionsBySecurityAccess(pa.getPortlets(), JetspeedActions.MASK_VIEW, servletRequest);
pdBeans.setTotalSize(pds.size());
for (PortletDefinition pd : (List<PortletDefinition>) PaginationUtils.subCollection(pds, beginIndex, maxResults))
{
pdBeanList.add(new PortletDefinitionBean(pd));
}
}
else
{
PortletDefinition pd = pa.getPortlet(definitionName);
if (pd == null)
{
pd = pa.getClone(definitionName);
}
if (pd != null && securityAccessController.checkPortletAccess(pd, JetspeedActions.MASK_VIEW))
{
pdBeanList.add(new PortletDefinitionBean(pd));
pdBeans.setTotalSize(1);
}
}
}
}