1 23 24 package org.infoglue.cms.applications.structuretool.actions; 25 26 import java.util.ArrayList ; 27 import java.util.List ; 28 29 import org.apache.log4j.Logger; 30 import org.infoglue.cms.applications.common.actions.InfoGlueAbstractAction; 31 import org.infoglue.cms.controllers.kernel.impl.simple.RegistryController; 32 import org.infoglue.cms.controllers.kernel.impl.simple.SiteNodeController; 33 import org.infoglue.cms.controllers.kernel.impl.simple.SiteNodeControllerProxy; 34 import org.infoglue.cms.entities.structure.SiteNodeVO; 35 36 37 42 43 public class DeleteSiteNodeAction extends InfoGlueAbstractAction 44 { 45 private final static Logger logger = Logger.getLogger(DeleteSiteNodeAction.class.getName()); 46 47 private SiteNodeVO siteNodeVO; 48 private Integer siteNodeId; 49 private Integer parentSiteNodeId; 50 private Integer changeTypeId; 51 private Integer repositoryId; 52 private String [] registryId; 53 54 private Integer contentId; 56 57 private List referenceBeanList = new ArrayList (); 58 59 60 public DeleteSiteNodeAction() 61 { 62 this(new SiteNodeVO()); 63 } 64 65 public DeleteSiteNodeAction(SiteNodeVO siteNodeVO) 66 { 67 this.siteNodeVO = siteNodeVO; 68 } 69 70 protected String doExecute() throws Exception 71 { 72 this.referenceBeanList = RegistryController.getController().getReferencingObjectsForSiteNode(this.siteNodeVO.getSiteNodeId()); 73 if(this.referenceBeanList != null && this.referenceBeanList.size() > 0) 74 { 75 return "showRelations"; 76 } 77 else 78 { 79 try 80 { 81 this.parentSiteNodeId = SiteNodeController.getParentSiteNode(this.siteNodeVO.getSiteNodeId()).getSiteNodeId(); 82 } 83 catch(Exception e) 84 { 85 logger.info("The siteNode must have been a root-siteNode because we could not find a parent."); 86 } 87 88 SiteNodeControllerProxy.getSiteNodeControllerProxy().acDelete(this.getInfoGluePrincipal(), this.siteNodeVO); 89 90 return "success"; 91 } 92 } 93 94 public String doDeleteReference() throws Exception 95 { 96 for(int i=0; i<registryId.length; i++) 97 RegistryController.getController().delete(new Integer (registryId[i])); 98 99 return doExecute(); 100 } 101 102 103 public String doFixPage() throws Exception 104 { 105 return "fixPage"; 106 } 107 108 public String doFixPageHeader() throws Exception 109 { 110 return "fixPageHeader"; 111 } 112 113 public void setSiteNodeId(Integer siteNodeId) 114 { 115 this.siteNodeVO.setSiteNodeId(siteNodeId); 116 } 117 118 public Integer getOriginalSiteNodeId() 119 { 120 return this.siteNodeVO.getSiteNodeId(); 121 } 122 123 public void setParentSiteNodeId(Integer parentSiteNodeId) 124 { 125 this.parentSiteNodeId = parentSiteNodeId; 126 } 127 128 public void setChangeTypeId(Integer changeTypeId) 129 { 130 this.changeTypeId = changeTypeId; 131 } 132 133 public Integer getSiteNodeId() 134 { 135 return this.parentSiteNodeId; 136 } 137 138 public Integer getUnrefreshedSiteNodeId() 139 { 140 return this.parentSiteNodeId; 141 } 142 143 public Integer getChangeTypeId() 144 { 145 return this.changeTypeId; 146 } 147 148 public String getErrorKey() 149 { 150 return "SiteNodeVersion.stateId"; 151 } 152 153 public String getReturnAddress() 154 { 155 return "ViewSiteNode.action?siteNodeId=" + this.siteNodeVO.getId() + "&repositoryId=" + this.siteNodeVO.getRepositoryId(); 156 } 157 158 public Integer getRepositoryId() 159 { 160 return repositoryId; 161 } 162 163 public void setRepositoryId(Integer repositoryId) 164 { 165 this.repositoryId = repositoryId; 166 } 167 168 public Integer getContentId() 169 { 170 return contentId; 171 } 172 173 public void setContentId(Integer contentId) 174 { 175 this.contentId = contentId; 176 } 177 178 public List getReferenceBeanList() 179 { 180 return referenceBeanList; 181 } 182 183 public String [] getRegistryId() 184 { 185 return registryId; 186 } 187 188 public void setRegistryId(String [] registryId) 189 { 190 this.registryId = registryId; 191 } 192 } 193 | Popular Tags |