com.elasticpath.domain.order.impl
Class OrderNumberGeneratorImpl

java.lang.Object
  extended by com.elasticpath.domain.impl.AbstractEpDomainImpl
      extended by com.elasticpath.domain.impl.AbstractPersistenceImpl
          extended by com.elasticpath.domain.order.impl.OrderNumberGeneratorImpl
All Implemented Interfaces:
EpDomain, OrderNumberGenerator, Persistence, java.io.Serializable

public class OrderNumberGeneratorImpl
extends AbstractPersistenceImpl
implements OrderNumberGenerator

This is used to track the next available order number.

Notes:

  • The order number is in a separate domain object so that it can be mapped to a table that can be independently locked while the order number is incremented.
  • Order numbers are strings that may contain characters.
  • There is only one NextOrderNumber object that corresponds to the first record in the table.
  • The table must be pre-populated with a record corresponding to the single instance of this object with the starting order number This implementation of OrderNumberGenerator expects an integer value pre-set in the database and increments it to create new order numbers.

    See Also:
    Serialized Form

    Field Summary
    static long serialVersionUID
              Serial version id.
     
    Fields inherited from interface com.elasticpath.domain.order.OrderNumberGenerator
    INSTANCE_UIDPK
     
    Constructor Summary
    OrderNumberGeneratorImpl()
               
     
    Method Summary
     java.lang.String getNextOrderNumber()
              Get the next available order number and increments it so that each call to this method will return a unique order number.
     
    Methods inherited from class com.elasticpath.domain.impl.AbstractPersistenceImpl
    executeBeforePersistAction, getUidPk, isPersistent, setDefaultValues, setUidPk
     
    Methods inherited from class com.elasticpath.domain.impl.AbstractEpDomainImpl
    getElasticPath, setElasticPath
     
    Methods inherited from class java.lang.Object
    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
     
    Methods inherited from interface com.elasticpath.domain.Persistence
    executeBeforePersistAction, getUidPk, isPersistent, setDefaultValues, setUidPk
     
    Methods inherited from interface com.elasticpath.domain.EpDomain
    getElasticPath, setElasticPath
     

    Field Detail

    serialVersionUID

    public static final long serialVersionUID
    Serial version id.

    See Also:
    Constant Field Values
    Constructor Detail

    OrderNumberGeneratorImpl

    public OrderNumberGeneratorImpl()
    Method Detail

    getNextOrderNumber

    public java.lang.String getNextOrderNumber()
    Get the next available order number and increments it so that each call to this method will return a unique order number. The NextOrderNumber should be persisted after calling this method

    Specified by:
    getNextOrderNumber in interface OrderNumberGenerator
    Returns:
    the order number