KickJava   Java API By Example, From Geeks To Geeks.

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


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.List JavaDoc;
27
28 import org.infoglue.cms.applications.common.actions.InfoGlueAbstractAction;
29 import org.infoglue.cms.controllers.kernel.impl.simple.ComponentPropertyDefinitionController;
30 import org.infoglue.cms.controllers.kernel.impl.simple.ContentTypeDefinitionController;
31 import org.infoglue.cms.controllers.kernel.impl.simple.ContentVersionController;
32 import org.infoglue.cms.entities.management.ContentTypeDefinitionVO;
33
34
35 /**
36  * This action handles all interaction a user wants to add/change/remove things in a components properties.
37  */

38
39 public class ViewComponentPropertiesEditorAction extends InfoGlueAbstractAction
40 {
41     private static final long serialVersionUID = 1L;
42     
43     private Integer JavaDoc contentVersionId;
44     private Integer JavaDoc contentId;
45     private String JavaDoc attributeName;
46     private String JavaDoc propertiesXML;
47     private List JavaDoc componentPropertyDefinitions;
48     private List JavaDoc contentTypeDefinitions;
49
50     private String JavaDoc closeOnLoad = "false";
51     
52     private void initialize() throws Exception JavaDoc
53     {
54         this.contentId = ContentVersionController.getContentVersionController().getContentVersionVOWithId(this.contentVersionId).getContentId();
55         String JavaDoc componentPropertiesXML = ContentVersionController.getContentVersionController().getAttributeValue(contentVersionId, attributeName, false);
56         this.componentPropertyDefinitions = ComponentPropertyDefinitionController.getController().parseComponentPropertyDefinitions(componentPropertiesXML);
57         this.contentTypeDefinitions = ContentTypeDefinitionController.getController().getContentTypeDefinitionVOList(ContentTypeDefinitionVO.CONTENT);
58     }
59     
60     public String JavaDoc doExecute() throws Exception JavaDoc
61     {
62         initialize();
63         
64         return SUCCESS;
65     }
66
67     public String JavaDoc doUpdate() throws Exception JavaDoc
68     {
69         ContentVersionController.getContentVersionController().updateAttributeValue(this.contentVersionId, this.attributeName, this.propertiesXML, this.getInfoGluePrincipal());
70         
71         return "update";
72     }
73
74
75     public String JavaDoc getAttributeName()
76     {
77         return attributeName;
78     }
79     
80     public void setAttributeName(String JavaDoc attributeName)
81     {
82         this.attributeName = attributeName;
83     }
84     
85     public Integer JavaDoc getContentVersionId()
86     {
87         return contentVersionId;
88     }
89     
90     public void setContentVersionId(Integer JavaDoc contentVersionId)
91     {
92         this.contentVersionId = contentVersionId;
93     }
94     
95     public List JavaDoc getComponentPropertyDefinitions()
96     {
97         return componentPropertyDefinitions;
98     }
99     
100     public void setPropertiesXML(String JavaDoc propertiesXML)
101     {
102         this.propertiesXML = propertiesXML;
103     }
104     
105     public List JavaDoc getContentTypeDefinitions()
106     {
107         return contentTypeDefinitions;
108     }
109     
110     public Integer JavaDoc getContentId()
111     {
112         return contentId;
113     }
114     
115     public void setContentId(Integer JavaDoc contentId)
116     {
117         this.contentId = contentId;
118     }
119     
120     public String JavaDoc getCloseOnLoad()
121     {
122         return closeOnLoad;
123     }
124     
125     public void setCloseOnLoad(String JavaDoc closeOnLoad)
126     {
127         this.closeOnLoad = closeOnLoad;
128     }
129
130 }
131
Popular Tags