mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-24 17:32:48 +00:00
Merged V2.2 to HEAD
8105: Fix for AR-1828 - multiple users being created from web siteregistration 8107: Merged V2.1 to v2.2 8106: Fixed fallout from MetadataExtractors setting properties to thecorrect data type 8109: Fix for AR-2016 8119: AR-1778: putContent method in the ContentUtils class fail to upload*.java, *.txt, *.xml 8120: AR-1895: fix to web service SDK sample 8125: Test added to prevent regression of AR-1707 8126: Enhanced exception message when non-marking InputStream is used. 8131: Merged V2.1 to V2.2 8129: Merged V1.4 to V2.1: 8128: Fix AR-2041: NPE checking voids during index tracking 8140: AR-1762 - correct generation of download servlet URL git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@8477 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -89,7 +89,10 @@
|
|||||||
</property>
|
</property>
|
||||||
<property name="searchService">
|
<property name="searchService">
|
||||||
<ref bean="admSearchService" />
|
<ref bean="admSearchService" />
|
||||||
</property>
|
</property>
|
||||||
|
<property name="retryingTransactionHelper">
|
||||||
|
<ref bean="retryingTransactionHelper"/>
|
||||||
|
</property>
|
||||||
<property name="userNamesAreCaseSensitive">
|
<property name="userNamesAreCaseSensitive">
|
||||||
<value>${user.name.caseSensitive}</value>
|
<value>${user.name.caseSensitive}</value>
|
||||||
</property>
|
</property>
|
||||||
|
@@ -65,6 +65,17 @@
|
|||||||
server.ipAddress = :ipAddress
|
server.ipAddress = :ipAddress
|
||||||
</query>
|
</query>
|
||||||
|
|
||||||
|
<query name="txn.GetTxnById">
|
||||||
|
select
|
||||||
|
txn
|
||||||
|
from
|
||||||
|
org.alfresco.repo.domain.hibernate.TransactionImpl as txn
|
||||||
|
where
|
||||||
|
txn.id = :txnId
|
||||||
|
order by
|
||||||
|
txn.commitTimeMs
|
||||||
|
</query>
|
||||||
|
|
||||||
<query name="txn.GetTxnsByCommitTimeAsc">
|
<query name="txn.GetTxnsByCommitTimeAsc">
|
||||||
<![CDATA[
|
<![CDATA[
|
||||||
select
|
select
|
||||||
|
@@ -1515,6 +1515,7 @@ public class HibernateNodeDaoServiceImpl extends HibernateDaoSupport implements
|
|||||||
/*
|
/*
|
||||||
* Queries for transactions
|
* Queries for transactions
|
||||||
*/
|
*/
|
||||||
|
private static final String QUERY_GET_TXN_BY_ID = "txn.GetTxnById";
|
||||||
private static final String QUERY_GET_TXNS_BY_COMMIT_TIME_ASC = "txn.GetTxnsByCommitTimeAsc";
|
private static final String QUERY_GET_TXNS_BY_COMMIT_TIME_ASC = "txn.GetTxnsByCommitTimeAsc";
|
||||||
private static final String QUERY_GET_TXNS_BY_COMMIT_TIME_DESC = "txn.GetTxnsByCommitTimeDesc";
|
private static final String QUERY_GET_TXNS_BY_COMMIT_TIME_DESC = "txn.GetTxnsByCommitTimeDesc";
|
||||||
private static final String QUERY_GET_TXN_UPDATE_COUNT_FOR_STORE = "txn.GetTxnUpdateCountForStore";
|
private static final String QUERY_GET_TXN_UPDATE_COUNT_FOR_STORE = "txn.GetTxnUpdateCountForStore";
|
||||||
@@ -1523,9 +1524,21 @@ public class HibernateNodeDaoServiceImpl extends HibernateDaoSupport implements
|
|||||||
private static final String QUERY_GET_TXN_CHANGES_FOR_STORE = "txn.GetTxnChangesForStore";
|
private static final String QUERY_GET_TXN_CHANGES_FOR_STORE = "txn.GetTxnChangesForStore";
|
||||||
private static final String QUERY_GET_TXN_CHANGES = "txn.GetTxnChanges";
|
private static final String QUERY_GET_TXN_CHANGES = "txn.GetTxnChanges";
|
||||||
|
|
||||||
public Transaction getTxnById(long txnId)
|
public Transaction getTxnById(final long txnId)
|
||||||
{
|
{
|
||||||
return (Transaction) getSession().get(TransactionImpl.class, new Long(txnId));
|
HibernateCallback callback = new HibernateCallback()
|
||||||
|
{
|
||||||
|
public Object doInHibernate(Session session)
|
||||||
|
{
|
||||||
|
Query query = session.getNamedQuery(QUERY_GET_TXN_BY_ID);
|
||||||
|
query.setLong("txnId", txnId)
|
||||||
|
.setReadOnly(true);
|
||||||
|
return query.uniqueResult();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
Transaction txn = (Transaction) getHibernateTemplate().execute(callback);
|
||||||
|
// done
|
||||||
|
return txn;
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
|
@@ -257,6 +257,18 @@ found:
|
|||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
else if (voidTxn.getCommitTimeMs() == null)
|
||||||
|
{
|
||||||
|
// http://issues.alfresco.com/browse/AR-2041
|
||||||
|
// An object was found, but sometimes it is still not fully formed.
|
||||||
|
// Perhaps it's the direct request by ID that gives back an uncommitted transaction.
|
||||||
|
// So this transaction is very likely to become live soon but we just leave it until it does.
|
||||||
|
// When the issue has been seen, there have not been any committed transactions with null commit times.
|
||||||
|
if (logger.isDebugEnabled())
|
||||||
|
{
|
||||||
|
logger.debug("Void is visible but not live: " + voidTxn);
|
||||||
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (logger.isDebugEnabled())
|
if (logger.isDebugEnabled())
|
||||||
|
@@ -40,8 +40,10 @@ import net.sf.acegisecurity.providers.encoding.PasswordEncoder;
|
|||||||
import org.alfresco.error.AlfrescoRuntimeException;
|
import org.alfresco.error.AlfrescoRuntimeException;
|
||||||
import org.alfresco.model.ContentModel;
|
import org.alfresco.model.ContentModel;
|
||||||
import org.alfresco.repo.tenant.TenantService;
|
import org.alfresco.repo.tenant.TenantService;
|
||||||
|
import org.alfresco.repo.transaction.RetryingTransactionHelper;
|
||||||
import org.alfresco.service.cmr.dictionary.DictionaryService;
|
import org.alfresco.service.cmr.dictionary.DictionaryService;
|
||||||
import org.alfresco.service.cmr.repository.ChildAssociationRef;
|
import org.alfresco.service.cmr.repository.ChildAssociationRef;
|
||||||
|
import org.alfresco.service.cmr.repository.InvalidNodeRefException;
|
||||||
import org.alfresco.service.cmr.repository.NodeRef;
|
import org.alfresco.service.cmr.repository.NodeRef;
|
||||||
import org.alfresco.service.cmr.repository.NodeService;
|
import org.alfresco.service.cmr.repository.NodeService;
|
||||||
import org.alfresco.service.cmr.repository.StoreRef;
|
import org.alfresco.service.cmr.repository.StoreRef;
|
||||||
@@ -68,6 +70,8 @@ public class RepositoryAuthenticationDao implements MutableAuthenticationDao
|
|||||||
private DictionaryService dictionaryService;
|
private DictionaryService dictionaryService;
|
||||||
|
|
||||||
private SearchService searchService;
|
private SearchService searchService;
|
||||||
|
|
||||||
|
private RetryingTransactionHelper retryingTransactionHelper;
|
||||||
|
|
||||||
private PasswordEncoder passwordEncoder;
|
private PasswordEncoder passwordEncoder;
|
||||||
|
|
||||||
@@ -97,6 +101,11 @@ public class RepositoryAuthenticationDao implements MutableAuthenticationDao
|
|||||||
{
|
{
|
||||||
this.nodeService = nodeService;
|
this.nodeService = nodeService;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setRetryingTransactionHelper(RetryingTransactionHelper retryingTransactionHelper)
|
||||||
|
{
|
||||||
|
this.retryingTransactionHelper = retryingTransactionHelper;
|
||||||
|
}
|
||||||
|
|
||||||
public void setTenantService(TenantService tenantService)
|
public void setTenantService(TenantService tenantService)
|
||||||
{
|
{
|
||||||
@@ -175,7 +184,7 @@ public class RepositoryAuthenticationDao implements MutableAuthenticationDao
|
|||||||
for (ResultSetRow row : rs)
|
for (ResultSetRow row : rs)
|
||||||
{
|
{
|
||||||
|
|
||||||
NodeRef nodeRef = row.getNodeRef();
|
final NodeRef nodeRef = row.getNodeRef();
|
||||||
if (nodeService.exists(nodeRef))
|
if (nodeService.exists(nodeRef))
|
||||||
{
|
{
|
||||||
String realUserName = DefaultTypeConverter.INSTANCE.convert(String.class, nodeService.getProperty(
|
String realUserName = DefaultTypeConverter.INSTANCE.convert(String.class, nodeService.getProperty(
|
||||||
@@ -191,7 +200,26 @@ public class RepositoryAuthenticationDao implements MutableAuthenticationDao
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
throw new AlfrescoRuntimeException("Found more than one user for "+searchUserName+ " (case sensitive)");
|
try
|
||||||
|
{
|
||||||
|
this.retryingTransactionHelper.doInTransaction(
|
||||||
|
new RetryingTransactionHelper.RetryingTransactionCallback<Object>()
|
||||||
|
{
|
||||||
|
public Object execute()
|
||||||
|
throws Throwable
|
||||||
|
{
|
||||||
|
// Delete the extra user node references
|
||||||
|
RepositoryAuthenticationDao.this.nodeService.deleteNode(nodeRef);
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
}, false, true);
|
||||||
|
}
|
||||||
|
catch (InvalidNodeRefException exception)
|
||||||
|
{
|
||||||
|
// Ignore this exception as the node has already been deleted
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -205,7 +233,26 @@ public class RepositoryAuthenticationDao implements MutableAuthenticationDao
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
throw new AlfrescoRuntimeException("Found more than one user for "+searchUserName+ " (case insensitive)");
|
try
|
||||||
|
{
|
||||||
|
this.retryingTransactionHelper.doInTransaction(
|
||||||
|
new RetryingTransactionHelper.RetryingTransactionCallback<Object>()
|
||||||
|
{
|
||||||
|
public Object execute()
|
||||||
|
throws Throwable
|
||||||
|
{
|
||||||
|
// Delete the extra user node references
|
||||||
|
RepositoryAuthenticationDao.this.nodeService.deleteNode(nodeRef);
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
}, false, true);
|
||||||
|
}
|
||||||
|
catch (InvalidNodeRefException exception)
|
||||||
|
{
|
||||||
|
// Ignore this exception as the node has already been deleted
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user