Search in sources :

Example 6 with MarcFunctionContext

use of cz.mzk.recordmanager.server.scripting.marc.MarcFunctionContext in project RecordManager2 by moravianlibrary.

the class MzkFormatFunctionsTest method physicalObjectFormat.

public void physicalObjectFormat() throws Exception {
    List<String> data = new ArrayList<String>();
    data.add("000 -----nrm-a22-----2a-4500");
    String format = formatFunctions.getMZKFormat(new MarcFunctionContext(MarcRecordFactory.recordFactory(data)));
    Assert.assertEquals(format, "PhysicalObject");
}
Also used : ArrayList(java.util.ArrayList) MarcFunctionContext(cz.mzk.recordmanager.server.scripting.marc.MarcFunctionContext)

Example 7 with MarcFunctionContext

use of cz.mzk.recordmanager.server.scripting.marc.MarcFunctionContext in project RecordManager2 by moravianlibrary.

the class MzkFormatFunctionsTest method eletronicFormat.

public void eletronicFormat() throws Exception {
    List<String> data = new ArrayList<String>();
    data.add("245 $honline [electronic resource]");
    String format = formatFunctions.getMZKFormat(new MarcFunctionContext(MarcRecordFactory.recordFactory(data)));
    Assert.assertEquals(format, "Electronic");
}
Also used : ArrayList(java.util.ArrayList) MarcFunctionContext(cz.mzk.recordmanager.server.scripting.marc.MarcFunctionContext)

Example 8 with MarcFunctionContext

use of cz.mzk.recordmanager.server.scripting.marc.MarcFunctionContext in project RecordManager2 by moravianlibrary.

the class MzkFormatFunctionsTest method unknownFormat.

public void unknownFormat() throws Exception {
    List<String> data = new ArrayList<String>();
    data.add("000 -----------------2a-4500");
    MarcRecordImpl record = MarcRecordFactory.recordFactory(data);
    String format = formatFunctions.getMZKFormat(new MarcFunctionContext(record));
    Assert.assertEquals(format, "Unknown");
}
Also used : MarcRecordImpl(cz.mzk.recordmanager.server.marc.MarcRecordImpl) ArrayList(java.util.ArrayList) MarcFunctionContext(cz.mzk.recordmanager.server.scripting.marc.MarcFunctionContext)

Example 9 with MarcFunctionContext

use of cz.mzk.recordmanager.server.scripting.marc.MarcFunctionContext in project RecordManager2 by moravianlibrary.

the class MzkStatusFunctionsTest method presentStatus.

public void presentStatus() throws Exception {
    List<String> data = new ArrayList<String>();
    data.add("996 $b2610651530 $c4-1355.961 $lMZK $rSklad / do 1 hodiny $n0$p p.v. $w001533248 $u000010$a1 $eBOA001 $jMZK50 $sP");
    Set<String> statuses = statusFunctions.getMZKStatuses(new MarcFunctionContext(MarcRecordFactory.recordFactory(data)));
    Assert.assertEquals(statuses, ImmutableSet.<String>of("present"));
}
Also used : ArrayList(java.util.ArrayList) MarcFunctionContext(cz.mzk.recordmanager.server.scripting.marc.MarcFunctionContext)

Example 10 with MarcFunctionContext

use of cz.mzk.recordmanager.server.scripting.marc.MarcFunctionContext in project RecordManager2 by moravianlibrary.

the class MarcSolrRecordMapper method parseAsLocalRecord.

protected Map<String, Object> parseAsLocalRecord(HarvestedRecord record) {
    InputStream is = new ByteArrayInputStream(record.getRawRecord());
    MarcRecord rec = marcXmlParser.parseRecord(is);
    MarcFunctionContext ctx = new MarcFunctionContext(rec, record, metadataRecordFactory.getMetadataRecord(record));
    return getHarvestedMappingScript(record).parse(ctx);
}
Also used : ByteArrayInputStream(java.io.ByteArrayInputStream) ByteArrayInputStream(java.io.ByteArrayInputStream) InputStream(java.io.InputStream) MarcRecord(cz.mzk.recordmanager.server.marc.MarcRecord) MarcFunctionContext(cz.mzk.recordmanager.server.scripting.marc.MarcFunctionContext)

Aggregations

MarcFunctionContext (cz.mzk.recordmanager.server.scripting.marc.MarcFunctionContext)17 ArrayList (java.util.ArrayList)13 MarcRecord (cz.mzk.recordmanager.server.marc.MarcRecord)9 AbstractTest (cz.mzk.recordmanager.server.AbstractTest)7 Test (org.testng.annotations.Test)7 InputStream (java.io.InputStream)4 ByteArrayInputStream (java.io.ByteArrayInputStream)2 MarcRecordImpl (cz.mzk.recordmanager.server.marc.MarcRecordImpl)1 Collection (java.util.Collection)1 List (java.util.List)1