Class DefaultOutboundSyncJobRegister
java.lang.Object
de.hybris.platform.outboundsync.job.impl.DefaultOutboundSyncJobRegister
- All Implemented Interfaces:
OutboundSyncJobRegister,OutboundSyncStateObserver
public class DefaultOutboundSyncJobRegister
extends Object
implements OutboundSyncJobRegister, OutboundSyncStateObserver
Implementation of the
OutboundSyncJobRegister that is used by default when no custom implementation is injected.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected OutboundSyncJobStateAggregatorcreateJobStateAggregator(@NotNull OutboundSyncCronJobModel job) Creates new instance of the {codeOutboundSyncJobStateAggregator}.Retrieves the outbound sync job object corresponding to the specified job model primary key.@NotNull OutboundSyncJobgetJob(@NotNull OutboundSyncCronJobModel model) Retrieves the outbound sync job object corresponding to the specified job model.@NotNull OutboundSyncJobgetNewJob(@NotNull OutboundSyncCronJobModel jobModel) Retrieves new instance of the outbound sync job object for the specified job model.Retrieves all outbound sync jobs that are currently running.booleanChecks whether the specified job is running now or not.voidsetFlexibleSearchService(FlexibleSearchService flexibleSearchService) Deprecated, for removal: This API element is subject to removal in a future version.not used anymore in this register implementationvoidsetOutboundSyncConfiguration(OutboundSyncConfiguration outboundSyncConfiguration) Deprecated, for removal: This API element is subject to removal in a future version.not used anymore in this register implementationvoidstateChanged(@NotNull OutboundSyncCronJobModel model, @NotNull OutboundSyncState state) Notifies the observer about the outbound sync job state change.
-
Constructor Details
-
DefaultOutboundSyncJobRegister
-
-
Method Details
-
getNewJob
@NotNull public @NotNull OutboundSyncJob getNewJob(@NotNull @NotNull OutboundSyncCronJobModel jobModel) Description copied from interface:OutboundSyncJobRegisterRetrieves new instance of the outbound sync job object for the specified job model. Each subsequent call always returns new job instance. On the other hand, because it always returns a fresh job object instance, it guarantees the previous and possibly stale state of the job is discarded. For this reason, it makes sense to use this method only when it's reliably the first retrieval of the outbound sync job from this register. Otherwise, #getJob should be used.- Specified by:
getNewJobin interfaceOutboundSyncJobRegister- Parameters:
jobModel- job entity model representing the cron job being executed.- Returns:
- a state aggregator for the specified job model. If a state aggregator has been requested for the job model before, exactly same instance of aggregator is returned for the subsequent calls; otherwise a new instance of the aggregator is created and registered.
-
getJob
Description copied from interface:OutboundSyncJobRegisterRetrieves the outbound sync job object corresponding to the specified job model primary key.- Specified by:
getJobin interfaceOutboundSyncJobRegister- Parameters:
jobPk- primary key of the job entity model, for which the outbound sync job needs to be retrieved.- Returns:
- an Optional with the outbound sync job for the specified job model primary key. If the job has
been requested for the job model before, exactly same instance of the job is returned in the
Optionalfor the subsequent calls; otherwise a new instance of the outbound sync job is created and registered. If the primary key does not correspond to anOutboundSyncCronJobModel, thenOptional.empty()is returned.
-
getJob
Description copied from interface:OutboundSyncJobRegisterRetrieves the outbound sync job object corresponding to the specified job model.- Specified by:
getJobin interfaceOutboundSyncJobRegister- Parameters:
model- job entity model representing the cron job being executed.- Returns:
- an outbound sync job for the specified job model. If that job has been requested by same job model before, exactly same instance of the outbound sync job is returned for the subsequent calls; otherwise a new instance of the job is created and registered.
-
getRunningJobs
Description copied from interface:OutboundSyncJobRegisterRetrieves all outbound sync jobs that are currently running.Note: default implementation in this interface returns an empty list. Each implementation of this interface must provide correct implementation of this method.
- Specified by:
getRunningJobsin interfaceOutboundSyncJobRegister- Returns:
- a collection of states for the outbound sync jobs, which are currently registered by this register; or an empty collection, if there is no a single running outbound sync job now.
- See Also:
-
isRunning
Description copied from interface:OutboundSyncJobRegisterChecks whether the specified job is running now or not. The default implementation of this method in this interface always returnsfalse, so this method must be overridden by implementations to provide valid logic.- Specified by:
isRunningin interfaceOutboundSyncJobRegister- Parameters:
id- identifier of the job to acquire about.- Returns:
true, if an outbound sync job with the specified ID is registered in this registry now, i.e. it will be returned by theOutboundSyncJobRegister.getRunningJobs()method; orfalseotherwise.- See Also:
-
createJobStateAggregator
protected OutboundSyncJobStateAggregator createJobStateAggregator(@NotNull @NotNull OutboundSyncCronJobModel job) Creates new instance of the {codeOutboundSyncJobStateAggregator}. This method should only create the aggregator but not register it yet.- Parameters:
job- a model for which an aggregator should be created.- Returns:
- new instance of the aggregator.
-
stateChanged
public void stateChanged(@NotNull @NotNull OutboundSyncCronJobModel model, @NotNull @NotNull OutboundSyncState state) Description copied from interface:OutboundSyncStateObserverNotifies the observer about the outbound sync job state change.- Specified by:
stateChangedin interfaceOutboundSyncStateObserver- Parameters:
model- outbound sync cron job model, for which the state changed. Implementors should not rely on this model correctly reflecting persisted state because the model may be stale. It's just to identify what job has changed.state- new state the job has changed to.
-
setFlexibleSearchService
@Deprecated(since="2205", forRemoval=true) public void setFlexibleSearchService(FlexibleSearchService flexibleSearchService) Deprecated, for removal: This API element is subject to removal in a future version.not used anymore in this register implementationInjects implementation of the flexible search service- Parameters:
flexibleSearchService- service implementation to use
-
setOutboundSyncConfiguration
@Deprecated(since="2205", forRemoval=true) public void setOutboundSyncConfiguration(OutboundSyncConfiguration outboundSyncConfiguration) Deprecated, for removal: This API element is subject to removal in a future version.not used anymore in this register implementationInjects implementation of the outbound sync configuration- Parameters:
outboundSyncConfiguration- configuration implementation to use
-