use of se.riv.clinicalprocess.healthcond.certificate.certificatestatusupdateforcareresponder.v1.CertificateStatusUpdateForCareType in project webcert by sklintyg.
the class CertificateStatusUpdateForCareResponderStub method certificateStatusUpdateForCare.
@Override
public CertificateStatusUpdateForCareResponseType certificateStatusUpdateForCare(String logicalAddress, CertificateStatusUpdateForCareType request) {
counter.incrementAndGet();
String utlatandeId = getUtlatandeId(request);
LOG.debug("utlatandeId: " + utlatandeId);
LOG.debug("numberOfReceivedMessages: " + getNumberOfReceivedMessages());
if (utlatandeId.startsWith(FALLERAT_MEDDELANDE)) {
int attempts = increaseAttempts(utlatandeId);
int numberOfRequestedFailedAttempts = Integer.parseInt(utlatandeId.substring(utlatandeId.length() - 1));
LOG.debug("attempts: " + attempts);
LOG.debug("numberOfRequestedFailedAttempts: " + numberOfRequestedFailedAttempts);
if (attempts < numberOfRequestedFailedAttempts + 1) {
throw new RuntimeException("Something went wrong");
}
}
store.add(request);
CertificateStatusUpdateForCareResponseType response = new CertificateStatusUpdateForCareResponseType();
response.setResult(ResultTypeUtil.okResult());
LOG.debug("Request set to 'OK'");
return response;
}
use of se.riv.clinicalprocess.healthcond.certificate.certificatestatusupdateforcareresponder.v1.CertificateStatusUpdateForCareType in project webcert by sklintyg.
the class NotificationTypeConverter method convert.
public static CertificateStatusUpdateForCareType convert(NotificationMessage notificationMessage, Intyg intyg) {
CertificateStatusUpdateForCareType destination = new CertificateStatusUpdateForCareType();
complementIntyg(intyg);
destination.setIntyg(intyg);
decorateWithHandelse(destination, notificationMessage);
decorateWithArenden(destination, notificationMessage);
destination.setRef(notificationMessage.getReference());
return destination;
}
use of se.riv.clinicalprocess.healthcond.certificate.certificatestatusupdateforcareresponder.v1.CertificateStatusUpdateForCareType in project webcert by sklintyg.
the class NotificationStubRestApi method notifieringarV3Stats.
@GET
@Path("/notifieringar/v3/stats")
@Produces(MediaType.APPLICATION_JSON)
public Response notifieringarV3Stats() {
Collection<se.riv.clinicalprocess.healthcond.certificate.certificatestatusupdateforcareresponder.v3.CertificateStatusUpdateForCareType> notifs = notificationStoreV3.getNotifications();
Map<String, List<NotificationStubEntry>> stringListMap = new StatTransformerUtil().toStat(notifs);
StringBuilder buf = new StringBuilder();
for (Map.Entry<String, List<NotificationStubEntry>> entry : stringListMap.entrySet()) {
buf.append("---- ").append(entry.getKey()).append(" ----\n");
entry.getValue().stream().sorted(Comparator.comparing(NotificationStubEntry::getHandelseTid)).forEach(ie -> buf.append(ie.getHandelseTid().format(DateTimeFormatter.ofPattern("HH:mm:ss"))).append("\t").append(ie.getHandelseKod()).append("\n"));
buf.append("-----------------------------------------------\n\n");
}
return Response.ok(buf.toString()).build();
}
use of se.riv.clinicalprocess.healthcond.certificate.certificatestatusupdateforcareresponder.v1.CertificateStatusUpdateForCareType in project webcert by sklintyg.
the class IntegrationTest method buildNotificationV1.
private CertificateStatusUpdateForCareType buildNotificationV1() {
Handelse handelse = new Handelse();
handelse.setHandelsetidpunkt(LocalDateTime.now().minusMinutes(1));
UtlatandeType utl = new UtlatandeType();
utl.setHandelse(handelse);
utl.setUtlatandeId(new UtlatandeId());
utl.getUtlatandeId().setExtension(UUID.randomUUID().toString());
CertificateStatusUpdateForCareType type = new CertificateStatusUpdateForCareType();
type.setUtlatande(utl);
return type;
}
use of se.riv.clinicalprocess.healthcond.certificate.certificatestatusupdateforcareresponder.v1.CertificateStatusUpdateForCareType in project webcert by sklintyg.
the class NotificationStoreTest method populateNotificationsMap.
private void populateNotificationsMap(int nbr, NotificationStoreImpl notificationStore, LocalDateTime baseTime) {
Iterator<String> intygsIdIter = Iterables.cycle(INTYG_IDS).iterator();
for (int i = 0; i < nbr; i++) {
String intygsId = intygsIdIter.next();
Handelse handelse = new Handelse();
handelse.setHandelsetidpunkt(baseTime.minusMinutes(nbr - i));
UtlatandeType utl = new UtlatandeType();
utl.setHandelse(handelse);
utl.setUtlatandeId(new UtlatandeId());
utl.getUtlatandeId().setExtension(intygsId);
CertificateStatusUpdateForCareType type = new CertificateStatusUpdateForCareType();
type.setUtlatande(utl);
notificationStore.put(type);
}
}
Aggregations