|
|
|
|
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.torweg.pulse.util.entity.AbstractBasicEntity
org.torweg.pulse.component.shop.model.Price
@Entity(name="Price") public class Price
represents a Price in the shop's model.
| Nested Class Summary | |
|---|---|
static class |
Price.IncomparablePricesException
exception identifying errors during price comparison. |
| Constructor Summary | |
|---|---|
protected |
Price()
Deprecated. |
|
Price(TaxGroup t,
long a)
creates a Price with the given sales tax and amount. |
|
Price(TaxGroup t,
long a, Status s)
creates a Price with the given sales tax, amount and status. |
|
Price(TaxGroup t,
java.lang.String a)
creates a Price with the given sales tax and amount. |
|
Price(TaxGroup t,
java.lang.String a, Status s)
creates a Price with the given sales tax, amount and status. |
| Method Summary | |
|---|---|
boolean |
availableForOrderSize(int a)
returns whether the Price is available for the given order size. |
org.jdom.Element |
deserializeToJDOM()
returns a JDOM representation of the Price. |
long |
getAmount()
returns the amount of the Price. |
java.util.Currency |
getCurrency()
returns the Currency of the Price. |
java.lang.Integer |
getMaxOrderSize()
returns the maximum amount of items the price is valid for or null, if no maximum is set. |
java.lang.Integer |
getMinOrderSize()
returns the minimal amount of items needed to get the price. |
java.util.Set<java.lang.Long> |
getRoleIds()
returns the ids of the roles that are assigned to the price. |
java.util.Set<Role> |
getRoles()
returns a set of roles for whose members the price is available for. |
Status |
getStatus()
returns the status of the price. |
TaxGroup |
getTaxGroup()
returns the sales tax of the Price. |
boolean |
isCheaperThan(Price price)
returns whether this Price is cheaper than the given Price. |
boolean |
isMoreExpensiveThan(Price price)
returns whether this Price is more expensive than the given
Price. |
boolean |
isNetBased()
returns the netBased flag of the Price. |
void |
setAmount(long a)
Sets the amount of the Price. |
void |
setAmount(java.lang.String a)
Sets the amount of the Price. |
void |
setMaxOrderSize(java.lang.Integer a)
sets the maximum amount of items the price is valid for. |
void |
setMinOrderSize(java.lang.Integer a)
sets the minimal amount of items needed to get the price. |
void |
setRoles(java.util.Set<Role> r)
sets the roles for whose members the price is available for. |
void |
setStatus(Status s)
sets the status of the price. |
void |
setTaxGroup(TaxGroup t)
sets the sales tax of the Price. |
net.sf.json.JSONObject |
toJSON()
returns a JSONObject representing the Price. |
static java.lang.String |
toPriceString(long a,
java.util.Currency c)
returns the given long a as a price string. |
| Methods inherited from class org.torweg.pulse.util.entity.AbstractBasicEntity |
|---|
compareTo, equals, getFullQualifiedClassNameJAXB, getId, hashCode |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
@Deprecated protected Price()
public Price(TaxGroup t,
long a)
Price with the given sales tax and amount.
t - the sales taxa - the amount
public Price(TaxGroup t,
java.lang.String a)
Price with the given sales tax and amount.
t - the sales taxa - the amount as a String
public Price(TaxGroup t,
long a, Status s)
Price with the given sales tax, amount and status.
t - the sales taxa - the amounts - the status
public Price(TaxGroup t,
java.lang.String a, Status s)
Price with the given sales tax, amount and status.
t - the sales taxa - the amount as a Strings - the status| Method Detail |
|---|
public final java.util.Currency getCurrency()
Currency of the Price.
Currency of the Pricepublic final boolean isNetBased()
Price.
Pricepublic final long getAmount()
Price.
Pricepublic final void setAmount(long a)
Price.
a - the amount of the Pricepublic final void setAmount(java.lang.String a)
Price.
a - the amount of the Price as String
java.lang.NumberFormatExceptionpublic final TaxGroup getTaxGroup()
Price.
Pricepublic final void setTaxGroup(TaxGroup t)
Price.
t - the sales tax in percentpublic final java.util.Set<Role> getRoles()
public final void setRoles(java.util.Set<Role> r)
r - the roles to setpublic final java.util.Set<java.lang.Long> getRoleIds()
use: assorter-load in administration
public final java.lang.Integer getMinOrderSize()
public final void setMinOrderSize(java.lang.Integer a)
a - the minimal amountpublic final java.lang.Integer getMaxOrderSize()
null, if no maximum is set.
null, if no maximum is setpublic final void setMaxOrderSize(java.lang.Integer a)
a - the maximum amount (may be null)public final boolean availableForOrderSize(int a)
Price is available for the given order size.
a - the order size
true, if and only if, the Price is available for
the given order size. Otherwise false.public final Status getStatus()
public final void setStatus(Status s)
s - the status to setpublic final boolean isCheaperThan(Price price)
Price is cheaper than the given Price.
price - the price to check against
true, if and only if this Price is cheaper than
the given Price. Otherwise falsepublic final boolean isMoreExpensiveThan(Price price)
Price is more expensive than the given
Price.
price - the price to check against
true, if and only if this Price is more expensive
than the given Price. Otherwise falsepublic org.jdom.Element deserializeToJDOM()
Price.
deserializeToJDOM in interface JDOMablePriceJDOMable.deserializeToJDOM()public final net.sf.json.JSONObject toJSON()
JSONObject representing the Price.
JSONObject representing the Price
public static java.lang.String toPriceString(long a,
java.util.Currency c)
If "defaultFractionDigits" of the given currency is greater than 0, "strRep" (strRep = Long.toString(a)) is expanded with leading '0's, if strRep.length() is lesser than or equal to "defaultFractionDigits". After that, a '.' (decimal point) is inserted in strRep at (strRep.length() - "defaultFractionDigits").
a - the amountc - the currency
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||