KickJava   Java API By Example, From Geeks To Geeks.

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


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.List JavaDoc;
28
29 import org.infoglue.cms.applications.common.actions.InfoGlueAbstractAction;
30 import org.infoglue.cms.controllers.kernel.impl.simple.ContentStateController;
31
32
33 public class ChangeContentStateAction extends InfoGlueAbstractAction
34 {
35     private static final long serialVersionUID = 2617481307791186845L;
36
37     private Integer JavaDoc contentId;
38     private Integer JavaDoc contentVersionId;
39     private Integer JavaDoc stateId;
40     private Integer JavaDoc languageId;
41     private String JavaDoc versionComment;
42     private boolean overrideVersionModifyer = false;
43     private String JavaDoc attributeName;
44     
45     //private ContentVO contentVO = new ContentVO();
46
//private ContentVersionVO contentVersionVO = new ContentVersionVO();
47

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

53        
54     public String JavaDoc doExecute() throws Exception JavaDoc
55     {
56         //If the comment is not null we carry out the stateChange
57
if(getStateId().intValue() == 2 && getVersionComment() == null)
58         {
59             return "commentVersion";
60         }
61
62         List JavaDoc events = new ArrayList JavaDoc();
63         ContentStateController.changeState(getContentVersionId(), getStateId(), getVersionComment(), this.overrideVersionModifyer, this.getInfoGluePrincipal(), getContentId(), events);
64         
65         this.contentVersionId = null;
66         
67         return "success";
68     }
69
70     public String JavaDoc doStandalone() throws Exception JavaDoc
71     {
72         //If the comment is not null we carry out the stateChange
73
if(getStateId().intValue() == 2 && getVersionComment() == null)
74         {
75             return "commentVersionStandalone";
76         }
77
78         List JavaDoc events = new ArrayList JavaDoc();
79         ContentStateController.changeState(getContentVersionId(), getStateId(), getVersionComment(), this.overrideVersionModifyer, this.getInfoGluePrincipal(), getContentId(), events);
80
81         this.contentVersionId = null;
82         
83         return "successStandalone";
84     }
85         
86     public java.lang.Integer JavaDoc getContentVersionId()
87     {
88         return this.contentVersionId;
89     }
90     
91     public void setContentVersionId(java.lang.Integer JavaDoc contentVersionId)
92     {
93         this.contentVersionId = contentVersionId;
94     }
95         
96     public java.lang.Integer JavaDoc getContentId()
97     {
98         return this.contentId;
99     }
100         
101     public void setContentId(java.lang.Integer JavaDoc contentId)
102     {
103         this.contentId = contentId;
104     }
105
106     public java.lang.Integer JavaDoc getLanguageId()
107     {
108         return this.languageId;
109     }
110         
111     public void setLanguageId(java.lang.Integer JavaDoc languageId)
112     {
113         this.languageId = languageId;
114     }
115                     
116     public void setStateId(Integer JavaDoc stateId)
117     {
118         this.stateId = stateId;
119     }
120
121     public void setVersionComment(String JavaDoc versionComment)
122     {
123         this.versionComment = versionComment;
124     }
125     
126     public String JavaDoc getVersionComment()
127     {
128         return this.versionComment;
129     }
130     
131     public Integer JavaDoc getStateId()
132     {
133         return this.stateId;
134     }
135             
136     public String JavaDoc getAttributeName()
137     {
138         return this.attributeName;
139     }
140
141     public void setAttributeName(String JavaDoc attributeName)
142     {
143         this.attributeName = attributeName;
144     }
145
146     public boolean getOverrideVersionModifyer()
147     {
148         return overrideVersionModifyer;
149     }
150     
151     public void setOverrideVersionModifyer(boolean overrideVersionModifyer)
152     {
153         this.overrideVersionModifyer = overrideVersionModifyer;
154     }
155 }
156
Popular Tags