1 23 24 package org.infoglue.cms.applications.structuretool.actions; 25 26 import java.util.List ; 27 28 import org.apache.log4j.Logger; 29 import org.infoglue.cms.applications.common.actions.InfoGlueAbstractAction; 30 import org.infoglue.cms.controllers.kernel.impl.simple.ContentController; 31 import org.infoglue.cms.controllers.kernel.impl.simple.RepositoryController; 32 import org.infoglue.cms.controllers.kernel.impl.simple.SiteNodeController; 33 import org.infoglue.cms.entities.content.ContentVO; 34 import org.infoglue.cms.entities.structure.SiteNodeVO; 35 import org.infoglue.cms.util.ConstraintExceptionBuffer; 36 37 40 41 public class ViewStructureTreeForInlineLinkAction extends InfoGlueAbstractAction 42 { 43 private final static Logger logger = Logger.getLogger(ViewStructureTreeForInlineLinkAction.class.getName()); 44 45 private static final long serialVersionUID = 1L; 46 47 private Integer repositoryId; 48 private ConstraintExceptionBuffer ceb; 49 private String tree; 50 private List repositories; 51 private String textAreaId = ""; 52 private Integer oldSiteNodeId; 53 private Integer oldContentId; 54 55 56 public ViewStructureTreeForInlineLinkAction() 57 { 58 this.ceb = new ConstraintExceptionBuffer(); 59 } 60 61 public void setRepositoryId(Integer repositoryId) 62 { 63 this.repositoryId = repositoryId; 64 } 65 66 public Integer getRepositoryId() 67 { 68 return this.repositoryId; 69 } 70 71 public String getTree() 72 { 73 return tree; 74 } 75 76 public void setTree(String string) 77 { 78 tree = string; 79 } 80 81 public String getCurrentAction() 82 { 83 return "ViewStructureTreeForInlineLink.action"; 84 } 85 86 public String doExecute() throws Exception 87 { 88 this.repositories = RepositoryController.getController().getAuthorizedRepositoryVOList(this.getInfoGluePrincipal(), true); 89 90 if(this.repositoryId == null) 91 { 92 this.repositoryId = (Integer )getHttpSession().getAttribute("repositoryId"); 93 if(this.repositoryId == null) 94 this.repositoryId = RepositoryController.getController().getFirstRepositoryVO().getRepositoryId(); 95 } 96 97 return "success"; 98 } 99 100 public String doUseFCKEditor() throws Exception 101 { 102 doExecute(); 103 104 return "successFCKEditor"; 105 } 106 107 public List getRepositories() 108 { 109 return repositories; 110 } 111 112 public String getTextAreaId() 113 { 114 return textAreaId; 115 } 116 117 public void setTextAreaId(String string) 118 { 119 textAreaId = string; 120 } 121 122 public Integer getOldSiteNodeId() 123 { 124 return oldSiteNodeId; 125 } 126 127 public void setOldSiteNodeId(Integer oldSiteNodeId) 128 { 129 this.oldSiteNodeId = oldSiteNodeId; 130 } 131 132 public String getExpansion(Integer oldSiteNodeId) 133 { 134 String expansion = "/"; 135 136 if(oldSiteNodeId == null) 137 return ""; 138 139 try 140 { 141 SiteNodeVO parentSiteNodeVO = SiteNodeController.getController().getParentSiteNode(oldSiteNodeId); 142 while(parentSiteNodeVO != null) 143 { 144 expansion += parentSiteNodeVO.getId() + "/"; 145 parentSiteNodeVO = SiteNodeController.getController().getParentSiteNode(parentSiteNodeVO.getId()); 146 } 147 } 148 catch(Exception e) 149 { 150 logger.warn("Expansion not possible:" + e.getMessage(), e); 151 } 152 153 return expansion; 154 } 155 156 public String getContentExpansion(Integer oldContentId) 157 { 158 String expansion = "/"; 159 160 if(oldContentId == null) 161 return ""; 162 163 try 164 { 165 ContentVO parentContentVO = ContentController.getContentController().getParentContent(oldContentId); 166 while(parentContentVO != null) 167 { 168 expansion += parentContentVO.getId() + "/"; 169 parentContentVO = ContentController.getContentController().getParentContent(parentContentVO.getId()); 170 } 171 } 172 catch(Exception e) 173 { 174 logger.warn("Expansion not possible:" + e.getMessage(), e); 175 } 176 177 return expansion; 178 } 179 180 public Integer getOldContentId() 181 { 182 return oldContentId; 183 } 184 185 public void setOldContentId(Integer oldContentId) 186 { 187 this.oldContentId = oldContentId; 188 } 189 } 190 | Popular Tags |