Merged V3.2 to HEAD

15596: Merged V3.1 to V3.2
        14017: Fix ETHREEOH-1880 - remove (double-)reverse of WCM staging snapshot order
        14112: Fix ETHREEOH-1758 - apply contributed patch
        14447: Merged V2.2 to V3.1
            14276: ETWOTWO-1224 / WCM-948 - browsing staging area during (commit of) large submit can cause AVMNotFoundException: Path /www/avm_webapps not found.
       14452: Add WCM services-based unit test for ETWOTWO-1224 / WCM-948
       14589: ETHREEOH-1646 - User Sandboxes aren't visible for Content Publisher
    15604: Merged V3.1 to V3.2
        14734: Merged V2.2 to V3.1
            14718: ETWOTWO-1244 - unable to revert some snapshots ("Does not exist: xxx")
        14852: Merged V2.2 to V3.1
            14720: ETWOTWO-1183 - "Show All Sandboxes" checkbox should only be visible for "Content Publisher" or "Content Manager"
        15032: Fix ETHREEOH-2240 - delete WCM web project (does not clean-up workflow sandboxes and also appears in archive store)
        15037: Fix ETHREEOH-2240 - follow-on for Alfresco Explorer's Manage (Review) Task Dialog
        15056: Fix ETHREEOH-2297 - WCM layered folder - problem deleting file
        15072: Minor - fix remote AVM test
    15605: Merged V3.1 to V3.2
        15082: Merged V2.2 to V3.1
            15081: AVM - add tests only
        15083: Fix ETHREEOH-2296 - user conflict when updating an AVM layered file
        15118: Merged V2.2 to V3.1
            15115: Fix ETWOTWO-1265 - WCM locking not working as expected (+ add WCM services test)
        15137: Fix ETHREEOH-2309 and ETHREEOH-227 - including refactor (& clean-up) of WCM-related actions
        15156: Fix ETHREEOH-2078 & ETHREEOH-2040 - WCM - deploy to localhost causes "Must have at least one store" errors
        15175: Fix ETHREEOH-2309 and ETHREEOH-227 - further clean-up of WCM submit/undo actions (for consistency)
        15190: Minor: message updates for WCM submit/undo actions


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@16858 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Jan Vonka
2009-10-13 11:34:23 +00:00
parent 69f987c456
commit 2eeefe0a72
33 changed files with 2983 additions and 323 deletions

View File

@@ -46,6 +46,7 @@ import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork;
import org.alfresco.repo.security.permissions.AccessDeniedException;
import org.alfresco.repo.transaction.AlfrescoTransactionSupport;
import org.alfresco.repo.transaction.TransactionListenerAdapter;
import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback;
import org.alfresco.service.cmr.avm.AVMNodeDescriptor;
import org.alfresco.service.cmr.avm.AVMNotFoundException;
import org.alfresco.service.cmr.avm.AVMService;
@@ -66,6 +67,7 @@ import org.alfresco.service.cmr.security.PersonService;
import org.alfresco.service.namespace.NamespaceService;
import org.alfresco.service.namespace.QName;
import org.alfresco.service.namespace.RegexQNamePattern;
import org.alfresco.service.transaction.TransactionService;
import org.alfresco.util.DNSNameMangler;
import org.alfresco.util.ParameterCheck;
import org.alfresco.wcm.preview.PreviewURIServiceRegistry;
@@ -101,10 +103,10 @@ public class WebProjectServiceImpl extends WCMUtil implements WebProjectService
private AuthorityService authorityService;
private PermissionService permissionService;
private PersonService personService;
private SandboxFactory sandboxFactory;
private VirtServerRegistry virtServerRegistry;
private PreviewURIServiceRegistry previewURIProviderRegistry;
private TransactionService transactionService;
public void setNodeService(NodeService nodeService)
{
@@ -156,6 +158,11 @@ public class WebProjectServiceImpl extends WCMUtil implements WebProjectService
this.previewURIProviderRegistry = previewURIProviderRegistry;
}
public void setTransactionService(TransactionService transactionService)
{
this.transactionService = transactionService;
}
/* (non-Javadoc)
* @see org.alfresco.wcm.WebProjectService#createWebProject(java.lang.String, java.lang.String, java.lang.String, java.lang.String)
*/
@@ -704,7 +711,7 @@ public class WebProjectServiceImpl extends WCMUtil implements WebProjectService
if (wpStoreId != null)
{
// Notifiy virtualization server about removing this website
// Notify virtualization server about removing this website
//
// Implementation note:
//
@@ -728,33 +735,61 @@ public class WebProjectServiceImpl extends WCMUtil implements WebProjectService
String path = WCMUtil.buildStoreWebappPath(sandbox, "/ROOT");
WCMUtil.removeAllVServerWebapps(virtServerRegistry, path, true);
AuthenticationUtil.runAs(new RunAsWork<Object>()
{
public Object doWork() throws Exception
{
List<SandboxInfo> sbInfos = sandboxFactory.listAllSandboxes(wpStoreId);
for (SandboxInfo sbInfo : sbInfos)
{
// delete sandbox
sandboxFactory.deleteSandbox(sbInfo.getSandboxId());
}
// TODO delete workflow sandboxes !
// delete the web project node itself
nodeService.deleteNode(wpNodeRef);
sandboxFactory.removeGroupsForStore(sandbox);
return null;
}
}, AuthenticationUtil.getSystemUserName());
if (logger.isInfoEnabled())
try
{
logger.info("Deleted web project: " + wpNodeRef + " (store id: " + wpStoreId + ")");
RetryingTransactionCallback<Object> deleteWebProjectWork = new RetryingTransactionCallback<Object>()
{
public Object execute() throws Throwable
{
AuthenticationUtil.runAs(new RunAsWork<Object>()
{
public Object doWork() throws Exception
{
List<SandboxInfo> sbInfos = sandboxFactory.listAllSandboxes(wpStoreId, true, true);
for (SandboxInfo sbInfo : sbInfos)
{
String sbStoreId = sbInfo.getSandboxId();
if (WCMUtil.isLocalhostDeployedStore(wpStoreId, sbStoreId))
{
if (getWebProject(WCMUtil.getWebProjectStoreId(sbStoreId)) != null)
{
continue;
}
}
// delete sandbox (and associated preview sandbox, if it exists)
sandboxFactory.deleteSandbox(wpStoreId, sbInfo.getSandboxId());
}
StoreRef archiveStoreRef = nodeService.getStoreArchiveNode(wpNodeRef.getStoreRef()).getStoreRef();
// delete the web project node itself
nodeService.deleteNode(wpNodeRef);
nodeService.deleteNode(new NodeRef(archiveStoreRef, wpNodeRef.getId()));
sandboxFactory.removeGroupsForStore(sandbox);
return null;
}
}, AuthenticationUtil.getSystemUserName());
return null;
}
};
transactionService.getRetryingTransactionHelper().doInTransaction(deleteWebProjectWork);
if (logger.isInfoEnabled())
{
logger.info("Deleted web project: " + wpNodeRef + " (store id: " + wpStoreId + ")");
}
}
catch (Throwable err)
{
throw new AlfrescoRuntimeException("Failed to delete web project: ", err);
}
}
}