pulse - the web application framework Get pulse at SourceForge.net. Fast, secure and Free Open Source software downloads Ohloh project report for pulse-java

org.torweg.pulse.component.shop.model
Class TaxGroup

java.lang.Object
  extended by org.torweg.pulse.util.entity.AbstractBasicEntity
      extended by org.torweg.pulse.util.entity.AbstractNamedEntity
          extended by org.torweg.pulse.util.entity.AbstractNamableEntity
              extended by org.torweg.pulse.component.shop.model.TaxGroup
All Implemented Interfaces:
java.io.Serializable, JDOMable, INameable, INamed

@Entity
public class TaxGroup
extends AbstractNamableEntity
implements INameable, JDOMable

represents a tax group in the shop's model.

The TaxGroup has the following uniqueness constraints:

  1. Names must be unique for a ShopSettings: @UniqueConstraint(columnNames = "shopSettings_id", "name")
  2. Percentages must be unique for a ShopSettings: @UniqueConstraint(columnNames = "shopSettings_id", "percentage")

Version:
$Revision: 1933 $
Author:
Thomas Weber, Christian Schatt, Daniel Dietz
See Also:
Serialized Form

Constructor Summary
protected TaxGroup()
          Deprecated. 
  TaxGroup(java.lang.String n, long p)
          creates a new TaxGroup with the given name and percentage.
  TaxGroup(java.lang.String n, java.lang.String p)
          creates a new TaxGroup with the given name and percentage.
 
Method Summary
 org.jdom.Element deserializeToJDOM()
          returns a JDOM representation of the Price.
 long getPercentage()
          returns the percentage of the TaxGroup.
 java.lang.String getPercentageString()
          returns the percentage of the TaxGroup as a string with the fraction.
 ShopSettings getShopSettings()
          returns the shop settings the tax group is associated with.
 void setPercentage(long p)
          sets the percentage of the TaxGroup.
 void setPercentage(java.lang.String p)
          sets the percentage of the TaxGroup from a given string.
protected  void setSettings(ShopSettings s)
          is called by ShopSettings.setTaxGroups(java.util.Set) to keep track of the bidirectional mapping, i.e.
 net.sf.json.JSONObject toJSON()
          returns a JSONObject representing the TaxGroup.
 java.lang.String toString()
          returns a string representation of the tax group.
 
Methods inherited from class org.torweg.pulse.util.entity.AbstractNamableEntity
setName
 
Methods inherited from class org.torweg.pulse.util.entity.AbstractNamedEntity
getName
 
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, wait, wait, wait
 
Methods inherited from interface org.torweg.pulse.util.INameable
setName
 
Methods inherited from interface org.torweg.pulse.util.INamed
getName
 

Constructor Detail

TaxGroup

@Deprecated
protected TaxGroup()
Deprecated. 

used by HibernateTM.


TaxGroup

public TaxGroup(java.lang.String n,
                long p)
creates a new TaxGroup with the given name and percentage.

Parameters:
n - the name
p - the percentage

TaxGroup

public TaxGroup(java.lang.String n,
                java.lang.String p)
creates a new TaxGroup with the given name and percentage.

Parameters:
n - the name
p - the percentage as string
Method Detail

getShopSettings

public final ShopSettings getShopSettings()
returns the shop settings the tax group is associated with.

Returns:
the shop settings

setSettings

protected final void setSettings(ShopSettings s)
is called by ShopSettings.setTaxGroups(java.util.Set) to keep track of the bidirectional mapping, i.e. the mapping is managed by ShopSettings.

Parameters:
s - the shop settings the tax group is associated with

getPercentage

public final long getPercentage()
returns the percentage of the TaxGroup.

Returns:
the percentage of the TaxGroup

getPercentageString

public final java.lang.String getPercentageString()
returns the percentage of the TaxGroup as a string with the fraction.

Returns:
the percentage of the TaxGroup as a string

setPercentage

public final void setPercentage(java.lang.String p)
sets the percentage of the TaxGroup from a given string.

Parameters:
p - the percentage to set as string

setPercentage

public final void setPercentage(long p)
sets the percentage of the TaxGroup.

Parameters:
p - the percentage to set

toString

public java.lang.String toString()
returns a string representation of the tax group.

Overrides:
toString in class java.lang.Object
Returns:
a string representation

deserializeToJDOM

public final org.jdom.Element deserializeToJDOM()
returns a JDOM representation of the Price.

Specified by:
deserializeToJDOM in interface JDOMable
Returns:
a JDOM representation of the Price
See Also:
JDOMable.deserializeToJDOM()

toJSON

public final net.sf.json.JSONObject toJSON()
returns a JSONObject representing the TaxGroup.

Returns:
a JSONObject representing the TaxGroup