class FruIdGeneratorUtil {

    public static String generateFruIdHashCode( ComponentIdentifier componentIdentifier, String location )
    {
        String hash = "0";

        try
        {
            if ( componentIdentifier != null )
            {
                if ( componentIdentifier.getManufacturer() != null )
                {
                    hash = String.valueOf( componentIdentifier.getManufacturer().hashCode() );
                }
                if ( componentIdentifier.getProduct() != null )
                {
                    hash = hash.concat( String.valueOf( componentIdentifier.getProduct().hashCode() ) );
                }
                if ( componentIdentifier.getPartNumber() != null )
                {
                    hash = hash.concat( String.valueOf( componentIdentifier.getPartNumber().hashCode() ) );
                }
                if ( componentIdentifier.getSerialNumber() != null )
                {
                    hash = hash.concat( String.valueOf( componentIdentifier.getSerialNumber().hashCode() ) );
                }
            }
            if ( location != null )
            {
                hash = hash.concat( String.valueOf( location.hashCode() ) );
            }
            return String.valueOf( hash.hashCode() );
        }
        catch ( Exception e )
        {
            logger.error( " Error while generating the FRU ID {} ", componentIdentifier, location, e );
        }
        return hash;
    }

}