Search in sources :

Example 1 with KrameriusConfiguration

use of cz.mzk.recordmanager.server.model.KrameriusConfiguration in project RecordManager2 by moravianlibrary.

the class KramDefaultMetadataDublinCoreRecord method getUrlsByImportConfId.

public List<String> getUrlsByImportConfId(Long importConfId) {
    String kramUrl = null;
    String kramUrlBase = null;
    KrameriusConfiguration kramConf = krameriusConfiguationDao.get(importConfId);
    if (kramConf != null && kramConf.getUrl() != null) {
        kramUrlBase = Pattern.compile("api/v\\d\\.\\d").matcher(kramConf.getUrl()).replaceAll("") + "i.jsp?pid=";
    }
    String policy = dcRecord.getRights().stream().anyMatch(s -> s.matches(".*public.*")) ? Constants.DOCUMENT_AVAILABILITY_ONLINE : Constants.DOCUMENT_AVAILABILITY_PROTECTED;
    kramUrl = policy + "|" + kramUrlBase + harvestedRecord.getUniqueId().getRecordId() + "|";
    return Collections.singletonList(kramUrl);
}
Also used : List(java.util.List) DublinCoreRecord(cz.mzk.recordmanager.server.dc.DublinCoreRecord) MetadataDublinCoreRecord(cz.mzk.recordmanager.server.metadata.MetadataDublinCoreRecord) Constants(cz.mzk.recordmanager.server.util.Constants) HarvestedRecord(cz.mzk.recordmanager.server.model.HarvestedRecord) KrameriusConfigurationDAO(cz.mzk.recordmanager.server.oai.dao.KrameriusConfigurationDAO) Autowired(org.springframework.beans.factory.annotation.Autowired) Pattern(java.util.regex.Pattern) KrameriusConfiguration(cz.mzk.recordmanager.server.model.KrameriusConfiguration) Collections(java.util.Collections) KrameriusConfiguration(cz.mzk.recordmanager.server.model.KrameriusConfiguration)

Example 2 with KrameriusConfiguration

use of cz.mzk.recordmanager.server.model.KrameriusConfiguration in project RecordManager2 by moravianlibrary.

the class ConfigurationTest method test.

@Test
public void test() {
    OAIHarvestConfiguration oaiConf = oaiConfigDao.get(OAI_CONF_ID);
    KrameriusConfiguration kramConf = kramConfigDao.get(KRAM_CONF_ID);
    Assert.assertEquals(importConfigDao.get(OAI_CONF_ID), oaiConf);
    Assert.assertEquals(importConfigDao.get(KRAM_CONF_ID), kramConf);
    kramConfigDao.persist(kramConf);
    Assert.assertNotNull(kramConfigDao.get(KRAM_CONF_ID));
}
Also used : OAIHarvestConfiguration(cz.mzk.recordmanager.server.model.OAIHarvestConfiguration) KrameriusConfiguration(cz.mzk.recordmanager.server.model.KrameriusConfiguration) Test(org.testng.annotations.Test) AbstractTest(cz.mzk.recordmanager.server.AbstractTest)

Example 3 with KrameriusConfiguration

use of cz.mzk.recordmanager.server.model.KrameriusConfiguration 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)

Aggregations

KrameriusConfiguration (cz.mzk.recordmanager.server.model.KrameriusConfiguration)3 AbstractTest (cz.mzk.recordmanager.server.AbstractTest)1 DublinCoreRecord (cz.mzk.recordmanager.server.dc.DublinCoreRecord)1 MetadataDublinCoreRecord (cz.mzk.recordmanager.server.metadata.MetadataDublinCoreRecord)1 HarvestedRecord (cz.mzk.recordmanager.server.model.HarvestedRecord)1 OAIHarvestConfiguration (cz.mzk.recordmanager.server.model.OAIHarvestConfiguration)1 KrameriusConfigurationDAO (cz.mzk.recordmanager.server.oai.dao.KrameriusConfigurationDAO)1 Constants (cz.mzk.recordmanager.server.util.Constants)1 SessionBinder (cz.mzk.recordmanager.server.util.HibernateSessionSynchronizer.SessionBinder)1 Collections (java.util.Collections)1 List (java.util.List)1 Pattern (java.util.regex.Pattern)1 Autowired (org.springframework.beans.factory.annotation.Autowired)1 Test (org.testng.annotations.Test)1