use of org.apereo.portal.portlet.om.IPortletDefinition in project uPortal by Jasig.
the class JpaPortletDefinitionDao method deletePortletDefinition.
@Override
@PortalTransactional
public void deletePortletDefinition(IPortletDefinition definition) {
Validate.notNull(definition, "definition can not be null");
final IPortletDefinition persistentPortletDefinition;
final EntityManager entityManager = this.getEntityManager();
if (entityManager.contains(definition)) {
persistentPortletDefinition = definition;
} else {
persistentPortletDefinition = entityManager.merge(definition);
}
entityManager.remove(persistentPortletDefinition);
}
use of org.apereo.portal.portlet.om.IPortletDefinition in project uPortal by Jasig.
the class JpaPortletEntityDao method createPortletEntity.
@Override
@PortalTransactional
public IPortletEntity createPortletEntity(IPortletDefinitionId portletDefinitionId, String layoutNodeId, int userId) {
Validate.notNull(portletDefinitionId, "portletDefinitionId can not be null");
Validate.notEmpty(layoutNodeId, "layoutNodeId can not be null");
final IPortletDefinition portletDefinition = this.portletDefinitionDao.getPortletDefinition(portletDefinitionId);
if (portletDefinition == null) {
throw new DataRetrievalFailureException("No IPortletDefinition exists for IPortletDefinitionId='" + portletDefinitionId + "'");
}
IPortletEntity portletEntity = new PortletEntityImpl(portletDefinition, layoutNodeId, userId);
this.getEntityManager().persist(portletEntity);
return portletEntity;
}
use of org.apereo.portal.portlet.om.IPortletDefinition in project uPortal by Jasig.
the class PortletDelegationLocatorImpl method createRequestDispatcher.
/* (non-Javadoc)
* @see org.apereo.portal.api.portlet.PortletDelegationLocator#createRequestDispatcher(java.lang.String)
*/
@Override
public PortletDelegationDispatcher createRequestDispatcher(PortletRequest portletRequest, String fName) {
final IPortletDefinition portletDefinition = this.portletDefinitionRegistry.getPortletDefinitionByFname(fName);
final IPortletDefinitionId portletDefinitionId = portletDefinition.getPortletDefinitionId();
return this.createRequestDispatcher(portletRequest, portletDefinitionId);
}
use of org.apereo.portal.portlet.om.IPortletDefinition in project uPortal by Jasig.
the class MarketplaceService method featuredEntriesForUser.
@Override
public Set<MarketplaceEntry> featuredEntriesForUser(final IPerson user, final Set<PortletCategory> categories) {
Validate.notNull(user, "Cannot determine relevant featured portlets for null user.");
final Set<MarketplaceEntry> browseablePortlets = browseableMarketplaceEntriesFor(user, categories);
final Set<MarketplaceEntry> featuredPortlets = new HashSet<>();
for (final MarketplaceEntry entry : browseablePortlets) {
final IPortletDefinition portletDefinition = entry.getMarketplacePortletDefinition();
for (final PortletCategory category : this.portletCategoryRegistry.getParentCategories(portletDefinition)) {
if (FEATURED_CATEGORY_NAME.equalsIgnoreCase(category.getName())) {
featuredPortlets.add(entry);
}
}
}
return featuredPortlets;
}
use of org.apereo.portal.portlet.om.IPortletDefinition in project uPortal by Jasig.
the class ChannelListController method preparePortletCategoryBean.
private PortletCategoryBean preparePortletCategoryBean(WebRequest req, PortletCategory category, Set<IPortletDefinition> portletsNotYetCategorized, IPerson user, Locale locale) {
/* Prepare child categories. */
Set<PortletCategoryBean> subcategories = new HashSet<>();
for (PortletCategory childCategory : this.portletCategoryRegistry.getChildCategories(category)) {
PortletCategoryBean childBean = preparePortletCategoryBean(req, childCategory, portletsNotYetCategorized, user, locale);
subcategories.add(childBean);
}
// add the direct child channels for this category
Set<IPortletDefinition> portlets = portletCategoryRegistry.getChildPortlets(category);
EntityIdentifier ei = user.getEntityIdentifier();
IAuthorizationPrincipal ap = AuthorizationServiceFacade.instance().newPrincipal(ei.getKey(), ei.getType());
Set<PortletDefinitionBean> marketplacePortlets = new HashSet<>();
for (IPortletDefinition portlet : portlets) {
if (authorizationService.canPrincipalBrowse(ap, portlet)) {
PortletDefinitionBean pdb = preparePortletDefinitionBean(req, portlet, locale);
marketplacePortlets.add(pdb);
}
/*
* Remove the portlet from the uncategorized collection;
* note -- this approach will not prevent portlets from
* appearing in multiple categories (as appropriate).
*/
portletsNotYetCategorized.remove(portlet);
}
// construct a new portlet category bean for this category
PortletCategoryBean categoryBean = PortletCategoryBean.fromPortletCategory(category, subcategories, marketplacePortlets);
categoryBean.setName(messageSource.getMessage(category.getName(), new Object[] {}, locale));
return categoryBean;
}
Aggregations