org.broadleafcommerce.inventory.admin.server.service.handler
Class AdminInventoryPersister

java.lang.Object
  extended by org.broadleafcommerce.inventory.admin.server.service.handler.AdminInventoryPersister

public class AdminInventoryPersister
extends Object

Used in order to create a new transaction when trying to save inventory. Needed to create separate Spring bean component for this logic because in order to be apart of a different transaction, the new transactional method has to be apart of a different bean. This component should only be used by the InventoryCustomPersistenceHandler#update() method.

Author:
Phillip Verheyden (phillipuniverse)

Field Summary
protected  InventoryDao inventoryDao
           
protected  InventoryService inventoryService
           
 
Constructor Summary
AdminInventoryPersister()
           
 
Method Summary
protected  Inventory populateInventory(Inventory adminInstance, org.broadleafcommerce.openadmin.client.dto.Entity entity, Map<String,org.broadleafcommerce.openadmin.client.dto.FieldMetadata> inventoryProperties, org.broadleafcommerce.openadmin.server.service.persistence.module.RecordHelper helper)
          Attempts to populate the given Inventory instance with the merged properties from the admin.
 Inventory saveAdminInventory(Long inventoryId, org.broadleafcommerce.openadmin.client.dto.Entity entity, Map<String,org.broadleafcommerce.openadmin.client.dto.FieldMetadata> adminProperties, org.broadleafcommerce.openadmin.server.service.persistence.module.RecordHelper helper)
          Creates a new transaction and attempts a read, populate, update within the transaction.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

inventoryDao

protected InventoryDao inventoryDao

inventoryService

protected InventoryService inventoryService
Constructor Detail

AdminInventoryPersister

public AdminInventoryPersister()
Method Detail

saveAdminInventory

@Transactional(propagation=REQUIRES_NEW,
               value="blTransactionManager",
               rollbackFor={InventoryUnavailableException.class,ConcurrentInventoryModificationException.class})
public Inventory saveAdminInventory(Long inventoryId,
                                                                                                                                   org.broadleafcommerce.openadmin.client.dto.Entity entity,
                                                                                                                                   Map<String,org.broadleafcommerce.openadmin.client.dto.FieldMetadata> adminProperties,
                                                                                                                                   org.broadleafcommerce.openadmin.server.service.persistence.module.RecordHelper helper)
                             throws ConcurrentInventoryModificationException,
                                    NumberFormatException,
                                    IllegalAccessException,
                                    InvocationTargetException,
                                    NoSuchMethodException,
                                    ParseException,
                                    InstantiationException,
                                    ClassNotFoundException
Creates a new transaction and attempts a read, populate, update within the transaction. Retry logic should only look for a ConcurrentModificationException. All other exceptions are thrown as a result of attempting to populate the Inventory object from the adminProperties passed in.

Parameters:
inventory -
entity -
adminProperties -
helper -
Throws:
ConcurrentInventoryModificationException
ClassNotFoundException
InstantiationException
ParseException
NoSuchMethodException
InvocationTargetException
IllegalAccessException
NumberFormatException

populateInventory

protected Inventory populateInventory(Inventory adminInstance,
                                      org.broadleafcommerce.openadmin.client.dto.Entity entity,
                                      Map<String,org.broadleafcommerce.openadmin.client.dto.FieldMetadata> inventoryProperties,
                                      org.broadleafcommerce.openadmin.server.service.persistence.module.RecordHelper helper)
                               throws NumberFormatException,
                                      IllegalAccessException,
                                      InvocationTargetException,
                                      NoSuchMethodException,
                                      ParseException,
                                      InstantiationException,
                                      ClassNotFoundException
Attempts to populate the given Inventory instance with the merged properties from the admin. Returns null if the given adminInstance fails validation. If validation fails, invokers should return the entity that was passed in since this will contain the validation failures.

Parameters:
adminInstance -
entity -
inventoryProperties -
helper -
Returns:
Throws:
NumberFormatException
IllegalAccessException
InvocationTargetException
NoSuchMethodException
ParseException
InstantiationException
ClassNotFoundException


Copyright © 2013. All Rights Reserved.