mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Merged HEAD-BUG-FIX (4.3/Cloud) to HEAD (4.3/Cloud)
59113: Merged V4.2-BUG-FIX (4.2.1) to HEAD-BUG-FIX (Cloud/4.3) 59084: MNT-10028: Editing online document is not displayed in "I'm Editing" (and similar) filters in Share. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@62093 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -527,6 +527,7 @@
|
||||
<property name="authenticationService" ref="authenticationService" />
|
||||
<property name="searchService" ref="admSearchService" />
|
||||
<property name="behaviourFilter" ref="policyBehaviourFilter" />
|
||||
<property name="nodeIndexer" ref="nodeIndexer"/>
|
||||
</bean>
|
||||
|
||||
<!-- -->
|
||||
|
@@ -59,7 +59,6 @@
|
||||
<property name="interceptorNames">
|
||||
<list>
|
||||
<value>nodeRefPropertyInterceptor</value>
|
||||
<value>lockableAspectInterceptor</value>
|
||||
<value>mlPropertyInterceptor</value>
|
||||
<value>tagscopeSummaryPropertyInterceptor</value>
|
||||
</list>
|
||||
@@ -93,6 +92,7 @@
|
||||
</property>
|
||||
<property name="interceptorNames">
|
||||
<list>
|
||||
<value>lockableAspectInterceptor</value>
|
||||
<value>multiTNodeServiceInterceptor</value>
|
||||
</list>
|
||||
</property>
|
||||
|
@@ -58,22 +58,7 @@
|
||||
|
||||
<bean id="permissionServiceImpl" class="org.alfresco.repo.security.permissions.impl.PermissionServiceImpl" init-method="init">
|
||||
<property name="nodeService">
|
||||
<!-- ALF-19732: added lockableAspectInterceptor -->
|
||||
<bean class="org.springframework.aop.framework.ProxyFactoryBean" >
|
||||
<property name="targetName">
|
||||
<value>mtAwareNodeService</value>
|
||||
</property>
|
||||
<property name="proxyInterfaces">
|
||||
<list>
|
||||
<value>org.alfresco.service.cmr.repository.NodeService</value>
|
||||
</list>
|
||||
</property>
|
||||
<property name="interceptorNames">
|
||||
<list>
|
||||
<value>lockableAspectInterceptor</value>
|
||||
</list>
|
||||
</property>
|
||||
</bean>
|
||||
<ref bean="mtAwareNodeService"/>
|
||||
</property>
|
||||
<property name="tenantService">
|
||||
<ref bean="tenantService"/>
|
||||
|
@@ -27,7 +27,6 @@ import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.repo.copy.CopyBehaviourCallback;
|
||||
@@ -40,6 +39,7 @@ import org.alfresco.repo.lock.mem.LockState;
|
||||
import org.alfresco.repo.lock.mem.LockStore;
|
||||
import org.alfresco.repo.lock.mem.LockableAspectInterceptor;
|
||||
import org.alfresco.repo.node.NodeServicePolicies;
|
||||
import org.alfresco.repo.node.index.NodeIndexer;
|
||||
import org.alfresco.repo.policy.BehaviourFilter;
|
||||
import org.alfresco.repo.policy.ClassPolicyDelegate;
|
||||
import org.alfresco.repo.policy.JavaBehaviour;
|
||||
@@ -48,7 +48,6 @@ import org.alfresco.repo.policy.PolicyScope;
|
||||
import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
||||
import org.alfresco.repo.tenant.TenantService;
|
||||
import org.alfresco.repo.transaction.AlfrescoTransactionSupport;
|
||||
import org.alfresco.repo.transaction.AlfrescoTransactionSupport.TxnReadState;
|
||||
import org.alfresco.repo.transaction.TransactionListener;
|
||||
import org.alfresco.repo.transaction.TransactionalResourceHelper;
|
||||
import org.alfresco.repo.version.VersionServicePolicies;
|
||||
@@ -103,6 +102,8 @@ public class LockServiceImpl implements LockService,
|
||||
/** Class policy delegate's */
|
||||
private ClassPolicyDelegate<BeforeLock> beforeLock;
|
||||
|
||||
private NodeIndexer nodeIndexer;
|
||||
|
||||
public void setNodeService(NodeService nodeService)
|
||||
{
|
||||
this.nodeService = nodeService;
|
||||
@@ -360,6 +361,8 @@ public class LockServiceImpl implements LockService,
|
||||
// it to be reverted to this state on rollback.
|
||||
TransactionalResourceHelper.getMap(KEY_MODIFIED_NODES).put(nodeRef, currentLockInfo);
|
||||
AlfrescoTransactionSupport.bindListener(this);
|
||||
|
||||
nodeIndexer.indexUpdateNode(nodeRef);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -502,6 +505,7 @@ public class LockServiceImpl implements LockService,
|
||||
{
|
||||
// Remove the ephemeral lock.
|
||||
lockStore.set(nodeRef, LockState.createUnlocked(nodeRef));
|
||||
nodeIndexer.indexUpdateNode(nodeRef);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -871,6 +875,11 @@ public class LockServiceImpl implements LockService,
|
||||
return behaviourFilter;
|
||||
}
|
||||
|
||||
public void setNodeIndexer(NodeIndexer nodeIndexer)
|
||||
{
|
||||
this.nodeIndexer = nodeIndexer;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void flush()
|
||||
{
|
||||
|
@@ -25,14 +25,14 @@ import java.util.Map;
|
||||
|
||||
import javax.transaction.NotSupportedException;
|
||||
import javax.transaction.SystemException;
|
||||
import javax.transaction.UserTransaction;
|
||||
|
||||
import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.repo.lock.mem.Lifetime;
|
||||
import org.alfresco.repo.lock.mem.LockState;
|
||||
import org.alfresco.repo.lock.mem.LockStore;
|
||||
import org.alfresco.repo.search.IndexerAndSearcher;
|
||||
import org.alfresco.repo.search.SearcherComponent;
|
||||
import org.alfresco.repo.security.authentication.AuthenticationComponent;
|
||||
import org.alfresco.repo.transaction.TransactionUtil;
|
||||
import org.alfresco.service.cmr.coci.CheckOutCheckInService;
|
||||
import org.alfresco.service.cmr.lock.LockService;
|
||||
import org.alfresco.service.cmr.lock.LockStatus;
|
||||
@@ -44,14 +44,14 @@ import org.alfresco.service.cmr.repository.ChildAssociationRef;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.cmr.repository.NodeService;
|
||||
import org.alfresco.service.cmr.repository.StoreRef;
|
||||
import org.alfresco.service.cmr.search.ResultSet;
|
||||
import org.alfresco.service.cmr.security.MutableAuthenticationService;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
import org.alfresco.service.transaction.TransactionService;
|
||||
import org.alfresco.test_category.BaseSpringTestsCategory;
|
||||
import org.alfresco.test_category.OwnJVMTestsCategory;
|
||||
import org.alfresco.util.BaseSpringTest;
|
||||
import org.alfresco.util.TestWithUserUtils;
|
||||
import org.hibernate.engine.TransactionHelper;
|
||||
import org.junit.Test;
|
||||
import org.junit.experimental.categories.Category;
|
||||
|
||||
/**
|
||||
@@ -341,6 +341,32 @@ public class LockServiceImplTest extends BaseSpringTest
|
||||
assertEquals(LockStatus.NO_LOCK, lockService.getLockStatus(noAspectNode));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testEphemeralLockIndexing()
|
||||
{
|
||||
TestWithUserUtils.authenticateUser(GOOD_USER_NAME, PWD, rootNodeRef, authenticationService);
|
||||
|
||||
IndexerAndSearcher indexerAndSearcher = (IndexerAndSearcher)
|
||||
applicationContext.getBean("indexerAndSearcherFactory");
|
||||
SearcherComponent searcher = new SearcherComponent();
|
||||
searcher.setIndexerAndSearcherFactory(indexerAndSearcher);
|
||||
|
||||
// Create a lock (owned by the current user)
|
||||
lockService.lock(noAspectNode, LockType.WRITE_LOCK, 86400, Lifetime.EPHEMERAL);
|
||||
|
||||
// Query for the user's locks
|
||||
final String query = String.format("+@cm\\:lockOwner:\"%s\" +@cm\\:lockType:\"WRITE_LOCK\"", GOOD_USER_NAME);
|
||||
ResultSet rs = searcher.query(storeRef, "lucene", query);
|
||||
assertTrue(rs.getNodeRefs().contains(noAspectNode));
|
||||
|
||||
// Unlock the node
|
||||
lockService.unlock(noAspectNode);
|
||||
|
||||
// Perform a new search, the index should reflect that it is not locked.
|
||||
rs = searcher.query(storeRef, "lucene", query);
|
||||
assertFalse(rs.getNodeRefs().contains(noAspectNode));
|
||||
}
|
||||
|
||||
public void testLockRevertedOnRollback() throws NotSupportedException, SystemException
|
||||
{
|
||||
// Preconditions of test
|
||||
|
Reference in New Issue
Block a user