KickJava   Java API By Example, From Geeks To Geeks.

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


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.actions.InfoGlueAbstractAction;
27 import org.infoglue.cms.controllers.kernel.impl.simple.ContentControllerProxy;
28 import org.infoglue.cms.entities.content.ContentVO;
29 import org.infoglue.cms.util.ConstraintExceptionBuffer;
30
31 /**
32  * This action represents the CreateContent Usecase.
33  */

34
35 public class MoveContentAction extends InfoGlueAbstractAction
36 {
37     private static final long serialVersionUID = 1L;
38     
39     private Integer JavaDoc contentId;
40     private Integer JavaDoc parentContentId;
41     private Integer JavaDoc newParentContentId;
42     private Integer JavaDoc changeTypeId;
43     private Integer JavaDoc repositoryId;
44     private ConstraintExceptionBuffer ceb;
45     private ContentVO contentVO;
46   
47   
48     public MoveContentAction()
49     {
50         this(new ContentVO());
51     }
52     
53     public MoveContentAction(ContentVO contentVO)
54     {
55         this.contentVO = contentVO;
56         this.ceb = new ConstraintExceptionBuffer();
57     }
58
59     public void setContentId(Integer JavaDoc contentId)
60     {
61         this.contentVO.setContentId(contentId);
62     }
63
64     public void setNewParentContentId(Integer JavaDoc newParentContentId)
65     {
66         this.newParentContentId = newParentContentId;
67     }
68
69     public void setParentContentId(Integer JavaDoc parentContentId)
70     {
71         this.parentContentId = parentContentId;
72     }
73
74     public void setChangeTypeId(Integer JavaDoc changeTypeId)
75     {
76         this.changeTypeId = changeTypeId;
77     }
78
79     public void setRepositoryId(Integer JavaDoc repositoryId)
80     {
81         this.repositoryId = repositoryId;
82     }
83     
84     public Integer JavaDoc getRepositoryId()
85     {
86         return this.repositoryId;
87     }
88
89     public Integer JavaDoc getParentContentId()
90     {
91         return this.parentContentId;
92     }
93         
94     public Integer JavaDoc getContentId()
95     {
96         return contentVO.getContentId();
97     }
98
99     public Integer JavaDoc getNewParentContentId()
100     {
101         return this.newParentContentId;
102     }
103     
104     public Integer JavaDoc getUnrefreshedContentId()
105     {
106         return this.newParentContentId;
107     }
108
109     public Integer JavaDoc getChangeTypeId()
110     {
111         return this.changeTypeId;
112     }
113       
114     public String JavaDoc doExecute() throws Exception JavaDoc
115     {
116         ceb.throwIfNotEmpty();
117         
118         //ContentController.moveContent(this.contentVO, this.newParentContentId);
119
ContentControllerProxy.getController().acMoveContent(this.getInfoGluePrincipal(), this.contentVO, this.newParentContentId);
120         
121         return "success";
122     }
123
124     
125     public String JavaDoc getErrorKey()
126     {
127         return "Content.parentContentId";
128     }
129     
130     public String JavaDoc getReturnAddress()
131     {
132         return "ViewContent.action?contentId=" + this.contentVO.getId() + "&repositoryId=" + this.repositoryId;
133     }
134 }
135
Popular Tags