Search in sources :

Example 1 with AfterStep

use of org.springframework.batch.core.annotation.AfterStep in project RecordManager2 by moravianlibrary.

the class AgrovocConvertorWriter method after.

@AfterStep
protected void after() {
    try {
        writer = new PrintWriter(filename, "UTF-8");
        for (String key : altLabel.keySet()) {
            if (!prefLabel.containsKey(key)) {
                continue;
            }
            Record record = factory.newRecord();
            record.setLeader(factory.newLeader("-----nz--a22-----n--4500"));
            record.addVariableField(factory.newControlField("001", key));
            record.addVariableField(factory.newDataField("150", ' ', ' ', "a", prefLabel.get(key).get(0)));
            addLabel(record, key, altLabel);
            writer.println((new MarcRecordImpl(record)).export(IOFormat.LINE_MARC));
        }
        writer.close();
    } catch (FileNotFoundException | UnsupportedEncodingException e) {
        e.printStackTrace();
    }
}
Also used : MarcRecordImpl(cz.mzk.recordmanager.server.marc.MarcRecordImpl) FileNotFoundException(java.io.FileNotFoundException) UnsupportedEncodingException(java.io.UnsupportedEncodingException) Record(org.marc4j.marc.Record) PrintWriter(java.io.PrintWriter) AfterStep(org.springframework.batch.core.annotation.AfterStep)

Aggregations

MarcRecordImpl (cz.mzk.recordmanager.server.marc.MarcRecordImpl)1 FileNotFoundException (java.io.FileNotFoundException)1 PrintWriter (java.io.PrintWriter)1 UnsupportedEncodingException (java.io.UnsupportedEncodingException)1 Record (org.marc4j.marc.Record)1 AfterStep (org.springframework.batch.core.annotation.AfterStep)1