public static SitePage pageForToolConfig(SiteService siteservice, ToolConfiguration tc) { SitePage page = tc.getContainingPage(); if (page == null) { page = siteservice.findPage(tc.getPageId()); } return page; }
public static SitePage pageForToolConfig(SiteService siteservice, ToolConfiguration tc) { SitePage page = tc.getContainingPage(); if (page == null) { page = siteservice.findPage(tc.getPageId()); } return page; }
public String getPortalPageUrl(ToolConfiguration p) { SitePage sitePage = p.getContainingPage(); String page = getSiteHelper().lookupPageToAlias(p.getSiteId(), sitePage); if (page == null) { // Fall back to default of using the page Id. page = p.getPageId(); } StringBuilder portalPageUrl = new StringBuilder(); portalPageUrl.append("/site/"); portalPageUrl.append(p.getSiteId()); portalPageUrl.append("/page/"); portalPageUrl.append(page); return portalPageUrl.toString(); }
public String getPortalPageUrl(ToolConfiguration p) { SitePage sitePage = p.getContainingPage(); String page = getSiteHelper().lookupPageToAlias(p.getSiteId(), sitePage); if (page == null) { // Fall back to default of using the page Id. page = p.getPageId(); } StringBuilder portalPageUrl = new StringBuilder(); portalPageUrl.append("/site/"); portalPageUrl.append(p.getSiteId()); portalPageUrl.append("/page/"); portalPageUrl.append(page); return portalPageUrl.toString(); }
for (ToolConfiguration config: toolConfs) { if (config.getToolId().equals(TOOL_ID)) { SitePage p = config.getContainingPage(); if (pageTitle != null && pageTitle.equals(p.getTitle()) &&
for (ToolConfiguration config: toolConfs) { if (config.getToolId().equals(TOOL_ID)) { SitePage p = config.getContainingPage(); if (pageTitle != null && pageTitle.equals(p.getTitle()) &&
protected boolean updateSite(JobExecutionContext context, Site site) throws JobExecutionException { // The toolId we are wanting to add to the site. String toolId = context.getMergedJobDataMap().getString("tool"); if (toolId == null || toolId.isEmpty()) { throw new JobExecutionException("tool isn't set in job data."); } Tool tool = toolManager.getTool(toolId); if (tool == null) { throw new JobExecutionException("Failed to find tool with id: "+ toolId); } ToolConfiguration toolConfiguration = site.getToolForCommonId(toolId); if (toolConfiguration == null) { // Add the tool to the site. SitePage page = site.addPage(); page.setTitle(tool.getTitle()); page.addTool(tool); try { siteService.save(site); return true; } catch (IdUnusedException|PermissionException e) { log.warn("Failed to save site: "+ site.getId(), e); } } else { log.debug(String.format("Site: %s already has tool: %s on page: %s", site.getId(), toolId, toolConfiguration.getContainingPage().getId())); } return false; }
protected boolean updateSite(JobExecutionContext context, Site site) throws JobExecutionException { // The toolId we are wanting to add to the site. String toolId = context.getMergedJobDataMap().getString("tool"); if (toolId == null || toolId.isEmpty()) { throw new JobExecutionException("tool isn't set in job data."); } Tool tool = toolManager.getTool(toolId); if (tool == null) { throw new JobExecutionException("Failed to find tool with id: "+ toolId); } ToolConfiguration toolConfiguration = site.getToolForCommonId(toolId); if (toolConfiguration == null) { // Add the tool to the site. SitePage page = site.addPage(); page.setTitle(tool.getTitle()); page.addTool(tool); try { siteService.save(site); return true; } catch (IdUnusedException|PermissionException e) { log.warn("Failed to save site: "+ site.getId(), e); } } else { log.debug(String.format("Site: %s already has tool: %s on page: %s", site.getId(), toolId, toolConfiguration.getContainingPage().getId())); } return false; }
public void duplicatePermissions(ToolConfiguration fromTool, ToolConfiguration toTool) { getPermissionManager().duplicatePermissions(getIdManager().getId(fromTool.getId()), getIdManager().getId(toTool.getId()), toTool.getContainingPage().getContainingSite()); }
rv = new BaseToolConfiguration(this, rv, rv.getContainingPage(), true); return rv;
/** * sets up the default perms for a tool. Use's the tool id as the qualifier. * Assumes that if no perms exist for the tool, the perms should be set to the defaults. * * @param toolConfig */ public void toolSiteChanged(ToolConfiguration toolConfig) { Id toolId = getIdManager().getId(toolConfig.getId()); PermissionsEdit edit = new PermissionsEdit(); edit.setQualifier(toolId); edit.setName(getPermissionEditName()); edit.setSiteId(toolConfig.getContainingPage().getContainingSite().getId()); getPermissionManager().fillPermissions(edit); if (edit.getPermissions() == null || edit.getPermissions().size() == 0) { createDefaultPermissions(edit.getSiteId(), toolId); } }