@Override public Collection<PortalPage> getFavouritePortalPages(final ApplicationUser user) { final Collection<Long> ids = getFavouriteIds(user); final List<PortalPage> results = new ArrayList<PortalPage>(ids.size()); for (final Long id : ids) { final PortalPage portalPage = portalPageManager.getPortalPage(user, id); if (portalPage != null) { results.add(portalPage); } } return results; }
public PortalPage getPortalPage(final JiraServiceContext context, final Long portalPageId) { Assertions.notNull("context", context); Assertions.notNull("portalPageId", portalPageId); final PortalPage portalPage = portalPageManager.getPortalPage(context.getLoggedInApplicationUser(), portalPageId); if (portalPage == null) { context.getErrorCollection().addErrorMessage(context.getI18nBean().getText("admin.errors.portalpages.no.access")); } return portalPage; }
public boolean validateForGetPortalPage(final JiraServiceContext context, final Long portalPageId) { Assertions.notNull("context", context); Assertions.notNull("portalPageId", portalPageId); final PortalPage portalPage = portalPageManager.getPortalPage(context.getLoggedInApplicationUser(), portalPageId); if (portalPage == null) { context.getErrorCollection().addErrorMessage(context.getI18nBean().getText("admin.errors.portalpages.no.access")); return false; } return true; }
private PortalPage checkForClone(final JiraServiceContext serviceCtx, final PortalPage portalPage, final Long clonePortalPageId) { final boolean ok = validateForCreate(serviceCtx, portalPage); PortalPage clonePortalPage = null; if (ok && (serviceCtx.getLoggedInApplicationUser() != null)) { final PortalPage tempClonePortalPage = portalPageManager.getPortalPage(serviceCtx.getLoggedInApplicationUser(), clonePortalPageId); if (tempClonePortalPage == null) { serviceCtx.getErrorCollection().addErrorMessage(serviceCtx.getI18nBean().getText("admin.errors.portalpages.clone.does.not.exist")); } else { clonePortalPage = tempClonePortalPage; } } return clonePortalPage; }
public void deletePortalPage(final JiraServiceContext serviceCtx, final Long portalPageId) { Assertions.notNull("serviceCtx", serviceCtx); Assertions.notNull("portalPageId", portalPageId); final ApplicationUser user = serviceCtx.getLoggedInApplicationUser(); validateForDelete(serviceCtx, portalPageId); if (!serviceCtx.getErrorCollection().hasAnyErrors()) { final PortalPage portalPage = portalPageManager.getPortalPage(user, portalPageId); if (portalPage != null) { deletePortalPageImpl(portalPage); } else { serviceCtx.getErrorCollection().addErrorMessage(serviceCtx.getI18nBean().getText("admin.errors.portalpages.nonexistent")); } } }