use of cz.mzk.recordmanager.server.util.HibernateSessionSynchronizer.SessionBinder in project RecordManager2 by moravianlibrary.
the class AsyncOAIItemReader method beforeStep.
@Override
public void beforeStep(final StepExecution stepExecution) {
try (SessionBinder sess = hibernateSync.register()) {
OAIHarvestConfiguration conf = configDao.get(confId);
OAIHarvesterParams params = new OAIHarvesterParams();
params.setUrl(conf.getUrl());
params.setMetadataPrefix(conf.getMetadataPrefix());
params.setGranularity(conf.getGranularity());
params.setSet(conf.getSet());
params.setFrom(fromDate);
params.setUntil(untilDate);
harvester = harvesterFactory.create(params);
processIdentify(conf);
conf = configDao.get(confId);
params.setGranularity(conf.getGranularity());
harvester = harvesterFactory.create(params);
}
}
use of cz.mzk.recordmanager.server.util.HibernateSessionSynchronizer.SessionBinder 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.HibernateSessionSynchronizer.SessionBinder in project RecordManager2 by moravianlibrary.
the class OAIItemSingleReader method beforeStep.
@Override
public void beforeStep(final StepExecution stepExecution) {
try (SessionBinder sess = hibernateSync.register()) {
OAIHarvestConfiguration conf = configDao.get(confId);
OAIHarvesterParams params = new OAIHarvesterParams();
params.setUrl(conf.getUrl());
params.setMetadataPrefix(conf.getMetadataPrefix());
params.setGranularity(conf.getGranularity());
params.setSet(conf.getSet());
/* params.setFrom(fromDate);
params.setUntil(untilDate);
*/
harvester = harvesterFactory.create(params);
processIdentify(conf);
conf = configDao.get(confId);
params.setGranularity(conf.getGranularity());
harvester = harvesterFactory.create(params);
}
}
use of cz.mzk.recordmanager.server.util.HibernateSessionSynchronizer.SessionBinder in project RecordManager2 by moravianlibrary.
the class OAIItemReader method beforeStep.
@Override
public void beforeStep(final StepExecution stepExecution) {
try (SessionBinder sess = hibernateSync.register()) {
OAIHarvestConfiguration conf = configDao.get(confId);
OAIHarvesterParams params = new OAIHarvesterParams();
params.setUrl(conf.getUrl());
params.setMetadataPrefix(conf.getMetadataPrefix());
params.setGranularity(conf.getGranularity());
params.setSet(conf.getSet());
params.setFrom(fromDate);
params.setUntil(untilDate);
harvester = harvesterFactory.create(params);
processIdentify(conf);
conf = configDao.get(confId);
params.setGranularity(conf.getGranularity());
harvester = harvesterFactory.create(params);
}
}
use of cz.mzk.recordmanager.server.util.HibernateSessionSynchronizer.SessionBinder in project RecordManager2 by moravianlibrary.
the class OAIOneByOneItemReader method beforeStep.
@Override
public void beforeStep(final StepExecution stepExecution) {
try (SessionBinder sess = hibernateSync.register()) {
OAIHarvestConfiguration conf = configDao.get(confId);
OAIHarvesterParams params = new OAIHarvesterParams();
params.setUrl(conf.getUrl());
params.setMetadataPrefix(conf.getMetadataPrefix());
params.setSet(conf.getSet());
params.setGranularity(conf.getGranularity());
params.setFrom(fromDate);
params.setUntil(untilDate);
harvester = harvesterFactory.create(params);
processIdentify(conf);
conf = configDao.get(confId);
params.setGranularity(conf.getGranularity());
harvester = harvesterFactory.create(params);
}
}
Aggregations