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.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static enumCard situation map.(package private) static enumCard status map. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final StringCard product type.private SubsystemRepositorySubsystem DB repository.private final TemporalBackofficeProductRepositoryTemporalBackofficeProduct repository.private static final StringEvent version.Fields inherited from class es.kukenan.smartfi.microservice.contracts.service.events.backoffice.AbstractBackofficeEvent
productRepository, userBackofficeRepository -
Constructor Summary
ConstructorsConstructorDescriptionBackofficeProductEventHandlerV2(ProductRepository productRepository, SubsystemRepository subsystemRepository, UserBackofficeRepository userBackofficeRepository, TemporalBackofficeProductRepository temporalBackofficeProductRepository) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionprivate booleancheckEntityValue(Object eventValue) booleancheckHandler(es.kukenan.smartfi.microservice.backoffice.events.cancelled.BackOfficeProductCancelledEvent backOfficeProductCancelledEvent) Determine handler to execute.booleancheckHandler(es.kukenan.smartfi.microservice.backoffice.events.created.BackOfficeProductCreatedEvent backOfficeProductCreatedEvent) Determine handler to execute.booleancheckHandler(es.kukenan.smartfi.microservice.backoffice.events.update.BackOfficeProductUpdatedEvent backOfficeProductUpdatedEvent) Determine handler to execute.private StringcheckProductsType(String productType, Integer backOfficeId) findProduct(UserBackoffice userBackoffice, String productId) voidhandleBackOfficeProductCancelledEvent(es.kukenan.smartfi.microservice.backoffice.events.cancelled.BackOfficeProductCancelledEvent backOfficeProductCancelledEvent) Backoffice product cancelled event handler.voidhandleBackOfficeProductCreatedEvent(es.kukenan.smartfi.microservice.backoffice.events.created.BackOfficeProductCreatedEvent backOfficeProductCreatedEvent) Backoffice product created event handler.voidhandleBackOfficeProductUpdatedEvent(es.kukenan.smartfi.microservice.backoffice.events.update.BackOfficeProductUpdatedEvent backOfficeProductUpdatedEvent) Backoffice product updated event handler.private TemporalBackofficeProductmapBodyToTemporal(es.kukenan.smartfi.microservice.backoffice.events.created.BackofficeMonitorProductEventCreatedBody body) private <T> TmergeCardEntityValue(T oldValue, T newValue) private StringmergeEntityValue(Optional<String> eventValue) private IntegermergeEntityValueInt(Optional<Integer> eventValue) private voidmergeEventBodyWithTemporal(es.kukenan.smartfi.microservice.backoffice.events.update.BackofficeMonitorProductEventUpdatedBody body, TemporalBackofficeProduct temporalBackofficeProduct) private <T> Optional<T>mergeValue(Optional<T> eventValue, T temporalValue) private <T> TmergeValue(T eventValue, T temporalValue) private ProductsaveBackofficeProduct(String backofficeUserId, Integer backOfficeId, String productType, String productId, String entity, String coreProductDetail, String productSubtype) private voidsaveBackofficesProducts(Integer backOfficeId, String productId, String productType, String coreProductDetail, es.kukenan.smartfi.microservice.backoffice.events.update.BackofficeMonitorProductEventUpdatedBody backofficeMonitorProductEventUpdatedBody) private ProductsaveProductV2(String productId, UserBackoffice userBackoffice, String subsystem, String coreProductDetail, String productType, String productSubtype) save product.private voidupdateProduct(Product product, String productId, UserBackoffice userBackoffice, String subsystem, String coreProductDetail, String productType, String productSubtype) Methods inherited from class es.kukenan.smartfi.microservice.contracts.service.events.backoffice.AbstractBackofficeEvent
getProductsByUserBackoffice, gettingSubsystem, saveProduct
-
Field Details
-
VERSION
Event version.- See Also:
-
CARD_TYPES
Card product type.- See Also:
-
temporalBackofficeProductRepository
TemporalBackofficeProduct repository. -
subsystemRepository
Subsystem DB repository.
-
-
Constructor Details
-
BackofficeProductEventHandlerV2
public BackofficeProductEventHandlerV2(ProductRepository productRepository, SubsystemRepository subsystemRepository, UserBackofficeRepository userBackofficeRepository, TemporalBackofficeProductRepository temporalBackofficeProductRepository) Constructor.- Parameters:
productRepository- Product repositorysubsystemRepository- Subsystem repositoryuserBackofficeRepository- User backoffice repositorytemporalBackofficeProductRepository- TemporalBackofficeProduct repository
-
-
Method Details
-
checkHandler
public boolean checkHandler(es.kukenan.smartfi.microservice.backoffice.events.created.BackOfficeProductCreatedEvent backOfficeProductCreatedEvent) Description copied from interface:BackofficeEventDetermine handler to execute.- Specified by:
checkHandlerin interfaceBackofficeEvent- 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:BackofficeEventDetermine handler to execute.- Specified by:
checkHandlerin interfaceBackofficeEvent- 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:BackofficeEventDetermine handler to execute.- Specified by:
checkHandlerin interfaceBackofficeEvent- 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:BackofficeEventBackoffice product created event handler.- Specified by:
handleBackOfficeProductCreatedEventin interfaceBackofficeEvent- Parameters:
backOfficeProductCreatedEvent- event
-
handleBackOfficeProductUpdatedEvent
public void handleBackOfficeProductUpdatedEvent(es.kukenan.smartfi.microservice.backoffice.events.update.BackOfficeProductUpdatedEvent backOfficeProductUpdatedEvent) Description copied from interface:BackofficeEventBackoffice product updated event handler.- Specified by:
handleBackOfficeProductUpdatedEventin interfaceBackofficeEvent- Parameters:
backOfficeProductUpdatedEvent- event
-
handleBackOfficeProductCancelledEvent
public void handleBackOfficeProductCancelledEvent(es.kukenan.smartfi.microservice.backoffice.events.cancelled.BackOfficeProductCancelledEvent backOfficeProductCancelledEvent) Description copied from interface:BackofficeEventBackoffice product cancelled event handler.- Specified by:
handleBackOfficeProductCancelledEventin interfaceBackofficeEvent- Parameters:
backOfficeProductCancelledEvent- event
-
mapBodyToTemporal
private TemporalBackofficeProduct mapBodyToTemporal(es.kukenan.smartfi.microservice.backoffice.events.created.BackofficeMonitorProductEventCreatedBody body) -
findProduct
-
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
-
saveBackofficesProducts
-
updateProduct
-
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
-
mergeEntityValue
-
mergeEntityValueInt
-
mergeCardEntityValue
private <T> T mergeCardEntityValue(T oldValue, T newValue) -
checkEntityValue
-
checkProductsType
-