1 23 24 package org.infoglue.cms.applications.contenttool.actions; 25 26 import org.infoglue.cms.applications.common.VisualFormatter; 27 import org.infoglue.cms.controllers.kernel.impl.simple.ContentController; 28 import org.infoglue.cms.controllers.kernel.impl.simple.ContentControllerProxy; 29 import org.infoglue.cms.entities.content.ContentVO; 30 import org.infoglue.cms.util.ConstraintExceptionBuffer; 31 32 33 38 public class UpdateContentAction extends ViewContentAction { 40 private static final long serialVersionUID = 1L; 41 42 private ContentVO contentVO = null; 43 private Integer repositoryId; 44 private Integer contentTypeDefinitionId; 45 46 private ConstraintExceptionBuffer ceb; 47 48 public UpdateContentAction() 49 { 50 this(new ContentVO()); 51 } 52 53 public UpdateContentAction(ContentVO contentVO) 54 { 55 this.contentVO = contentVO; 56 this.ceb = new ConstraintExceptionBuffer(); 57 } 58 59 public String doExecute() throws Exception 60 { 61 super.initialize(getContentId()); 62 ContentVO oldContentVO = ContentController.getContentController().getContentVOWithId(getContentId()); 63 64 this.contentVO.setCreatorName(this.getInfoGluePrincipal().getName()); 65 this.contentVO.setIsBranch(oldContentVO.getIsBranch()); 67 68 ceb = this.contentVO.validate(); 69 70 ceb.throwIfNotEmpty(); 71 72 ContentControllerProxy.getController().acUpdate(this.getInfoGluePrincipal(), this.contentVO, this.contentTypeDefinitionId); 73 75 return "success"; 76 } 77 78 public String doStandalone() throws Exception 79 { 80 doExecute(); 81 82 return "successStandalone"; 83 } 84 85 public String doSaveAndExit() throws Exception 86 { 87 doExecute(); 88 89 return "saveAndExit"; 90 } 91 92 public void setContentId(Integer contentId) 93 { 94 this.contentVO.setContentId(contentId); 95 } 96 97 public java.lang.Integer getContentId() 98 { 99 return this.contentVO.getContentId(); 100 } 101 102 public java.lang.String getName() 103 { 104 return this.contentVO.getName(); 105 } 106 107 public Boolean getIsBranch() 108 { 109 return this.contentVO.getIsBranch(); 110 } 111 112 public void setName(java.lang.String name) 113 { 114 this.contentVO.setName(name); 115 } 116 117 public Integer getIsProtected() 118 { 119 return this.contentVO.getIsProtected(); 120 } 121 122 public void setIsProtected(java.lang.Integer isProtected) 123 { 124 this.contentVO.setIsProtected(isProtected); 125 } 126 127 public void setPublishDateTime(String publishDateTime) 128 { 129 this.contentVO.setPublishDateTime(new VisualFormatter().parseDate(publishDateTime, "yyyy-MM-dd HH:mm")); 130 } 131 132 public void setExpireDateTime(String expireDateTime) 133 { 134 this.contentVO.setExpireDateTime(new VisualFormatter().parseDate(expireDateTime, "yyyy-MM-dd HH:mm")); 135 } 136 137 public void setIsBranch(Boolean isBranch) 138 { 139 this.contentVO.setIsBranch(isBranch); 140 } 141 142 public void setContentTypeDefinitionId(Integer contentTypeDefinitionId) 143 { 144 this.contentTypeDefinitionId = contentTypeDefinitionId; 145 } 146 147 public void setRepositoryId(Integer repositoryId) 148 { 149 this.repositoryId = repositoryId; 150 } 151 152 public Integer getRepositoryId() 153 { 154 return this.repositoryId; 155 } 156 157 } 158 | Popular Tags |