DocUtilities
instead.public class DocUtilities
extends java.lang.Object
Document
s.
Code that processes objects (like calculating an invoice amount) is concentrated in this class (instead of in the persistent object classes) to make the persistent objects class reducing network bandwidth and increasing code security (by avoiding code traveling with the persistent object).
Some functions require a persisntent manager and must be provided before calling them.
Modifier and Type | Field and Description |
---|---|
private static org.sistema.persist.PersistentService |
persistentManager
Deprecated.
The manager required to peform queries of persistent objects.
|
Constructor and Description |
---|
DocUtilities()
Deprecated.
|
Modifier and Type | Method and Description |
---|---|
static java.util.Collection<ItemPercentage> |
getDefaultPercentages(java.util.Date date,
java.lang.String ticket)
Deprecated.
|
static java.lang.Iterable<IItem> |
getItems(IDocumentItemized document)
Deprecated.
Builds an array with every
IItem on the invoice. |
static java.util.Collection |
getPayments(org.sistema.persist.Persistent document,
java.util.Date closingDate)
Deprecated.
Retrieves the payments
|
static java.math.BigDecimal |
getPercentageAmount(IItem item,
java.math.BigDecimal baseAmount,
java.math.BigDecimal runningSum,
java.lang.Integer percentageId)
Deprecated.
|
static java.lang.Iterable<ItemPercentage> |
getPercentages(IDocumentItemized invoice,
byte typeId)
Deprecated.
|
static java.util.Collection |
getPercentageTypes(IDocumentItemized document)
Deprecated.
Builds a collection with the percentage types
that are set on an invoice.
|
static java.math.BigDecimal |
getSubtotal(IDocumentItemized document)
Deprecated.
Calculates the subtotal of an invoice based an all it's items value.
|
static java.lang.Boolean |
isDocumentCancelled(org.sistema.persist.Persistent document)
Deprecated.
Standard way to determine if a document has been cancelled.
|
static void |
setPersistentManager(org.sistema.persist.PersistentService newManager)
Deprecated.
Sets the persistent manager used by functions of this class to perform queries.
|
private static org.sistema.persist.PersistentService persistentManager
public static java.lang.Iterable<IItem> getItems(IDocumentItemized document)
IItem
on the invoice.document
- public static java.util.Collection getPayments(org.sistema.persist.Persistent document, java.util.Date closingDate)
document
- Document to retrieve the payments fromclosingDate
- public static java.math.BigDecimal getPercentageAmount(IItem item, java.math.BigDecimal baseAmount, java.math.BigDecimal runningSum, java.lang.Integer percentageId)
item
- baseAmount
- runningSum
- percentageId
- public static java.util.Collection getPercentageTypes(IDocumentItemized document)
document
- public static java.lang.Iterable<ItemPercentage> getPercentages(IDocumentItemized invoice, byte typeId)
invoice
- typeId
- typeId
or an empty collection when no percentages match.public static java.math.BigDecimal getSubtotal(IDocumentItemized document)
document
- public static java.util.Collection<ItemPercentage> getDefaultPercentages(java.util.Date date, java.lang.String ticket) throws java.lang.Exception
java.lang.Exception
public static java.lang.Boolean isDocumentCancelled(org.sistema.persist.Persistent document)
A document is cancelled when the ATTRIBUTE_STAUS_CANCELLED
has been set.
Using this method (instead of checking the ATTRIBUTE_STATUS field of a document object) makes maintenance easier (just one place to change the logic when required).
document
- DocumentConstants
public static void setPersistentManager(org.sistema.persist.PersistentService newManager)
newManager
- The persistent manager.