use of cz.mzk.recordmanager.server.marc.MarcRecord in project RecordManager2 by moravianlibrary.
the class BoundingBoxMarcFunctionsTest method testCzechRepublic.
@Test
public void testCzechRepublic() throws Exception {
List<String> data = new ArrayList<String>();
data.add("034 $aa $b200000 $dE0115843 $eE0185426 $fN0510158 $gN0483256");
MarcRecord record = MarcRecordFactory.recordFactory(data);
String result = functions.getBoundingBoxAsPolygon(new MarcFunctionContext(record, null, null));
Assert.assertEquals(result, "POLYGON((11.979 48.549, 18.907 48.549, 18.907 51.033, 11.979 51.033, 11.979 48.549))");
}
use of cz.mzk.recordmanager.server.marc.MarcRecord in project RecordManager2 by moravianlibrary.
the class GetStatusesMarcFunctions method getStatuses.
public List<String> getStatuses(MarcFunctionContext ctx) {
MarcRecord record = ctx.record();
List<String> statuses = new ArrayList<String>();
statuses.addAll(ctx.metadataRecord().getDefaultStatuses());
if (statuses.isEmpty())
statuses.addAll(getStatusFrom856(record, "856"));
statuses.addAll(getStatuses(record, "996"));
return statuses;
}
use of cz.mzk.recordmanager.server.marc.MarcRecord in project RecordManager2 by moravianlibrary.
the class PublishDateMarcFunctions method getPublishDateFromFields.
public Set<String> getPublishDateFromFields(MarcFunctionContext ctx) {
MarcRecord record = ctx.record();
Set<String> years = new TreeSet<>();
for (DataField datafield : record.getDataFields("264")) {
if (datafield.getIndicator2() == '1') {
if (datafield.getSubfield('c') != null) {
years.add(datafield.getSubfield('c').getData());
}
}
}
years.addAll(record.getFields("260", 'c'));
years.addAll(record.getFields("773", '9'));
years.addAll(record.getFields("996", 'y'));
Set<String> results = new TreeSet<>();
years.forEach(y -> {
Matcher matcher;
if ((matcher = FOUR_DIGIT_YEAR_PATTERN.matcher(y)).find())
results.add(matcher.group(1));
});
return results;
}
use of cz.mzk.recordmanager.server.marc.MarcRecord in project RecordManager2 by moravianlibrary.
the class ImportRecordsJobTest method testSimpleImportOsobnosti.
@Test
public void testSimpleImportOsobnosti() throws Exception {
Job job = jobRegistry.getJob(Constants.JOB_ID_IMPORT);
Map<String, JobParameter> params = new HashMap<>();
params.put(Constants.JOB_PARAM_CONF_ID, new JobParameter(300L));
params.put(Constants.JOB_PARAM_IN_FILE, new JobParameter(testFileOsobnosti1));
params.put(Constants.JOB_PARAM_FORMAT, new JobParameter("osobnosti"));
JobParameters jobParams = new JobParameters(params);
jobLauncher.run(job, jobParams);
HarvestedRecord hr = harvestedRecordDao.findByIdAndHarvestConfiguration("5", 300L);
Assert.assertNotNull(hr);
InputStream is = new ByteArrayInputStream(hr.getRawRecord());
MarcRecord mr = new MarcRecordImpl(marcXmlParser.parseUnderlyingRecord(is));
Assert.assertFalse(mr.getDataFields("100").isEmpty());
Assert.assertFalse(mr.getDataFields("670").isEmpty());
Assert.assertEquals(mr.getDataFields("856").size(), 1);
}
use of cz.mzk.recordmanager.server.marc.MarcRecord in project RecordManager2 by moravianlibrary.
the class ImportRecordsJobTest method testSimpleImportPatents.
@Test
public void testSimpleImportPatents() throws Exception {
Job job = jobRegistry.getJob(Constants.JOB_ID_IMPORT);
Map<String, JobParameter> params = new HashMap<>();
params.put(Constants.JOB_PARAM_CONF_ID, new JobParameter(300L));
params.put(Constants.JOB_PARAM_IN_FILE, new JobParameter(testFilePatents1));
params.put(Constants.JOB_PARAM_FORMAT, new JobParameter("patents"));
JobParameters jobParams = new JobParameters(params);
jobLauncher.run(job, jobParams);
HarvestedRecord hr = harvestedRecordDao.findByIdAndHarvestConfiguration("St36_CZ_305523_B6", 300L);
Assert.assertNotNull(hr);
InputStream is = new ByteArrayInputStream(hr.getRawRecord());
MarcRecord mr = new MarcRecordImpl(marcXmlParser.parseUnderlyingRecord(is));
Assert.assertFalse(mr.getDataFields("100").isEmpty());
Assert.assertFalse(mr.getDataFields("520").isEmpty());
}
Aggregations