Package org.alfresco.repo.events
Class AbstractEventsService
java.lang.Object
org.alfresco.repo.transaction.TransactionListenerAdapter
org.alfresco.repo.events.AbstractEventsService
- All Implemented Interfaces:
TransactionListener,org.alfresco.util.transaction.TransactionListener
- Direct Known Subclasses:
EventsServiceImpl,ExceptionEventsServiceImpl
- Author:
- steveglover
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected CheckOutCheckInServiceprotected DictionaryServiceprotected org.alfresco.sync.events.EventRegistryprotected FileFolderServiceprotected HiddenAspectprotected NamespaceServiceprotected NodeServiceprotected PermissionServiceprotected booleanprotected SiteServiceprotected static final Stringprotected TransactionService -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidInvoked after transaction commit.voidInvoked after transaction rollback.voidbeforeCommit(boolean readOnly) Called before a transaction is committed.protected List<org.alfresco.sync.events.types.Event>filterEventsBeforeSend(List<org.alfresco.sync.events.types.Event> events) Filter out event before sending them toMessageProducerprotected org.alfresco.sync.repo.ClientgetAlfrescoClient(org.alfresco.sync.repo.Client knownClientType) getNodeIds(List<Path> nodePaths) For each path, construct a list of ancestor node ids starting with the leaf path element node id first.getNodeIdsFromParent(List<Path> nodePaths) For each path, construct a list of ancestor node ids starting with the parent node id first.protected AbstractEventsService.NodeInfogetNodeInfo(NodeRef nodeRef, String eventType) protected org.alfresco.repo.events.AbstractEventsService.TxnEventsprotected booleanincludeEventType(String eventType) voidinit()protected longprotected voidretrieveAdditionalProps(Map<String, Serializable> properties, NodeRef nodeRef) Extract additional information for the provided nodevoidsendEvent(org.alfresco.sync.events.types.Event event) Register the event to be sent to a message producer once the transaction is overvoidsetCociService(CheckOutCheckInService cociService) voidsetDictionaryService(DictionaryService dictionaryService) voidsetEventRegistry(org.alfresco.sync.events.EventRegistry eventRegistry) voidsetFileFolderService(FileFolderService fileFolderService) voidsetHiddenAspect(HiddenAspect hiddenAspect) voidsetIncludeEventTypes(String includeEventTypesStr) voidsetMessageProducer(MessageProducer messageProducer) voidsetNamespaceService(NamespaceService namespaceService) voidsetNodeService(NodeService nodeService) voidsetPermissionService(PermissionService permissionService) voidsetSendEventsBeforeCommit(boolean sendEventsBeforeCommit) voidsetSiteService(SiteService siteService) voidsetTransactionService(TransactionService transactionService) protected booleanDetermines whether it still makes sense to create and send a TransactionCommittedEvent after the transaction is committed.Methods inherited from class org.alfresco.repo.transaction.TransactionListenerAdapter
beforeCompletion, flush
-
Field Details
-
TRANSACTION_HAS_EVENTS
- See Also:
-
cociService
-
siteService
-
nodeService
-
dictionaryService
-
namespaceService
-
permissionService
-
eventRegistry
protected org.alfresco.sync.events.EventRegistry eventRegistry -
fileFolderService
-
transactionService
-
includeEventTypes
-
matchingTypes
-
sendEventsBeforeCommit
protected boolean sendEventsBeforeCommit
-
-
Constructor Details
-
AbstractEventsService
public AbstractEventsService()
-
-
Method Details
-
setCociService
-
setHiddenAspect
-
setSendEventsBeforeCommit
public void setSendEventsBeforeCommit(boolean sendEventsBeforeCommit) -
setTransactionService
-
setIncludeEventTypes
-
setFileFolderService
-
setEventRegistry
public void setEventRegistry(org.alfresco.sync.events.EventRegistry eventRegistry) -
setNamespaceService
-
setPermissionService
-
setMessageProducer
-
setDictionaryService
-
setNodeService
-
setSiteService
-
init
public void init() -
nextSequenceNumber
protected long nextSequenceNumber() -
beforeCommit
public void beforeCommit(boolean readOnly) Description copied from class:TransactionListenerAdapterCalled before a transaction is committed.All transaction resources are still available.
- Specified by:
beforeCommitin interfaceTransactionListener- Specified by:
beforeCommitin interfaceorg.alfresco.util.transaction.TransactionListener- Overrides:
beforeCommitin classTransactionListenerAdapter- Parameters:
readOnly- true if the transaction is read-only
-
getAlfrescoClient
protected org.alfresco.sync.repo.Client getAlfrescoClient(org.alfresco.sync.repo.Client knownClientType) -
afterCommit
public void afterCommit()Description copied from class:TransactionListenerAdapterInvoked after transaction commit.Any exceptions generated here will only be logged and will have no effect on the state of the transaction.
Although all transaction resources are still available, this method should be used only for cleaning up resources after a commit has occured.
- Specified by:
afterCommitin interfaceTransactionListener- Specified by:
afterCommitin interfaceorg.alfresco.util.transaction.TransactionListener- Overrides:
afterCommitin classTransactionListenerAdapter
-
shouldSendCommitEvent
protected boolean shouldSendCommitEvent()Determines whether it still makes sense to create and send a TransactionCommittedEvent after the transaction is committed. (e.g. if there are no events for the specific transaction makes no sense to signal the end of transaction with TransactionCommittedEvent)- Returns:
- whether the TransactionCommitted event should be sent
-
filterEventsBeforeSend
protected List<org.alfresco.sync.events.types.Event> filterEventsBeforeSend(List<org.alfresco.sync.events.types.Event> events) Filter out event before sending them toMessageProducer- Parameters:
events- the events to be filtered- Returns:
- a filtered list of events
-
afterRollback
public void afterRollback()Description copied from class:TransactionListenerAdapterInvoked after transaction rollback.Any exceptions generated here will only be logged and will have no effect on the state of the transaction.
Although all transaction resources are still available, this method should be used only for cleaning up resources after a rollback has occured.
- Specified by:
afterRollbackin interfaceTransactionListener- Specified by:
afterRollbackin interfaceorg.alfresco.util.transaction.TransactionListener- Overrides:
afterRollbackin classTransactionListenerAdapter
-
includeEventType
-
retrieveAdditionalProps
Extract additional information for the provided node- Parameters:
properties- the properties map to add the new info tonodeRef- the node to extract the property from
-
getPaths
-
getNodeIdsFromParent
For each path, construct a list of ancestor node ids starting with the parent node id first.- Parameters:
nodePaths-- Returns:
-
getNodeIds
For each path, construct a list of ancestor node ids starting with the leaf path element node id first.- Parameters:
nodePaths-- Returns:
-
getTxnEvents
protected org.alfresco.repo.events.AbstractEventsService.TxnEvents getTxnEvents() -
sendEvent
public void sendEvent(org.alfresco.sync.events.types.Event event) Register the event to be sent to a message producer once the transaction is over- Parameters:
event- event to be sent
-
getNodeInfo
-