KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > infoglue > cms > applications > structuretool > actions > ViewListSiteNodeVersionAction


1 /* ===============================================================================
2  *
3  * Part of the InfoGlue SiteNode 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.structuretool.actions;
25
26 import java.util.ArrayList JavaDoc;
27 import java.util.List JavaDoc;
28
29 import org.apache.log4j.Logger;
30 import org.infoglue.cms.applications.common.actions.InfoGlueAbstractAction;
31 import org.infoglue.cms.controllers.kernel.impl.simple.AccessRightController;
32 import org.infoglue.cms.controllers.kernel.impl.simple.SiteNodeVersionController;
33 import org.infoglue.cms.controllers.kernel.impl.simple.SiteNodeVersionControllerProxy;
34 import org.infoglue.cms.entities.structure.SiteNodeVersionVO;
35 import org.infoglue.cms.exception.AccessConstraintException;
36 import org.infoglue.cms.util.AccessConstraintExceptionBuffer;
37
38 /**
39  *
40  * @author Mattias Bogeblad
41  *
42  * Present a list of siteNodeVersions under a given siteNode, recursing down in the hierarcy.
43  * Used to publish an entire hierarchy of pages.
44  *
45  */

46
47 public class ViewListSiteNodeVersionAction extends InfoGlueAbstractAction
48 {
49     private final static Logger logger = Logger.getLogger(ViewListSiteNodeVersionAction.class.getName());
50
51     private static final long serialVersionUID = 1L;
52
53     private List JavaDoc siteNodeVersionVOList = new ArrayList JavaDoc();
54     private List JavaDoc contentVersionVOList = new ArrayList JavaDoc();
55     private Integer JavaDoc siteNodeVersionId;
56     private Integer JavaDoc siteNodeId;
57     private Integer JavaDoc repositoryId;
58     private String JavaDoc returnAddress;
59
60
61     protected String JavaDoc doExecute() throws Exception JavaDoc
62     {
63         logger.info("siteNodeId:" + this.siteNodeId);
64         logger.info("siteNodeVersionId:" + this.siteNodeVersionId);
65         if(this.siteNodeVersionId == null)
66         {
67             SiteNodeVersionVO siteNodeVersionVO = SiteNodeVersionControllerProxy.getSiteNodeVersionControllerProxy().getACLatestActiveSiteNodeVersionVO(this.getInfoGluePrincipal(), siteNodeId);
68             if(siteNodeVersionVO != null)
69                 this.siteNodeVersionId = siteNodeVersionVO.getId();
70         }
71         
72         if(this.siteNodeVersionId != null)
73         {
74             AccessConstraintExceptionBuffer ceb = new AccessConstraintExceptionBuffer();
75         
76             Integer JavaDoc protectedSiteNodeVersionId = SiteNodeVersionControllerProxy.getSiteNodeVersionControllerProxy().getProtectedSiteNodeVersionId(siteNodeVersionId);
77             if(protectedSiteNodeVersionId != null && !AccessRightController.getController().getIsPrincipalAuthorized(this.getInfoGluePrincipal(), "SiteNodeVersion.SubmitToPublish", protectedSiteNodeVersionId.toString()))
78                 ceb.add(new AccessConstraintException("SiteNodeVersion.siteNodeVersionId", "1005"));
79         
80             ceb.throwIfNotEmpty();
81
82             SiteNodeVersionController.getController().getSiteNodeAndAffectedItemsRecursive(this.siteNodeId, SiteNodeVersionVO.WORKING_STATE, this.siteNodeVersionVOList, this.contentVersionVOList, false);
83         }
84
85         return "success";
86     }
87     
88
89     public List JavaDoc getSiteNodeVersions()
90     {
91         return this.siteNodeVersionVOList;
92     }
93     
94
95     public Integer JavaDoc getSiteNodeId()
96     {
97         return siteNodeId;
98     }
99
100     public void setSiteNodeId(Integer JavaDoc siteNodeId)
101     {
102         this.siteNodeId = siteNodeId;
103     }
104
105     public Integer JavaDoc getSiteNodeVersionId()
106     {
107         return siteNodeVersionId;
108     }
109
110     public void setSiteNodeVersionId(Integer JavaDoc siteNodeVersionId)
111     {
112         this.siteNodeVersionId = siteNodeVersionId;
113     }
114
115     public Integer JavaDoc getRepositoryId()
116     {
117         return repositoryId;
118     }
119     
120     public void setRepositoryId(Integer JavaDoc repositoryId)
121     {
122         this.repositoryId = repositoryId;
123     }
124     
125     public List JavaDoc getContentVersionVOList()
126     {
127         return contentVersionVOList;
128     }
129     
130     public List JavaDoc getSiteNodeVersionVOList()
131     {
132         return siteNodeVersionVOList;
133     }
134
135
136     public String JavaDoc getReturnAddress() {
137         return returnAddress;
138     }
139
140
141     public void setReturnAddress(String JavaDoc returnAddress) {
142         this.returnAddress = returnAddress;
143     }
144 }
145
Popular Tags