KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > infoglue > cms > treeservice > ss > ManagementToolNodeSupplier


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
24 package org.infoglue.cms.treeservice.ss;
25
26 import java.util.ArrayList JavaDoc;
27 import java.util.Collection JavaDoc;
28
29 import org.infoglue.cms.exception.SystemException;
30
31 import com.frovi.ss.Tree.BaseNodeSupplier;
32
33 /**
34  * ContentNodeSupplier.java
35  * Created on 2002-sep-30
36  * @author Stefan Sik, ss@frovi.com
37  *
38  * Provides tree menu for the management tool
39  *
40  */

41 public class ManagementToolNodeSupplier extends BaseNodeSupplier
42 {
43
44     private boolean showLeafs = true;
45     
46     public ManagementToolNodeSupplier(Integer JavaDoc repositoryId) throws SystemException
47     {
48         if (repositoryId.intValue() == 0)
49             setRootNode(new ManagementNodeImpl(repositoryId,"root", "ViewManagementToolStartPage.action"));
50         else
51             setRootNode(new ManagementNodeImpl(repositoryId,"root", "ViewRepository.action?repositoryId=" + repositoryId));
52     }
53     
54     /**
55      * @see com.frovi.ss.Tree.BaseNodeSupplier#hasChildren()
56      */

57     public boolean hasChildren()
58     {
59         if (showLeafs)
60             return false;
61         else
62             return true;
63     }
64
65     /**
66      * @see com.frovi.ss.Tree.INodeSupplier#getChildContainerNodes(Integer)
67      */

68     public Collection JavaDoc getChildContainerNodes(Integer JavaDoc parentNode)
69     {
70         int cnt = 1;
71         ArrayList JavaDoc r = new ArrayList JavaDoc();
72         ManagementNodeImpl node;
73                 
74         if (parentNode.intValue() == 0)
75         {
76             r.add(new ManagementNodeImpl(cnt++, "Repositories", "ViewListRepository.action?title=Repositories"));
77             r.add(new ManagementNodeImpl(cnt++, "SystemUsers", "ViewListSystemUser.action?title=SystemUsers"));
78             r.add(new ManagementNodeImpl(cnt++, "Roles", "ViewListRole.action?title=Roles"));
79             r.add(new ManagementNodeImpl(cnt++, "Groups", "ViewListGroup.action?title=Groups"));
80             //r.add(new ManagementNodeImpl(cnt++, "ExtranetUsers", "ViewListExtranetUser.action?title=ExtranetUsers"));
81
//ManagementNodeImpl extranetRolesNode = new ManagementNodeImpl(cnt++, "ExtranetRoles", "ViewListExtranetRole.action?title=ExtranetRoles");
82
//extranetRolesNode.setChildren(true);
83
//extranetRolesNode.setContainer(true);
84
//extranetRolesNode.setId(new Integer(100 + cnt));
85
//r.add(extranetRolesNode);
86

87             r.add(new ManagementNodeImpl(cnt++, "Languages", "ViewListLanguage.action?title=Languages"));
88             //r.add(new ManagementNodeImpl(cnt++, "Functions", "ViewListFunction.action?title=Functions"));
89
r.add(new ManagementNodeImpl(cnt++, "InterceptionPoints", "ViewListInterceptionPoint.action?title=InterceptionPoints"));
90             r.add(new ManagementNodeImpl(cnt++, "Interceptors", "ViewListInterceptor.action?title=Interceptors"));
91             r.add(new ManagementNodeImpl(cnt++, "ServiceDefinitions", "ViewListServiceDefinition.action?title=ServiceDefinitions"));
92             r.add(new ManagementNodeImpl(cnt++, "AvailableServiceBindings", "ViewListAvailableServiceBinding.action?title=AvailableServiceBindings"));
93             r.add(new ManagementNodeImpl(cnt++, "SiteNodeTypeDefinitions", "ViewListSiteNodeTypeDefinition.action?title=SiteNodeTypeDefinitions"));
94             r.add(new ManagementNodeImpl(cnt++, "Categories", "CategoryManagement!list.action?title=ContentCategories"));
95             r.add(new ManagementNodeImpl(cnt++, "ContentTypeDefinitions", "ViewListContentTypeDefinition.action?title=ContentTypeDefinitions"));
96             //r.add(new ManagementNodeImpl(cnt++, "Workflows", "ViewListWorkflow.action?title=Workflows"));
97
//r.add(new ManagementNodeImpl(cnt++, "TransactionHistory", "ViewListTransactionHistory.action?title=TransactionHistory"));
98
r.add(new ManagementNodeImpl(cnt++, "Up2Date", "ViewListUp2Date.action?title=InfoGlue Up2Date"));
99             r.add(new ManagementNodeImpl(cnt++, "Validation", "InstallationValidator!input.action?title=Validation"));
100             r.add(new ManagementNodeImpl(cnt++, "Workflows", "ViewListWorkflowDefinition.action"));
101             r.add(new ManagementNodeImpl(cnt++, "Portlets", "ViewListPortlet.action"));
102             r.add(new ManagementNodeImpl(cnt++, "Redirects", "ViewListRedirect.action"));
103             r.add(new ManagementNodeImpl(cnt++, "Application settings", "ViewListServerNode.action"));
104             r.add(new ManagementNodeImpl(cnt++, "Message center", "ViewMessageCenter.action"));
105             r.add(new ManagementNodeImpl(cnt++, "Diagnostics and status", "ViewDiagnosticCenter.action"));
106         }
107         /*else if(parentNode.intValue() > 100 || parentNode.intValue() < 0)
108         {
109             if(parentNode.intValue() > 100)
110                 return getExtranetRoleChildren(null);
111             else
112                 return getExtranetRoleChildren(new Integer(-parentNode.intValue()));
113         }*/

114         else
115         {
116             //r.add(new ManagementNodeImpl(cnt++, "Permissions", "ViewPermission.action?repositoryId=" + parentNode +"&title=Permissions"));
117
r.add(new ManagementNodeImpl(cnt++, "Permissions", "ViewAccessRights.action?interceptionPointCategory=Repository&extraParameters=" + parentNode +"&colorScheme=ManagementTool&returnAddress=ViewRepositoryOverview.action?repositoryId=" + parentNode));
118             r.add(new ManagementNodeImpl(cnt++, "Languages", "ViewListRepositoryLanguage.action?repositoryId=" + parentNode + "&title=Languages"));
119         }
120         
121         return r;
122     }
123
124     /**
125      * @see com.frovi.ss.Tree.INodeSupplier#getChildLeafNodes(Integer)
126      */

127     public Collection JavaDoc getChildLeafNodes(Integer JavaDoc parentNode)
128     {
129         ArrayList JavaDoc ret = new ArrayList JavaDoc();
130         return ret;
131     }
132
133     /**
134      * Gets the children extranet roles
135      * @author Mattias Bogeblad
136      */

137 /*
138     private List getExtranetRoleChildren(Integer parentExtranetRoleId)
139     {
140         List children = new ArrayList();
141         
142         List childrenList = null;
143         try
144         {
145             childrenList = ExtranetRoleController.getController().getExtranetRoleChildren(parentExtranetRoleId);
146         }
147         catch (Exception e)
148         {
149             e.printStackTrace();
150         }
151     
152         if(childrenList != null)
153         {
154             Iterator i = childrenList.iterator();
155             while(i.hasNext())
156             {
157                 ExtranetRoleVO vo = (ExtranetRoleVO) i.next();
158                 //if (vo.getIsBranch().booleanValue())
159                 //{
160                     BaseNode node = new ManagementNodeImpl(vo.getId(), vo.getName(), "ViewListExtranetRole.action?title=ExtranetRoles&parentExtranetRoleId=" + vo.getId());
161                     node.setId(new Integer(-vo.getId().intValue()));
162                     node.setContainer(true);
163                 
164                     node.setChildren((vo.getChildCount().intValue() > 0)); //
165                 
166                     node.setTitle(vo.getName());
167                 
168                     children.add(node);
169                 //}
170                 //else
171                 //{
172                 // if (showLeafs)
173                 // {
174                 // BaseNode node = new ContentNodeImpl();
175                 // node.setId(vo.getId());
176                 // node.setContainer(false);
177                 // node.setTitle(vo.getName());
178                 //
179                 // cacheLeafs.add(node);
180                 // }
181                 //}
182             
183             }
184         }
185         
186         return children;
187     }
188     */

189 }
190
Popular Tags