コード例 #1
0
ファイル: DataSource.java プロジェクト: BerengereG/contrib
  /**
   * Add MDRecord to database
   *
   * @param request
   * @param ingestedRecords
   */
  protected void addMdRecord2Database(Request request, List<RecordRepox> ingestedRecords) {
    try {
      Repox2Sip repox2Sip = RepoxContextUtil.getRepoxManager().getDataManager().getRepox2sip();
      List<MetadataRecord> allMetadataRecords = new ArrayList<MetadataRecord>();
      for (RecordRepox rp : ingestedRecords) {
        allMetadataRecords.add(rp.createRecordSip());
        // rp.addRecord2DataBase(request.getId(), repox2Sip);
      }
      repox2Sip.addMetadataRecords(request.getId(), allMetadataRecords);

    } catch (Repox2SipException e) {
      log.error("Could not add MetadataRecord to Data Base", e);
      e.printStackTrace();
    }
  }
コード例 #2
0
 private List<String> indexRecordRepoxMarc(RecordRepox repoxRecord) {
   Record record =
       (repoxRecord instanceof RecordRepoxMarc
           ? ((RecordRepoxMarc) repoxRecord).getRecord()
           : MarcXChangeDom4jBuilder.parseRecord(repoxRecord.getDom()));
   List<String> idxVals = new ArrayList<String>();
   List<Field> fields = record.getField(tag);
   for (Field f : fields) {
     if (subfield == null) {
       String val = f.getValue();
       if (val != null) {
         idxVals.add(IndexUtil.encode(val));
       }
     } else {
       for (String val : f.getSubfieldValues(subfield)) {
         String[] indVals = IndexUtil.encode(val).split(" ");
         for (String word : indVals) {
           idxVals.add(word);
         }
       }
     }
   }
   return idxVals;
 }