Class LocationPK

java.lang.Object
org.openwms.common.location.LocationPK
All Implemented Interfaces:
Serializable

@Embeddable public class LocationPK extends Object implements Serializable
A LocationPK, is a value type and is used as an unique natural key for Location entities.
Author:
Heiko Scherrer
See Also:
  • Field Details

    • KEY_LENGTH

      public static final short KEY_LENGTH
      See Also:
    • NUMBER_OF_KEYS

      public static final short NUMBER_OF_KEYS
      See Also:
    • PK_LENGTH

      public static final short PK_LENGTH
      Returns the complete length of all keys. Currently, all keys have the same length, therefore it is the 5 times the length of a single key (KEY_LENGTH). But since this can change the actual length is encapsulated within this method.
      See Also:
    • area

      @Size(max=4) private @Size(max=4) String area
      Expresses the area the Location belongs to.
    • aisle

      @Size(max=4) private @Size(max=4) String aisle
      Expresses the aisle the Location belongs to.
    • x

      @Size(max=4) private @Size(max=4) String x
      Expresses the x-dimension the Location belongs to.
    • y

      @Size(max=4) private @Size(max=4) String y
      Expresses the y-dimension the Location belongs to.
    • z

      @Size(max=4) private @Size(max=4) String z
      Expresses the z-dimension the Location belongs to.
  • Constructor Details

    • LocationPK

      protected LocationPK()
      Dear JPA ...
    • LocationPK

      private LocationPK(String... keys)
      Weak constructor to create a new LocationPK with a couple of keys only.
      Parameters:
      keys - The array of keys, currently expected to be 5
      Throws:
      IllegalArgumentException - if the number of keys does not match NUMBER_OF_KEYS
  • Method Details

    • of

      public static LocationPK of(String area, String aisle, String x, String y, String z)
      Create a new LocationPK with all required fields.
      Parameters:
      area - Area where the Location belongs to
      aisle - Aisle where the Location belongs to
      x - Dimension x where the Location belongs to
      y - Dimension y where the Location belongs to
      z - Dimension z where the Location belongs to
    • fromString

      public static LocationPK fromString(String s)
      Create a LocationPK from the given String.
      Parameters:
      s - The String, not null
      Returns:
      An instance
    • isValid

      public static boolean isValid(String locationPk)
      Checks whether the given locationPK String is in valid format.
      Parameters:
      locationPk - The String to verify
      Returns:
      true if valid
    • getArea

      public String getArea()
      Get the area region.
      Returns:
      The area
    • getAisle

      public String getAisle()
      Get the aisle region.
      Returns:
      The aisle
    • getX

      public String getX()
      Get the x-dimension.
      Returns:
      The x-dimension
    • getY

      public String getY()
      Get the y-dimension.
      Returns:
      The y-dimension
    • getZ

      public String getZ()
      Get the z-dimension.
      Returns:
      The z-dimension
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
      See Also:
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
      See Also:
    • toString

      public String toString()
      Return a String like AREA/AISLE/X/Y/Z.
      Overrides:
      toString in class Object
      Returns:
      String
      See Also: