mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
jndi-client and catalina-virtual that I introduced earlier. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/WCM-DEV2/root@3393 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
88 lines
2.4 KiB
Java
88 lines
2.4 KiB
Java
package org.alfresco.web.bean.content;
|
|
|
|
import java.text.MessageFormat;
|
|
|
|
import javax.faces.context.FacesContext;
|
|
|
|
import org.alfresco.web.app.AlfrescoNavigationHandler;
|
|
import org.alfresco.web.app.Application;
|
|
import org.alfresco.web.bean.dialog.BaseDialogBean;
|
|
import org.alfresco.web.bean.repository.Node;
|
|
import org.apache.commons.logging.Log;
|
|
import org.apache.commons.logging.LogFactory;
|
|
|
|
/**
|
|
* Bean implementation for the "Delete Content" dialog
|
|
*
|
|
* @author gavinc
|
|
*/
|
|
public class DeleteContentDialog extends BaseDialogBean
|
|
{
|
|
private static final Log logger = LogFactory.getLog(DeleteContentDialog.class);
|
|
|
|
// ------------------------------------------------------------------------------
|
|
// Dialog implementation
|
|
|
|
@Override
|
|
protected String finishImpl(FacesContext context, String outcome)
|
|
throws Exception
|
|
{
|
|
// get the content to delete
|
|
Node node = this.browseBean.getDocument();
|
|
if (node != null)
|
|
{
|
|
if (logger.isDebugEnabled())
|
|
logger.debug("Trying to delete content node: " + node.getId());
|
|
|
|
// delete the node
|
|
this.nodeService.deleteNode(node.getNodeRef());
|
|
}
|
|
else
|
|
{
|
|
logger.warn("WARNING: delete called without a current Document!");
|
|
}
|
|
|
|
return outcome;
|
|
}
|
|
|
|
@Override
|
|
protected String doPostCommitProcessing(FacesContext context, String outcome)
|
|
{
|
|
// clear action context
|
|
this.browseBean.setDocument(null);
|
|
|
|
// setting the outcome will show the browse view again
|
|
return AlfrescoNavigationHandler.CLOSE_DIALOG_OUTCOME +
|
|
AlfrescoNavigationHandler.OUTCOME_SEPARATOR + "browse";
|
|
}
|
|
|
|
@Override
|
|
protected String getErrorMessageId()
|
|
{
|
|
return "error_delete_file";
|
|
}
|
|
|
|
@Override
|
|
public boolean getFinishButtonDisabled()
|
|
{
|
|
return false;
|
|
}
|
|
|
|
// ------------------------------------------------------------------------------
|
|
// Bean Getters and Setters
|
|
|
|
/**
|
|
* Returns the confirmation to display to the user before deleting the content.
|
|
*
|
|
* @return The formatted message to display
|
|
*/
|
|
public String getConfirmMessage()
|
|
{
|
|
String fileConfirmMsg = Application.getMessage(FacesContext.getCurrentInstance(),
|
|
"delete_file_confirm");
|
|
|
|
return MessageFormat.format(fileConfirmMsg,
|
|
new Object[] {this.browseBean.getDocument().getName()});
|
|
}
|
|
}
|