. Delete Website implemented

- removes staging store, preview stores and associated user stores before removing the website node itself
. Content Reviewer permissions definition fix
. Useful summary page info added to Create Website wizard

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/WCM-DEV2/root@4020 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Kevin Roast
2006-10-04 15:53:28 +00:00
parent 7116697960
commit a89f975503
3 changed files with 98 additions and 0 deletions

View File

@@ -0,0 +1,98 @@
package org.alfresco.web.bean.wcm;
import java.text.MessageFormat;
import java.util.List;
import javax.faces.context.FacesContext;
import org.alfresco.model.ContentModel;
import org.alfresco.service.cmr.avm.AVMService;
import org.alfresco.service.cmr.repository.ChildAssociationRef;
import org.alfresco.service.namespace.RegexQNamePattern;
import org.alfresco.web.app.Application;
import org.alfresco.web.bean.repository.Node;
import org.alfresco.web.bean.spaces.DeleteSpaceDialog;
/**
* Bean implementation for the "Delete Website" dialog.
* Removes all user stores and the main staging and preview stores.
*
* @author kevinr
*/
public class DeleteWebsiteDialog extends DeleteSpaceDialog
{
protected AVMService avmService;
// ------------------------------------------------------------------------------
// Bean property getters and setters
/**
* @param avmService The AVMService to set.
*/
public void setAvmService(AVMService avmService)
{
this.avmService = avmService;
}
// ------------------------------------------------------------------------------
// Dialog implementation
@Override
protected String finishImpl(FacesContext context, String outcome) throws Exception
{
Node websiteNode = this.browseBean.getActionSpace();
// delete all attached website sandboxes in reverse order to the layering
String storeRoot = (String)websiteNode.getProperties().get(ContentModel.PROP_AVMSTORE);
// get the list of users who have a sandbox in the website
int index = 0;
List<ChildAssociationRef> userInfoRefs = nodeService.getChildAssocs(
websiteNode.getNodeRef(), ContentModel.ASSOC_WEBUSER, RegexQNamePattern.MATCH_ALL);
for (ChildAssociationRef ref : userInfoRefs)
{
String username = (String)nodeService.getProperty(ref.getChildRef(), ContentModel.PROP_WEBUSERNAME);
// delete the preview store for this user
deleteStore(AVMConstants.buildAVMUserPreviewStoreName(storeRoot, username));
// delete the main store for this user
deleteStore(AVMConstants.buildAVMUserMainStoreName(storeRoot, username));
}
// remove the main staging and preview stores
deleteStore(AVMConstants.buildAVMStagingPreviewStoreName(storeRoot));
deleteStore(AVMConstants.buildAVMStagingStoreName(storeRoot));
// use the super implementation to delete the node itself
return super.finishImpl(context, outcome);
}
private void deleteStore(String store)
{
// check it exists before we try to remove it
if (this.avmService.getAVMStore(store) != null)
{
this.avmService.purgeAVMStore(store);
}
}
// ------------------------------------------------------------------------------
// 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_website_confirm");
return MessageFormat.format(fileConfirmMsg,
new Object[] {this.browseBean.getActionSpace().getName()});
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 635 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB