Class AbstractPersistenceEvent
- java.lang.Object
-
- java.util.EventObject
-
- org.springframework.context.ApplicationEvent
-
- de.hybris.platform.servicelayer.event.events.AbstractEvent
-
- de.hybris.platform.servicelayer.event.events.AbstractPersistenceEvent
-
- All Implemented Interfaces:
ClusterAwareEvent,TransactionAwareEvent,java.io.Serializable
- Direct Known Subclasses:
AfterItemCreationEvent,AfterItemRemovalEvent
public abstract class AbstractPersistenceEvent extends AbstractEvent implements TransactionAwareEvent, ClusterAwareEvent
Abstract event class for persistence related events.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description AbstractPersistenceEvent()AbstractPersistenceEvent(java.io.Serializable pk)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.ObjectgetId()Returns a unique id.booleanpublish(int sourceNodeId, int targetNodeId)Decide whether this event should be broadcasted/received.booleanpublishOnCommitOnly()Decide whether this event should be broadcasted/received delayed on commit or directly this is useful if you want to publish custom event depending on the success of a running transaction if no transaction is running, the event is being sent immediately.-
Methods inherited from class de.hybris.platform.servicelayer.event.events.AbstractEvent
getScope, getSource, isFromCluster, setFromCluster, setScope, toString
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface de.hybris.platform.servicelayer.event.ClusterAwareEvent
canPublish
-
-
-
-
Method Detail
-
getId
public java.lang.Object getId()
Description copied from interface:TransactionAwareEventReturns a unique id. Two events with the same id in the same transaction will not get published twice.- Specified by:
getIdin interfaceTransactionAwareEvent- Returns:
- the id
-
publishOnCommitOnly
public boolean publishOnCommitOnly()
Description copied from interface:TransactionAwareEventDecide whether this event should be broadcasted/received delayed on commit or directly this is useful if you want to publish custom event depending on the success of a running transaction if no transaction is running, the event is being sent immediately.- Specified by:
publishOnCommitOnlyin interfaceTransactionAwareEvent
-
publish
public boolean publish(int sourceNodeId, int targetNodeId)Description copied from interface:ClusterAwareEventDecide whether this event should be broadcasted/received. Examples arereturn (sourceNodeId==targetNodeId );=> will only publish to local clusterreturn true;=> will publish to all nodesreturn (targetNodeId==14);=> publish to dedicated node regardless of source
- Specified by:
publishin interfaceClusterAwareEvent- Returns:
trueif event should be published from source cluster node to target cluster node
-
-