KickJava   Java API By Example, From Geeks To Geeks.

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


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.structuretool.actions;
25
26 import java.util.ArrayList JavaDoc;
27 import java.util.List JavaDoc;
28
29 import org.infoglue.cms.applications.common.actions.InfoGlueAbstractAction;
30 import org.infoglue.cms.controllers.kernel.impl.simple.SiteNodeStateController;
31
32
33 public class ChangeSiteNodeStateAction extends InfoGlueAbstractAction
34 {
35     private Integer JavaDoc siteNodeId;
36     private Integer JavaDoc siteNodeVersionId;
37     private Integer JavaDoc stateId;
38     private String JavaDoc versionComment;
39     private boolean overrideVersionModifyer = false;
40     
41     //private SiteNodeVO siteNodeVO = new SiteNodeVO();
42
//private SiteNodeVersionVO siteNodeVersionVO = new SiteNodeVersionVO();
43

44     /**
45      * This method gets called when calling this action.
46      * If the stateId is 2 which equals that the user tries to prepublish the page. If so we
47      * ask the user for a comment as this is to be regarded as a new version.
48      */

49        
50     public String JavaDoc doExecute() throws Exception JavaDoc
51     {
52         //If the comment is not null we carry out the stateChange
53
if(getStateId().intValue() == 2 && getVersionComment() == null)
54         {
55             return "commentVersion";
56         }
57
58         List JavaDoc events = new ArrayList JavaDoc();
59         SiteNodeStateController.getController().changeState(getSiteNodeVersionId(), getStateId(), getVersionComment(), this.overrideVersionModifyer, this.getInfoGluePrincipal(), getSiteNodeId(), events);
60         
61         return "success";
62     }
63         
64     public java.lang.Integer JavaDoc getSiteNodeVersionId()
65     {
66         return this.siteNodeVersionId;
67     }
68     
69     public void setSiteNodeVersionId(java.lang.Integer JavaDoc siteNodeVersionId)
70     {
71         this.siteNodeVersionId = siteNodeVersionId;
72     }
73         
74     public java.lang.Integer JavaDoc getSiteNodeId()
75     {
76         return this.siteNodeId;
77     }
78         
79     public void setSiteNodeId(java.lang.Integer JavaDoc siteNodeId)
80     {
81         this.siteNodeId = siteNodeId;
82     }
83                     
84     public void setStateId(Integer JavaDoc stateId)
85     {
86         this.stateId = stateId;
87     }
88
89     public void setVersionComment(String JavaDoc versionComment)
90     {
91         this.versionComment = versionComment;
92     }
93     
94     public String JavaDoc getVersionComment()
95     {
96         return this.versionComment;
97     }
98     
99     public Integer JavaDoc getStateId()
100     {
101         return this.stateId;
102     }
103             
104     public boolean getOverrideVersionModifyer()
105     {
106         return overrideVersionModifyer;
107     }
108     
109     public void setOverrideVersionModifyer(boolean overrideVersionModifyer)
110     {
111         this.overrideVersionModifyer = overrideVersionModifyer;
112     }
113 }
114
Popular Tags