KickJava   Java API By Example, From Geeks To Geeks.

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


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 org.infoglue.cms.applications.common.VisualFormatter;
27 import org.infoglue.cms.controllers.kernel.impl.simple.ContentController;
28 import org.infoglue.cms.controllers.kernel.impl.simple.ContentControllerProxy;
29 import org.infoglue.cms.entities.content.ContentVO;
30 import org.infoglue.cms.util.ConstraintExceptionBuffer;
31
32
33 /**
34   * This is the action-class for UpdateContent
35   *
36   * @author Mattias Bogeblad
37   */

38 public class UpdateContentAction extends ViewContentAction //WebworkAbstractAction
39
{
40     private static final long serialVersionUID = 1L;
41     
42     private ContentVO contentVO = null;
43     private Integer JavaDoc repositoryId;
44     private Integer JavaDoc contentTypeDefinitionId;
45     
46     private ConstraintExceptionBuffer ceb;
47     
48     public UpdateContentAction()
49     {
50         this(new ContentVO());
51     }
52     
53     public UpdateContentAction(ContentVO contentVO)
54     {
55         this.contentVO = contentVO;
56         this.ceb = new ConstraintExceptionBuffer();
57     }
58     
59     public String JavaDoc doExecute() throws Exception JavaDoc
60     {
61         super.initialize(getContentId());
62         ContentVO oldContentVO = ContentController.getContentController().getContentVOWithId(getContentId());
63         
64         this.contentVO.setCreatorName(this.getInfoGluePrincipal().getName());
65         //this.contentVO.setCreatorName(oldContentVO.getCreatorName());
66
this.contentVO.setIsBranch(oldContentVO.getIsBranch());
67         
68         ceb = this.contentVO.validate();
69         
70         ceb.throwIfNotEmpty();
71         
72         ContentControllerProxy.getController().acUpdate(this.getInfoGluePrincipal(), this.contentVO, this.contentTypeDefinitionId);
73         //ContentController.update(this.contentVO);
74

75         return "success";
76     }
77
78     public String JavaDoc doStandalone() throws Exception JavaDoc
79     {
80         doExecute();
81                         
82         return "successStandalone";
83     }
84         
85     public String JavaDoc doSaveAndExit() throws Exception JavaDoc
86     {
87         doExecute();
88                         
89         return "saveAndExit";
90     }
91
92     public void setContentId(Integer JavaDoc contentId)
93     {
94         this.contentVO.setContentId(contentId);
95     }
96
97     public java.lang.Integer JavaDoc getContentId()
98     {
99         return this.contentVO.getContentId();
100     }
101         
102     public java.lang.String JavaDoc getName()
103     {
104         return this.contentVO.getName();
105     }
106
107     public Boolean JavaDoc getIsBranch()
108     {
109         return this.contentVO.getIsBranch();
110     }
111         
112     public void setName(java.lang.String JavaDoc name)
113     {
114         this.contentVO.setName(name);
115     }
116
117     public Integer JavaDoc getIsProtected()
118     {
119         return this.contentVO.getIsProtected();
120     }
121         
122     public void setIsProtected(java.lang.Integer JavaDoc isProtected)
123     {
124         this.contentVO.setIsProtected(isProtected);
125     }
126
127     public void setPublishDateTime(String JavaDoc publishDateTime)
128     {
129         this.contentVO.setPublishDateTime(new VisualFormatter().parseDate(publishDateTime, "yyyy-MM-dd HH:mm"));
130     }
131
132     public void setExpireDateTime(String JavaDoc expireDateTime)
133     {
134         this.contentVO.setExpireDateTime(new VisualFormatter().parseDate(expireDateTime, "yyyy-MM-dd HH:mm"));
135     }
136
137     public void setIsBranch(Boolean JavaDoc isBranch)
138     {
139         this.contentVO.setIsBranch(isBranch);
140     }
141
142     public void setContentTypeDefinitionId(Integer JavaDoc contentTypeDefinitionId)
143     {
144         this.contentTypeDefinitionId = contentTypeDefinitionId;
145     }
146
147     public void setRepositoryId(Integer JavaDoc repositoryId)
148     {
149         this.repositoryId = repositoryId;
150     }
151
152     public Integer JavaDoc getRepositoryId()
153     {
154         return this.repositoryId;
155     }
156
157 }
158
Popular Tags