Search in sources :

Example 1 with IntegreradEnhetEntry

use of se.inera.intyg.webcert.web.integration.registry.dto.IntegreradEnhetEntry in project webcert by sklintyg.

the class IntegreradeEnheterRegistryImplTest method testPutIntegreradEnhetSetsSchemaVersion.

@Test
public void testPutIntegreradEnhetSetsSchemaVersion() {
    final String enhetsId = "enhetsId";
    IntegreradEnhetEntry entry = new IntegreradEnhetEntry(enhetsId, "vardgivareId");
    // not found
    when(integreradEnhetRepository.findOne(enhetsId)).thenReturn(null);
    when(integreradEnhetRepository.save(any(IntegreradEnhet.class))).thenReturn(new IntegreradEnhet());
    registry.putIntegreradEnhet(entry, false, true);
    ArgumentCaptor<IntegreradEnhet> enhetCaptor = ArgumentCaptor.forClass(IntegreradEnhet.class);
    verify(integreradEnhetRepository).save(enhetCaptor.capture());
    assertTrue(enhetCaptor.getValue().isSchemaVersion3());
}
Also used : IntegreradEnhetEntry(se.inera.intyg.webcert.web.integration.registry.dto.IntegreradEnhetEntry) IntegreradEnhet(se.inera.intyg.webcert.persistence.integreradenhet.model.IntegreradEnhet) Test(org.junit.Test)

Example 2 with IntegreradEnhetEntry

use of se.inera.intyg.webcert.web.integration.registry.dto.IntegreradEnhetEntry in project webcert by sklintyg.

the class CopyUtkastServiceImpl method checkIntegreradEnhet.

private void checkIntegreradEnhet(CopyUtkastBuilderResponse builderResponse) {
    String orginalEnhetsId = builderResponse.getOrginalEnhetsId();
    Utkast utkastCopy = builderResponse.getUtkastCopy();
    IntegreradEnhetEntry newEntry = new IntegreradEnhetEntry(utkastCopy.getEnhetsId(), utkastCopy.getEnhetsNamn(), utkastCopy.getVardgivarId(), utkastCopy.getVardgivarNamn());
    integreradeEnheterRegistry.addIfSameVardgivareButDifferentUnits(orginalEnhetsId, newEntry, utkastCopy.getIntygsTyp());
}
Also used : IntegreradEnhetEntry(se.inera.intyg.webcert.web.integration.registry.dto.IntegreradEnhetEntry) Utkast(se.inera.intyg.webcert.persistence.utkast.model.Utkast)

Example 3 with IntegreradEnhetEntry

use of se.inera.intyg.webcert.web.integration.registry.dto.IntegreradEnhetEntry in project webcert by sklintyg.

the class CreateDraftCertificateResponderImpl method addVardenhetToRegistry.

private void addVardenhetToRegistry(CreateNewDraftRequest utkastsRequest) {
    Vardenhet vardenhet = utkastsRequest.getHosPerson().getVardenhet();
    Vardgivare vardgivare = vardenhet.getVardgivare();
    IntegreradEnhetEntry integreradEnhet = new IntegreradEnhetEntry(vardenhet.getEnhetsid(), vardenhet.getEnhetsnamn(), vardgivare.getVardgivarid(), vardgivare.getVardgivarnamn());
    integreradeEnheterRegistry.putIntegreradEnhet(integreradEnhet, true, false);
}
Also used : IntegreradEnhetEntry(se.inera.intyg.webcert.web.integration.registry.dto.IntegreradEnhetEntry) Vardenhet(se.inera.intyg.common.support.model.common.internal.Vardenhet) Vardgivare(se.inera.intyg.common.support.model.common.internal.Vardgivare)

Example 4 with IntegreradEnhetEntry

use of se.inera.intyg.webcert.web.integration.registry.dto.IntegreradEnhetEntry in project webcert by sklintyg.

the class IntegreradeEnheterRegistryImpl method addIfSameVardgivareButDifferentUnits.

@Override
@Transactional("jpaTransactionManager")
public void addIfSameVardgivareButDifferentUnits(String orgEnhetsHsaId, IntegreradEnhetEntry newEntry, String intygType) {
    if (getSchemaVersion(orgEnhetsHsaId, intygType).isPresent()) {
        IntegreradEnhet enhet = getIntegreradEnhet(orgEnhetsHsaId);
        IntegreradEnhetEntry orgEntry = getIntegreradEnhetEntry(enhet);
        if (orgEntry != null && orgEntry.compareTo(newEntry) != 0) {
            putIntegreradEnhet(newEntry, enhet.isSchemaVersion1(), enhet.isSchemaVersion3());
        }
    }
}
Also used : IntegreradEnhetEntry(se.inera.intyg.webcert.web.integration.registry.dto.IntegreradEnhetEntry) IntegreradEnhet(se.inera.intyg.webcert.persistence.integreradenhet.model.IntegreradEnhet) Transactional(org.springframework.transaction.annotation.Transactional)

Example 5 with IntegreradEnhetEntry

use of se.inera.intyg.webcert.web.integration.registry.dto.IntegreradEnhetEntry in project webcert by sklintyg.

the class CreateDraftCertificateResponderImpl method addVardenhetToRegistry.

private void addVardenhetToRegistry(CreateNewDraftRequest utkastsRequest) {
    Vardenhet vardenhet = utkastsRequest.getHosPerson().getVardenhet();
    Vardgivare vardgivare = vardenhet.getVardgivare();
    IntegreradEnhetEntry integreradEnhet = new IntegreradEnhetEntry(vardenhet.getEnhetsid(), vardenhet.getEnhetsnamn(), vardgivare.getVardgivarid(), vardgivare.getVardgivarnamn());
    integreradeEnheterRegistry.putIntegreradEnhet(integreradEnhet, false, true);
}
Also used : IntegreradEnhetEntry(se.inera.intyg.webcert.web.integration.registry.dto.IntegreradEnhetEntry) Vardenhet(se.inera.intyg.common.support.model.common.internal.Vardenhet) Vardgivare(se.inera.intyg.common.support.model.common.internal.Vardgivare)

Aggregations

IntegreradEnhetEntry (se.inera.intyg.webcert.web.integration.registry.dto.IntegreradEnhetEntry)8 IntegreradEnhet (se.inera.intyg.webcert.persistence.integreradenhet.model.IntegreradEnhet)5 Test (org.junit.Test)4 Vardenhet (se.inera.intyg.common.support.model.common.internal.Vardenhet)2 Vardgivare (se.inera.intyg.common.support.model.common.internal.Vardgivare)2 Transactional (org.springframework.transaction.annotation.Transactional)1 Utkast (se.inera.intyg.webcert.persistence.utkast.model.Utkast)1