public class StatusServiceImpl extends java.lang.Object implements StatusService
Modifier and Type | Field and Description |
---|---|
private TimestampCache |
cache |
private static org.slf4j.Logger |
log |
private OrderRepository |
orderRepository |
private ShopRepository |
shopRepository |
Constructor and Description |
---|
StatusServiceImpl(javax.inject.Provider<ShopRepository> shopProvider,
javax.inject.Provider<OrderRepository> orderProvider,
javax.inject.Provider<TimestampCache> cacheProvider) |
Modifier and Type | Method and Description |
---|---|
private void |
captureTimestamp(java.lang.String shopId) |
private void |
eraseTimestamp(java.lang.String shopId) |
private OrderEntity |
getOrCreateOrderEntity(java.lang.String shopId,
java.lang.String orderId) |
private ShopEntity |
getOrCreateShopEntity(java.lang.String shopId) |
private OrderEntity |
getOrderEntity(java.lang.String shopId,
java.lang.String orderId) |
OrderStatusInformation |
getOrderStatus(java.lang.String shopId,
java.lang.String orderId)
Returns status information about a specific order.
|
private ShopEntity |
getShopEntity(java.lang.String shopId) |
ShopStatusInformation |
getShopStatus(java.lang.String shopId)
Returns status information about a specific shop.
|
void |
initializeShopStatus(java.lang.String shopId)
Initializes the status information for a specific shop.
|
boolean |
isFirstSynchronization(java.lang.String shopId)
Determines if the shop has already performed a
successful synchronization at least once.
|
boolean |
isReadyForSynchronization(java.lang.String shopId)
Determines if the shop with the specified identifier
is ready to perform a synchronization.
|
private void |
saveOrderEntity(OrderEntity entity) |
private void |
saveShopEntity(ShopEntity entity) |
void |
setBusy(java.lang.String shopId)
Sets a specific shop sync-status to "busy".
|
void |
setConnected(java.lang.String shopId)
Sets a specific shop connection-status to "connected".
|
void |
setDisconnected(java.lang.String shopId)
Sets a specific shop connection-status to "disconnected".
|
void |
setIdle(java.lang.String shopId)
Sets a specific shop sync-status to "idle".
|
void |
setOrderStatus(OrderStatusInformation status)
Sets the status of a specific order.
|
void |
synchronizationAborted(java.lang.String shopId)
Sets a specific shop sync-status to "idle"
without updating the last synchronization timestamp.
|
void |
synchronizationCompleted(java.lang.String shopId)
Sets a specific shop sync-status to "idle"
and updates the last synchronization timestamp.
|
void |
synchronizationStarted(java.lang.String shopId)
Sets a specific shop sync-status to "busy".
|
private java.lang.String |
timestampToString(java.sql.Timestamp timestamp) |
private ShopRepository shopRepository
private OrderRepository orderRepository
private TimestampCache cache
private static final org.slf4j.Logger log
@Inject public StatusServiceImpl(javax.inject.Provider<ShopRepository> shopProvider, javax.inject.Provider<OrderRepository> orderProvider, javax.inject.Provider<TimestampCache> cacheProvider)
public boolean isReadyForSynchronization(java.lang.String shopId)
StatusService
isReadyForSynchronization
in interface StatusService
public boolean isFirstSynchronization(java.lang.String shopId)
StatusService
isFirstSynchronization
in interface StatusService
public ShopStatusInformation getShopStatus(java.lang.String shopId) throws javax.persistence.EntityNotFoundException, javax.persistence.PersistenceException
StatusService
getShopStatus
in interface StatusService
javax.persistence.EntityNotFoundException
- in case a shop with
the passed identifier could not be found.javax.persistence.PersistenceException
- in case an error
occurred while accessing the database.public OrderStatusInformation getOrderStatus(java.lang.String shopId, java.lang.String orderId) throws javax.persistence.EntityNotFoundException, javax.persistence.PersistenceException
StatusService
getOrderStatus
in interface StatusService
javax.persistence.EntityNotFoundException
- in case a shop with
the passed identifier or a order with the passed
identifier could not be found.javax.persistence.PersistenceException
- in case an error
occurred while accessing the database.public void setOrderStatus(OrderStatusInformation status) throws javax.persistence.PersistenceException
StatusService
setOrderStatus
in interface StatusService
javax.persistence.PersistenceException
- in case an error
occurred while saving the data.public void initializeShopStatus(java.lang.String shopId) throws javax.persistence.PersistenceException
StatusService
initializeShopStatus
in interface StatusService
javax.persistence.PersistenceException
- in case an error
occurred while saving the data.public void setConnected(java.lang.String shopId) throws javax.persistence.EntityNotFoundException, javax.persistence.PersistenceException
StatusService
setConnected
in interface StatusService
javax.persistence.EntityNotFoundException
- in case a shop with
the passed identifier could not be found.javax.persistence.PersistenceException
- in case an error
occurred while saving the data.public void setDisconnected(java.lang.String shopId) throws javax.persistence.EntityNotFoundException, javax.persistence.PersistenceException
StatusService
setDisconnected
in interface StatusService
javax.persistence.EntityNotFoundException
- in case a shop with
the passed identifier could not be found.javax.persistence.PersistenceException
- in case an error
occurred while saving the data.public void setBusy(java.lang.String shopId) throws javax.persistence.EntityNotFoundException, javax.persistence.PersistenceException
StatusService
setBusy
in interface StatusService
javax.persistence.EntityNotFoundException
- in case a shop with
the passed identifier could not be found.javax.persistence.PersistenceException
- in case an error
occurred while saving the data.public void setIdle(java.lang.String shopId) throws javax.persistence.EntityNotFoundException, javax.persistence.PersistenceException
StatusService
setIdle
in interface StatusService
javax.persistence.EntityNotFoundException
- in case a shop with
the passed identifier could not be found.javax.persistence.PersistenceException
- in case an error
occurred while saving the data.public void synchronizationStarted(java.lang.String shopId) throws javax.persistence.EntityNotFoundException, javax.persistence.PersistenceException
StatusService
synchronizationStarted
in interface StatusService
javax.persistence.EntityNotFoundException
- in case a shop with
the passed identifier could not be found.javax.persistence.PersistenceException
- in case an error
occurred while saving the data.public void synchronizationAborted(java.lang.String shopId) throws javax.persistence.EntityNotFoundException, javax.persistence.PersistenceException
StatusService
synchronizationAborted
in interface StatusService
javax.persistence.EntityNotFoundException
- in case a shop with
the passed identifier could not be found.javax.persistence.PersistenceException
- in case an error
occurred while saving the data.public void synchronizationCompleted(java.lang.String shopId) throws javax.persistence.EntityNotFoundException, javax.persistence.PersistenceException
StatusService
synchronizationCompleted
in interface StatusService
javax.persistence.EntityNotFoundException
- in case a shop with
the passed identifier could not be found.javax.persistence.PersistenceException
- in case an error
occurred while saving the data.private void captureTimestamp(java.lang.String shopId)
private void eraseTimestamp(java.lang.String shopId)
private ShopEntity getShopEntity(java.lang.String shopId) throws javax.persistence.EntityNotFoundException, javax.persistence.PersistenceException
javax.persistence.EntityNotFoundException
javax.persistence.PersistenceException
private ShopEntity getOrCreateShopEntity(java.lang.String shopId) throws javax.persistence.PersistenceException
javax.persistence.PersistenceException
private void saveShopEntity(ShopEntity entity) throws javax.persistence.PersistenceException
javax.persistence.PersistenceException
private OrderEntity getOrderEntity(java.lang.String shopId, java.lang.String orderId) throws javax.persistence.EntityNotFoundException, javax.persistence.PersistenceException
javax.persistence.EntityNotFoundException
javax.persistence.PersistenceException
private OrderEntity getOrCreateOrderEntity(java.lang.String shopId, java.lang.String orderId) throws javax.persistence.PersistenceException
javax.persistence.PersistenceException
private void saveOrderEntity(OrderEntity entity) throws javax.persistence.PersistenceException
javax.persistence.PersistenceException
private java.lang.String timestampToString(java.sql.Timestamp timestamp)