wt.clients.replication.unit
Class UsageItem

java.lang.Object
  extended bywt.clients.replication.unit.UsageItem
All Implemented Interfaces:
Explorable, Identifiable, ReferenceHolder, Updateable

public class UsageItem
extends Object
implements Explorable, Updateable

UsageItem is a model class for manipulating WTPartUsageLinks.

UsageItem implements the wt.explorer.Explorable interface to allow for use in the WTExplorer.

It contains many methods which it delegates to the contained uses Part Item to allow for easy integration with the PartExplorer.



Supported API: false

Extendable: false

See Also:
WTExplorer, PartItem, wt.clients.replication.unit.PartExplorer, WTPartUsageLink

Field Summary
(package private) static DecimalFormat df
           
private  String id
           
private  boolean modified
           
private static int newUsageCounter
           
private  double quantity
           
private  QuantityUnit unit
           
private  WTPartUsageLink usageLink
           
private  PartItem usedBy
           
private  PartItem uses
           
 
Constructor Summary
UsageItem()
          Create an empty usage item.
UsageItem(PartItem uses, PartItem usedBy)
          Create a usage item between the specified part items.
UsageItem(PartItem uses, PartItem usedBy, WTPartUsageLink usage_link)
          Create a usage item between the specified part items using the specified usage link.
 
Method Summary
 void create()
          Create a new usage link using the contained information.
 void delete()
          Delete the usage link.
 Explorable[] getContents()
          Return the contents of the uses part item
static DecimalFormat getDecimalFormat()
           
 String getId()
          Get an identifier for this object.
 String getIdentity()
          Return the identity icon of the uses part item
 String getName()
          Return the name of the uses part item
 String getNumber()
          Return the number of the uses part item
 Object getObject()
          Get the contained object.
 Image getOpenIcon()
          Return the open icon of the uses part item
 WTPartUsageLink getPartUsageLink()
          Get the contained usage link.
 double getQuantity()
          Get the quantity amount in the usage link
 String getQuantityString()
           
 String getRevision()
          Return the revision of the uses part item
 Image getStandardIcon()
          Return the standard icon of the uses part item
 String getState()
          Return the state of the uses part item
 String getType()
          Return the type of the uses part item
 String getUniqueIdentity()
          Return the unique identity icon of the uses part item
 String getUnitName()
          Get a string representation of the units
 QuantityUnit getUnits()
          Get the units for the quantity.
 PartItem getUsedBy()
          Get the used by part item
 Explorable[] getUses()
          Return the objects used by the uses part item.
 PartItem getUsesPart()
          Get the uses part item
 String getVersion()
          Return the version of the uses part item
 View getView()
          Return the view of the uses part item
 String getViewName()
          Return the view name of the uses part item
 boolean isModified()
          Return the modified flag
 void setModified(boolean modified_flag)
          Set the modified flag.
 void setObject(Object obj)
          Set the contained object.
 void setPartUsageLink(WTPartUsageLink usage_link)
          Set the contained usage link.
 void setQuantity(double a_quantity)
          Set the quantity amount in the usage link.
 void setUnit(QuantityUnit a_unit)
          Set the units for the quantity.
 void setUsedBy(PartItem usedBy)
          Set the used by part item
 void setUses(PartItem uses)
          Set the uses part item.
 String toString()
          Return a string with debug information
 void update()
          Update the usage link.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

usageLink

private WTPartUsageLink usageLink

newUsageCounter

private static int newUsageCounter

modified

private boolean modified

id

private String id

quantity

private double quantity

unit

private QuantityUnit unit

uses

private PartItem uses

usedBy

private PartItem usedBy

df

static DecimalFormat df
Constructor Detail

UsageItem

public UsageItem()
Create an empty usage item.


UsageItem

public UsageItem(PartItem uses,
                 PartItem usedBy)
Create a usage item between the specified part items.

Parameters:
uses - the uses part
usedBy - the usedBy part

UsageItem

public UsageItem(PartItem uses,
                 PartItem usedBy,
                 WTPartUsageLink usage_link)
Create a usage item between the specified part items using the specified usage link.

Parameters:
uses - the uses part
usedBy - the usedBy part
usage_link - the actual usage link
Method Detail

setModified

public void setModified(boolean modified_flag)
Set the modified flag.

Parameters:
modified_flag - the new value for the modified flag

isModified

