org.openwms.common.domain
Class TransportUnit

java.lang.Object
  extended by org.openwms.core.domain.AbstractEntity
      extended by org.openwms.common.domain.TransportUnit
All Implemented Interfaces:
Serializable, DomainObject<Long>

public class TransportUnit
extends AbstractEntity
implements DomainObject<Long>

A TransportUnit is an item like a box, a toad, a bin or a palette that is moved around within a warehouse and can carry goods.

Used as container to transport items like LoadUnits. It can be moved between Locations.

Since:
0.1
Version:
$Revision: 1594 $
Author:
Heiko Scherrer
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class org.openwms.core.domain.AbstractEntity
AbstractEntity.AbstractEntityListener
 
Field Summary
static String NQ_FIND_ALL
          Name of the NamedQuery to find all TransportUnit Entities.
static String NQ_FIND_BY_UNIQUE_QUERY
          Query to find one TransportUnit by its natural key.
 
Fields inherited from class org.openwms.core.domain.AbstractEntity
FIND_ALL, FIND_BY_ID
 
Constructor Summary
TransportUnit(Barcode barcode)
          Create a new TransportUnit with an unique Barcode.
TransportUnit(String unitId)
          Create a new TransportUnit with an unique id.
 
Method Summary
 void addChild(TransportUnit transportUnit)
          Add a TransportUnit to the children.
 UnitError addError(UnitError error)
          Add an error to the TransportUnit.
 Location getActualLocation()
          Get the actual Location of the TransportUnit.
 Date getActualLocationDate()
          Returns the date when the TransportUnit moved to the actualLocation.
 Barcode getBarcode()
          Return the Barcode of the TransportUnit.
 Set<TransportUnit> getChildren()
          Get all child TransportUnits.
 Date getCreationDate()
          Returns the creation date of the TransportUnit.
 Map<Date,UnitError> getErrors()
          Get all errors that have occurred on the TransportUnit.
 Long getId()
          Return the technical key value.
 Date getInventoryDate()
          Returns the timestamp of the last inventory check of the TransportUnit.
 User getInventoryUser()
          Returns the User who performed the last inventory action on the TransportUnit.
 int getNoTransportUnits()
          Number of TransportUnits belonging to the TransportUnit.
 TransportUnit getParent()
          Returns the parent TransportUnit.
 TransportUnitState getState()
          Return the state of the TransportUnit.
 Location getTargetLocation()
          Get the target Location of the TransportUnit.
 TransportUnitType getTransportUnitType()
          Return the TransportUnitType of the TransportUnit.
 long getVersion()
          Return the value of the optimistic locking field.
 BigDecimal getWeight()
          Returns the current weight of the TransportUnit.
 Boolean isEmpty()
          Indicates whether the TransportUnit is empty or not.
 boolean isNew()
          Check whether the instance is a transient or persisted one.
 void removeChild(TransportUnit transportUnit)
          Remove a TransportUnit from the list of children.
 void setActualLocation(Location actualLocation)
          Put the TransportUnit on a Location.
 void setActualLocationDate(Date actualLocationDate)
          Set the actualLocationDate.
 void setBarcode(Barcode barcode)
          Set the Barcode of the TransportUnit.
 void setEmpty(Boolean empty)
          Marks the TransportUnit to be empty.
 void setInventoryDate(Date inventoryDate)
          Set the timestamp of the last inventory action of the TransportUnit.
 void setInventoryUser(User inventoryUser)
          Set the User> who performed the last inventory action on the TransportUnit.
 void setParent(TransportUnit parent)
          Set a parent TransportUnit.
 void setState(TransportUnitState state)
          Set the state of the TransportUnit.
 void setTargetLocation(Location targetLocation)
          Set the target Location of the TransportUnit.
 void setTransportUnitType(TransportUnitType transportUnitType)
          Set the TransportUnitType of the TransportUnit.
 void setWeight(BigDecimal weight)
          Sets the current weight of the TransportUnit.
 String toString()
          Return the Barcode as String.
 
Methods inherited from class org.openwms.core.domain.AbstractEntity
equals, hashCode
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

NQ_FIND_ALL

public static final String NQ_FIND_ALL
Name of the NamedQuery to find all TransportUnit Entities.

See Also:
Constant Field Values

NQ_FIND_BY_UNIQUE_QUERY

public static final String NQ_FIND_BY_UNIQUE_QUERY
Query to find one TransportUnit by its natural key.

See Also:
Constant Field Values
Constructor Detail

TransportUnit

public TransportUnit(String unitId)
Create a new TransportUnit with an unique id. The id is used to create a Barcode.

Parameters:
unitId - The unique identifier of the TransportUnit

TransportUnit

public TransportUnit(Barcode barcode)
Create a new TransportUnit with an unique Barcode.

Parameters:
barcode - The unique identifier of this TransportUnit is the Barcode
Method Detail

getId

public Long getId()
Return the technical key value.

Specified by:
getId in interface DomainObject<Long>
Returns:
The technical, unique key

isNew

public boolean isNew()
Check whether the instance is a transient or persisted one.

Specified by:
isNew in interface DomainObject<Long>
Returns:
true if transient (not persisted before), otherwise false

