@Entity public class SubOrder<O extends Order<I>,I extends OrderItem> extends RelatedOrder<O,I> implements Iterator<O>, IHierarchialReference<Long>
RelatedOrder that tracks its own partialAmount and previous and next.SubOrder shares the same OrderItem of its RelatedOrder.getRoot() by overriding getItems(). The items of the SubOrder are by default null
to avoid multiple copies, and rather rely on the getItems() method.| Modifier and Type | Field and Description |
|---|---|
protected String |
hierarchy
|
protected Amount |
partialAmount
|
rootcreated, id, paymentMethod, purchaseDate, realized, statusDate, type, useramount, finalWeight, lastStatusReason, packagingAmount, paymentContext, promotionNames, quantity, shippingAmount, status, updatedROOT| Constructor and Description |
|---|
SubOrder() |
SubOrder(GenericEcomUser user,
PaymentContext paymentContext,
PaymentMethod paymentMethod,
Amount amount,
Date purchaseDate) |
SubOrder(GenericEcomUser user,
PaymentMethod paymentMethod) |
SubOrder(GenericEcomUser user,
PaymentMethod paymentMethod,
Amount amount) |
SubOrder(GenericEcomUser user,
PaymentMethod paymentMethod,
Amount amount,
Date purchaseDate) |
SubOrder(O root) |
SubOrder(O root,
Amount partialAmount) |
SubOrder(String json) |
SubOrder(SubOrder<O,I> previous) |
SubOrder(SubOrder<O,I> previousOrRoot,
Amount partialAmount) |
| Modifier and Type | Method and Description |
|---|---|
String |
getHierarchy()
A String like: "rootId-nodeId-subnodeId-thisId"; gives the entire picture of
the hierarchy to this point.
|
List<I> |
getItems() |
String |
getName()
Return
Order.getId() |
<S extends SubOrder<O,I>> |
getNext()
In the sequence of Orders created, the next
SubOrder
The first most element may or may not be the parent. |
Long |
getParentId() |
Amount |
getPartialAmount()
|
Double |
getPayableTotal()
Payable Total for a SubOrder =
partialAmount.total (if it exists)
else
Payable Total for a SubOrder = amount.total - any partialAmount.discount
The method is provided to define a consistent meaning of a payable total for the SubOrder. |
<S extends SubOrder<O,I>> |
getPrevious()
In the sequence of Orders created, the previous
SubOrder
The first most element may or may not be the parent. |
Boolean |
getSucceded()
If A
SubOrder is created for this one that succeeds it.This reflects both (linear or hierarchical) succession. |
Double |
getTotalDiscount()
In the
SubOrder the discount has 2 components. |
boolean |
hasNext() |
O |
next() |
void |
remove() |
protected void |
set(O root)
Inherit some properties from root; if root is null then leave state unchanged
|
void |
setHierarchy(String hierarchy)
A String like: "rootId-nodeId-subnodeId-thisId"; gives the entire picture of
the hierarchy to this point.
|
void |
setName(String name)
Method not supported for this implementation
|
<S extends SubOrder<O,I>> |
setNext(S next)
In the sequence of Orders created, the next
SubOrder
The first most element may or may not be the parent. |
void |
setParentId(Long parentId)
Method not supported for this implementation, as we
cannot override
RelatedOrder.getRoot()Order.setId(Long). |
void |
setPartialAmount(Amount partialAmount)
|
<S extends SubOrder<O,I>> |
setPrevious(S previous)
In the sequence of Orders created, the previous
SubOrder
The first most element may or may not be the parent. |
void |
setSucceded(Boolean succeded)
If A
SubOrder is created for this one that succeeds it.This reflects both (linear or hierarchical) succession. |
String |
toString() |
void |
validateRelations()
Since a double linked list is created , also validate the list to ensure no wierd links or kinks created
Detect cycles, error for current node.
|
deriveRoot, getRoot, setRootaddItem, addTransaction, equals, getActors, getBitmask, getCreated, getDeliveryDetails, getFlowStatus, getId, getInvoiceId, getLastInvoiceDate, getParams, getPaymentMethod, getPurchaseDate, getRealized, getStatusDate, getSteps, getStrategiesVersion, getTransaction, getTransactionIds, getType, getUser, getUserContactDetails, hashCode, setActors, setBitmask, setCreated, setDeliveryDetails, setId, setInvoiceId, setItems, setLastInvoiceDate, setParams, setPaymentMethod, setPurchaseDate, setRealized, setStatus, setStatusDate, setSteps, setStrategiesVersion, setTransaction, setTransactionIds, setType, setUser, setUserContactDetails, synchStatusWithItemsgetAmount, getComments, getFinalWeight, getLastStatusReason, getPackagingAmount, getPaymentContext, getPromotionNames, getQuantity, getShippingAmount, getStatus, getUpdated, setAmount, setComments, setFinalWeight, setLastStatusReason, setPackagingAmount, setPaymentContext, setPromotionNames, setQuantity, setShippingAmount, setUpdatedclone, finalize, getClass, notify, notifyAll, wait, wait, waitforEachRemaininggetId, setIdgetUpdatedpublic SubOrder()
public SubOrder(String json)
public SubOrder(GenericEcomUser user, PaymentMethod paymentMethod)
public SubOrder(GenericEcomUser user, PaymentMethod paymentMethod, Amount amount)
public SubOrder(GenericEcomUser user, PaymentMethod paymentMethod, Amount amount, Date purchaseDate)
public SubOrder(GenericEcomUser user, PaymentContext paymentContext, PaymentMethod paymentMethod, Amount amount, Date purchaseDate)
public SubOrder(O root)
protected void set(O root)
public <S extends SubOrder<O,I>> S getPrevious()
SubOrder
SubOrder then it is likely to be the parent.public <S extends SubOrder<O,I>> void setPrevious(S previous)
SubOrder
SubOrder then it is likely to be the parent.public <S extends SubOrder<O,I>> S getNext()
SubOrder
SubOrder then it is likely to be the parent.public <S extends SubOrder<O,I>> void setNext(S next)
SubOrder
SubOrder then it is likely to be the parent.public Amount getPartialAmount()
public void setPartialAmount(Amount partialAmount)
public Double getTotalDiscount()
SubOrder the discount has 2 components. The discount component from the amount and the partialAmountSubOrder.
One can override this method to change what a total discount means, when looking @ a particular SubOrderpublic Double getPayableTotal()
partialAmount.total (if it exists)
else
Payable Total for a SubOrder = amount.total - any partialAmount.discount
SubOrder.
One can override this method to change what a total means, when looking @ a particular SubOrderpublic Boolean getSucceded()
SubOrder is created for this one that succeeds it.getSucceded in class RelatedOrder<O extends Order<I>,I extends OrderItem>public void setSucceded(Boolean succeded)
SubOrder is created for this one that succeeds it.setSucceded in class RelatedOrder<O extends Order<I>,I extends OrderItem>public void validateRelations()
throws javax.validation.ValidationException
javax.validation.ValidationExceptionpublic String toString()
public String getName()
Order.getId()getName in interface IHierarchialReference<Long>public void setName(String name)
setName in interface IHierarchialReference<Long>public Long getParentId()
getParentId in interface IHierarchialReference<Long>public void setParentId(Long parentId)
RelatedOrder.getRoot()Order.setId(Long). No benefit.setParentId in interface IHierarchialReference<Long>public String getHierarchy()
IHierarchialReferencegetHierarchy in interface IHierarchialReference<Long>public void setHierarchy(String hierarchy)
IHierarchialReferencesetHierarchy in interface IHierarchialReference<Long>Copyright © 2018. All rights reserved.