mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
- WARNING: this change requires a new DB as the WCM model has changed significantly, yes I have probably broken a few WCM things :) Previously the following statements were true: - Most of the model constants were defined in the ContentModel class - including web-client Application specific model items - WCMModel class was a mix of WCM repository and WCM application model constants - The applicationModel.xml definition file contained both web-client Application and WCM application model definitions - The wcmModel.xml definition file contained both WCM repository and WCM application model definitions The following statements are now true: - All web-client application specific model constants have been moved from ContentModel to a new model constants class ApplicationModel - A new WCM application model has been defined with the prefix "wca" and URI: http://www.alfresco.org/model/wcmappmodel/1.0 - All WCM application specific model constants have been renamed/moved from ContentModel/WCMModel to a new model constants class WCMAppModel - The mix of WCM application specific model definitions in contentModel.xml and applicationModel.xml has been moved to a new definition file wcmAppModel.xml - A patch is not required for standard Alfresco as only WCM definitions have actually changed . Fix to issue created during workflow id/name refactor . Fix to allow forms in the Available Content Forms panel to have correct sandbox/username context for action dialog git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/WCM-DEV2/root@4448 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
106 lines
3.5 KiB
Java
106 lines
3.5 KiB
Java
package org.alfresco.web.bean.wcm;
|
|
|
|
import java.text.MessageFormat;
|
|
import java.util.List;
|
|
|
|
import javax.faces.context.FacesContext;
|
|
|
|
import org.alfresco.model.WCMAppModel;
|
|
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
|
|
|
|
/**
|
|
* @see org.alfresco.web.bean.dialog.BaseDialogBean#finishImpl(javax.faces.context.FacesContext, java.lang.String)
|
|
*/
|
|
@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(WCMAppModel.PROP_AVMSTORE);
|
|
|
|
// get the list of users who have a sandbox in the website
|
|
List<ChildAssociationRef> userInfoRefs = nodeService.getChildAssocs(
|
|
websiteNode.getNodeRef(), WCMAppModel.ASSOC_WEBUSER, RegexQNamePattern.MATCH_ALL);
|
|
for (ChildAssociationRef ref : userInfoRefs)
|
|
{
|
|
String username = (String)nodeService.getProperty(ref.getChildRef(), WCMAppModel.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);
|
|
}
|
|
|
|
/**
|
|
* Delete a store, checking for its existance first.
|
|
*
|
|
* @param store
|
|
*/
|
|
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()});
|
|
}
|
|
}
|