KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > infoglue > cms > controllers > kernel > impl > simple > PageTemplateController


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.controllers.kernel.impl.simple;
25
26 import java.util.ArrayList JavaDoc;
27 import java.util.HashMap JavaDoc;
28 import java.util.Iterator JavaDoc;
29 import java.util.List JavaDoc;
30
31 import org.infoglue.cms.entities.content.ContentVO;
32 import org.infoglue.cms.entities.content.ContentVersionVO;
33 import org.infoglue.cms.entities.kernel.BaseEntityVO;
34 import org.infoglue.cms.entities.structure.SiteNodeVO;
35 import org.infoglue.cms.security.InfoGluePrincipal;
36
37 public class PageTemplateController extends BaseController
38 {
39     
40     /**
41      * Factory method
42      */

43
44     public static PageTemplateController getController()
45     {
46         return new PageTemplateController();
47     }
48
49     /**
50      * This method returns the contents that are of contentTypeDefinition "PageTemplate"
51      */

52     
53     public List JavaDoc getPageTemplates(InfoGluePrincipal infoGluePrincipal, Integer JavaDoc languageId) throws Exception JavaDoc
54     {
55         List JavaDoc pageTemplates = getPageTemplates(infoGluePrincipal);
56         Iterator JavaDoc i = pageTemplates.iterator();
57         while(i.hasNext())
58         {
59             ContentVO contentVO = (ContentVO)i.next();
60             ContentVersionVO contentVersionVO = ContentVersionController.getContentVersionController().getLatestActiveContentVersionVO(contentVO.getId(), languageId);
61             if(contentVersionVO == null)
62             {
63                 i.remove();
64             }
65         }
66         
67         return pageTemplates;
68     }
69
70     /**
71      * This method returns the contents that are of contentTypeDefinition "PageTemplate"
72      */

73     
74     public List JavaDoc getPageTemplates(InfoGluePrincipal infoGluePrincipal) throws Exception JavaDoc
75     {
76         HashMap JavaDoc arguments = new HashMap JavaDoc();
77         arguments.put("method", "selectListOnContentTypeName");
78         
79         List JavaDoc argumentList = new ArrayList JavaDoc();
80         HashMap JavaDoc argument = new HashMap JavaDoc();
81         argument.put("contentTypeDefinitionName", "PageTemplate");
82         argumentList.add(argument);
83         arguments.put("arguments", argumentList);
84         
85         return ContentControllerProxy.getController().getACContentVOList(infoGluePrincipal, arguments);
86         //return ContentController.getContentController().getContentVOList(arguments);
87
}
88
89     
90     
91
92     
93     /**
94      * This is a method that gives the user back an newly initialized ValueObject for this entity that the controller
95      * is handling.
96      */

97
98     public BaseEntityVO getNewVO()
99     {
100         return new SiteNodeVO();
101     }
102
103
104 }
105  
106
Popular Tags