Пример #1
0
  // TODO: Implement replace / addNew / replaceAll functionality
  public void addDataRecord(DataRecord nRecord, boolean bAddNew, boolean bReplaceAll) {
    // ISISAPI.IsisRecFieldUpdate(spaceHandler, 0, "a" );
    String[] irComponents = nRecord.getIDRecord().split(Pattern.quote(DataRecord.getIDSeperator()));
    String fieldCode = irComponents[0];

    char subfieldCode = ' ';
    if (irComponents.length > 1) {
      subfieldCode = irComponents[1].charAt(0);
    }

    HashMap<Character, String> subfields = null;

    if (this.writeBuffer.containsKey(fieldCode)) {
      subfields = this.writeBuffer.get(fieldCode);
    } else {
      subfields = new HashMap<Character, String>();
    }
    subfields.put(subfieldCode, nRecord.getRecordContent());

    this.writeBuffer.put(fieldCode, subfields);
  }
Пример #2
0
  /**
   * Return a data record for a given IDRecord in the current entry
   *
   * @param IDRecord ID of record to return
   * @return DataRecord with empty content if nothing found
   */
  public DataRecord getDataRecord(String IDRecord) {
    DataRecord rRecord = new DataRecord();
    rRecord.setIDRecord(IDRecord);
    rRecord.setRecordContent("");

    String[] irComponents = IDRecord.split(Pattern.quote(DataRecord.getIDSeperator()));
    String fieldCode = irComponents[0];

    char subfieldCode = ' ';
    if (irComponents.length > 1) {
      subfieldCode = irComponents[1].charAt(0);
    }

    HashMap<Character, String> subfields = null;
    if (this.writeBuffer.containsKey(fieldCode)) {
      subfields = this.writeBuffer.get(fieldCode);

      if (subfields.containsKey(subfieldCode)) {
        rRecord.setRecordContent(subfields.get(subfieldCode));
      }
    }

    return rRecord;
  }