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.servlet.ServletContext;
import javax.transaction.UserTransaction;
import org.alfresco.error.AlfrescoRuntimeException;
import org.alfresco.model.ApplicationModel;
import org.alfresco.model.ContentModel;
import org.alfresco.repo.SessionUser;
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.cmr.repository.ChildAssociationRef;
import org.alfresco.service.cmr.repository.NodeRef;
@@ -215,18 +215,18 @@ public final class User implements SessionUser
*/
synchronized NodeRef getUserPreferencesRef(WebApplicationContext context)
{
ServiceRegistry registry = (ServiceRegistry)context.getBean("ServiceRegistry");
NodeService nodeService = registry.getNodeService();
SearchService searchService = registry.getSearchService();
NamespaceService namespaceService = registry.getNamespaceService();
ConfigurableService configurableService = (ConfigurableService)context.getBean("ConfigurableService");
UserTransaction txn = registry.getTransactionService().getUserTransaction();
NodeRef prefRef = null;
try
final ServiceRegistry registry = (ServiceRegistry) context.getBean("ServiceRegistry");
final NodeService nodeService = registry.getNodeService();
final SearchService searchService = registry.getSearchService();
final NamespaceService namespaceService = registry.getNamespaceService();
final ConfigurableService configurableService = (ConfigurableService) context.getBean("ConfigurableService");
RetryingTransactionHelper txnHelper = registry.getRetryingTransactionHelper();
return txnHelper.doInTransaction(new RetryingTransactionCallback<NodeRef>()
{
txn.begin();
public NodeRef execute() throws Throwable
{
NodeRef prefRef = null;
NodeRef person = getPerson();
if (nodeService.hasAspect(person, ApplicationModel.ASPECT_CONFIGURABLE) == false)
{
@@ -238,16 +238,12 @@ public final class User implements SessionUser
NodeRef configRef = configurableService.getConfigurationFolder(person);
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(
configRef,
xpath,
null,
namespaceService,
false);
List<NodeRef> nodes = searchService.selectNodes(configRef, xpath, null, namespaceService, false);
if (nodes.size() == 1)
{
@@ -256,24 +252,17 @@ public final class User implements SessionUser
else
{
// create the preferences Node for this user
ChildAssociationRef childRef = nodeService.createNode(
configRef,
ContentModel.ASSOC_CONTAINS,
QName.createQName(NamespaceService.APP_MODEL_1_0_URI, "preferences"),
ContentModel.TYPE_CMOBJECT);
ChildAssociationRef childRef = nodeService
.createNode(configRef, ContentModel.ASSOC_CONTAINS, QName.createQName(
NamespaceService.APP_MODEL_1_0_URI, "preferences"), 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