Package org.goplanit.event.handler
Class SyncXmlIdToIdHandler
- java.lang.Object
-
- org.goplanit.event.handler.SyncXmlIdToIdHandler
-
- All Implemented Interfaces:
EventListener
,DemandsModifierListener
,EventListener
,DirectedGraphModifierListener
,GraphModifierListener
,RoutedServicesModifierListener
- Direct Known Subclasses:
SyncDeparturesXmlIdToIdHandler
,SyncRoutedServicesXmlIdToIdHandler
,SyncRoutedTripsXmlIdToIdHandler
,SyncXmlIdToIdDemandsEntitiesHandler
,SyncXmlIdToIdGraphEntitiesHandler
,SyncXmlIdToIdZoningEntitiesHandler
public abstract class SyncXmlIdToIdHandler extends Object implements RoutedServicesModifierListener, GraphModifierListener, DirectedGraphModifierListener, DemandsModifierListener
Whenever managed Ids containers with entities aso supporting an external id are changed in terms of their internal id, their XML ids remain the same and might no longer be unique. When this is not desirable and the user wants to keep the XML ids unique, for example when the network is persisted to disk afterwards, in which case the XML ids must be unique, then this handler can be used to sync the XML ids to the newly assigned unique internal ids.- Author:
- markr
-
-
Constructor Summary
Constructors Constructor Description SyncXmlIdToIdHandler(EventType... eventTypes)
Default constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description EventType[]
getKnownSupportedEventTypes()
Collect explicitly supported event types that are known.void
onDemandsModificationEvent(DemandsModificationEvent event)
Notify method for graph modification eventsvoid
onDirectedGraphModificationEvent(DirectedGraphModificationEvent event)
Notify method for directed graph modification eventsprotected void
onEvent(Event event)
void
onGraphModificationEvent(GraphModificationEvent event)
Notify method for graph modification eventsvoid
onRoutedServicesModifierEvent(RoutedServicesModificationEvent event)
Notify method for zoning modification eventsprotected <T extends ExternalIdAble>
voidsyncXmlIdToInternalId(T entity)
Perform action by syncing XML ids to ids-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.goplanit.utils.event.EventListener
hasKnownSupportedEventTypes
-
-
-
-
Constructor Detail
-
SyncXmlIdToIdHandler
public SyncXmlIdToIdHandler(EventType... eventTypes)
Default constructor- Parameters:
eventTypes
- event types
-
-
Method Detail
-
syncXmlIdToInternalId
protected <T extends ExternalIdAble> void syncXmlIdToInternalId(T entity)
Perform action by syncing XML ids to ids- Type Parameters:
T
- type of ExternalIdAble- Parameters:
entity
- entity to sync XML id to internal id
-
onEvent
protected void onEvent(Event event)
-
getKnownSupportedEventTypes
public EventType[] getKnownSupportedEventTypes()
Collect explicitly supported event types that are known. When not defined the user has to explicitly provide them upon registering the listener on an event producer, otherwise they can be extracted from here- Specified by:
getKnownSupportedEventTypes
in interfaceEventListener
- Returns:
- the supported event types
-
onRoutedServicesModifierEvent
public void onRoutedServicesModifierEvent(RoutedServicesModificationEvent event)
Notify method for zoning modification events- Specified by:
onRoutedServicesModifierEvent
in interfaceRoutedServicesModifierListener
- Parameters:
event
- representing the zoning modification event at hand
-
onGraphModificationEvent
public void onGraphModificationEvent(GraphModificationEvent event)
Notify method for graph modification events- Specified by:
onGraphModificationEvent
in interfaceGraphModifierListener
- Parameters:
event
- representing the graph modification event at hand
-
onDirectedGraphModificationEvent
public void onDirectedGraphModificationEvent(DirectedGraphModificationEvent event)
Notify method for directed graph modification events- Specified by:
onDirectedGraphModificationEvent
in interfaceDirectedGraphModifierListener
- Parameters:
event
- representing the directed graph modification event at hand
-
onDemandsModificationEvent
public void onDemandsModificationEvent(DemandsModificationEvent event)
Notify method for graph modification events- Specified by:
onDemandsModificationEvent
in interfaceDemandsModifierListener
- Parameters:
event
- representing the graph modification event at hand
-
-