Merged V3.0 to HEAD

12185: Fix 3.0 SP1 installation on non-Oracle databases. Removed creation of indexes in AlfrescoPostCreate-2.2-MappedFKIndexes.sql that were also in AlfrescoPostCreate-2.2-Extra.sql
  12186: Performance improvements to HibernateNodeDaoServiceImpl
  12188: Multi user tests: enable graceful web script recovery on optimistic locking failure (...)
  12191: Improve Javascript execution performance in Web Scripts & Improve error presentation (...) thrown by JavaScript
  12192: Share performance improvements: stop AbstractFeedGenerator from 'choking' the repository with too many web script requests
  12193: Multi user testing: don't suppress all exceptions during Wiki Move.
  12194: Multi user testing. Don't suppress all runtime exceptions in script site node object.
  12195: Multi user testing. Convert User bean object to use a retrying transaction so that optimistic locking failures are handled.
  12196: Multi user testing: Configuration changes to support concurrent access by 20 users


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@12522 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Jan Vonka
2008-12-19 17:44:01 +00:00
parent 155190be25
commit 0926251645

View File

@@ -30,13 +30,13 @@ import java.util.Map;
import javax.faces.context.FacesContext; import javax.faces.context.FacesContext;
import javax.servlet.ServletContext; import javax.servlet.ServletContext;
import javax.transaction.UserTransaction;
import org.alfresco.error.AlfrescoRuntimeException;
import org.alfresco.model.ApplicationModel; import org.alfresco.model.ApplicationModel;
import org.alfresco.model.ContentModel; import org.alfresco.model.ContentModel;
import org.alfresco.repo.SessionUser; import org.alfresco.repo.SessionUser;
import org.alfresco.repo.configuration.ConfigurableService; import org.alfresco.repo.configuration.ConfigurableService;
import org.alfresco.repo.transaction.RetryingTransactionHelper;
import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback;
import org.alfresco.service.ServiceRegistry; import org.alfresco.service.ServiceRegistry;
import org.alfresco.service.cmr.repository.ChildAssociationRef; import org.alfresco.service.cmr.repository.ChildAssociationRef;
import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.service.cmr.repository.NodeRef;
@@ -214,66 +214,55 @@ public final class User implements SessionUser
* Utilises the 'configurable' aspect on the Person linked to this user. * Utilises the 'configurable' aspect on the Person linked to this user.
*/ */
synchronized NodeRef getUserPreferencesRef(WebApplicationContext context) synchronized NodeRef getUserPreferencesRef(WebApplicationContext context)
{ {
ServiceRegistry registry = (ServiceRegistry)context.getBean("ServiceRegistry"); final ServiceRegistry registry = (ServiceRegistry) context.getBean("ServiceRegistry");
NodeService nodeService = registry.getNodeService(); final NodeService nodeService = registry.getNodeService();
SearchService searchService = registry.getSearchService(); final SearchService searchService = registry.getSearchService();
NamespaceService namespaceService = registry.getNamespaceService(); final NamespaceService namespaceService = registry.getNamespaceService();
ConfigurableService configurableService = (ConfigurableService)context.getBean("ConfigurableService"); final ConfigurableService configurableService = (ConfigurableService) context.getBean("ConfigurableService");
UserTransaction txn = registry.getTransactionService().getUserTransaction(); RetryingTransactionHelper txnHelper = registry.getRetryingTransactionHelper();
return txnHelper.doInTransaction(new RetryingTransactionCallback<NodeRef>()
NodeRef prefRef = null; {
try
{ public NodeRef execute() throws Throwable
txn.begin(); {
NodeRef prefRef = null;
NodeRef person = getPerson(); NodeRef person = getPerson();
if (nodeService.hasAspect(person, ApplicationModel.ASPECT_CONFIGURABLE) == false) if (nodeService.hasAspect(person, ApplicationModel.ASPECT_CONFIGURABLE) == false)
{ {
// create the configuration folder for this Person node // create the configuration folder for this Person node
configurableService.makeConfigurable(person); configurableService.makeConfigurable(person);
} }
// target of the assoc is the configurations folder ref // target of the assoc is the configurations folder ref
NodeRef configRef = configurableService.getConfigurationFolder(person); NodeRef configRef = configurableService.getConfigurationFolder(person);
if (configRef == null) if (configRef == null)
{ {
throw new IllegalStateException("Unable to find associated 'configurations' folder for node: " + person); throw new IllegalStateException("Unable to find associated 'configurations' folder for node: "
} + person);
}
String xpath = NamespaceService.APP_MODEL_PREFIX + ":" + "preferences";
List<NodeRef> nodes = searchService.selectNodes( String xpath = NamespaceService.APP_MODEL_PREFIX + ":" + "preferences";
configRef, List<NodeRef> nodes = searchService.selectNodes(configRef, xpath, null, namespaceService, false);
xpath,
null, if (nodes.size() == 1)
namespaceService, {
false); prefRef = nodes.get(0);
}
if (nodes.size() == 1) else
{ {
prefRef = nodes.get(0); // create the preferences Node for this user
} ChildAssociationRef childRef = nodeService
else .createNode(configRef, ContentModel.ASSOC_CONTAINS, QName.createQName(
{ NamespaceService.APP_MODEL_1_0_URI, "preferences"), ContentModel.TYPE_CMOBJECT);
// create the preferences Node for this user
ChildAssociationRef childRef = nodeService.createNode( prefRef = childRef.getChildRef();
configRef,
ContentModel.ASSOC_CONTAINS, }
QName.createQName(NamespaceService.APP_MODEL_1_0_URI, "preferences"), return prefRef;
ContentModel.TYPE_CMOBJECT); }
});
prefRef = childRef.getChildRef(); }
}
txn.commit();
}
catch (Throwable err)
{
try { txn.rollback(); } catch (Exception tex) {}
throw new AlfrescoRuntimeException("Error during getUserPreferencesRef(): " + err.getMessage(), err);
}
return prefRef;
}
/** /**
* Returns the full name of the user represented by the given NodeRef * Returns the full name of the user represented by the given NodeRef