public boolean isModified()
Return the modified flag

Returns:
true if modified

create

public void create()
            throws WTException
Create a new usage link using the contained information.

Specified by:
create in interface Updateable
Throws:
WTException
See Also:
WTException

update

public void update()
            throws WTException
Update the usage link.

Specified by:
update in interface Updateable
Throws:
WTException
See Also:
WTException

delete

public void delete()
            throws WTException
Delete the usage link.

Specified by:
delete in interface Updateable
Throws:
WTException
See Also:
WTException

setPartUsageLink

public void setPartUsageLink(WTPartUsageLink usage_link)
Set the contained usage link.

Parameters:
usage_link - the usage link to contain.

getPartUsageLink

public WTPartUsageLink getPartUsageLink()
Get the contained usage link.

Returns:
the contained usage link

setUses

public void setUses(PartItem uses)
Set the uses part item.

Parameters:
uses - the uses part item

getUsesPart

public PartItem getUsesPart()
Get the uses part item

Returns:
the uses part item

setUsedBy

public void setUsedBy(PartItem usedBy)
Set the used by part item

Parameters:
usedBy - the used by part item

getUsedBy

public PartItem getUsedBy()
Get the used by part item

Returns:
the used by part item

getId

public String getId()
Get an identifier for this object.

Returns:
an identifying string

setQuantity

public void setQuantity(double a_quantity)
Set the quantity amount in the usage link.

Parameters:
a_quantity - the amount

getQuantityString

public String getQuantityString()

getQuantity

public double getQuantity()
Get the quantity amount in the usage link

Returns:
the quantity amount in the link

setUnit

public void setUnit(QuantityUnit a_unit)
Set the units for the quantity.

Parameters:
a_unit - the unit to use

getUnits

public QuantityUnit getUnits()
Get the units for the quantity.

Returns:
the units for the quantity

getUnitName

public String getUnitName()
Get a string representation of the units

Returns:
a string representation of the units.

toString

public String toString()
Return a string with debug information

Returns:
a string with debug information

getUses

public Explorable[] getUses()
                     throws WTException
Return the objects used by the uses part item.

Specified by:
getUses in interface Explorable
Returns:
an array of used objects
Throws:
WTException
See Also:
WTException

getState

public String getState()
Return the state of the uses part item

Returns:
the state of the uses part item

getRevision

public String getRevision()
Return the revision of the uses part item

Returns:
the revision of the uses part item

getVersion

public String getVersion()
Return the version of the uses part item

Returns:
the version of the uses part item

getNumber

public String getNumber()
Return the number of the uses part item

Returns:
the number of the uses part item

getType

public String getType()
Return the type of the uses part item

Returns:
the type of the uses part item

getName

public String getName()
Return the name of the uses part item

Returns:
the name of the uses part item

getView

public View getView()
Return the view of the uses part item

Returns:
the view of the uses part item

getViewName

public String getViewName()
Return the view name of the uses part item

Returns:
the view name of the uses part item

getStandardIcon

public Image getStandardIcon()
Return the standard icon of the uses part item

Specified by:
getStandardIcon in interface Identifiable
Returns:
the standard icon of the uses part item

getOpenIcon

public Image getOpenIcon()
Return the open icon of the uses part item

Specified by:
getOpenIcon in interface Identifiable
Returns:
the open icon of the uses part item

getIdentity

public String getIdentity()
Return the identity icon of the uses part item

Specified by:
getIdentity in interface Identifiable
Returns:
the identity icon of the uses part item

getUniqueIdentity

public String getUniqueIdentity()
Return the unique identity icon of the uses part item

Specified by:
getUniqueIdentity in interface Identifiable
Returns:
the unique identity icon of the uses part item

getContents

public Explorable[] getContents()
                         throws WTException
Return the contents of the uses part item

Specified by:
getContents in interface Explorable
Returns:
an array of contents of the uses part item
Throws:
WTException
See Also:
WTException

setObject

public void setObject(Object obj)
Set the contained object.

Implements the ReferenceHolder interface.

Specified by:
setObject in interface ReferenceHolder
Parameters:
obj - the contained object

getObject

public Object getObject()
Get the contained object.

Implements the ReferenceHolder interface.

Specified by:
getObject in interface ReferenceHolder
Returns:
the contained object

getDecimalFormat

public static DecimalFormat getDecimalFormat()