1 23 24 package org.infoglue.cms.applications.contenttool.actions; 25 26 import java.util.ArrayList ; 27 import java.util.HashSet ; 28 import java.util.List ; 29 import java.util.Set ; 30 31 import org.infoglue.cms.applications.common.actions.InfoGlueAbstractAction; 32 import org.infoglue.cms.controllers.kernel.impl.simple.AccessRightController; 33 import org.infoglue.cms.controllers.kernel.impl.simple.ContentController; 34 import org.infoglue.cms.controllers.kernel.impl.simple.ContentControllerProxy; 35 import org.infoglue.cms.controllers.kernel.impl.simple.ContentVersionController; 36 import org.infoglue.cms.entities.content.ContentVO; 37 import org.infoglue.cms.entities.content.ContentVersionVO; 38 import org.infoglue.cms.exception.AccessConstraintException; 39 import org.infoglue.cms.util.AccessConstraintExceptionBuffer; 40 41 48 49 public class ViewListContentVersionAction extends InfoGlueAbstractAction 50 { 51 private static final long serialVersionUID = -1767277488570719994L; 52 53 private List contentVersionVOList = new ArrayList (); 54 private List siteNodeVersionVOList = new ArrayList (); 55 private Integer contentId; 56 private Integer repositoryId; 57 private String returnAddress = null; 58 59 protected String doExecute() throws Exception 60 { 61 if(this.contentId != null) 62 { 63 ContentVO contentVO = ContentController.getContentController().getContentVOWithId(this.contentId); 64 this.repositoryId = contentVO.getRepositoryId(); 65 66 AccessConstraintExceptionBuffer ceb = new AccessConstraintExceptionBuffer(); 67 68 Integer protectedContentId = ContentControllerProxy.getController().getProtectedContentId(contentId); 69 if(protectedContentId != null && !AccessRightController.getController().getIsPrincipalAuthorized(this.getInfoGluePrincipal(), "Content.SubmitToPublish", protectedContentId.toString())) 70 ceb.add(new AccessConstraintException("Content.contentId", "1005")); 71 72 ceb.throwIfNotEmpty(); 73 74 ContentVersionController.getContentVersionController().getContentAndAffectedItemsRecursive(this.contentId, ContentVersionVO.WORKING_STATE, this.siteNodeVersionVOList, this.contentVersionVOList, true, true); 75 76 Set contentVersionVOListSet = new HashSet (); 77 contentVersionVOListSet.addAll(contentVersionVOList); 78 contentVersionVOList.clear(); 79 contentVersionVOList.addAll(contentVersionVOListSet); 80 81 Set siteNodeVersionVOListSet = new HashSet (); 82 siteNodeVersionVOListSet.addAll(siteNodeVersionVOList); 83 siteNodeVersionVOList.clear(); 84 siteNodeVersionVOList.addAll(siteNodeVersionVOListSet); 85 86 } 88 89 return "success"; 90 } 91 92 95 public Integer getContentId() 96 { 97 return contentId; 98 } 99 100 103 public void setContentId(Integer integer) 104 { 105 contentId = integer; 106 } 107 108 public Integer getRepositoryId() 109 { 110 return repositoryId; 111 } 112 113 public List getContentVersionVOList() 114 { 115 return contentVersionVOList; 116 } 117 118 public List getSiteNodeVersionVOList() 119 { 120 return siteNodeVersionVOList; 121 } 122 123 public String getReturnAddress() 124 { 125 return returnAddress; 126 } 127 128 public void setReturnAddress(String returnAddress) 129 { 130 this.returnAddress = returnAddress; 131 } 132 } 133 | Popular Tags |