mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
- Converted delete content, delete space and all forum item deletes to use the new dialog framework
- Removed old JSPs (AWC-748) git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@3364 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
100
source/java/org/alfresco/web/bean/spaces/DeleteSpaceDialog.java
Normal file
100
source/java/org/alfresco/web/bean/spaces/DeleteSpaceDialog.java
Normal file
@@ -0,0 +1,100 @@
|
||||
package org.alfresco.web.bean.spaces;
|
||||
|
||||
import java.text.MessageFormat;
|
||||
|
||||
import javax.faces.application.FacesMessage;
|
||||
import javax.faces.context.FacesContext;
|
||||
|
||||
import org.alfresco.web.app.AlfrescoNavigationHandler;
|
||||
import org.alfresco.web.app.Application;
|
||||
import org.alfresco.web.bean.content.DeleteContentDialog;
|
||||
import org.alfresco.web.bean.dialog.BaseDialogBean;
|
||||
import org.alfresco.web.bean.repository.Node;
|
||||
import org.alfresco.web.ui.common.Utils;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
/**
|
||||
* Bean implementation for the "Delete Space" dialog
|
||||
*
|
||||
* @author gavinc
|
||||
*/
|
||||
public class DeleteSpaceDialog 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 space to delete
|
||||
Node node = this.browseBean.getActionSpace();
|
||||
if (node != null)
|
||||
{
|
||||
if (logger.isDebugEnabled())
|
||||
logger.debug("Trying to delete space: " + node.getId());
|
||||
|
||||
this.nodeService.deleteNode(node.getNodeRef());
|
||||
}
|
||||
else
|
||||
{
|
||||
logger.warn("WARNING: delete called without a current Space!");
|
||||
}
|
||||
|
||||
return outcome;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String doPostCommitProcessing(FacesContext context, String outcome)
|
||||
{
|
||||
Node node = this.browseBean.getActionSpace();
|
||||
|
||||
// remove this node from the breadcrumb if required
|
||||
this.browseBean.removeSpaceFromBreadcrumb(node);
|
||||
|
||||
// add a message to inform the user that the delete was OK
|
||||
String statusMsg = MessageFormat.format(
|
||||
Application.getMessage(FacesContext.getCurrentInstance(), "status_space_deleted"),
|
||||
new Object[]{node.getName()});
|
||||
Utils.addStatusMessage(FacesMessage.SEVERITY_INFO, statusMsg);
|
||||
|
||||
// clear action context
|
||||
this.browseBean.setActionSpace(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_space";
|
||||
}
|
||||
|
||||
@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_space_confirm");
|
||||
|
||||
return MessageFormat.format(fileConfirmMsg,
|
||||
new Object[] {this.browseBean.getActionSpace().getName()});
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user