From ecadace15f323675655b3779a63ed2581934d7a8 Mon Sep 17 00:00:00 2001 From: Mark Rogers Date: Wed, 30 Apr 2014 16:21:29 +0000 Subject: [PATCH] Merged HEAD-BUG-FIX (4.3/Cloud) to HEAD (4.3/Cloud) 68161: Merged V4.2-BUG-FIX (4.2.3) to HEAD-BUG-FIX (4.3/Cloud) 67875: Merged V4.1-BUG-FIX (4.1.9) to V4.2-BUG-FIX (4.2.3) 67795: Merged DEV to V4.1-BUG-FIX (4.1.9) 67728: MNT-11251: Impossible to upload/create content when lifecycle workflow is deployed 'org.alfresco.web.bean.content.BaseContentWizard.getObjectTypes()' has been wrapped with retrying transaction to avoid not transactional invocations of dictionary methods which access the repository git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@68443 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261 --- .../web/bean/content/BaseContentWizard.java | 31 +++++++++++++++++-- 1 file changed, 28 insertions(+), 3 deletions(-) diff --git a/source/java/org/alfresco/web/bean/content/BaseContentWizard.java b/source/java/org/alfresco/web/bean/content/BaseContentWizard.java index 6237fc6620..05a6c3dfe2 100644 --- a/source/java/org/alfresco/web/bean/content/BaseContentWizard.java +++ b/source/java/org/alfresco/web/bean/content/BaseContentWizard.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2005-2010 Alfresco Software Limited. + * Copyright (C) 2005-2014 Alfresco Software Limited. * * This file is part of Alfresco * @@ -30,6 +30,7 @@ import javax.faces.model.SelectItem; import org.alfresco.model.ApplicationModel; import org.alfresco.model.ContentModel; +import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback; import org.alfresco.service.ServiceRegistry; import org.alfresco.service.cmr.dictionary.TypeDefinition; import org.alfresco.service.cmr.repository.ContentService; @@ -38,6 +39,7 @@ import org.alfresco.service.cmr.repository.MimetypeService; import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.service.namespace.NamespaceService; import org.alfresco.service.namespace.QName; +import org.alfresco.service.transaction.TransactionService; import org.alfresco.web.app.Application; import org.alfresco.web.bean.repository.Repository; import org.alfresco.web.bean.wizard.BaseWizardBean; @@ -74,6 +76,7 @@ public abstract class BaseContentWizard extends BaseWizardBean protected NodeRef createdNode; protected List objectTypes; transient private ContentService contentService; + transient private TransactionService transactionService; protected static final String MSG_NODE_LOCKED = "node_locked_dialog_closed"; @@ -291,11 +294,23 @@ public abstract class BaseContentWizard extends BaseWizardBean { return UICharsetSelector.getCharsetEncodingList(); } - + /** * @return Returns a list of object types to allow the user to select from */ public List getObjectTypes() + { + return getTransactionService().getRetryingTransactionHelper().doInTransaction(new RetryingTransactionCallback>() + { + @Override + public List execute() throws Throwable + { + return getObjectTypesImpl(); + } + }, true); + } + + private List getObjectTypesImpl() { if ((this.objectTypes == null) || (Application.isDynamicConfig(FacesContext.getCurrentInstance()))) { @@ -442,7 +457,17 @@ public abstract class BaseContentWizard extends BaseWizardBean } return contentService; } - + + protected TransactionService getTransactionService() + { + if (null == transactionService) + { + transactionService = Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getTransactionService(); + } + + return transactionService; + } + // ------------------------------------------------------------------------------ // Helper methods