Files
alfresco-community-repo/source/java/org/alfresco/web/bean/wcm/DeleteWebsiteDialog.java
Ariel Backenroth 15733b9771 putting jon's change from last night back in and fixing mostly everything (i know of) that it broke
- added utility methods to AVMConstants to extract information about stores from their names.  this has to be reimplemented to look at store properties rather than inferring things from their names - but it works for now.  this also centralizes all the usage of the store name to infer data about it so it'll make it easier later.
- made the problematic constants jon changed private to avoid having this problem happen again
- checked pretty much every usage of buildAVM<bla> to ensure that nothing else was broken.  in the process removed the AVM part from the buildAVM<bla> part of the method to shorten it and since it's redundant with the classname AVMConstants in which their contained.

creating workflow sandboxes in a manner consistent with user sandboxes
- added a method to SandboxFactory to create workflow sandboxes. they're created with the name <storeId>--workflow-<guid>
- centralized workflow package creation code in AVMWorkflowUtil.
- refactored sandbox creation code to use new utility methods in AVMConstants and so that at some point it can be further refactored.
 
getting avm actions to show up in manage task screen for avm workflows
- modified the model to use different packageItemActionGroups for wcm workflows
- modified the AVMWorkflowEvaluator to allow all actions for items in a workflow package
- added some debug output to various classes
- made wcm navigation ids exposed throughout the app since they are now called from workflow jsps.

things that now work that didn't before:
- virtualization now works again with jon's new naming scheme
- some actions from the manage task screen.

known bugs introduced or remaining as a consequence of this change (i'll filed jira issues for these as soon as i commit this):
- i'm inaccurately counting the number of users in a sandbox since it's harder now to differentiate between user main sandboxes and all the other ones that are being created
- preview does not work on assets within the workflow sandboxes
- review and approve workflow does not appear to actually submit once approved.  not sure if it did before
- lots of actions still do not work from manage tasks, though edit does appear to.
- i commented out the location column in the manage task screen since the path link was causing me troubles - need to put that back in.

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@4692 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
2006-12-23 01:44:19 +00:00

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.buildUserPreviewStoreName(storeRoot, username));
// delete the main store for this user
deleteStore(AVMConstants.buildUserMainStoreName(storeRoot, username));
}
// remove the main staging and preview stores
deleteStore(AVMConstants.buildStagingPreviewStoreName(storeRoot));
deleteStore(AVMConstants.buildStagingStoreName(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.getStore(store) != null)
{
this.avmService.purgeStore(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()});
}
}