/** * @inheritDoc */ public Collection getTools(String[] toolIds) { List rv = new Vector(); if ((toolIds == null) || (toolIds.length == 0)) return rv; for (Iterator iTools = getTools().iterator(); iTools.hasNext();) { ToolConfiguration tc = (ToolConfiguration) iTools.next(); Tool tool = tc.getTool(); if ((tool != null) && (tool.getId() != null)) { for (int i = 0; i < toolIds.length; i++) { if (tool.getId().equals(toolIds[i])) { rv.add(tc); } } } } return rv; }
m_tool = other.getTool(); m_title = other.getTitle(); m_layoutHints = other.getLayoutHints();
/** * Look through the pages in a site and find the page that corresponds to a tool. * * @param <code>site</code> * The site * @param <code>toolId</code> * The placement / tool ID * @return The page if found otherwise null. */ public static SitePage getPageForTool(Site site, String toolId) { if ( site == null || toolId == null ) return null; List pages = site.getOrderedPages(); for (Iterator i = pages.iterator(); i.hasNext();) { SitePage p = (SitePage) i.next(); List<ToolConfiguration> pTools = p.getTools(); Iterator<ToolConfiguration> toolz = pTools.iterator(); while(toolz.hasNext()){ ToolConfiguration tc = toolz.next(); Tool to = tc.getTool(); if ( toolId.equals(tc.getId()) ) { return p; } } } return null; }
List pageToolList = page.getTools(); try { toolId = ((ToolConfiguration) pageToolList.get(0)).getTool().getId(); } catch (Exception ee) { log.warn(siteId + " contains a page (" + page.getTitle() + ") without a valid tool registration");
List pageToolList = page.getTools(); try { toolId = ((ToolConfiguration) pageToolList.get(0)).getTool().getId(); } catch (Exception ee) { log.warn(siteId + " contains a page (" + page.getTitle() + ") without a valid tool registration");
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws java.io.IOException, javax.servlet.ServletException { // rsf does this: //Tool tool = (Tool) request.getAttribute("sakai.tool"); //placement = (Placement) request.getAttribute("sakai.tool.placement"); // we need to set it. String placementId = request.getParameter("placementId"); ToolConfiguration placement = SiteService.findTool(placementId); String siteId = placement.getSiteId(); // there was some concern whether it's safe to set up a placement to which the // user doesn't have access. So check whether the user is in the associated site // the user ID comes from requestfilter, which is run before this try { Site site = SiteService.getSite(siteId); String currentUserId = UserDirectoryService.getCurrentUser().getId(); Tool tool = placement.getTool(); if (site != null && site.getUserRole(currentUserId) != null) { request.setAttribute("sakai.tool", tool); request.setAttribute("sakai.tool.placement", placement); } } catch (Exception impossible) { } chain.doFilter(request, response); }
Tool tool = tc.getTool(); if (tool != null && tool.getId().equals(toolRegistrationId)) {