KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > infoglue > cms > applications > managementtool > actions > ViewListPortletAction


1 /* ===============================================================================
2 *
3 * Part of the InfoGlue Content Management Platform (www.infoglue.org)
4 *
5 * ===============================================================================
6 *
7 * Copyright (C)
8 *
9 * This program is free software; you can redistribute it and/or modify it under
10 * the terms of the GNU General Public License version 2, as published by the
11 * Free Software Foundation. See the file LICENSE.html for more information.
12 *
13 * This program is distributed in the hope that it will be useful, but WITHOUT
14 * ANY WARRANTY, including the implied warranty of MERCHANTABILITY or FITNESS
15 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License along with
18 * this program; if not, write to the Free Software Foundation, Inc. / 59 Temple
19 * Place, Suite 330 / Boston, MA 02111-1307 / USA.
20 *
21 * ===============================================================================
22 */

23 package org.infoglue.cms.applications.managementtool.actions;
24
25 import java.io.InputStream JavaDoc;
26 import java.util.Hashtable JavaDoc;
27 import java.util.Iterator JavaDoc;
28 import java.util.Map JavaDoc;
29 import java.util.Vector JavaDoc;
30
31 import org.apache.pluto.om.entity.PortletApplicationEntity;
32 import org.apache.pluto.om.entity.PortletApplicationEntityList;
33 import org.apache.pluto.om.entity.PortletEntity;
34 import org.apache.pluto.portalImpl.services.portletentityregistry.PortletEntityRegistry;
35 import org.infoglue.cms.applications.common.actions.InfoGlueAbstractAction;
36 import org.infoglue.cms.controllers.kernel.impl.simple.PortletAssetController;
37 import org.infoglue.cms.entities.content.DigitalAsset;
38 import org.infoglue.cms.io.FileHelper;
39
40 /**
41  * @author jand
42  * @author mattias
43  */

44 public class ViewListPortletAction extends InfoGlueAbstractAction
45 {
46     private static final long serialVersionUID = 1L;
47
48     private Hashtable JavaDoc portlets = new Hashtable JavaDoc();
49     private String JavaDoc portletRegistry;
50
51     protected String JavaDoc doExecute() throws Exception JavaDoc
52     {
53         PortletApplicationEntityList pael = PortletEntityRegistry.getPortletApplicationEntityList();
54         
55         for(Iterator JavaDoc it = pael.iterator(); it.hasNext();) {
56             PortletApplicationEntity pae = (PortletApplicationEntity) it.next();
57             String JavaDoc app = pae.getId().toString();
58             
59             Vector JavaDoc list = new Vector JavaDoc();
60             for(Iterator JavaDoc it2 = pae.getPortletEntityList().iterator(); it2.hasNext();) {
61                 PortletEntity pe = (PortletEntity) it2.next();
62                 list.add(pe.getId().toString());
63             }
64             portlets.put(app, list);
65         }
66         
67         return "success";
68     }
69     
70     public String JavaDoc doSimple() throws Exception JavaDoc
71     {
72         DigitalAsset digitalAsset = PortletAssetController.getPortletAssetController().getPortletRegistryAsset();
73         InputStream JavaDoc is = digitalAsset.getAssetBlob();
74         
75         portletRegistry = FileHelper.getStreamAsString(is);
76             
77         return "successSimple";
78     }
79
80     
81     public Map JavaDoc getPortlets()
82     {
83         return this.portlets;
84     }
85
86     public String JavaDoc getPortletRegistry() {
87         return portletRegistry;
88     }
89     
90 }
91
Popular Tags