use of cz.mzk.recordmanager.server.scripting.dc.DublinCoreFunctionContext in project RecordManager2 by moravianlibrary.
the class DublinCoreSolrRecordMapper method parseAsDedupRecord.
protected Map<String, Object> parseAsDedupRecord(HarvestedRecord record) {
InputStream is = new ByteArrayInputStream(record.getRawRecord());
MappingScript<DublinCoreFunctionContext> script = getMappingScript(record);
DublinCoreRecord rec = parser.parseRecord(is);
DublinCoreFunctionContext dcContext = new DublinCoreFunctionContext(rec, record, metadataRecordFactory.getMetadataRecord(record));
Map<String, Object> fields = script.parse(dcContext);
return fields;
}
use of cz.mzk.recordmanager.server.scripting.dc.DublinCoreFunctionContext in project RecordManager2 by moravianlibrary.
the class DublinCoreSolrRecordMapper method parseAsLocalRecord.
protected Map<String, Object> parseAsLocalRecord(HarvestedRecord record) {
InputStream is = new ByteArrayInputStream(record.getRawRecord());
DublinCoreRecord rec = parser.parseRecord(is);
DublinCoreFunctionContext dcContext = new DublinCoreFunctionContext(rec, record, metadataRecordFactory.getMetadataRecord(record));
return harvestedRecordMappingScript.parse(dcContext);
}
use of cz.mzk.recordmanager.server.scripting.dc.DublinCoreFunctionContext in project RecordManager2 by moravianlibrary.
the class IdentifiersDublinCoreRecordFunctionsTest method getISBNs.
@Test
public void getISBNs() {
DublinCoreRecord record = new DublinCoreRecordImpl();
record.addIdentifier("ISBN:0385424728");
DublinCoreFunctionContext dcContext = new DublinCoreFunctionContext(record);
List<String> isbns = functions.getISBNs(dcContext);
Assert.assertFalse(isbns.isEmpty());
Assert.assertEquals(isbns.get(0), "0385424728");
}
use of cz.mzk.recordmanager.server.scripting.dc.DublinCoreFunctionContext in project RecordManager2 by moravianlibrary.
the class DublinCoreScriptFactoryTest method test.
@Test
public void test() {
InputStream is1 = getClass().getResourceAsStream("/groovy/BaseDublinCore.groovy");
MappingScript<DublinCoreFunctionContext> script = factory.create(is1);
DublinCoreRecord record = new DublinCoreRecordImpl();
record.addTitle("test");
DublinCoreFunctionContext dcContext = new DublinCoreFunctionContext(record);
Map<String, Object> entries = script.parse(dcContext);
Assert.assertEquals(entries.size(), 1);
Assert.assertEquals(entries.get("title"), "test");
}
Aggregations