Gavin Cornwell a4564a1a49 Next phase of forums functionality
Simple dialog framework implementation

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@2056 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
2005-12-22 11:57:43 +00:00

97 lines
2.8 KiB
Java

/*
* Copyright (C) 2005 Alfresco, Inc.
*
* Licensed under the GNU Lesser General Public License as
* published by the Free Software Foundation; either version
* 2.1 of the License, or (at your option) any later version.
* You may obtain a copy of the License at
*
* http://www.gnu.org/licenses/lgpl.txt
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific
* language governing permissions and limitations under the
* License.
*/
package org.alfresco.web.bean.wizard;
import javax.faces.event.ActionEvent;
import org.alfresco.model.ContentModel;
import org.alfresco.web.app.AlfrescoNavigationHandler;
import org.alfresco.web.ui.common.Utils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
/**
* Backing bean for posting replies to forum articles.
*
* @author gavinc
*/
public class NewReplyWizard extends NewPostWizard
{
private static Log logger = LogFactory.getLog(NewReplyWizard.class);
/**
* @see org.alfresco.web.bean.wizard.AbstractWizardBean#startWizard(javax.faces.event.ActionEvent)
*/
@Override
public void startWizard(ActionEvent event)
{
super.startWizard(event);
// also setup the content in the browse bean
this.browseBean.setupContentAction(event);
}
/**
* @see org.alfresco.web.bean.wizard.AbstractWizardBean#finish()
*/
@Override
public String finish()
{
// remove link breaks and replace with <br/>
this.content = Utils.replaceLineBreaks(this.content);
super.finish();
return AlfrescoNavigationHandler.CLOSE_DIALOG_OUTCOME;
}
/**
* @see org.alfresco.web.bean.wizard.BaseContentWizard#performCustomProcessing()
*/
@Override
protected void performCustomProcessing()
{
if (this.editMode == false)
{
// setup the referencing aspect with the references association
// between the new post and the one being replied to
this.nodeService.addAspect(this.createdNode, ContentModel.ASPECT_REFERENCING, null);
this.nodeService.createAssociation(this.createdNode, this.browseBean.getDocument().getNodeRef(),
ContentModel.ASSOC_REFERENCES);
if (logger.isDebugEnabled())
{
logger.debug("created new node: " + this.createdNode);
logger.debug("existing node: " + this.browseBean.getDocument().getNodeRef());
}
}
}
/**
* @see org.alfresco.web.bean.wizard.AbstractWizardBean#cancel()
*/
@Override
public String cancel()
{
super.cancel();
return AlfrescoNavigationHandler.CLOSE_DIALOG_OUTCOME;
}
}