1 23 24 package org.infoglue.cms.applications.contenttool.wizards.actions; 25 26 import org.infoglue.cms.applications.common.VisualFormatter; 27 import org.infoglue.cms.controllers.kernel.impl.simple.ContentControllerProxy; 28 import org.infoglue.cms.entities.content.ContentVO; 29 import org.infoglue.cms.util.CmsPropertyHandler; 30 import org.infoglue.cms.util.ConstraintExceptionBuffer; 31 32 33 37 38 public class CreateContentWizardFinishAction extends CreateContentWizardAbstractAction 39 { 40 private ConstraintExceptionBuffer ceb = null; 41 private String returnAddress = "CreateContentWizardFinish.action"; 42 private String refreshAddress = null; 43 private Integer contentId = null; 44 45 public CreateContentWizardFinishAction() 46 { 47 this.ceb = new ConstraintExceptionBuffer(); 48 } 49 50 51 public String doExecute() throws Exception 52 { 53 try 54 { 55 CreateContentWizardInfoBean createContentWizardInfoBean = getCreateContentWizardInfoBean(); 56 57 if(createContentWizardInfoBean.getParentContentId() == null) 58 { 59 return "stateLocation"; 60 } 61 62 createContentWizardInfoBean.getContent().setCreator(this.getInfoGluePrincipal().getName()); 63 this.ceb = createContentWizardInfoBean.getContent().getValueObject().validate(); 64 65 if(!this.ceb.isEmpty()) 66 { 67 return "inputContent"; 68 } 69 70 if(createContentWizardInfoBean.getContentVersions().size() == 0) 71 { 72 String wysiwygEditor = CmsPropertyHandler.getWysiwygEditor(); 73 if(wysiwygEditor == null || wysiwygEditor.equalsIgnoreCase("") || wysiwygEditor.equalsIgnoreCase("HTMLArea")) 74 return "inputContentVersions"; 75 else 76 return "inputContentVersionsForFCKEditor"; 77 78 } 79 81 ContentVO contentVO = ContentControllerProxy.getController().acCreate(this.getInfoGluePrincipal(), createContentWizardInfoBean); 82 this.contentId = contentVO.getContentId(); 83 84 String returnAddress = createContentWizardInfoBean.getReturnAddress(); 85 returnAddress = returnAddress.replaceAll("#entityId", this.contentId.toString()); 86 returnAddress = returnAddress.replaceAll("#path", contentVO.getName()); 87 88 this.invalidateCreateContentWizardInfoBean(); 89 90 this.getResponse().sendRedirect(returnAddress); 91 } 92 catch(Exception e) 93 { 94 e.printStackTrace(); 95 } 96 97 return NONE; 98 } 99 100 public void setParentContentId(Integer parentContentId) 101 { 102 getCreateContentWizardInfoBean().setParentContentId(parentContentId); 103 } 104 105 public Integer getParentContentId() 106 { 107 return getCreateContentWizardInfoBean().getParentContentId(); 108 } 109 110 public void setRepositoryId(Integer repositoryId) 111 { 112 getCreateContentWizardInfoBean().setRepositoryId(repositoryId); 113 } 114 115 public Integer getRepositoryId() 116 { 117 return getCreateContentWizardInfoBean().getRepositoryId(); 118 } 119 120 public void setContentTypeDefinitionId(Integer contentTypeDefinitionId) 121 { 122 getCreateContentWizardInfoBean().setContentTypeDefinitionId(contentTypeDefinitionId); 123 } 124 125 public Integer getContentTypeDefinitionId() 126 { 127 return getCreateContentWizardInfoBean().getContentTypeDefinitionId(); 128 } 129 130 public java.lang.String getName() 131 { 132 return getCreateContentWizardInfoBean().getContent().getName(); 133 } 134 135 public String getPublishDateTime() 136 { 137 return new VisualFormatter().formatDate(getCreateContentWizardInfoBean().getContent().getPublishDateTime(), "yyyy-MM-dd HH:mm"); 138 } 139 140 public String getExpireDateTime() 141 { 142 return new VisualFormatter().formatDate(getCreateContentWizardInfoBean().getContent().getExpireDateTime(), "yyyy-MM-dd HH:mm"); 143 } 144 145 public Boolean getIsBranch() 146 { 147 return getCreateContentWizardInfoBean().getContent().getIsBranch(); 148 } 149 150 public void setName(String name) 151 { 152 getCreateContentWizardInfoBean().getContent().setName(name); 153 } 154 155 public void setPublishDateTime(String publishDateTime) 156 { 157 getCreateContentWizardInfoBean().getContent().setPublishDateTime(new VisualFormatter().parseDate(publishDateTime, "yyyy-MM-dd HH:mm")); 158 } 159 160 public void setExpireDateTime(String expireDateTime) 161 { 162 getCreateContentWizardInfoBean().getContent().setExpireDateTime(new VisualFormatter().parseDate(expireDateTime, "yyyy-MM-dd HH:mm")); 163 } 164 165 public void setIsBranch(Boolean isBranch) 166 { 167 getCreateContentWizardInfoBean().getContent().setIsBranch(isBranch); 168 } 169 170 public ContentVO getContentVO() 171 { 172 return getCreateContentWizardInfoBean().getContent().getValueObject(); 173 } 174 175 public void setContentVO(ContentVO contentVO) 176 { 177 getCreateContentWizardInfoBean().getContent().setValueObject(contentVO); 178 } 179 180 public void setReturnAddress(String returnAddress) 181 { 182 this.returnAddress = returnAddress; 183 } 184 185 public String getReturnAddress() 186 { 187 return returnAddress; 188 } 189 190 public void setRefreshAddress(String refreshAddress) 191 { 192 getCreateContentWizardInfoBean().setReturnAddress(refreshAddress); 193 } 194 195 public String getRefreshAddress() 196 { 197 return getCreateContentWizardInfoBean().getReturnAddress(); 198 } 199 200 public Integer getContentId() 201 { 202 return this.contentId; 203 } 204 205 } 206 | Popular Tags |