parseLine
// The line is expected to be in <PhysicalID> <UPCCode of CDRelease> format
String[] tokens = line.split( "\\|" );
if ( tokens.length < 2 )
{
throw new ParseLineDeviation( ERROR_CDDISC_TOKEN_COUNT +
tokens.length );
}
String cdDiscPhysicalIDString = tokens[0];
String cdDiscReleaseUPCCodeString = tokens[1];
try
{
PhysicalID aPhysicalID = PhysicalID.parseString(
cdDiscPhysicalIDString );
UPCCode aUPCCode = UPCCode.parseString( cdDiscReleaseUPCCodeString );
StoreDataAccess collections = StoreDataAccess.getInstance();
CDRelease aCDRelease = collections.theCDReleaseDataAccess.
findByUPCCode( aUPCCode );
if ( aCDRelease == null )
{
throw new ParseLineDeviation( ERROR_CDRELEASE_NOT_FOUND +
aUPCCode );
}
return new CDDisc( aCDRelease, aPhysicalID );
}
catch ( PhysicalIDFormatDeviation e )
{
throw new ParseLineDeviation( e.getMessage() );
}
catch ( UPCCodeFormatDeviation e )
{
throw new ParseLineDeviation( e.getMessage() );
}