示例#1
0
  public static void convertRecord(Record rec) {
    if (rec == null) return;

    if (rec.getLeader() != null) rec.setLeader(convertString(rec.getLeader()));

    for (Field field : rec.getFields()) {
      if (field.isControlField()) {
        String newData = convertString(field.getValue());
        field.setValue(newData);
      } else {
        for (Subfield subfield : field.getSubfields()) {
          String newData = convertString(subfield.getValue());
          subfield.setValue(newData);
        }
      }
    }
  }
 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;
 }