@Service(value="blResourcePurgeService") public class ResourcePurgeServiceImpl extends Object implements ResourcePurgeService
ResourcePurgeService
for additional API documentation.
A basic Quartz scheduled job configuration for calling this service can be configured as follows:
<bean id="purgeCartConfig" class="org.springframework.beans.factory.config.MapFactoryBean">
<property name="sourceMap">
<map>
<entry key="SECONDS_OLD" value="2592000"/>
<entry key="STATUS" value="IN_PROCESS"/>
</map>
</property>
</bean>
<p/>
<bean id="purgeCartJobDetail" class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">
<property name="targetObject" ref="blResourcePurgeService" />
<property name="targetMethod" value="purgeCarts" />
<property name="arguments">
<list>
<ref bean="purgeCartConfig"/>
</list>
</property>
</bean>
<p/>
<bean id="purgeCartTrigger" class="org.springframework.scheduling.quartz.SimpleTriggerFactoryBean">
<property name="jobDetail" ref="purgeCartJobDetail" />
<property name="startDelay" value="30000" />
<property name="repeatInterval" value="86400000" />
</bean>
Modifier and Type | Field and Description |
---|---|
protected org.broadleafcommerce.core.util.service.ResourcePurgeServiceImpl.PurgeErrorCache |
cartPurgeErrors |
protected org.broadleafcommerce.core.util.service.ResourcePurgeServiceImpl.PurgeErrorCache |
customerPurgeErrors |
protected CustomerService |
customerService |
protected OrderService |
orderService |
protected ResourcePurgeDao |
resourcePurgeDao |
protected org.springframework.transaction.PlatformTransactionManager |
transactionManager |
Constructor and Description |
---|
ResourcePurgeServiceImpl() |
Modifier and Type | Method and Description |
---|---|
protected void |
deleteCart(Order cart)
Remove the cart from the persistence layer.
|
protected void |
deleteCustomer(Customer customer)
Remove the cart from the persistence layer.
|
protected Set<Long> |
getCartsInErrorToIgnore(org.broadleafcommerce.core.util.service.ResourcePurgeServiceImpl.CartPurgeParams purgeParams)
Get the Carts Ids from cache that should be ignored due to errors in previous purge attempts.
|
protected List<Order> |
getCartsToPurge(org.broadleafcommerce.core.util.service.ResourcePurgeServiceImpl.CartPurgeParams purgeParams,
int startPos,
int length,
List<Long> cartsInError)
Get the list of carts to delete from the database.
|
protected Long |
getCartsToPurgeLength(org.broadleafcommerce.core.util.service.ResourcePurgeServiceImpl.CartPurgeParams purgeParams,
List<Long> cartsInError) |
protected Set<Long> |
getCustomersInErrorToIgnore(org.broadleafcommerce.core.util.service.ResourcePurgeServiceImpl.CustomerPurgeParams purgeParams)
Get the Customer Ids from cache that should be ignored due to errors in previous purge attempts
|
protected List<Customer> |
getCustomersToPurge(org.broadleafcommerce.core.util.service.ResourcePurgeServiceImpl.CustomerPurgeParams purgeParams,
int startPos,
int length,
List<Long> customersInError)
Get the list of carts to delete from the database.
|
protected Long |
getCustomersToPurgeLength(org.broadleafcommerce.core.util.service.ResourcePurgeServiceImpl.CustomerPurgeParams purgeParams,
List<Long> customersInError)
Get the count of customers to delete from the database.
|
void |
purgeCarts(Map<String,String> config)
Execute a purge of carts from the persistence layer based on the configuration parameters.
|
void |
purgeCustomers(Map<String,String> config) |
protected org.broadleafcommerce.core.util.service.ResourcePurgeServiceImpl.PurgeErrorCache customerPurgeErrors
protected org.broadleafcommerce.core.util.service.ResourcePurgeServiceImpl.PurgeErrorCache cartPurgeErrors
protected org.springframework.transaction.PlatformTransactionManager transactionManager
protected ResourcePurgeDao resourcePurgeDao
protected OrderService orderService
protected CustomerService customerService
public void purgeCarts(Map<String,String> config)
ResourcePurgeService
org.broadleafcommerce.core.order.service.OrderService#findCarts(String[],
org.broadleafcommerce.core.order.service.type.OrderStatus[], java.util.Date, Boolean, int, int)
for more info on the default behavior.purgeCarts
in interface ResourcePurgeService
config
- Map of params used to drive the selection of carts to purgepublic void purgeCustomers(Map<String,String> config)
purgeCustomers
in interface ResourcePurgeService
protected Set<Long> getCartsInErrorToIgnore(org.broadleafcommerce.core.util.service.ResourcePurgeServiceImpl.CartPurgeParams purgeParams)
purgeParams
- configured parameters for the cart purge processprotected List<Order> getCartsToPurge(org.broadleafcommerce.core.util.service.ResourcePurgeServiceImpl.CartPurgeParams purgeParams, int startPos, int length, List<Long> cartsInError)
purgeParams
- configured parameters for the Cart purge processcartsInError
- list of cart ids to be ignored/excluded from the queryprotected Long getCartsToPurgeLength(org.broadleafcommerce.core.util.service.ResourcePurgeServiceImpl.CartPurgeParams purgeParams, List<Long> cartsInError)
protected void deleteCart(Order cart)
cart
- the cart to removeprotected Set<Long> getCustomersInErrorToIgnore(org.broadleafcommerce.core.util.service.ResourcePurgeServiceImpl.CustomerPurgeParams purgeParams)
purgeParams
- configured parameters for the Customer purge processprotected List<Customer> getCustomersToPurge(org.broadleafcommerce.core.util.service.ResourcePurgeServiceImpl.CustomerPurgeParams purgeParams, int startPos, int length, List<Long> customersInError)
purgeParams
- configured parameters for the Customer purge processcustomersInError
- list of customer ids to be ignored/excluded from the queryprotected Long getCustomersToPurgeLength(org.broadleafcommerce.core.util.service.ResourcePurgeServiceImpl.CustomerPurgeParams purgeParams, List<Long> customersInError)
purgeParams
- configured parameters for the Customer purge processcustomersInError
- list of customer ids to be ignored/excluded from the queryprotected void deleteCustomer(Customer customer)
customer
- the customer to removeCopyright © 2017. All rights reserved.