com.ibm.rfid.epc.datahandler
Class GTIN14

java.lang.Object
  extended by com.ibm.rfid.epc.datahandler.AbstractHandler
      extended by com.ibm.rfid.epc.datahandler.GTIN14
All Implemented Interfaces:
DataHandler

public class GTIN14
extends AbstractHandler
implements DataHandler

Manages an instance of a data handler for an EAN.UCC Global Trade IDentifier (GTIN) data type. A GTIN14 is a 14-digit number composed of an indicator digit that can be used to indicate the level of packaging the GTIN is associated with, an EAN Company Prefix, an Item Reference, and a Check Digit. The input data for this handler may be specified in either of two forms, both of which are strings.

  • The first form is a simple string of the following concatenated data fields:
    Indicator digit - digit that can be used to indicate the level of packaging of the GTIN
    EAN.UCC Company Prefix - variable length number assigned to a company by EAN.UCC. The inclusion of the EAN.UCC Company Prefix ensures uniqueness throughout the world. The EAN.UCC Company Prefix is assigned to companies in varying lengths. Note: A UCC Company Prefix is converted to an EAN.UCC Company Prefix by adding a leading zero. Examples: the UCC Company Prefix 614141 will be 0614141 and the UCC Company Prefix 81123456 will be 081123456.
    Item Reference - variable length number assigned by the holder of the Company Prefix to uniquely identify the class or type of item. The Item Reference varies in length as a function of the EAN.UCC Company Prefix length. Note: The combined length of the EAN.UCC Company Prefix, Indicator digit and Item Reference is always 13 digits.
    Check Digit – a calculated one-digit number used to ensure data integrity.
    An example of this input would be:
    "12345678901234"
    where if the company prefix length were specified as 6, the indicator digit would be the leading 1, the company prefix would be the next 6 digits "234567", the item reference would be the next 6 digits "890123" and the check digit would be the final digit "4". This input form will commission an EPC using the specified fields, and generate a unique serial number.
  • The second form is a formatted string of the following fields with literal field labels and explicit seperators:
    GTIN - see above
    Serial number - a number to provide uniqueness for the specified GTIN
    An example of this input would be:
    "gtin=20073796510026;serial=1"
    This input form will commission an EPC using the specified fields, it will not generate a serial number, instead it will use the one provided, as such, it is the responsiblity of the provider to ensure unqiueness.

  • Field Summary
    static java.lang.String COPYRIGHT
               
     
    Fields inherited from class com.ibm.rfid.epc.datahandler.AbstractHandler
    companyPrefix, companyPrefixLength, handlerType, inputData, maxCompanyPrefixLength, minCompanyPrefixLength, pureId, serialNumber, useLocalConfigMgr
     
    Fields inherited from interface com.ibm.rfid.epc.datahandler.DataHandler
    DOD, GIAI, GID, GLN, GRAI, GTIN14, MAX_CAGE_DODAAC_LENGTH, MAX_EAN_UCC_COMPANY_PREFIX_LENGTH, MAX_GID_GENERAL_MANAGER_LENGTH, MAX_NDC10_COMPANY_PREFIX_LENGTH, MIN_CAGE_DODAAC_LENGTH, MIN_EAN_UCC_COMPANY_PREFIX_LENGTH, MIN_GID_GENERAL_MANAGER_LENGTH, MIN_NDC10_COMPANY_PREFIX_LENGTH, NDC10, SSCC18
     
    Constructor Summary
    GTIN14(java.lang.String inputData, int companyPrefixLength, java.lang.String encodingType)
              Creates an instance of a data handler for an GTIN data type.
     
    Method Summary
     java.lang.String getCheckDigit()
              Gets the check digit of the input data string.
     java.lang.String getIndicatorDigit()
              Gets the EAN.UCC indicator digit
     java.lang.String getItemReference()
               
     java.lang.String getUnserializedPureId()
              Create the portion of the ID URI (pure id) associated with this handler this is not serialized, i.e.
     void setCheckDigit(java.lang.String checkDigit)
              Sets the check digit of the input data string.
     void setIndicatorDigit(java.lang.String indicatorDigit)
              Sets the EAN.UCC indicator digit
     void setItemReference(java.lang.String itemReference)
              Sets the item reference portion of the input data string.
     
    Methods inherited from class com.ibm.rfid.epc.datahandler.AbstractHandler
    getCompanyPrefix, getCompanyPrefixLength, getHandlerType, getInputData, getMaxCompanyPrefixLength, getMinCompanyPrefixLength, getPureId, getSerialNumber, serialize, setCompanyPrefix, setCompanyPrefixLength, setHandlerType, toString, validate
     
    Methods inherited from class java.lang.Object
    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
     
    Methods inherited from interface com.ibm.rfid.epc.datahandler.DataHandler
    getCompanyPrefix, getHandlerType, getInputData, getMaxCompanyPrefixLength, getMinCompanyPrefixLength, getSerialNumber, serialize
     

    Field Detail

    COPYRIGHT

    public static final java.lang.String COPYRIGHT
    See Also:
    Constant Field Values
    Constructor Detail

    GTIN14

    public GTIN14(java.lang.String inputData,
                  int companyPrefixLength,
                  java.lang.String encodingType)
           throws InvalidFormatException
    Creates an instance of a data handler for an GTIN data type.

    Parameters:
    inputData - numeric string data to be managed by this handler. Input data may be any of the two forms discussed above.
    companyPrefixLength - length of CP portion of the data string
    encodingType - string encoding type
    Throws:
    InvalidFormatException - if any of the input data fails validation
    Method Detail

    getItemReference

    public java.lang.String getItemReference()

    setItemReference

    public void setItemReference(java.lang.String itemReference)
    Sets the item reference portion of the input data string. For a GTIN, the item ref portion of the input string lies between the company prefix and the check digit and does not include the check digit

    Parameters:
    itemReference - string item reference number of this data handler

    getIndicatorDigit

    public java.lang.String getIndicatorDigit()
    Gets the EAN.UCC indicator digit

    Returns:
    the indicator digit of this data handler

    setIndicatorDigit

    public void setIndicatorDigit(java.lang.String indicatorDigit)
    Sets the EAN.UCC indicator digit

    Parameters:
    indicatorDigit - the indicator digit of this data handler

    getCheckDigit

    public java.lang.String getCheckDigit()
    Gets the check digit of the input data string. For a GTIN, the checkdigit is the last digit of the number.

    Returns:
    the check digit of this data handler

    setCheckDigit

    public void setCheckDigit(java.lang.String checkDigit)
    Sets the check digit of the input data string. For a GTIN, the checkdigit is the last digit of the number.

    Parameters:
    checkDigit - the check digit of this data handler

    getUnserializedPureId

    public java.lang.String getUnserializedPureId()
    Create the portion of the ID URI (pure id) associated with this handler this is not serialized, i.e. is determined by the input data only, and thus not unique.

    Specified by:
    getUnserializedPureId in interface DataHandler
    Returns:
    string EPCglobal ID URI excluding the serial number where the item reference has the indicator digit prepended Thus, the unserialized uri returned will be:
    urn:epc:id:sgtin:<CompanyPrefix>.<IndicatorDigit><ItemReference>.
    where the trailing period is included as it seperates the next field (serial number) and <CompanyPrefix>, <IndicatorDigit> and <ItemReference> are defined above.


    Copyright © 2005 - 2009 IBM Corp. All Rights Reserved.