Skip to content

Commit

Permalink
fix: Patient_consent required for delete
Browse files Browse the repository at this point in the history
  • Loading branch information
vincenzo-ingenito committed Mar 26, 2024
1 parent 1cd0d7f commit 48809ed
Showing 1 changed file with 11 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@
*/
package it.finanze.sanita.fse2.ms.gtw.dispatcher.service.impl;

import it.finanze.sanita.fse2.ms.gtw.dispatcher.enums.*;
import static org.apache.commons.lang3.StringUtils.isEmpty;
import static org.apache.commons.lang3.StringUtils.isNotBlank;

import org.apache.commons.lang3.ObjectUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
Expand All @@ -20,11 +22,15 @@
import it.finanze.sanita.fse2.ms.gtw.dispatcher.config.JwtCFG;
import it.finanze.sanita.fse2.ms.gtw.dispatcher.dto.JWTPayloadDTO;
import it.finanze.sanita.fse2.ms.gtw.dispatcher.dto.response.ErrorResponseDTO;
import it.finanze.sanita.fse2.ms.gtw.dispatcher.enums.ActionEnum;
import it.finanze.sanita.fse2.ms.gtw.dispatcher.enums.ErrorInstanceEnum;
import it.finanze.sanita.fse2.ms.gtw.dispatcher.enums.PurposeOfUseEnum;
import it.finanze.sanita.fse2.ms.gtw.dispatcher.enums.RestExecutionResultEnum;
import it.finanze.sanita.fse2.ms.gtw.dispatcher.enums.RoleEnum;
import it.finanze.sanita.fse2.ms.gtw.dispatcher.enums.SubjectOrganizationEnum;
import it.finanze.sanita.fse2.ms.gtw.dispatcher.enums.SystemTypeEnum;
import it.finanze.sanita.fse2.ms.gtw.dispatcher.exceptions.ValidationException;
import it.finanze.sanita.fse2.ms.gtw.dispatcher.service.IJwtSRV;
import it.finanze.sanita.fse2.ms.gtw.dispatcher.utility.StringUtility;

import static org.apache.commons.lang3.StringUtils.*;

@Service
public class JwtSRV extends AbstractService implements IJwtSRV {
Expand Down Expand Up @@ -59,7 +65,6 @@ public SystemTypeEnum getSystemByIssuer(String issuer) {
@Override
public void validatePayloadForCreate(JWTPayloadDTO payload) {
performCommonValidation(payload);
checkNull(payload.getPatient_consent(), "patient_consent");
checkNull(payload.getResource_hl7_type(), "resource_hl7_type");
validateActionCoherence(payload, ActionEnum.CREATE);
validatePurposeOfUseCoherence(payload, PurposeOfUseEnum.TREATMENT);
Expand All @@ -68,7 +73,6 @@ public void validatePayloadForCreate(JWTPayloadDTO payload) {
@Override
public void validatePayloadForReplace(JWTPayloadDTO payload) {
performCommonValidation(payload);
checkNull(payload.getPatient_consent(), "patient_consent");
checkNull(payload.getResource_hl7_type(), "resource_hl7_type");
validateActionCoherence(payload, ActionEnum.CREATE);
validatePurposeOfUseCoherence(payload, PurposeOfUseEnum.TREATMENT);
Expand All @@ -77,7 +81,6 @@ public void validatePayloadForReplace(JWTPayloadDTO payload) {
@Override
public void validatePayloadForUpdate(JWTPayloadDTO payload) {
performCommonValidation(payload);
checkNull(payload.getPatient_consent(), "patient_consent");
validateActionCoherence(payload, ActionEnum.UPDATE);
validatePurposeOfUseCoherence(payload, PurposeOfUseEnum.UPDATE);
}
Expand All @@ -97,6 +100,7 @@ private void performCommonValidation(JWTPayloadDTO payload) {

public void validateMandatoryFields(JWTPayloadDTO payload) {
checkNull(payload, "jwt payload");
checkNull(payload.getPatient_consent(), "patient_consent");
checkNull(payload.getAction_id(), "action_id");
checkNull(payload.getLocality(), "locality");
checkNull(payload.getPerson_id(), "person_id");
Expand All @@ -111,7 +115,6 @@ public void validateMandatoryFields(JWTPayloadDTO payload) {

private void validateFiscalCodes(JWTPayloadDTO payload) {
checkFiscalCode(payload.getSub(), "sub");
// checkFiscalCode(payload.getPerson_id(), "person_id");
}

private void validateFieldsValue(JWTPayloadDTO payload) {
Expand Down

0 comments on commit 48809ed

Please sign in to comment.