mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
. 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:
@@ -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()});
|
||||
}
|
||||
}
|
BIN
source/web/images/icons/delete_website.gif
Normal file
BIN
source/web/images/icons/delete_website.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 635 B |
BIN
source/web/images/icons/delete_website_large.gif
Normal file
BIN
source/web/images/icons/delete_website_large.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.6 KiB |
Reference in New Issue
Block a user