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());
}
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());
}
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);
}
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());
}
}
}
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);
}
Aggregations