getActualLocation

public Location getActualLocation()
Get the actual Location of the TransportUnit.

Returns:
The Location where the TransportUnit is placed on

setActualLocation

public void setActualLocation(Location actualLocation)
Put the TransportUnit on a Location.

Parameters:
actualLocation - The new Location of the TransportUnit

getTargetLocation

public Location getTargetLocation()
Get the target Location of the TransportUnit. This property can not be null when an active TransportOrder exists.

Returns:
The target location

setTargetLocation

public void setTargetLocation(Location targetLocation)
Set the target Location of the TransportUnit. Shall only be set in combination with an active TransportOder.

Parameters:
targetLocation - The target Location where this TransportUnit shall be transported to

isEmpty

public Boolean isEmpty()
Indicates whether the TransportUnit is empty or not.

Returns:
true if empty, false if not empty, null when not defined

setEmpty

public void setEmpty(Boolean empty)
Marks the TransportUnit to be empty.

Parameters:
empty - true to mark the TransportUnit as empty, false to mark it as not empty and null for no definition

getInventoryUser

public User getInventoryUser()
Returns the User who performed the last inventory action on the TransportUnit.

Returns:
The User who did the last inventory check

setInventoryUser

public void setInventoryUser(User inventoryUser)
Set the User> who performed the last inventory action on the TransportUnit.

Parameters:
inventoryUser - The User who did the last inventory check

getNoTransportUnits

public int getNoTransportUnits()
Number of TransportUnits belonging to the TransportUnit.

Returns:
The number of all TransportUnits belonging to this one

getCreationDate

public Date getCreationDate()
Returns the creation date of the TransportUnit.

Returns:
The creation date

getActualLocationDate

public Date getActualLocationDate()
Returns the date when the TransportUnit moved to the actualLocation.

Returns:
The timestamp when the TransportUnit moved the last time

getInventoryDate

public Date getInventoryDate()
Returns the timestamp of the last inventory check of the TransportUnit.

Returns:
The timestamp of the last inventory check of the TransportUnit.

setInventoryDate

public void setInventoryDate(Date inventoryDate)
Set the timestamp of the last inventory action of the TransportUnit.

Parameters:
inventoryDate - The timestamp of the last inventory check

getWeight

public BigDecimal getWeight()
Returns the current weight of the TransportUnit.

Returns:
The current weight of the TransportUnit

setWeight

public void setWeight(BigDecimal weight)
Sets the current weight of the TransportUnit.

Parameters:
weight - The current weight of the TransportUnit

getErrors

public Map<Date,UnitError> getErrors()
Get all errors that have occurred on the TransportUnit.

Returns:
A Map of all occurred UnitErrors on the TransportUnit

addError

public UnitError addError(UnitError error)
Add an error to the TransportUnit.

Parameters:
error - An UnitError to be added
Returns:
The key.
Throws:
IllegalArgumentException - when something went wrong

getState

public TransportUnitState getState()
Return the state of the TransportUnit.

Returns:
The current state of the TransportUnit

setState

public void setState(TransportUnitState state)
Set the state of the TransportUnit.

Parameters:
state - The state to set on the TransportUnit

getTransportUnitType

public TransportUnitType getTransportUnitType()
Return the TransportUnitType of the TransportUnit.

Returns:
The TransportUnitType the TransportUnit belongs to

setTransportUnitType

public void setTransportUnitType(TransportUnitType transportUnitType)
Set the TransportUnitType of the TransportUnit.

Parameters:
transportUnitType - The type of the TransportUnit

getBarcode

public Barcode getBarcode()
Return the Barcode of the TransportUnit.

Returns:
The current Barcode

setBarcode

public void setBarcode(Barcode barcode)
Set the Barcode of the TransportUnit.

Parameters:
barcode - The Barcode to be set on the TransportUnit

getParent

public TransportUnit getParent()
Returns the parent TransportUnit.

Returns:
the parent.

setParent

public void setParent(TransportUnit parent)
Set a parent TransportUnit.

Parameters:
parent - The parent to set.

getChildren

public Set<TransportUnit> getChildren()
Get all child TransportUnits.

Returns:
the transportUnits.

addChild

public void addChild(TransportUnit transportUnit)
Add a TransportUnit to the children.

Parameters:
transportUnit - The TransportUnit to be added to the list of children
Throws:
IllegalArgumentException - when transportUnit is null

removeChild

public void removeChild(TransportUnit transportUnit)
Remove a TransportUnit from the list of children.

Parameters:
transportUnit - The TransportUnit to be removed from the list of children
Throws:
IllegalArgumentException - when transportUnit is null or any other failure occurs

setActualLocationDate

public void setActualLocationDate(Date actualLocationDate)
Set the actualLocationDate.

Parameters:
actualLocationDate - The actualLocationDate to set.

getVersion

public long getVersion()
Return the value of the optimistic locking field.

Specified by:
getVersion in interface DomainObject<Long>
Returns:
the version number

toString

public String toString()
Return the Barcode as String.

Overrides:
toString in class Object
Returns:
String
See Also:
Object.toString()


Copyright © 2005-2011 openwms.org. All Rights Reserved.