1 23 24 package org.infoglue.cms.applications.contenttool.wizards.actions; 25 26 import java.net.URLEncoder ; 27 import java.util.List ; 28 29 import org.infoglue.cms.applications.contenttool.actions.ViewContentTreeActionInterface; 30 import org.infoglue.cms.controllers.kernel.impl.simple.RepositoryController; 31 import org.infoglue.cms.entities.content.ContentVO; 32 import org.infoglue.cms.entities.management.RepositoryVO; 33 import org.infoglue.cms.exception.Bug; 34 import org.infoglue.cms.exception.ConstraintException; 35 import org.infoglue.cms.exception.SystemException; 36 import org.infoglue.cms.util.ConstraintExceptionBuffer; 37 38 41 42 public class CreateContentWizardChooseParentAction extends CreateContentWizardAbstractAction implements ViewContentTreeActionInterface 43 { 44 private Integer contentId; 46 private String tree; 47 private String hideLeafs; 48 private Integer siteNodeId; 49 private Integer languageId; 50 private String componentId; 51 private String propertyName; 52 private String refreshAddress; 53 private String showSimple; 54 55 private Integer parentContentId; 56 private Integer repositoryId; 57 private ConstraintExceptionBuffer ceb; 58 59 private String returnAddress; 60 private String [] allowedContentTypeIds = null; 61 62 private List repositories; 63 64 public CreateContentWizardChooseParentAction() 65 { 66 this(new ContentVO()); 67 } 68 69 public CreateContentWizardChooseParentAction(ContentVO contentVO) 70 { 71 this.ceb = new ConstraintExceptionBuffer(); 72 } 73 74 public String doExecute() throws Exception 75 { 76 this.repositories = RepositoryController.getController().getAuthorizedRepositoryVOList(this.getInfoGluePrincipal(), false); 77 78 return "success"; 79 } 80 81 public Integer getTopRepositoryId() throws ConstraintException, SystemException, Bug 82 { 83 Integer topRepositoryId = null; 84 85 if (repositoryId != null) 86 topRepositoryId = repositoryId; 87 88 if(repositories.size() > 0) 89 { 90 topRepositoryId = ((RepositoryVO)repositories.get(0)).getRepositoryId(); 91 } 92 93 return topRepositoryId; 94 } 95 96 public void setHideLeafs(String hideLeafs) 97 { 98 this.hideLeafs = hideLeafs; 99 } 100 101 public String getHideLeafs() 102 { 103 return this.hideLeafs; 104 } 105 106 public String getTree() 107 { 108 return tree; 109 } 110 111 public void setTree(String tree) 112 { 113 this.tree = tree; 114 } 115 116 public void setParentContentId(Integer parentContentId) 117 { 118 this.parentContentId = parentContentId; 119 } 120 121 public Integer getParentContentId() 122 { 123 return this.parentContentId; 124 } 125 126 public void setRepositoryId(Integer repositoryId) 127 { 128 this.repositoryId = repositoryId; 129 } 130 131 public Integer getRepositoryId() 132 { 133 try 134 { 135 if(this.repositoryId == null) 136 { 137 this.repositoryId = (Integer )getHttpSession().getAttribute("repositoryId"); 138 139 if(this.repositoryId == null) 140 { 141 this.repositoryId = getTopRepositoryId(); 142 getHttpSession().setAttribute("repositoryId", this.repositoryId); 143 } 144 } 145 } 146 catch(Exception e) 147 { 148 } 149 150 return repositoryId; 151 } 152 153 public void setContentId(Integer contentId) 154 { 155 this.contentId = contentId; 156 } 157 158 public Integer getContentId() 159 { 160 return this.contentId; 161 } 162 163 public String getReturnAddress() 164 { 165 return returnAddress; 166 } 167 168 public void setReturnAddress(String string) 169 { 170 returnAddress = string; 171 } 172 173 public String getAllowedContentTypeIdsAsUrlEncodedString() throws Exception 174 { 175 StringBuffer sb = new StringBuffer (); 176 177 for(int i=0; i<allowedContentTypeIds.length; i++) 178 { 179 if(i > 0) 180 sb.append("&"); 181 182 sb.append("allowedContentTypeIds=" + URLEncoder.encode(allowedContentTypeIds[i], "UTF-8")); 183 } 184 185 return sb.toString(); 186 } 187 188 public String [] getAllowedContentTypeIds() 189 { 190 return allowedContentTypeIds; 191 } 192 193 public void setAllowedContentTypeIds(String [] allowedContentTypeIds) 194 { 195 this.allowedContentTypeIds = allowedContentTypeIds; 196 } 197 198 public List getRepositories() 199 { 200 return repositories; 201 } 202 203 public String getComponentId() 204 { 205 return componentId; 206 } 207 208 public void setComponentId(String componentId) 209 { 210 this.componentId = componentId; 211 } 212 213 public Integer getLanguageId() 214 { 215 return languageId; 216 } 217 218 public void setLanguageId(Integer languageId) 219 { 220 this.languageId = languageId; 221 } 222 223 public String getPropertyName() 224 { 225 return propertyName; 226 } 227 228 public void setPropertyName(String propertyName) 229 { 230 this.propertyName = propertyName; 231 } 232 233 public String getRefreshAddress() 234 { 235 return refreshAddress; 236 } 237 238 public String getEncodedRefreshAddress() throws Exception 239 { 240 return URLEncoder.encode(refreshAddress, "UTF-8"); 241 } 242 243 public void setRefreshAddress(String refreshAddress) 244 { 245 this.refreshAddress = refreshAddress; 246 } 247 248 public String getShowSimple() 249 { 250 return showSimple; 251 } 252 253 public void setShowSimple(String showSimple) 254 { 255 this.showSimple = showSimple; 256 } 257 258 public Integer getSiteNodeId() 259 { 260 return siteNodeId; 261 } 262 263 public void setSiteNodeId(Integer siteNodeId) 264 { 265 this.siteNodeId = siteNodeId; 266 } 267 268 } 269 | Popular Tags |