mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-24 17:32:48 +00:00
Merged V1.3 to HEAD (3106:3116)
svn merge svn://www.alfresco.org:3691/alfresco/BRANCHES/V1.3@3106 svn://www.alfresco.org:3691/alfresco/BRANCHES/V1.3@3116 . git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@3401 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -1,26 +1,32 @@
|
|||||||
<alfresco-config area="file-servers">
|
<alfresco-config area="file-servers">
|
||||||
|
|
||||||
<config evaluator="string-compare" condition="Filesystems">
|
<!-- To override the default Alfresco filesystem use replace="true", to -->
|
||||||
|
<!-- add additional filesystems remove the replace="true" attribute -->
|
||||||
<!-- Default share -->
|
|
||||||
<filesystem name="Alfresco">
|
<config evaluator="string-compare" condition="Filesystems" replace="true">
|
||||||
|
|
||||||
<store>workspace://SpacesStore</store>
|
|
||||||
<rootPath>/app:company_home</rootPath>
|
|
||||||
|
|
||||||
<!-- Enable Web client launch shortcut in all folders -->
|
|
||||||
<urlFile>
|
|
||||||
|
|
||||||
<!-- Change the filename as required, keeping the .url extension -->
|
|
||||||
<filename>_Alfresco.url</filename>
|
|
||||||
|
|
||||||
<!-- Change 'localhost' to the name or IP of the Alfresco server -->
|
|
||||||
<webpath>http://localhost:8080/alfresco/</webpath>
|
|
||||||
|
|
||||||
</urlFile>
|
|
||||||
|
|
||||||
</filesystem>
|
|
||||||
|
|
||||||
|
<filesystems>
|
||||||
|
|
||||||
|
<!-- Default share -->
|
||||||
|
<filesystem name="Alfresco">
|
||||||
|
|
||||||
|
<store>workspace://SpacesStore</store>
|
||||||
|
<rootPath>/app:company_home</rootPath>
|
||||||
|
|
||||||
|
<!-- Enable Web client launch shortcut in all folders -->
|
||||||
|
<urlFile>
|
||||||
|
|
||||||
|
<!-- Change the filename as required, keeping the .url extension -->
|
||||||
|
<filename>_Alfresco.url</filename>
|
||||||
|
|
||||||
|
<!-- Change 'localhost' to the name or IP of the Alfresco server -->
|
||||||
|
<webpath>http://localhost:8080/alfresco/</webpath>
|
||||||
|
|
||||||
|
</urlFile>
|
||||||
|
|
||||||
|
</filesystem>
|
||||||
|
</filesystems>
|
||||||
|
|
||||||
</config>
|
</config>
|
||||||
|
|
||||||
<!-- Allow guest access to file systems -->
|
<!-- Allow guest access to file systems -->
|
||||||
|
@@ -126,15 +126,6 @@
|
|||||||
<bean id="on-property-update-trigger" class="org.alfresco.repo.rule.ruletrigger.OnPropertyUpdateRuleTrigger" parent="rule-trigger-base">
|
<bean id="on-property-update-trigger" class="org.alfresco.repo.rule.ruletrigger.OnPropertyUpdateRuleTrigger" parent="rule-trigger-base">
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
<bean id="on-delete-node-trigger" class="org.alfresco.repo.rule.ruletrigger.SingleChildAssocRefPolicyRuleTrigger" parent="rule-trigger-base">
|
|
||||||
<property name="policyName">
|
|
||||||
<value>onDeleteNode</value>
|
|
||||||
</property>
|
|
||||||
<property name="isClassBehaviour">
|
|
||||||
<value>true</value>
|
|
||||||
</property>
|
|
||||||
</bean>
|
|
||||||
|
|
||||||
<bean id="on-create-child-association-trigger" class="org.alfresco.repo.rule.ruletrigger.SingleChildAssocRefPolicyRuleTrigger" parent="rule-trigger-base">
|
<bean id="on-create-child-association-trigger" class="org.alfresco.repo.rule.ruletrigger.SingleChildAssocRefPolicyRuleTrigger" parent="rule-trigger-base">
|
||||||
<property name="policyName">
|
<property name="policyName">
|
||||||
<value>onCreateChildAssociation</value>
|
<value>onCreateChildAssociation</value>
|
||||||
|
@@ -318,7 +318,7 @@ public abstract class AbstractNodeServiceImpl implements NodeService
|
|||||||
/**
|
/**
|
||||||
* @see NodeServicePolicies.OnDeleteNodePolicy#onDeleteNode(ChildAssociationRef)
|
* @see NodeServicePolicies.OnDeleteNodePolicy#onDeleteNode(ChildAssociationRef)
|
||||||
*/
|
*/
|
||||||
protected void invokeOnDeleteNode(ChildAssociationRef childAssocRef, QName childNodeTypeQName, Set<QName> childAspectQnames)
|
protected void invokeOnDeleteNode(ChildAssociationRef childAssocRef, QName childNodeTypeQName, Set<QName> childAspectQnames, boolean isArchivedNode)
|
||||||
{
|
{
|
||||||
// get qnames to invoke against
|
// get qnames to invoke against
|
||||||
Set<QName> qnames = new HashSet<QName>(childAspectQnames.size() + 1);
|
Set<QName> qnames = new HashSet<QName>(childAspectQnames.size() + 1);
|
||||||
@@ -327,7 +327,7 @@ public abstract class AbstractNodeServiceImpl implements NodeService
|
|||||||
|
|
||||||
// execute policy for node type and aspects
|
// execute policy for node type and aspects
|
||||||
NodeServicePolicies.OnDeleteNodePolicy policy = onDeleteNodeDelegate.get(childAssocRef.getChildRef(), qnames);
|
NodeServicePolicies.OnDeleteNodePolicy policy = onDeleteNodeDelegate.get(childAssocRef.getChildRef(), qnames);
|
||||||
policy.onDeleteNode(childAssocRef);
|
policy.onDeleteNode(childAssocRef, isArchivedNode);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -679,7 +679,7 @@ public abstract class BaseNodeServiceTest extends BaseSpringTest
|
|||||||
nodeService.addAspect(nodeRef, ASPECT_QNAME_TEST_TITLED, null);
|
nodeService.addAspect(nodeRef, ASPECT_QNAME_TEST_TITLED, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onDeleteNode(ChildAssociationRef childAssocRef)
|
public void onDeleteNode(ChildAssociationRef childAssocRef, boolean isArchivedNode)
|
||||||
{
|
{
|
||||||
// add the child to the list
|
// add the child to the list
|
||||||
deletedNodeRefs.add(childAssocRef.getChildRef());
|
deletedNodeRefs.add(childAssocRef.getChildRef());
|
||||||
|
@@ -140,9 +140,10 @@ public interface NodeServicePolicies
|
|||||||
* which has been deleted and cannot be used to retrieve node or associaton
|
* which has been deleted and cannot be used to retrieve node or associaton
|
||||||
* information from any of the services.
|
* information from any of the services.
|
||||||
*
|
*
|
||||||
* @param childAssocRef the primary parent-child association of the deleted node
|
* @param childAssocRef the primary parent-child association of the deleted node
|
||||||
|
* @param isNodeArchived indicates whether the node has been archived rather than purged
|
||||||
*/
|
*/
|
||||||
public void onDeleteNode(ChildAssociationRef childAssocRef);
|
public void onDeleteNode(ChildAssociationRef childAssocRef, boolean isNodeArchived);
|
||||||
}
|
}
|
||||||
|
|
||||||
public interface BeforeAddAspectPolicy extends ClassPolicy
|
public interface BeforeAddAspectPolicy extends ClassPolicy
|
||||||
|
@@ -451,7 +451,9 @@ public class DbNodeServiceImpl extends AbstractNodeServiceImpl
|
|||||||
// invoke policy behaviour
|
// invoke policy behaviour
|
||||||
if (movingStore)
|
if (movingStore)
|
||||||
{
|
{
|
||||||
invokeOnDeleteNode(oldAssocRef, nodeToMoveTypeQName, nodeToMoveAspects);
|
// TODO for now indicate that the node has been archived to prevent the version history from being removed
|
||||||
|
// in the future a onMove policy could be added and remove the need for onDelete and onCreate to be fired here
|
||||||
|
invokeOnDeleteNode(oldAssocRef, nodeToMoveTypeQName, nodeToMoveAspects, true);
|
||||||
invokeOnCreateNode(newAssoc.getChildAssocRef());
|
invokeOnCreateNode(newAssoc.getChildAssocRef());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -643,6 +645,8 @@ public class DbNodeServiceImpl extends AbstractNodeServiceImpl
|
|||||||
|
|
||||||
public void deleteNode(NodeRef nodeRef)
|
public void deleteNode(NodeRef nodeRef)
|
||||||
{
|
{
|
||||||
|
boolean isArchivedNode = false;
|
||||||
|
|
||||||
// Invoke policy behaviours
|
// Invoke policy behaviours
|
||||||
invokeBeforeDeleteNode(nodeRef);
|
invokeBeforeDeleteNode(nodeRef);
|
||||||
|
|
||||||
@@ -663,15 +667,17 @@ public class DbNodeServiceImpl extends AbstractNodeServiceImpl
|
|||||||
{
|
{
|
||||||
// perform a normal deletion
|
// perform a normal deletion
|
||||||
nodeDaoService.deleteNode(node, true);
|
nodeDaoService.deleteNode(node, true);
|
||||||
|
isArchivedNode = false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// archive it
|
// archive it
|
||||||
archiveNode(nodeRef, archiveStoreRef);
|
archiveNode(nodeRef, archiveStoreRef);
|
||||||
|
isArchivedNode = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Invoke policy behaviours
|
// Invoke policy behaviours
|
||||||
invokeOnDeleteNode(childAssocRef, nodeTypeQName, nodeAspectQNames);
|
invokeOnDeleteNode(childAssocRef, nodeTypeQName, nodeAspectQNames, isArchivedNode);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ChildAssociationRef addChild(NodeRef parentRef, NodeRef childRef, QName assocTypeQName, QName assocQName)
|
public ChildAssociationRef addChild(NodeRef parentRef, NodeRef childRef, QName assocTypeQName, QName assocQName)
|
||||||
|
@@ -96,7 +96,7 @@ public class NodeIndexer
|
|||||||
indexer.updateNode(nodeRef);
|
indexer.updateNode(nodeRef);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onDeleteNode(ChildAssociationRef childAssocRef)
|
public void onDeleteNode(ChildAssociationRef childAssocRef, boolean isArchivedNode)
|
||||||
{
|
{
|
||||||
indexer.deleteNode(childAssocRef);
|
indexer.deleteNode(childAssocRef);
|
||||||
}
|
}
|
||||||
|
@@ -335,7 +335,7 @@ public class IntegrityChecker
|
|||||||
/**
|
/**
|
||||||
* No checking performed: The association changes will be handled
|
* No checking performed: The association changes will be handled
|
||||||
*/
|
*/
|
||||||
public void onDeleteNode(ChildAssociationRef childAssocRef)
|
public void onDeleteNode(ChildAssociationRef childAssocRef, boolean isArchivedNode)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -93,23 +93,23 @@ public class RuleTriggerTest extends BaseSpringTest
|
|||||||
assertTrue(ruleType.rulesTriggered);
|
assertTrue(ruleType.rulesTriggered);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testOnDeleteNodeTrigger()
|
// public void testOnDeleteNodeTrigger()
|
||||||
{
|
// {
|
||||||
NodeRef nodeRef = this.nodeService.createNode(
|
// NodeRef nodeRef = this.nodeService.createNode(
|
||||||
this.rootNodeRef,
|
// this.rootNodeRef,
|
||||||
ContentModel.ASSOC_CHILDREN,
|
// ContentModel.ASSOC_CHILDREN,
|
||||||
ContentModel.ASSOC_CHILDREN,
|
// ContentModel.ASSOC_CHILDREN,
|
||||||
ContentModel.TYPE_CONTAINER).getChildRef();
|
// ContentModel.TYPE_CONTAINER).getChildRef();
|
||||||
|
//
|
||||||
TestRuleType ruleType = createTestRuleType(ON_DELETE_NODE_TRIGGER);
|
// TestRuleType ruleType = createTestRuleType(ON_DELETE_NODE_TRIGGER);
|
||||||
assertFalse(ruleType.rulesTriggered);
|
// assertFalse(ruleType.rulesTriggered);
|
||||||
|
//
|
||||||
// Try and trigger the type
|
// // Try and trigger the type
|
||||||
this.nodeService.deleteNode(nodeRef);
|
// this.nodeService.deleteNode(nodeRef);
|
||||||
|
//
|
||||||
// Check to see if the rule type has been triggered
|
// // Check to see if the rule type has been triggered
|
||||||
assertTrue(ruleType.rulesTriggered);
|
// assertTrue(ruleType.rulesTriggered);
|
||||||
}
|
// }
|
||||||
|
|
||||||
public void testOnCreateChildAssociationTrigger()
|
public void testOnCreateChildAssociationTrigger()
|
||||||
{
|
{
|
||||||
|
@@ -26,6 +26,7 @@ import java.util.Map;
|
|||||||
import org.alfresco.model.ContentModel;
|
import org.alfresco.model.ContentModel;
|
||||||
import org.alfresco.repo.dictionary.DictionaryDAO;
|
import org.alfresco.repo.dictionary.DictionaryDAO;
|
||||||
import org.alfresco.repo.dictionary.M2Model;
|
import org.alfresco.repo.dictionary.M2Model;
|
||||||
|
import org.alfresco.repo.node.archive.NodeArchiveService;
|
||||||
import org.alfresco.repo.security.authentication.MutableAuthenticationDao;
|
import org.alfresco.repo.security.authentication.MutableAuthenticationDao;
|
||||||
import org.alfresco.repo.version.common.counter.VersionCounterService;
|
import org.alfresco.repo.version.common.counter.VersionCounterService;
|
||||||
import org.alfresco.repo.version.common.versionlabel.SerialVersionLabelPolicy;
|
import org.alfresco.repo.version.common.versionlabel.SerialVersionLabelPolicy;
|
||||||
@@ -56,6 +57,7 @@ public abstract class BaseVersionStoreTest extends BaseSpringTest
|
|||||||
protected AuthenticationService authenticationService;
|
protected AuthenticationService authenticationService;
|
||||||
protected TransactionService transactionService;
|
protected TransactionService transactionService;
|
||||||
protected MutableAuthenticationDao authenticationDAO;
|
protected MutableAuthenticationDao authenticationDAO;
|
||||||
|
protected NodeArchiveService nodeArchiveService;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Data used by tests
|
* Data used by tests
|
||||||
@@ -136,6 +138,7 @@ public abstract class BaseVersionStoreTest extends BaseSpringTest
|
|||||||
this.authenticationService = (AuthenticationService)applicationContext.getBean("authenticationService");
|
this.authenticationService = (AuthenticationService)applicationContext.getBean("authenticationService");
|
||||||
this.transactionService = (TransactionService)this.applicationContext.getBean("transactionComponent");
|
this.transactionService = (TransactionService)this.applicationContext.getBean("transactionComponent");
|
||||||
this.authenticationDAO = (MutableAuthenticationDao) applicationContext.getBean("alfDaoImpl");
|
this.authenticationDAO = (MutableAuthenticationDao) applicationContext.getBean("alfDaoImpl");
|
||||||
|
this.nodeArchiveService = (NodeArchiveService) applicationContext.getBean("nodeArchiveService");
|
||||||
|
|
||||||
authenticationService.clearCurrentSecurityContext();
|
authenticationService.clearCurrentSecurityContext();
|
||||||
|
|
||||||
|
@@ -384,15 +384,15 @@ public class VersionServiceImpl extends AbstractVersionServiceImpl
|
|||||||
{
|
{
|
||||||
VersionHistory versionHistory = null;
|
VersionHistory versionHistory = null;
|
||||||
|
|
||||||
if (this.nodeService.hasAspect(nodeRef, ContentModel.ASPECT_VERSIONABLE) == true)
|
if (this.nodeService.exists(nodeRef) == true)
|
||||||
{
|
{
|
||||||
NodeRef versionHistoryRef = getVersionHistoryNodeRef(nodeRef);
|
NodeRef versionHistoryRef = getVersionHistoryNodeRef(nodeRef);
|
||||||
if (versionHistoryRef != null)
|
if (versionHistoryRef != null)
|
||||||
{
|
{
|
||||||
versionHistory = buildVersionHistory(versionHistoryRef, nodeRef);
|
versionHistory = buildVersionHistory(versionHistoryRef, nodeRef);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return versionHistory;
|
return versionHistory;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1078,7 +1078,7 @@ public class VersionServiceImpl extends AbstractVersionServiceImpl
|
|||||||
// Delete the version history node
|
// Delete the version history node
|
||||||
this.dbNodeService.deleteNode(versionHistoryNodeRef);
|
this.dbNodeService.deleteNode(versionHistoryNodeRef);
|
||||||
|
|
||||||
if (this.nodeService.hasAspect(nodeRef, ContentModel.ASPECT_VERSIONABLE) == true)
|
if (this.nodeService.exists(nodeRef) == true && this.nodeService.hasAspect(nodeRef, ContentModel.ASPECT_VERSIONABLE) == true)
|
||||||
{
|
{
|
||||||
// Reset the version label property on the versionable node
|
// Reset the version label property on the versionable node
|
||||||
this.nodeService.setProperty(nodeRef, ContentModel.PROP_VERSION_LABEL, null);
|
this.nodeService.setProperty(nodeRef, ContentModel.PROP_VERSION_LABEL, null);
|
||||||
|
@@ -26,6 +26,7 @@ import org.alfresco.repo.transaction.TransactionUtil;
|
|||||||
import org.alfresco.service.cmr.repository.ContentReader;
|
import org.alfresco.service.cmr.repository.ContentReader;
|
||||||
import org.alfresco.service.cmr.repository.ContentWriter;
|
import org.alfresco.service.cmr.repository.ContentWriter;
|
||||||
import org.alfresco.service.cmr.repository.NodeRef;
|
import org.alfresco.service.cmr.repository.NodeRef;
|
||||||
|
import org.alfresco.service.cmr.repository.StoreRef;
|
||||||
import org.alfresco.service.cmr.version.Version;
|
import org.alfresco.service.cmr.version.Version;
|
||||||
import org.alfresco.service.cmr.version.VersionHistory;
|
import org.alfresco.service.cmr.version.VersionHistory;
|
||||||
import org.alfresco.service.cmr.version.VersionServiceException;
|
import org.alfresco.service.cmr.version.VersionServiceException;
|
||||||
@@ -609,4 +610,74 @@ public class VersionServiceImplTest extends BaseVersionStoreTest
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void testAutoRemovalOfVersionHistory()
|
||||||
|
{
|
||||||
|
StoreRef spacesStoreRef = new StoreRef(StoreRef.PROTOCOL_WORKSPACE, "SpacesStore");
|
||||||
|
NodeRef root = this.dbNodeService.getRootNode(spacesStoreRef);
|
||||||
|
|
||||||
|
HashMap<QName, Serializable> props2 = new HashMap<QName, Serializable>();
|
||||||
|
props2.put(ContentModel.PROP_NAME, "test.txt");
|
||||||
|
final NodeRef nodeRef = this.dbNodeService.createNode(
|
||||||
|
root,
|
||||||
|
ContentModel.ASSOC_CHILDREN,
|
||||||
|
QName.createQName("{test}MyVersionableNode2"),
|
||||||
|
ContentModel.TYPE_CONTENT,
|
||||||
|
props2).getChildRef();
|
||||||
|
this.dbNodeService.addAspect(nodeRef, ContentModel.ASPECT_VERSIONABLE, null);
|
||||||
|
|
||||||
|
setComplete();
|
||||||
|
endTransaction();
|
||||||
|
|
||||||
|
TransactionUtil.executeInUserTransaction(this.transactionService, new TransactionUtil.TransactionWork<Object>()
|
||||||
|
{
|
||||||
|
public Object doWork() throws Exception
|
||||||
|
{
|
||||||
|
VersionHistory versionHistory = VersionServiceImplTest.this.versionService.getVersionHistory(nodeRef);
|
||||||
|
assertNotNull(versionHistory);
|
||||||
|
assertEquals(1, versionHistory.getAllVersions().size());
|
||||||
|
|
||||||
|
// Delete the node
|
||||||
|
VersionServiceImplTest.this.dbNodeService.deleteNode(nodeRef);
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
TransactionUtil.executeInUserTransaction(this.transactionService, new TransactionUtil.TransactionWork<Object>()
|
||||||
|
{
|
||||||
|
public Object doWork() throws Exception
|
||||||
|
{
|
||||||
|
// Get the archived noderef
|
||||||
|
NodeRef archivedNodeRef = VersionServiceImplTest.this.nodeArchiveService.getArchivedNode(nodeRef);
|
||||||
|
|
||||||
|
// The archived noderef should still have a link to the version history
|
||||||
|
VersionHistory versionHistory = VersionServiceImplTest.this.versionService.getVersionHistory(archivedNodeRef);
|
||||||
|
assertNotNull(versionHistory);
|
||||||
|
assertEquals(1, versionHistory.getAllVersions().size());
|
||||||
|
|
||||||
|
// Delete the node for good
|
||||||
|
VersionServiceImplTest.this.dbNodeService.deleteNode(archivedNodeRef);
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
TransactionUtil.executeInUserTransaction(this.transactionService, new TransactionUtil.TransactionWork<Object>()
|
||||||
|
{
|
||||||
|
public Object doWork() throws Exception
|
||||||
|
{
|
||||||
|
// Get the archived noderef
|
||||||
|
NodeRef archivedNodeRef = VersionServiceImplTest.this.nodeArchiveService.getArchivedNode(nodeRef);
|
||||||
|
|
||||||
|
// Check that the version histories have been deleted
|
||||||
|
VersionHistory versionHistory12 = VersionServiceImplTest.this.versionService.getVersionHistory(nodeRef);
|
||||||
|
assertNull(versionHistory12);
|
||||||
|
VersionHistory versionHistory23 = VersionServiceImplTest.this.versionService.getVersionHistory(archivedNodeRef);
|
||||||
|
assertNull(versionHistory23);
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -29,6 +29,7 @@ import org.alfresco.repo.policy.JavaBehaviour;
|
|||||||
import org.alfresco.repo.policy.PolicyComponent;
|
import org.alfresco.repo.policy.PolicyComponent;
|
||||||
import org.alfresco.repo.policy.PolicyScope;
|
import org.alfresco.repo.policy.PolicyScope;
|
||||||
import org.alfresco.repo.transaction.AlfrescoTransactionSupport;
|
import org.alfresco.repo.transaction.AlfrescoTransactionSupport;
|
||||||
|
import org.alfresco.service.cmr.repository.ChildAssociationRef;
|
||||||
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;
|
||||||
@@ -44,7 +45,8 @@ import org.alfresco.service.namespace.QName;
|
|||||||
*/
|
*/
|
||||||
public class VersionableAspect implements ContentServicePolicies.OnContentUpdatePolicy,
|
public class VersionableAspect implements ContentServicePolicies.OnContentUpdatePolicy,
|
||||||
NodeServicePolicies.OnAddAspectPolicy,
|
NodeServicePolicies.OnAddAspectPolicy,
|
||||||
NodeServicePolicies.OnRemoveAspectPolicy
|
NodeServicePolicies.OnRemoveAspectPolicy,
|
||||||
|
NodeServicePolicies.OnDeleteNodePolicy
|
||||||
{
|
{
|
||||||
/** The i18n'ized messages */
|
/** The i18n'ized messages */
|
||||||
private static final String MSG_INITIAL_VERSION = "create_version.initial_version";
|
private static final String MSG_INITIAL_VERSION = "create_version.initial_version";
|
||||||
@@ -108,6 +110,10 @@ public class VersionableAspect implements ContentServicePolicies.OnContentUpdate
|
|||||||
QName.createQName(NamespaceService.ALFRESCO_URI, "onRemoveAspect"),
|
QName.createQName(NamespaceService.ALFRESCO_URI, "onRemoveAspect"),
|
||||||
ContentModel.ASPECT_VERSIONABLE,
|
ContentModel.ASPECT_VERSIONABLE,
|
||||||
new JavaBehaviour(this, "onRemoveAspect", Behaviour.NotificationFrequency.TRANSACTION_COMMIT));
|
new JavaBehaviour(this, "onRemoveAspect", Behaviour.NotificationFrequency.TRANSACTION_COMMIT));
|
||||||
|
this.policyComponent.bindClassBehaviour(
|
||||||
|
QName.createQName(NamespaceService.ALFRESCO_URI, "onDeleteNode"),
|
||||||
|
ContentModel.ASPECT_VERSIONABLE,
|
||||||
|
new JavaBehaviour(this, "onDeleteNode", Behaviour.NotificationFrequency.TRANSACTION_COMMIT));
|
||||||
|
|
||||||
autoVersionBehaviour = new JavaBehaviour(this, "onContentUpdate", Behaviour.NotificationFrequency.TRANSACTION_COMMIT);
|
autoVersionBehaviour = new JavaBehaviour(this, "onContentUpdate", Behaviour.NotificationFrequency.TRANSACTION_COMMIT);
|
||||||
this.policyComponent.bindClassBehaviour(
|
this.policyComponent.bindClassBehaviour(
|
||||||
@@ -122,6 +128,19 @@ public class VersionableAspect implements ContentServicePolicies.OnContentUpdate
|
|||||||
new JavaBehaviour(this, "onCopy"));
|
new JavaBehaviour(this, "onCopy"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see org.alfresco.repo.node.NodeServicePolicies.OnDeleteNodePolicy#onDeleteNode(org.alfresco.service.cmr.repository.ChildAssociationRef, boolean)
|
||||||
|
*/
|
||||||
|
public void onDeleteNode(ChildAssociationRef childAssocRef, boolean isNodeArchived)
|
||||||
|
{
|
||||||
|
if (isNodeArchived == false)
|
||||||
|
{
|
||||||
|
// If we are perminantly deleting the node then we need to remove the associated version history
|
||||||
|
this.versionService.deleteVersionHistory(childAssocRef.getChildRef());
|
||||||
|
}
|
||||||
|
// otherwise we do nothing since we need to hold onto the version history in case the node is restored later
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* OnCopy behaviour implementation for the version aspect.
|
* OnCopy behaviour implementation for the version aspect.
|
||||||
* <p>
|
* <p>
|
||||||
@@ -218,7 +237,7 @@ public class VersionableAspect implements ContentServicePolicies.OnContentUpdate
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enable the auto version behaviour
|
* Enable the auto version behaviour
|
||||||
*
|
*
|
||||||
@@ -235,5 +254,5 @@ public class VersionableAspect implements ContentServicePolicies.OnContentUpdate
|
|||||||
public void disableAutoVersion()
|
public void disableAutoVersion()
|
||||||
{
|
{
|
||||||
this.autoVersionBehaviour.disable();
|
this.autoVersionBehaviour.disable();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user