KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > infoglue > cms > applications > contenttool > actions > ViewListContentVersionAction


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.applications.contenttool.actions;
25
26 import java.util.ArrayList JavaDoc;
27 import java.util.HashSet JavaDoc;
28 import java.util.List JavaDoc;
29 import java.util.Set JavaDoc;
30
31 import org.infoglue.cms.applications.common.actions.InfoGlueAbstractAction;
32 import org.infoglue.cms.controllers.kernel.impl.simple.AccessRightController;
33 import org.infoglue.cms.controllers.kernel.impl.simple.ContentController;
34 import org.infoglue.cms.controllers.kernel.impl.simple.ContentControllerProxy;
35 import org.infoglue.cms.controllers.kernel.impl.simple.ContentVersionController;
36 import org.infoglue.cms.entities.content.ContentVO;
37 import org.infoglue.cms.entities.content.ContentVersionVO;
38 import org.infoglue.cms.exception.AccessConstraintException;
39 import org.infoglue.cms.util.AccessConstraintExceptionBuffer;
40
41 /**
42  *
43  * @author Stefan Sik
44  *
45  * Present a list of contentVersion under a given content, recursing down in the hierarcy
46  *
47  */

48
49 public class ViewListContentVersionAction extends InfoGlueAbstractAction
50 {
51     private static final long serialVersionUID = -1767277488570719994L;
52
53     private List JavaDoc contentVersionVOList = new ArrayList JavaDoc();
54     private List JavaDoc siteNodeVersionVOList = new ArrayList JavaDoc();
55     private Integer JavaDoc contentId;
56     private Integer JavaDoc repositoryId;
57     private String JavaDoc returnAddress = null;
58
59     protected String JavaDoc doExecute() throws Exception JavaDoc
60     {
61         if(this.contentId != null)
62         {
63             ContentVO contentVO = ContentController.getContentController().getContentVOWithId(this.contentId);
64             this.repositoryId = contentVO.getRepositoryId();
65             
66             AccessConstraintExceptionBuffer ceb = new AccessConstraintExceptionBuffer();
67         
68             Integer JavaDoc protectedContentId = ContentControllerProxy.getController().getProtectedContentId(contentId);
69             if(protectedContentId != null && !AccessRightController.getController().getIsPrincipalAuthorized(this.getInfoGluePrincipal(), "Content.SubmitToPublish", protectedContentId.toString()))
70                 ceb.add(new AccessConstraintException("Content.contentId", "1005"));
71             
72             ceb.throwIfNotEmpty();
73
74             ContentVersionController.getContentVersionController().getContentAndAffectedItemsRecursive(this.contentId, ContentVersionVO.WORKING_STATE, this.siteNodeVersionVOList, this.contentVersionVOList, true, true);
75
76             Set JavaDoc contentVersionVOListSet = new HashSet JavaDoc();
77             contentVersionVOListSet.addAll(contentVersionVOList);
78             contentVersionVOList.clear();
79             contentVersionVOList.addAll(contentVersionVOListSet);
80
81             Set JavaDoc siteNodeVersionVOListSet = new HashSet JavaDoc();
82             siteNodeVersionVOListSet.addAll(siteNodeVersionVOList);
83             siteNodeVersionVOList.clear();
84             siteNodeVersionVOList.addAll(siteNodeVersionVOListSet);
85
86             //contentVersionVOList = ContentVersionController.getContentVersionController().getContentVersionVOWithParentRecursiveAndRelated(contentId, ContentVersionVO.WORKING_STATE);
87
}
88
89         return "success";
90     }
91         
92     /**
93      * @return
94      */

95     public Integer JavaDoc getContentId()
96     {
97         return contentId;
98     }
99
100     /**
101      * @param integer
102      */

103     public void setContentId(Integer JavaDoc integer)
104     {
105         contentId = integer;
106     }
107
108     public Integer JavaDoc getRepositoryId()
109     {
110         return repositoryId;
111     }
112     
113     public List JavaDoc getContentVersionVOList()
114     {
115         return contentVersionVOList;
116     }
117     
118     public List JavaDoc getSiteNodeVersionVOList()
119     {
120         return siteNodeVersionVOList;
121     }
122
123     public String JavaDoc getReturnAddress()
124     {
125         return returnAddress;
126     }
127
128     public void setReturnAddress(String JavaDoc returnAddress)
129     {
130         this.returnAddress = returnAddress;
131     }
132 }
133
Popular Tags