Class DefaultOutboundSyncJobRegister

    • Constructor Detail

      • DefaultOutboundSyncJobRegister

        public DefaultOutboundSyncJobRegister​(@NotNull
                                              @NotNull ModelService service)
    • Method Detail

      • getNewJob

        @NotNull
        public @NotNull OutboundSyncJob getNewJob​(@NotNull
                                                  @NotNull OutboundSyncCronJobModel jobModel)
        Description copied from interface: OutboundSyncJobRegister
        Retrieves 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:
        getNewJob in interface OutboundSyncJobRegister
        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

        public java.util.Optional<OutboundSyncJob> getJob​(@NotNull
                                                          @NotNull PK jobPk)
        Description copied from interface: OutboundSyncJobRegister
        Retrieves the outbound sync job object corresponding to the specified job model primary key.
        Specified by:
        getJob in interface OutboundSyncJobRegister
        Parameters:
        jobPk - primary key of the job entity model, for which the aggregator 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 Optional for the subsequent calls; otherwise a new instance of the outbound sync job is created and registered. If the primary key does not correspond to an OutboundSyncCronJobModel, then Optional.empty() is returned.
      • getJob

        @NotNull
        public @NotNull OutboundSyncJob getJob​(@NotNull
                                               @NotNull OutboundSyncCronJobModel jobModel)
        Description copied from interface: OutboundSyncJobRegister
        Retrieves the outbound sync job object corresponding to the specified job model.
        Specified by:
        getJob in interface OutboundSyncJobRegister
        Parameters:
        jobModel - 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.
      • stateChanged

        public void stateChanged​(@NotNull
                                 @NotNull OutboundSyncCronJobModel model,
                                 @NotNull
                                 @NotNull OutboundSyncState state)
        Description copied from interface: OutboundSyncStateObserver
        Notifies the observer about the outbound sync job state change.
        Specified by:
        stateChanged in interface OutboundSyncStateObserver
        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

        public void setFlexibleSearchService​(FlexibleSearchService flexibleSearchService)
      • setOutboundSyncConfiguration

        public void setOutboundSyncConfiguration​(OutboundSyncConfiguration outboundSyncConfiguration)