use of cz.mzk.recordmanager.server.util.RegexpExtractor in project RecordManager2 by moravianlibrary.
the class OAIItemProcessor method beforeStep.
@Override
public void beforeStep(StepExecution stepExecution) {
try (SessionBinder session = sync.register()) {
Long confId = stepExecution.getJobParameters().getLong("configurationId");
OAIHarvestConfiguration hc = configDao.get(confId);
if (hc != null) {
format = formatResolver.resolve(hc.getMetadataPrefix());
String regex = MoreObjects.firstNonNull(hc.getRegex(), DEFAULT_EXTRACT_ID_PATTERN);
configuration = hc;
idExtractor = new RegexpExtractor(regex);
} else {
DownloadImportConfiguration dic = downloadImportConfDao.get(confId);
if (dic != null) {
format = formatResolver.resolve(Constants.METADATA_FORMAT_XML_MARC);
String regex = MoreObjects.firstNonNull(dic.getRegex(), DEFAULT_EXTRACT_ID_PATTERN);
configuration = dic;
idExtractor = new RegexpExtractor(regex);
}
}
try {
TransformerFactory transformerFactory = TransformerFactory.newInstance();
transformer = transformerFactory.newTransformer();
} catch (TransformerConfigurationException tce) {
throw new RuntimeException(tce);
}
}
}
use of cz.mzk.recordmanager.server.util.RegexpExtractor in project RecordManager2 by moravianlibrary.
the class ImportRecordsWriter method beforeStep.
@Override
public void beforeStep(StepExecution stepExecution) {
try (SessionBinder session = sync.register()) {
OAIHarvestConfiguration hc = oaiHarvestConfigurationDao.get(configurationId);
String regex = null;
if (hc != null) {
regex = hc.getRegex();
harvestConfiguration = hc;
} else {
DownloadImportConfiguration dic = downloadImportConfigurationDao.get(configurationId);
if (dic != null) {
regex = dic.getRegex();
harvestConfiguration = dic;
}
}
if (regex != null) {
regexpExtractor = new RegexpExtractor(regex);
}
}
}
Aggregations