1 18 package org.alfresco.web.bean.wizard; 19 20 import javax.faces.event.ActionEvent; 21 22 import org.alfresco.model.ContentModel; 23 import org.alfresco.service.cmr.repository.ContentReader; 24 import org.alfresco.service.cmr.repository.NodeRef; 25 import org.alfresco.web.app.AlfrescoNavigationHandler; 26 import org.alfresco.web.ui.common.Utils; 27 import org.apache.commons.logging.Log; 28 import org.apache.commons.logging.LogFactory; 29 30 31 36 public class NewReplyWizard extends NewPostWizard 37 { 38 private static Log logger = LogFactory.getLog(NewReplyWizard.class); 39 40 private String replyContent = null; 41 42 47 public String getReplyContent() 48 { 49 if (this.replyContent == null) 50 { 51 NodeRef replyNode = this.browseBean.getDocument().getNodeRef(); 53 if (replyNode != null) 54 { 55 ContentReader reader = this.contentService.getReader(replyNode, ContentModel.PROP_CONTENT); 56 57 if (reader != null) 58 { 59 this.replyContent = reader.getContentString(); 60 } 61 } 62 } 63 64 return this.replyContent; 65 } 66 67 70 @Override 71 public void init() 72 { 73 super.init(); 74 75 this.replyContent = null; 76 } 77 78 81 @Override 82 public void startWizard(ActionEvent event) 83 { 84 super.startWizard(event); 85 86 this.browseBean.setupContentAction(event); 88 } 89 90 93 @Override 94 public String finish() 95 { 96 this.content = Utils.replaceLineBreaks(this.content); 98 99 String outcome = super.finish(); 100 101 if (outcome != null); 103 { 104 outcome = AlfrescoNavigationHandler.CLOSE_DIALOG_OUTCOME; 105 } 106 107 return outcome; 108 } 109 110 113 @Override 114 protected void performCustomProcessing() 115 { 116 if (this.editMode == false) 117 { 118 this.nodeService.addAspect(this.createdNode, ContentModel.ASPECT_REFERENCING, null); 121 this.nodeService.createAssociation(this.createdNode, this.browseBean.getDocument().getNodeRef(), 122 ContentModel.ASSOC_REFERENCES); 123 124 if (logger.isDebugEnabled()) 125 { 126 logger.debug("created new node: " + this.createdNode); 127 logger.debug("existing node: " + this.browseBean.getDocument().getNodeRef()); 128 } 129 } 130 } 131 132 135 @Override 136 public String cancel() 137 { 138 super.cancel(); 139 140 return AlfrescoNavigationHandler.CLOSE_DIALOG_OUTCOME; 141 } 142 } 143 | Popular Tags |