Mentions légales du service

Skip to content
Snippets Groups Projects
Commit 8a74b3cc authored by pm's avatar pm
Browse files

Replaced String isBlank() to StringUtils one

parent d3181e2a
No related branches found
No related tags found
2 merge requests!7Merger master into Develop,!5Release/2.0.0
......@@ -14,6 +14,7 @@ import net.ihe.gazelle.framework.preferencesmodelapi.application.NamespaceExcept
import net.ihe.gazelle.framework.preferencesmodelapi.application.OperationalPreferencesService;
import net.ihe.gazelle.framework.preferencesmodelapi.application.PreferenceException;
import net.ihe.gazelle.lib.annotations.Package;
import org.apache.commons.lang3.StringUtils;
import org.hl7.fhir.r4.model.Bundle;
import javax.inject.Inject;
......@@ -105,7 +106,7 @@ public class PatientRegistryFeedClient {
}
PersonName name = patient.getNames().get(0);
if (name.getFamily().isBlank() || name.getGivens().isEmpty()) {
if (StringUtils.isBlank(name.getFamily()) || name.getGivens().isEmpty()) {
throw new InvalidRequestException("Mandatory fields are missing");
}
if (patient.getDateOfBirth() == null || patient.getGender() == null) {
......@@ -117,7 +118,7 @@ public class PatientRegistryFeedClient {
patient.setActive(true);
uuid = client.createPatient(patient);
if (uuid == null || uuid.isBlank()) {
if (StringUtils.isBlank(uuid)) {
throw new InternalErrorException(NO_UUID);
}
......@@ -148,7 +149,7 @@ public class PatientRegistryFeedClient {
logger.info(CLIENT_NOT_SET);
initializeClient();
}
if (patient == null || uuid == null || uuid.isBlank()) {
if (patient == null || StringUtils.isBlank(uuid)) {
throw new InvalidRequestException(INVALID_PARAMETERS);
}
......@@ -174,10 +175,10 @@ public class PatientRegistryFeedClient {
logger.info(CLIENT_NOT_SET);
initializeClient();
}
if (uuidOriginal == null || uuidOriginal.isBlank()) {
if (StringUtils.isBlank(uuidOriginal)) {
throw new InvalidRequestException(INVALID_PARAMETERS);
}
if (uuidDuplicated == null || uuidDuplicated.isBlank()) {
if (StringUtils.isBlank(uuidDuplicated)) {
throw new InvalidRequestException(INVALID_PARAMETERS);
}
Bundle response = new Bundle();
......@@ -195,14 +196,14 @@ public class PatientRegistryFeedClient {
* Methode to delete a Patient with its uuid
* @param uuid of the patient to delete
* @return Result of the Deletion
* @throws PatientFeedException
* @throws PatientFeedException If deletion cannot be performed.
*/
public Bundle delete(String uuid) throws PatientFeedException {
if (client == null) {
logger.info(CLIENT_NOT_SET);
initializeClient();
}
if (uuid == null || uuid.isBlank()) {
if (StringUtils.isBlank(uuid)) {
throw new InvalidRequestException("Invalid parameter");
}
try {
......
......@@ -21,6 +21,7 @@ import net.ihe.gazelle.application.PatientRegistrySearchClient;
import net.ihe.gazelle.application.PatientRegistryXRefSearchClient;
import net.ihe.gazelle.lib.annotations.Package;
import net.ihe.gazelle.lib.searchmodelapi.business.exception.SearchException;
import org.apache.commons.lang3.StringUtils;
import org.hl7.fhir.instance.model.api.IBaseResource;
import org.hl7.fhir.r4.model.IdType;
import org.hl7.fhir.r4.model.Parameters;
......@@ -100,7 +101,7 @@ public class ChPatientResourceProvider implements IResourceProvider {
@Read
public Patient read(@IdParam IdType theId) {
String uuid = theId.getIdPart();
if (uuid == null || uuid.isBlank()) {
if (StringUtils.isBlank(uuid)) {
patientLogger.error(NO_ID_PROVIDED);
throw new InvalidRequestException(NO_ID_PROVIDED);
}
......@@ -155,7 +156,7 @@ public class ChPatientResourceProvider implements IResourceProvider {
@Update
public MethodOutcome update(@IdParam IdType theId, @ResourceParam Patient hl7Patient) {
String uuid = theId.getIdPart();
if (uuid == null || uuid.isBlank()) {
if (StringUtils.isBlank(uuid)) {
patientLogger.error(NO_ID_PROVIDED);
throw new InvalidRequestException(NO_ID_PROVIDED);
}
......@@ -215,7 +216,7 @@ public class ChPatientResourceProvider implements IResourceProvider {
EntityIdentifier sourceIdentifier = createEntityIdentifierFromSourceIdentifier(sourceIdentifierParam);
List<String> targetSystemList = createTargetSystemListFromParam(targetSystemParam);
Parameters parametersResults = null;
Parameters parametersResults;
try {
parametersResults = patientRegistryXRefSearchClient.process(sourceIdentifier, targetSystemList);
} catch (SearchCrossReferenceException e) {
......@@ -243,7 +244,7 @@ public class ChPatientResourceProvider implements IResourceProvider {
patientLogger.error(INVALID_REQUEST_BAD_SOURCE_IDENTIFIER + " null value");
throw new InvalidRequestException(SOURCE_IDENTIFIER_ASSIGNING_AUTHORITY_NOT_FOUND);
}
if (sourceIdentifierSystem.isBlank() || sourceIdentifierValue.isBlank()) {
if (StringUtils.isBlank(sourceIdentifierSystem) || StringUtils.isBlank(sourceIdentifierValue)) {
patientLogger.error(INVALID_REQUEST_BAD_SOURCE_IDENTIFIER + " empty system or value");
throw new InvalidRequestException(SOURCE_IDENTIFIER_ASSIGNING_AUTHORITY_NOT_FOUND);
}
......
......@@ -6,6 +6,7 @@ import java.util.List;
import javax.inject.Inject;
import javax.inject.Named;
import org.apache.commons.lang3.StringUtils;
import org.hl7.fhir.instance.model.api.IBaseResource;
import org.hl7.fhir.r4.model.IdType;
import org.hl7.fhir.r4.model.Parameters;
......@@ -84,12 +85,11 @@ public class IhePatientResourceProvider implements IResourceProvider {
*/
@Read
public Patient read(@IdParam IdType theId) {
if (theId.getIdPart() == null || theId.getIdPart().isBlank()) {
if (StringUtils.isBlank(theId.getIdPart())) {
patientLogger.error(NO_ID_PROVIDED);
throw new InvalidRequestException(NO_ID_PROVIDED);
}
String uuid = theId.getIdPart();
try {
Patient retrievedPatient = patientRegistrySearchClient.searchPatient(uuid);
patientLogger.info("Patient Successfully found");
......@@ -116,7 +116,7 @@ public class IhePatientResourceProvider implements IResourceProvider {
EntityIdentifier sourceIdentifier = createEntityIdentifierFromSourceIdentifier(sourceIdentifierParam);
List<String> targetSystemList = createTargetSystemListFromParam(targetSystemParam);
Parameters parametersResults = null;
Parameters parametersResults;
try {
parametersResults = patientRegistryXRefSearchClient.process(sourceIdentifier, targetSystemList);
} catch (SearchCrossReferenceException e) {
......@@ -140,7 +140,7 @@ public class IhePatientResourceProvider implements IResourceProvider {
patientLogger.error(INVALID_REQUEST_BAD_SOURCE_IDENTIFIER + " null value");
throw new InvalidRequestException(SOURCE_IDENTIFIER_ASSIGNING_AUTHORITY_NOT_FOUND);
}
if (sourceIdentifierSystem.isBlank() || sourceIdentifierValue.isBlank()) {
if (StringUtils.isBlank(sourceIdentifierSystem) || StringUtils.isBlank(sourceIdentifierValue)) {
patientLogger.error(INVALID_REQUEST_BAD_SOURCE_IDENTIFIER + " empty system or value");
throw new InvalidRequestException(SOURCE_IDENTIFIER_ASSIGNING_AUTHORITY_NOT_FOUND);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment