mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-09-17 14:21:39 +00:00
Tidy up of UserTransaction roll back on throwable as opposed to Exception
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@2218 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -40,6 +40,8 @@ import org.alfresco.service.transaction.TransactionService;
|
|||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
import org.apache.commons.logging.LogFactory;
|
import org.apache.commons.logging.LogFactory;
|
||||||
|
|
||||||
|
import com.sun.star.uno.RuntimeException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Alfresco Authenticator Class
|
* Alfresco Authenticator Class
|
||||||
*
|
*
|
||||||
@@ -351,7 +353,7 @@ public class AlfrescoAuthenticator extends SrvAuthenticator
|
|||||||
client.setHomeFolder( homeSpaceRef);
|
client.setHomeFolder( homeSpaceRef);
|
||||||
tx.commit();
|
tx.commit();
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Throwable ex)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -359,7 +361,16 @@ public class AlfrescoAuthenticator extends SrvAuthenticator
|
|||||||
}
|
}
|
||||||
catch (Exception ex2)
|
catch (Exception ex2)
|
||||||
{
|
{
|
||||||
logger.error("Failed to rollback transaction", ex);
|
logger.error("Failed to rollback transaction", ex2);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(ex instanceof RuntimeException)
|
||||||
|
{
|
||||||
|
throw (RuntimeException)ex;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
throw new RuntimeException("Failed to get home folder", ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -135,22 +135,34 @@ public class RepositoryAuthenticationDao implements MutableAuthenticationDao
|
|||||||
sp.addStore(getUserStoreRef());
|
sp.addStore(getUserStoreRef());
|
||||||
sp.excludeDataInTheCurrentTransaction(false);
|
sp.excludeDataInTheCurrentTransaction(false);
|
||||||
|
|
||||||
ResultSet rs = searchService.query(sp);
|
ResultSet rs = null;
|
||||||
|
|
||||||
for (ResultSetRow row : rs)
|
try
|
||||||
{
|
{
|
||||||
|
rs = searchService.query(sp);
|
||||||
|
|
||||||
NodeRef nodeRef = row.getNodeRef();
|
for (ResultSetRow row : rs)
|
||||||
if (nodeService.exists(nodeRef))
|
|
||||||
{
|
{
|
||||||
String realUserName = DefaultTypeConverter.INSTANCE.convert(String.class, nodeService.getProperty(
|
|
||||||
nodeRef, ContentModel.PROP_USER_USERNAME));
|
NodeRef nodeRef = row.getNodeRef();
|
||||||
if (realUserName.equals(userName))
|
if (nodeService.exists(nodeRef))
|
||||||
{
|
{
|
||||||
return nodeRef;
|
String realUserName = DefaultTypeConverter.INSTANCE.convert(String.class, nodeService.getProperty(
|
||||||
|
nodeRef, ContentModel.PROP_USER_USERNAME));
|
||||||
|
if (realUserName.equals(userName))
|
||||||
|
{
|
||||||
|
return nodeRef;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
if (rs != null)
|
||||||
|
{
|
||||||
|
rs.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@@ -134,23 +134,35 @@ public class PersonServiceImpl implements PersonService
|
|||||||
sp.addStore(storeRef);
|
sp.addStore(storeRef);
|
||||||
sp.excludeDataInTheCurrentTransaction(false);
|
sp.excludeDataInTheCurrentTransaction(false);
|
||||||
|
|
||||||
ResultSet rs = searchService.query(sp);
|
ResultSet rs = null;
|
||||||
|
|
||||||
for (ResultSetRow row : rs)
|
try
|
||||||
{
|
{
|
||||||
|
rs = searchService.query(sp);
|
||||||
|
|
||||||
NodeRef nodeRef = row.getNodeRef();
|
for (ResultSetRow row : rs)
|
||||||
if (nodeService.exists(nodeRef))
|
|
||||||
{
|
{
|
||||||
String realUserName = DefaultTypeConverter.INSTANCE.convert(String.class, nodeService.getProperty(
|
|
||||||
nodeRef, ContentModel.PROP_USERNAME));
|
NodeRef nodeRef = row.getNodeRef();
|
||||||
realUserName = userNamesAreCaseSensitive ? realUserName : realUserName.toLowerCase();
|
if (nodeService.exists(nodeRef))
|
||||||
if (realUserName.equals(userName))
|
|
||||||
{
|
{
|
||||||
return nodeRef;
|
String realUserName = DefaultTypeConverter.INSTANCE.convert(String.class, nodeService.getProperty(
|
||||||
|
nodeRef, ContentModel.PROP_USERNAME));
|
||||||
|
realUserName = userNamesAreCaseSensitive ? realUserName : realUserName.toLowerCase();
|
||||||
|
if (realUserName.equals(userName))
|
||||||
|
{
|
||||||
|
return nodeRef;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
if (rs != null)
|
||||||
|
{
|
||||||
|
rs.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -214,7 +226,7 @@ public class PersonServiceImpl implements PersonService
|
|||||||
{
|
{
|
||||||
return getCompanyHome();
|
return getCompanyHome();
|
||||||
}
|
}
|
||||||
|
|
||||||
public NodeRef createPerson(Map<QName, Serializable> properties)
|
public NodeRef createPerson(Map<QName, Serializable> properties)
|
||||||
{
|
{
|
||||||
String caseSensitiveUserName = DefaultTypeConverter.INSTANCE.convert(String.class, properties
|
String caseSensitiveUserName = DefaultTypeConverter.INSTANCE.convert(String.class, properties
|
||||||
@@ -283,23 +295,35 @@ public class PersonServiceImpl implements PersonService
|
|||||||
{
|
{
|
||||||
SearchParameters sp = new SearchParameters();
|
SearchParameters sp = new SearchParameters();
|
||||||
sp.setLanguage(SearchService.LANGUAGE_LUCENE);
|
sp.setLanguage(SearchService.LANGUAGE_LUCENE);
|
||||||
sp.setQuery("TYPE:\"" + ContentModel.TYPE_PERSON+"\"");
|
sp.setQuery("TYPE:\"" + ContentModel.TYPE_PERSON + "\"");
|
||||||
sp.addStore(storeRef);
|
sp.addStore(storeRef);
|
||||||
sp.excludeDataInTheCurrentTransaction(false);
|
sp.excludeDataInTheCurrentTransaction(false);
|
||||||
|
|
||||||
ResultSet rs = searchService.query(sp);
|
|
||||||
|
|
||||||
HashSet<NodeRef> nodes = new HashSet<NodeRef>();
|
HashSet<NodeRef> nodes = new HashSet<NodeRef>();
|
||||||
for (ResultSetRow row : rs)
|
ResultSet rs = null;
|
||||||
{
|
|
||||||
|
|
||||||
NodeRef nodeRef = row.getNodeRef();
|
try
|
||||||
if (nodeService.exists(nodeRef))
|
{
|
||||||
|
rs = searchService.query(sp);
|
||||||
|
|
||||||
|
|
||||||
|
for (ResultSetRow row : rs)
|
||||||
{
|
{
|
||||||
nodes.add(nodeRef);
|
|
||||||
|
NodeRef nodeRef = row.getNodeRef();
|
||||||
|
if (nodeService.exists(nodeRef))
|
||||||
|
{
|
||||||
|
nodes.add(nodeRef);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
if (rs != null)
|
||||||
|
{
|
||||||
|
rs.close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return nodes;
|
return nodes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user