KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > infoglue > cms > applications > contenttool > wizards > actions > CreateContentWizardInputContentVersionsAction


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.wizards.actions;
25
26 import java.util.Iterator JavaDoc;
27 import java.util.List JavaDoc;
28
29 import org.infoglue.cms.applications.databeans.AssetKeyDefinition;
30 import org.infoglue.cms.controllers.kernel.impl.simple.ContentTypeDefinitionController;
31 import org.infoglue.cms.controllers.kernel.impl.simple.LanguageController;
32 import org.infoglue.cms.entities.content.ContentVersionVO;
33 import org.infoglue.cms.entities.management.ContentTypeDefinitionVO;
34 import org.infoglue.cms.entities.management.LanguageVO;
35 import org.infoglue.cms.util.CmsPropertyHandler;
36 import org.infoglue.cms.util.ConstraintExceptionBuffer;
37
38 /**
39  * This action represents the create content versions including assets in the wizards.
40  */

41
42 public class CreateContentWizardInputContentVersionsAction extends CreateContentWizardAbstractAction
43 {
44     private ContentTypeDefinitionVO contentTypeDefinitionVO = null;
45     private List JavaDoc contentTypeAttributes = null;
46     private String JavaDoc returnAddress = null;
47     private ConstraintExceptionBuffer ceb = new ConstraintExceptionBuffer();
48
49     private String JavaDoc versionValue = null;
50     private Integer JavaDoc currentEditorId = null;
51     private Integer JavaDoc languageId = null;
52     private ContentVersionVO contentVersionVO = new ContentVersionVO();
53     
54     public CreateContentWizardInputContentVersionsAction()
55     {
56     }
57     
58
59     /**
60      * This method presents the user with the initial input screen for creating a content.
61      *
62      * @return
63      * @throws Exception
64      */

65      
66     public String JavaDoc doInput() throws Exception JavaDoc
67     {
68         CreateContentWizardInfoBean createContentWizardInfoBean = getCreateContentWizardInfoBean();
69         
70         Integer JavaDoc contentTypeDefinitionId = createContentWizardInfoBean.getContentTypeDefinitionId();
71         this.contentTypeDefinitionVO = ContentTypeDefinitionController.getController().getContentTypeDefinitionVOWithId(contentTypeDefinitionId);
72         
73         this.contentTypeDefinitionVO = ContentTypeDefinitionController.getController().validateAndUpdateContentType(this.contentTypeDefinitionVO);
74         List JavaDoc assetKeys = ContentTypeDefinitionController.getController().getDefinedAssetKeys(this.contentTypeDefinitionVO.getSchemaValue());
75         
76         LanguageVO masterLanguageVO = LanguageController.getController().getMasterLanguage(createContentWizardInfoBean.getRepositoryId());
77         if(this.languageId == null)
78             this.languageId = masterLanguageVO.getLanguageId();
79         
80         /*
81         boolean missingAsset = false;
82         Iterator assetKeysIterator = assetKeys.iterator();
83         while(assetKeysIterator.hasNext())
84         {
85             AssetKeyDefinition assetKeyDefinition = (AssetKeyDefinition)assetKeysIterator.next();
86             if(!createContentWizardInfoBean.getDigitalAssets().containsKey(assetKeyDefinition.getAssetKey() + "_" + masterLanguageVO.getId()))
87                 return "inputAssets";
88         }
89         */

90         
91         this.contentTypeAttributes = ContentTypeDefinitionController.getController().getContentTypeAttributes(this.contentTypeDefinitionVO.getSchemaValue());
92         
93         String JavaDoc wysiwygEditor = CmsPropertyHandler.getWysiwygEditor();
94         if(wysiwygEditor == null || wysiwygEditor.equalsIgnoreCase("") || wysiwygEditor.equalsIgnoreCase("HTMLArea"))
95             return "inputContentVersions";
96         else
97             return "inputContentVersionsForFCKEditor";
98     }
99
100     /**
101      * This method validates the input and handles any deviations.
102      *
103      * @return
104      * @throws Exception
105      */

106      
107     public String JavaDoc doExecute() throws Exception JavaDoc
108     {
109         CreateContentWizardInfoBean createContentWizardInfoBean = getCreateContentWizardInfoBean();
110         
111         this.contentVersionVO.setVersionModifier(this.getInfoGluePrincipal().getName());
112
113         createContentWizardInfoBean.getContentVersions().put(languageId, this.contentVersionVO);
114
115         //getCreateContentWizardInfoBean()
116
//this.contentVO.setCreatorName(this.getInfoGluePrincipal().getName());
117

118         //ceb = this.contentVO.validate();
119

120         //if(!ceb.isEmpty())
121
// initialiaze();
122

123         //ceb.throwIfNotEmpty();
124

125         return "success";
126     }
127
128     public List JavaDoc getContentTypeAttributes()
129     {
130         return this.contentTypeAttributes;
131     }
132
133     public ContentTypeDefinitionVO getContentTypeDefinitionVO()
134     {
135         return this.contentTypeDefinitionVO;
136     }
137
138     public Integer JavaDoc getCurrentEditorId()
139     {
140         return this.currentEditorId;
141     }
142
143     public Integer JavaDoc getLanguageId()
144     {
145         return this.languageId;
146     }
147
148     public void setCurrentEditorId(Integer JavaDoc currentEditorId)
149     {
150         this.currentEditorId = currentEditorId;
151     }
152
153     public void setLanguageId(Integer JavaDoc languageId)
154     {
155         this.languageId = languageId;
156         this.contentVersionVO.setLanguageId(languageId);
157     }
158
159     public void setVersionValue(String JavaDoc versionValue)
160     {
161         this.contentVersionVO.setVersionValue(versionValue);
162     }
163
164 }
165
Popular Tags