Skip to content

Commit

Permalink
ACS-8668 Add PoC (Event generator solution)
Browse files Browse the repository at this point in the history
  • Loading branch information
damianujma committed Sep 25, 2024
1 parent 6e76b11 commit 2e6f69c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import java.util.Set;

import org.alfresco.model.ContentModel;
import org.alfresco.repo.event2.EventGenerator;
import org.alfresco.repo.node.NodeServicePolicies.BeforeAddAspectPolicy;
import org.alfresco.repo.node.NodeServicePolicies.BeforeArchiveNodePolicy;
import org.alfresco.repo.node.NodeServicePolicies.BeforeCreateNodePolicy;
Expand Down Expand Up @@ -111,6 +112,7 @@ public abstract class AbstractNodeServiceImpl implements NodeService
protected TransactionService transactionService;
protected TenantService tenantService;
protected Set<String> storesToIgnorePolicies = Collections.emptySet();
protected EventGenerator eventGenerator;
protected String archiveStore;

/*
Expand Down Expand Up @@ -180,6 +182,11 @@ public void setArchiveStore(String archiveStore)
this.archiveStore = archiveStore;
}

public void setEventGenerator(EventGenerator eventGenerator)
{
this.eventGenerator = eventGenerator;
}

/**
* Checks equality by type and uuid
*/
Expand Down Expand Up @@ -490,11 +497,15 @@ else if (after == null)
*/
protected void invokeBeforeDeleteNode(NodeRef nodeRef)
{
if (ignorePolicy(nodeRef) && !isInArchiveStore(nodeRef))
if(isInArchiveStore(nodeRef))
{
eventGenerator.beforeDeleteNode(nodeRef);
return;
}
if (ignorePolicy(nodeRef))
{
return;
}

// get qnames to invoke against
Set<QName> qnames = getTypeAndAspectQNames(nodeRef);
// execute policy for node type and aspects
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,7 @@
</property>
<property name="enableTimestampPropagation" value="${system.enableTimestampPropagation}" />
<property name="archiveStore" value="${spaces.archive.store}" />
<property name="eventGenerator" ref="eventGeneratorV2"/>
</bean>

<bean id="nodeAuditor" class="org.alfresco.repo.node.NodeAuditor">
Expand Down

0 comments on commit 2e6f69c

Please sign in to comment.