Search in sources :

Example 6 with SessionBinder

use of cz.mzk.recordmanager.server.util.HibernateSessionSynchronizer.SessionBinder in project RecordManager2 by moravianlibrary.

the class OAIAuthItemWriter method beforeStep.

@Override
public void beforeStep(StepExecution stepExecution) {
    try (SessionBinder session = sync.register()) {
        Long confId = stepExecution.getJobParameters().getLong("configurationId");
        configuration = configDao.get(confId);
        format = formatResolver.resolve(configuration.getMetadataPrefix());
        try {
            TransformerFactory transformerFactory = TransformerFactory.newInstance();
            transformer = transformerFactory.newTransformer();
        } catch (TransformerConfigurationException tce) {
            throw new RuntimeException(tce);
        }
    }
}
Also used : TransformerFactory(javax.xml.transform.TransformerFactory) TransformerConfigurationException(javax.xml.transform.TransformerConfigurationException) SessionBinder(cz.mzk.recordmanager.server.util.HibernateSessionSynchronizer.SessionBinder)

Example 7 with SessionBinder

use of cz.mzk.recordmanager.server.util.HibernateSessionSynchronizer.SessionBinder 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);
        }
    }
}
Also used : RegexpExtractor(cz.mzk.recordmanager.server.util.RegexpExtractor) OAIHarvestConfiguration(cz.mzk.recordmanager.server.model.OAIHarvestConfiguration) SessionBinder(cz.mzk.recordmanager.server.util.HibernateSessionSynchronizer.SessionBinder) DownloadImportConfiguration(cz.mzk.recordmanager.server.model.DownloadImportConfiguration)

Example 8 with SessionBinder

use of cz.mzk.recordmanager.server.util.HibernateSessionSynchronizer.SessionBinder in project RecordManager2 by moravianlibrary.

the class KrameriusItemReader method beforeStep.

@Override
public void beforeStep(StepExecution stepExecution) {
    try (SessionBinder sess = hibernateSync.register()) {
        conf = configDao.get(confId);
        if (conf == null) {
            throw new IllegalArgumentException(String.format("OAI harvest configuration with id=%s not found", confId));
        }
        KrameriusHarvesterParams params = new KrameriusHarvesterParams();
        params.setUrl(conf.getUrl());
        params.setMetadataStream(conf.getMetadataStream());
        params.setQueryRows(conf.getQueryRows());
        params.setFrom(fromDate);
        params.setUntil(untilDate);
        kHarvester = harvesterFactory.create(params, confId);
    }
}
Also used : SessionBinder(cz.mzk.recordmanager.server.util.HibernateSessionSynchronizer.SessionBinder)

Example 9 with SessionBinder

use of cz.mzk.recordmanager.server.util.HibernateSessionSynchronizer.SessionBinder in project RecordManager2 by moravianlibrary.

the class KrameriusFulltextProcessor method beforeStep.

@Override
public void beforeStep(StepExecution stepExecution) {
    try (SessionBinder sess = sync.register()) {
        KrameriusConfiguration config = configDao.get(confId);
        if (config == null) {
            throw new IllegalArgumentException(String.format("Kramerius configuration with id=%s not found", confId));
        }
        downloadPrivateFulltexts = config.isDownloadPrivateFulltexts();
        fulltexter = krameriusFulltexterFactory.create(config);
    }
}
Also used : KrameriusConfiguration(cz.mzk.recordmanager.server.model.KrameriusConfiguration) SessionBinder(cz.mzk.recordmanager.server.util.HibernateSessionSynchronizer.SessionBinder)

Example 10 with SessionBinder

use of cz.mzk.recordmanager.server.util.HibernateSessionSynchronizer.SessionBinder in project RecordManager2 by moravianlibrary.

the class KrameriusItemProcessor method beforeStep.

@Override
public void beforeStep(StepExecution stepExecution) {
    try (SessionBinder session = sync.register()) {
        Long confId = stepExecution.getJobParameters().getLong("configurationId");
        configuration = configDao.get(confId);
        format = formatResolver.resolve(configuration.getMetadataStream());
    }
}
Also used : SessionBinder(cz.mzk.recordmanager.server.util.HibernateSessionSynchronizer.SessionBinder)

Aggregations

SessionBinder (cz.mzk.recordmanager.server.util.HibernateSessionSynchronizer.SessionBinder)11 OAIHarvestConfiguration (cz.mzk.recordmanager.server.model.OAIHarvestConfiguration)6 DownloadImportConfiguration (cz.mzk.recordmanager.server.model.DownloadImportConfiguration)2 RegexpExtractor (cz.mzk.recordmanager.server.util.RegexpExtractor)2 TransformerConfigurationException (javax.xml.transform.TransformerConfigurationException)2 TransformerFactory (javax.xml.transform.TransformerFactory)2 KrameriusConfiguration (cz.mzk.recordmanager.server.model.KrameriusConfiguration)1