001/* 002 * (C) Copyright 2012 Nuxeo SA (http://nuxeo.com/) and contributors. 003 * 004 * All rights reserved. This program and the accompanying materials 005 * are made available under the terms of the GNU Lesser General Public License 006 * (LGPL) version 2.1 which accompanies this distribution, and is available at 007 * http://www.gnu.org/licenses/lgpl.html 008 * 009 * This library is distributed in the hope that it will be useful, 010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 012 * Lesser General Public License for more details. 013 * 014 * Contributors: 015 * Anahide Tchertchian 016 */ 017package org.nuxeo.ecm.styleguide; 018 019import static org.jboss.seam.ScopeType.APPLICATION; 020 021import java.io.IOException; 022import java.net.MalformedURLException; 023import java.net.URISyntaxException; 024import java.util.List; 025import java.util.Map; 026 027import javax.faces.context.FacesContext; 028 029import org.jboss.seam.annotations.Factory; 030import org.jboss.seam.annotations.Name; 031import org.jboss.seam.annotations.Scope; 032import org.nuxeo.ecm.styleguide.service.StyleGuideService; 033import org.nuxeo.ecm.styleguide.service.descriptors.IconDescriptor; 034import org.nuxeo.runtime.api.Framework; 035 036/** 037 * @since 5.7 038 */ 039@Name("styleGuideIconActions") 040@Scope(APPLICATION) 041public class StyleGuideIconActions { 042 043 @Factory("styleGuideIcons") 044 public Map<String, List<IconDescriptor>> getIcons() throws MalformedURLException, IOException, URISyntaxException, 045 Exception { 046 FacesContext ctx = FacesContext.getCurrentInstance(); 047 StyleGuideService service = Framework.getService(StyleGuideService.class); 048 Map<String, List<IconDescriptor>> res = service.getIconsByCat(ctx.getExternalContext(), "/icons"); 049 return res; 050 } 051 052}