// BTE Data Loader interface methods
@Override
public RecordSet getRecords() throws MalformedSourceException
{
RecordSet recordSet = new RecordSet();
List<Record> results = null;
try
{
if (getIdentifiers() != null)
{ // Search by identifiers
results = getByIdentifier(null, getIdentifiers());
}
else
{
String title = getSearchTerms().get("title") != null ? getSearchTerms()
.get("title").iterator().next()
: null;
String authors = getSearchTerms().get("authors") != null ? getSearchTerms()
.get("authors").iterator().next()
: null;
String year = getSearchTerms().get("year") != null ? getSearchTerms()
.get("year").iterator().next()
: null;
int yearInt = Integer.parseInt(year);
results = search(null, title, authors, yearInt);
}
}
catch (HttpException e)
{
e.printStackTrace();
}
catch (IOException e)
{
e.printStackTrace();
}
if (results != null)
{
for (Record record : results)
{
recordSet.addRecord(record);
}
}
return recordSet;
}