use of se.inera.intyg.webcert.web.web.controller.integration.dto.IntegrationParameters in project webcert by sklintyg.
the class IntygModuleApiController method createReplacementCopyRequest.
private CreateReplacementCopyRequest createReplacementCopyRequest(String orgIntygsId, String intygsTyp, CopyIntygRequest request) {
HoSPersonal hosPerson = createHoSPersonFromUser();
Patient patient = createPatientFromCopyIntygRequest(request);
final WebCertUser user = userService.getUser();
IntegrationParameters parameters = user.getParameters();
boolean coherentJournaling = parameters != null && parameters.isSjf();
CreateReplacementCopyRequest req = new CreateReplacementCopyRequest(orgIntygsId, intygsTyp, patient, hosPerson, coherentJournaling);
// Add new personnummer to request
addPersonnummerToRequest(req, parameters);
// Set djupintegrerad flag on request to true if origin is DJUPINTEGRATION
setDeepIntegrationFlagOnRequest(req);
return req;
}
use of se.inera.intyg.webcert.web.web.controller.integration.dto.IntegrationParameters in project webcert by sklintyg.
the class IntygIntegrationController method postRedirectToIntyg.
@POST
@Path("/{certType}/{certId}")
@Consumes(MediaType.APPLICATION_FORM_URLENCODED)
public Response postRedirectToIntyg(@Context UriInfo uriInfo, @PathParam(PARAM_CERT_TYPE) String intygTyp, @PathParam(PARAM_CERT_ID) String intygId, @DefaultValue("") @FormParam(PARAM_ENHET_ID) String enhetId, @DefaultValue("") @FormParam(PARAM_PATIENT_ALTERNATE_SSN) String alternatePatientSSn, @DefaultValue("") @FormParam(PARAM_RESPONSIBLE_HOSP_NAME) String responsibleHospName, @FormParam(PARAM_PATIENT_FORNAMN) String fornamn, @FormParam(PARAM_PATIENT_EFTERNAMN) String efternamn, @FormParam(PARAM_PATIENT_MELLANNAMN) String mellannamn, @FormParam(PARAM_PATIENT_POSTADRESS) String postadress, @FormParam(PARAM_PATIENT_POSTNUMMER) String postnummer, @FormParam(PARAM_PATIENT_POSTORT) String postort, @DefaultValue("false") @FormParam(PARAM_COHERENT_JOURNALING) boolean coherentJournaling, @FormParam(PARAM_REFERENCE) String reference, @DefaultValue("false") @FormParam(PARAM_INACTIVE_UNIT) boolean inactiveUnit, @DefaultValue("false") @FormParam(PARAM_PATIENT_DECEASED) boolean deceased, @DefaultValue("true") @FormParam(PARAM_COPY_OK) boolean copyOk) {
Map<String, Object> params = new HashMap<>();
params.put(PARAM_CERT_TYPE, intygTyp);
params.put(PARAM_CERT_ID, intygId);
// validate the request
validateRequest(params);
IntegrationParameters integrationParameters = getIntegrationParameters(reference, responsibleHospName, alternatePatientSSn, fornamn, efternamn, mellannamn, postadress, postnummer, postort, coherentJournaling, inactiveUnit, deceased, copyOk);
WebCertUser user = getWebCertUser();
user.setParameters(integrationParameters);
return handleRedirectToIntyg(uriInfo, intygTyp, intygId, enhetId, user);
}
use of se.inera.intyg.webcert.web.web.controller.integration.dto.IntegrationParameters in project webcert by sklintyg.
the class IntygServiceRevokeTest method buildWebCertUser.
private WebCertUser buildWebCertUser(HoSPersonal person) {
Role role = AUTHORITIES_RESOLVER.getRole(AuthoritiesConstants.ROLE_LAKARE);
WebCertUser user = new WebCertUser();
user.setRoles(AuthoritiesResolverUtil.toMap(role));
user.setOrigin(UserOriginType.DJUPINTEGRATION.name());
user.setParameters(new IntegrationParameters(USER_REFERENCE, "", "", "", "", "", "", "", "", false, false, false, true));
user.setAuthorities(AuthoritiesResolverUtil.toMap(role.getPrivileges(), Privilege::getName));
user.setNamn(person.getFullstandigtNamn());
user.setHsaId(person.getPersonId());
return user;
}
use of se.inera.intyg.webcert.web.web.controller.integration.dto.IntegrationParameters in project webcert by sklintyg.
the class IntygServiceSendTest method createUser.
private WebCertUser createUser() {
Role role = AUTHORITIES_RESOLVER.getRole(AuthoritiesConstants.ROLE_LAKARE);
WebCertUser user = new WebCertUser();
user.setOrigin(UserOriginType.DJUPINTEGRATION.name());
user.setParameters(new IntegrationParameters("", "", "", "", "", "", "", "", "", false, false, false, true));
user.setRoles(AuthoritiesResolverUtil.toMap(role));
user.setAuthorities(AuthoritiesResolverUtil.toMap(role.getPrivileges(), Privilege::getName));
return user;
}
use of se.inera.intyg.webcert.web.web.controller.integration.dto.IntegrationParameters in project webcert by sklintyg.
the class IntygServiceTest method setupDefaultAuthorization.
@Before
public void setupDefaultAuthorization() {
Set<String> set = new HashSet<>();
set.add("fk7263");
when(webCertUserService.getUser()).thenReturn(webcertUser);
when(webcertUser.getOrigin()).thenReturn(UserOriginType.NORMAL.name());
when(webcertUser.getParameters()).thenReturn(new IntegrationParameters(USER_REFERENCE, "", "", "", "", "", "", "", "", false, false, false, true));
when(webCertUserService.isAuthorizedForUnit(any(String.class), any(String.class), eq(true))).thenReturn(true);
when(authoritiesHelper.getIntygstyperForPrivilege(any(WebCertUser.class), anyString())).thenReturn(set);
}
Aggregations