Class BackofficeProductEventHandlerV2

java.lang.Object
es.kukenan.smartfi.microservice.contracts.service.events.backoffice.AbstractBackofficeEvent
es.kukenan.smartfi.microservice.contracts.service.events.backoffice.v2.BackofficeProductEventHandlerV2
All Implemented Interfaces:
BackofficeEvent

@Component public class BackofficeProductEventHandlerV2 extends AbstractBackofficeEvent implements BackofficeEvent
Backoffice product event for version 2.0.
  • Field Details

  • Constructor Details

    • BackofficeProductEventHandlerV2

      public BackofficeProductEventHandlerV2(ProductRepository productRepository, SubsystemRepository subsystemRepository, UserBackofficeRepository userBackofficeRepository, TemporalBackofficeProductRepository temporalBackofficeProductRepository)
      Constructor.
      Parameters:
      productRepository - Product repository
      subsystemRepository - Subsystem repository
      userBackofficeRepository - User backoffice repository
      temporalBackofficeProductRepository - TemporalBackofficeProduct repository
  • Method Details

    • checkHandler

      public boolean checkHandler(es.kukenan.smartfi.microservice.backoffice.events.created.BackOfficeProductCreatedEvent backOfficeProductCreatedEvent)
      Description copied from interface: BackofficeEvent
      Determine handler to execute.
      Specified by:
      checkHandler in interface BackofficeEvent
      Parameters:
      backOfficeProductCreatedEvent - event
      Returns:
      if the service must manage this version
    • checkHandler

      public boolean checkHandler(es.kukenan.smartfi.microservice.backoffice.events.update.BackOfficeProductUpdatedEvent backOfficeProductUpdatedEvent)
      Description copied from interface: BackofficeEvent
      Determine handler to execute.
      Specified by:
      checkHandler in interface BackofficeEvent
      Parameters:
      backOfficeProductUpdatedEvent - event
      Returns:
      if the service must manage this version
    • checkHandler

      public boolean checkHandler(es.kukenan.smartfi.microservice.backoffice.events.cancelled.BackOfficeProductCancelledEvent backOfficeProductCancelledEvent)
      Description copied from interface: BackofficeEvent
      Determine handler to execute.
      Specified by:
      checkHandler in interface BackofficeEvent
      Parameters:
      backOfficeProductCancelledEvent - event
      Returns:
      if the service must manage this version
    • handleBackOfficeProductCreatedEvent

      public void handleBackOfficeProductCreatedEvent(es.kukenan.smartfi.microservice.backoffice.events.created.BackOfficeProductCreatedEvent backOfficeProductCreatedEvent)
      Description copied from interface: BackofficeEvent
      Backoffice product created event handler.
      Specified by:
      handleBackOfficeProductCreatedEvent in interface BackofficeEvent
      Parameters:
      backOfficeProductCreatedEvent - event
    • handleBackOfficeProductUpdatedEvent

      public void handleBackOfficeProductUpdatedEvent(es.kukenan.smartfi.microservice.backoffice.events.update.BackOfficeProductUpdatedEvent backOfficeProductUpdatedEvent)
      Description copied from interface: BackofficeEvent
      Backoffice product updated event handler.
      Specified by:
      handleBackOfficeProductUpdatedEvent in interface BackofficeEvent
      Parameters:
      backOfficeProductUpdatedEvent - event
    • handleBackOfficeProductCancelledEvent

      public void handleBackOfficeProductCancelledEvent(es.kukenan.smartfi.microservice.backoffice.events.cancelled.BackOfficeProductCancelledEvent backOfficeProductCancelledEvent)
      Description copied from interface: BackofficeEvent
      Backoffice product cancelled event handler.
      Specified by:
      handleBackOfficeProductCancelledEvent in interface BackofficeEvent
      Parameters:
      backOfficeProductCancelledEvent - event
    • mapBodyToTemporal

      private TemporalBackofficeProduct mapBodyToTemporal(es.kukenan.smartfi.microservice.backoffice.events.created.BackofficeMonitorProductEventCreatedBody body)
    • findProduct

      private Optional<Product> findProduct(UserBackoffice userBackoffice, String productId)
    • saveProductV2

      private Product saveProductV2(String productId, UserBackoffice userBackoffice, String subsystem, String coreProductDetail, String productType, String productSubtype)
      save product.
      Parameters:
      productId - productId.
      userBackoffice - user Backoffice.
      subsystem - coming from Product Type.
      coreProductDetail - core products detail.
      productType - product type.
      productSubtype - prodct subtype identifier.
      Returns:
      The product entity saved
    • saveBackofficeProduct

      private Product saveBackofficeProduct(String backofficeUserId, Integer backOfficeId, String productType, String productId, String entity, String coreProductDetail, String productSubtype)
    • saveBackofficesProducts

      private void saveBackofficesProducts(Integer backOfficeId, String productId, String productType, String coreProductDetail, es.kukenan.smartfi.microservice.backoffice.events.update.BackofficeMonitorProductEventUpdatedBody backofficeMonitorProductEventUpdatedBody)
    • updateProduct

      private void updateProduct(Product product, String productId, UserBackoffice userBackoffice, String subsystem, String coreProductDetail, String productType, String productSubtype)
    • mergeEventBodyWithTemporal

      private void mergeEventBodyWithTemporal(es.kukenan.smartfi.microservice.backoffice.events.update.BackofficeMonitorProductEventUpdatedBody body, TemporalBackofficeProduct temporalBackofficeProduct)
    • mergeValue

      private <T> T mergeValue(T eventValue, T temporalValue)
    • mergeValue

      private <T> Optional<T> mergeValue(Optional<T> eventValue, T temporalValue)
    • mergeEntityValue

      private String mergeEntityValue(Optional<String> eventValue)
    • mergeEntityValueInt

      private Integer mergeEntityValueInt(Optional<Integer> eventValue)
    • mergeCardEntityValue

      private <T> T mergeCardEntityValue(T oldValue, T newValue)
    • checkEntityValue

      private boolean checkEntityValue(Object eventValue)
    • checkProductsType

      private String checkProductsType(String productType, Integer backOfficeId)