@Override public RecordSet getRecords() throws MalformedSourceException { RecordSet recordSet = new RecordSet(); try { InputStream inputStream = new FileInputStream(new File(filename)); DocumentBuilderFactory factory = DocumentBuilderFactory .newInstance(); factory.setValidating(false); factory.setIgnoringComments(true); factory.setIgnoringElementContentWhitespace(true); DocumentBuilder db = factory.newDocumentBuilder(); Document inDoc = db.parse(inputStream); Element xmlRoot = inDoc.getDocumentElement(); // There is no element to represent an record, so we can not process // multi records at once. Record record = CiNiiUtils.convertCiNiiDomToRecord(xmlRoot); if (record != null) { recordSet.addRecord(convertFields(record)); } } catch (FileNotFoundException e) { log.error(e.getMessage(), e); } catch (ParserConfigurationException e) { log.error(e.getMessage(), e); } catch (SAXException e) { log.error(e.getMessage(), e); } catch (IOException e) { log.error(e.getMessage(), e); } return recordSet; }
Record record = ArxivUtils.convertArxixDomToRecord(dataRoot); if (record != null) { recordSet.addRecord(convertFields(record));
try { record = PubmedUtils.convertPubmedDomToRecord(xmlArticle); recordSet.addRecord(convertFields(record)); } catch (Exception e) { throw new RuntimeException(e.getMessage(), e);
@Override public RecordSet getRecords() throws MalformedSourceException { RecordSet recordSet = new RecordSet(); try { InputStream inputStream = new FileInputStream(new File(filename)); DocumentBuilderFactory factory = DocumentBuilderFactory .newInstance(); factory.setValidating(false); factory.setIgnoringComments(true); factory.setIgnoringElementContentWhitespace(true); DocumentBuilder db = factory.newDocumentBuilder(); Document inDoc = db.parse(inputStream); Element xmlRoot = inDoc.getDocumentElement(); Element queryResult = XMLUtils.getSingleElement(xmlRoot, "query_result"); Element body = XMLUtils.getSingleElement(queryResult, "body"); Element dataRoot = XMLUtils.getSingleElement(body, "query"); Record record = CrossRefUtils.convertCrossRefDomToRecord(dataRoot); recordSet.addRecord(convertFields(record)); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (ParserConfigurationException e) { e.printStackTrace(); } catch (SAXException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } return recordSet; }
/** * Executes this {@link ProcessingStep}. * <br> * <br> * For each {@link Record} contained in the {@link RecordSet} * given as argument, if {@link AbstractFilter#isIncluded} returns * <code>true</code> the Record is included in the return result, * otherwise it is ignored. * * @see ProcessingStep#execute * * @param recs The initial set of records * @return The resulting set after the filter is applied */ @Override public RecordSet execute(RecordSet recs) { RecordSet ret = new RecordSet(); for (Record rec : recs) { if (this.isIncluded(rec)) { ret.addRecord(rec); } } return ret; }
Document doc = doc_builder.parse(fl); XPathRecord rec = new XPathRecord(doc, xpathStringMap_); ret.addRecord(rec);
recordSet.addRecord(record);
@Override public RecordSet getRecords() throws MalformedSourceException { if (dtoList == null) { throw new MalformedSourceException("dtoList not initialized"); } RecordSet ret = new RecordSet(); for (ItemSubmissionLookupDTO dto : dtoList) { Record rec = dto.getTotalPublication(providers); ret.addRecord(rec); } log.info("BTE DataLoader finished. Items loaded: " + ret.getRecords().size()); // Printing debug message String totalString = ""; for (Record record : ret.getRecords()) { totalString += SubmissionLookupUtils.getPrintableString(record) + "\n"; } log.debug("Records loaded:\n" + totalString); return ret; }
records.addRecord(rec); rec = null; continue;
ret.addRecord(current_record); current_record = new MapRecord(); current_value = null;
/** * Executes this {@link ProcessingStep}. * <br> * <br> * For each {@link Record} contained in the {@link RecordSet} * given as argument, converts it to {@link MutableRecord} calls * {@link AbstractModifier#modify}, and adds the modified record * in the return result. * * @see ProcessingStep#execute * * @param recs The initial set of records * @return A {@link RecordSet} containing the modified records */ @Override public RecordSet execute(RecordSet recs) { RecordSet ret = new RecordSet(); Record modified_record; for (Record rec : recs) { modified_record = this.modify(rec.makeMutable()); ret.addRecord(modified_record); } return recs; }
rs.addRecord(rec);
ret.addRecord(rec);
recordSet.addRecord(rec); if (rec.isMutable()) { rec.makeMutable().addValue(
ret.addRecord(rec);
ret.addRecord(rec);
@Override public RecordSet getRecords(DataLoadingSpec spec) throws MalformedSourceException { //See if the data loading spec requests a specific record. if (spec.getIdentifier() != null) { if(server_ == null) { throw new MalformedSourceException("Connection with server " + server_address_ + " has not been established"); } RecordSet ret = new RecordSet(); try { se.kb.oai.pmh.Record oai_record = server_.getRecord(spec.getIdentifier(), prefix_); Record rec = oai2bte(oai_record); ret.addRecord(rec); } catch (OAIException e) { logger_.info("Caught OAIException " + e.getMessage()); throw new MalformedSourceException(e.getMessage()); } return ret; } return getRecords(); }