org.apache.ojb.odmg
Class Article

java.lang.Object
  extended byorg.apache.ojb.odmg.Article
All Implemented Interfaces:
java.io.Serializable, TransactionAware

public class Article
extends java.lang.Object
implements TransactionAware

Simple Article class is not derived from any base class nor does it implement any Interface, but still it can be made persistent by the PersistenceBroker. Has a lot of private members to be mapped to rdbms columns, but only few business methods

See Also:
Serialized Form

Field Summary
 
Fields inherited from interface org.apache.ojb.odmg.TransactionAware
serialVersionUID
 
Constructor Summary
Article()
           
Article(int pArticleId, java.lang.String pArticleName, int pSupplierId, int pProcuctGroupId, java.lang.String pUnit, double pPrice, int pStock, int pOrderedUnits, int pMinimumStock, boolean pIsSelloutArticle)
           
 
Method Summary
 void addToStock(int diff)
          increase the amount of articles in stock by diff mark the object as modified only if value changes (i.e.
 void afterAbort()
          afterAbort will be called after a transaction has been aborted.
 void afterCommit()
          afterCommit is called only after a successful commit has taken place.
 void beforeAbort()
          beforeAbort is called before a transaction is aborted.
 void beforeCommit()
          beforeCommit will give an object a chance to kill a transaction before it is committed.
 boolean equals(java.lang.Object obj)
           
 int getArticleId()
          return an articles unique id.
 java.lang.String getArticleName()
          return an articles name.
 boolean getIsSelloutArticle()
          Gets the isSelloutArticle.
 int getMinimumStock()
          Gets the minimumStock.
 int getOrderedUnits()
          Gets the orderedUnits.
 double getPrice()
          Gets the price.
 ProductGroup getProductGroup()
          return an articles ProductGroup
 int getProductGroupId()
          Gets the productGroupId.
 int getStock()
          return stock of Article.
 double getStockValue()
          compute the total value of an articles stock
 int getSupplierId()
          Gets the supplierId.
 java.lang.String getUnit()
          Gets the unit.
 void setArticleId(int articleId)
          Sets the articleId.
 void setArticleName(java.lang.String articleName)
          Sets the articleName.
 void setIsSelloutArticle(boolean isSelloutArticle)
          Sets the isSelloutArticle.
 void setMinimumStock(int minimumStock)
          Sets the minimumStock.
 void setOrderedUnits(int orderedUnits)
          Sets the orderedUnits.
 void setPrice(double price)
          Sets the price.
 void setProductGroup(ProductGroup productGroup)
          Sets the productGroup.
 void setProductGroupId(int productGroupId)
          Sets the productGroupId.
 void setStock(int stock)
          Sets the stock.
 void setSupplierId(int supplierId)
          Sets the supplierId.
 void setUnit(java.lang.String unit)
          Sets the unit.
 java.lang.String toString()
          return a string representaion of an article
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Article

public Article(int pArticleId,
               java.lang.String pArticleName,
               int pSupplierId,
               int pProcuctGroupId,
               java.lang.String pUnit,
               double pPrice,
               int pStock,
               int pOrderedUnits,
               int pMinimumStock,
               boolean pIsSelloutArticle)

Article

public Article()
Method Detail

toString

public java.lang.String toString()
return a string representaion of an article


addToStock

public void addToStock(int diff)
increase the amount of articles in stock by diff mark the object as modified only if value changes (i.e. diff != 0 )


getArticleId

public int getArticleId()
return an articles unique id.

Returns:
int the articles unique id

getArticleName

public java.lang.String getArticleName()
return an articles name.

Returns:
java.lang.String

getProductGroup

public ProductGroup getProductGroup()
return an articles ProductGroup


getStock

public int getStock()
return stock of Article.

Returns:
int

getStockValue

public double getStockValue()
compute the total value of an articles stock


setArticleId

public void setArticleId(int articleId)
Sets the articleId.

Parameters:
articleId - The articleId to set

setArticleName

public void setArticleName(java.lang.String articleName)
Sets the articleName.

Parameters:
articleName - The articleName to set

setStock

public void setStock(int stock)
Sets the stock.

Parameters:
stock - The stock to set

afterAbort

public void afterAbort()
afterAbort will be called after a transaction has been aborted. The values of fields which get persisted will have changed to what they were at the begining of the transaction. This method should be overridden to reset any transient or non-persistent fields.

Specified by:
afterAbort in interface TransactionAware

afterCommit

public void afterCommit()
afterCommit is called only after a successful commit has taken place.

Specified by:
afterCommit in interface TransactionAware

beforeAbort

public void beforeAbort()
beforeAbort is called before a transaction is aborted.

Specified by:
beforeAbort in interface TransactionAware

beforeCommit

public void beforeCommit()
                  throws TransactionAbortedException
beforeCommit will give an object a chance to kill a transaction before it is committed. To kill a transaction, throw a new TransactionAbortedException.

Specified by:
beforeCommit in interface TransactionAware
Throws:
TransactionAbortedException

equals

public boolean equals(java.lang.Object obj)

getIsSelloutArticle

public boolean getIsSelloutArticle()
Gets the isSelloutArticle.

Returns:
Returns a boolean

setIsSelloutArticle

public void setIsSelloutArticle(boolean isSelloutArticle)
Sets the isSelloutArticle.

Parameters:
isSelloutArticle - The isSelloutArticle to set

getMinimumStock

public int getMinimumStock()
Gets the minimumStock.

Returns:
Returns a int

setMinimumStock

public void setMinimumStock(int minimumStock)
Sets the minimumStock.

Parameters:
minimumStock - The minimumStock to set

getOrderedUnits

public int getOrderedUnits()
Gets the orderedUnits.

Returns:
Returns a int

setOrderedUnits

public void setOrderedUnits(int orderedUnits)
Sets the orderedUnits.

Parameters:
orderedUnits - The orderedUnits to set

getPrice

public double getPrice()
Gets the price.

Returns:
Returns a double

setPrice

public void setPrice(double price)
Sets the price.

Parameters:
price - The price to set

setProductGroup

public void setProductGroup(ProductGroup productGroup)
Sets the productGroup.

Parameters:
productGroup - The productGroup to set

getProductGroupId

public int getProductGroupId()
Gets the productGroupId.

Returns:
Returns a int

setProductGroupId

public void setProductGroupId(int productGroupId)
Sets the productGroupId.

Parameters:
productGroupId - The productGroupId to set

getSupplierId

public int getSupplierId()
Gets the supplierId.

Returns:
Returns a int

setSupplierId

public void setSupplierId(int supplierId)
Sets the supplierId.

Parameters:
supplierId - The supplierId to set

getUnit

public java.lang.String getUnit()
Gets the unit.

Returns:
Returns a String

setUnit

public void setUnit(java.lang.String unit)
Sets the unit.

Parameters:
unit - The unit to set


Authors: Thomas Mahler and others. (C) 2000 - 2003 Apache Software Foundation
All rights reserved. Published under the Apache License.
http://db.apache.org/ojb
Version: 1.0.rc5, 2003-12-14