Partial refactor of Provider

This commit is contained in:
Tadgh 2020-11-10 12:26:20 -05:00
parent a67b3a8298
commit ffbe35e2cd
11 changed files with 106 additions and 106 deletions

View File

@ -50,7 +50,7 @@ public class EmpiClearSvcImpl implements IEmpiExpungeSvc {
}
@Override
public long expungeAllEmpiLinksOfTargetType(String theResourceType, ServletRequestDetails theRequestDetails) {
public long expungeAllMdmLinksOfTargetType(String theResourceType, ServletRequestDetails theRequestDetails) {
throwExceptionIfInvalidTargetType(theResourceType);
ourLog.info("Clearing all EMPI Links for resource type {}...", theResourceType);
List<Long> personPids = myEmpiLinkDaoSvc.deleteAllEmpiLinksOfTypeAndReturnPersonPids(theResourceType);
@ -61,7 +61,7 @@ public class EmpiClearSvcImpl implements IEmpiExpungeSvc {
private void throwExceptionIfInvalidTargetType(String theResourceType) {
if (!EmpiUtil.supportedTargetType(theResourceType)) {
throw new InvalidRequestException(ProviderConstants.EMPI_CLEAR + " does not support resource type: " + theResourceType);
throw new InvalidRequestException(ProviderConstants.MDM_CLEAR + " does not support resource type: " + theResourceType);
}
}

View File

@ -55,8 +55,8 @@ public class EmpiControllerSvcImpl implements IEmpiControllerSvc {
@Override
public IAnyResource mergePersons(String theFromPersonId, String theToPersonId, EmpiTransactionContext theEmpiTransactionContext) {
IAnyResource fromPerson = myEmpiControllerHelper.getLatestPersonFromIdOrThrowException(ProviderConstants.EMPI_MERGE_PERSONS_FROM_PERSON_ID, theFromPersonId);
IAnyResource toPerson = myEmpiControllerHelper.getLatestPersonFromIdOrThrowException(ProviderConstants.EMPI_MERGE_PERSONS_TO_PERSON_ID, theToPersonId);
IAnyResource fromPerson = myEmpiControllerHelper.getLatestPersonFromIdOrThrowException(ProviderConstants.MDM_MERGE_GR_FROM_GOLDEN_RESOURCE_ID, theFromPersonId);
IAnyResource toPerson = myEmpiControllerHelper.getLatestPersonFromIdOrThrowException(ProviderConstants.MDM_MERGE_GR_TO_GOLDEN_RESOURCE_ID, theToPersonId);
myEmpiControllerHelper.validateMergeResources(fromPerson, toPerson);
myEmpiControllerHelper.validateSameVersion(fromPerson, theFromPersonId);
myEmpiControllerHelper.validateSameVersion(toPerson, theToPersonId);
@ -66,8 +66,8 @@ public class EmpiControllerSvcImpl implements IEmpiControllerSvc {
@Override
public Stream<EmpiLinkJson> queryLinks(@Nullable String thePersonId, @Nullable String theTargetId, @Nullable String theMatchResult, @Nullable String theLinkSource, EmpiTransactionContext theEmpiContext) {
IIdType personId = EmpiControllerUtil.extractPersonIdDtOrNull(ProviderConstants.EMPI_QUERY_LINKS_PERSON_ID, thePersonId);
IIdType targetId = EmpiControllerUtil.extractTargetIdDtOrNull(ProviderConstants.EMPI_QUERY_LINKS_TARGET_ID, theTargetId);
IIdType personId = EmpiControllerUtil.extractPersonIdDtOrNull(ProviderConstants.MDM_QUERY_LINKS_GOLDEN_RESOURCE_ID, thePersonId);
IIdType targetId = EmpiControllerUtil.extractTargetIdDtOrNull(ProviderConstants.MDM_QUERY_LINKS_RESOURCE_ID, theTargetId);
EmpiMatchResultEnum matchResult = EmpiControllerUtil.extractMatchResultOrNull(theMatchResult);
EmpiLinkSourceEnum linkSource = EmpiControllerUtil.extractLinkSourceOrNull(theLinkSource);
@ -82,8 +82,8 @@ public class EmpiControllerSvcImpl implements IEmpiControllerSvc {
@Override
public IAnyResource updateLink(String thePersonId, String theTargetId, String theMatchResult, EmpiTransactionContext theEmpiContext) {
EmpiMatchResultEnum matchResult = EmpiControllerUtil.extractMatchResultOrNull(theMatchResult);
IAnyResource person = myEmpiControllerHelper.getLatestPersonFromIdOrThrowException(ProviderConstants.EMPI_UPDATE_LINK_PERSON_ID, thePersonId);
IAnyResource target = myEmpiControllerHelper.getLatestTargetFromIdOrThrowException(ProviderConstants.EMPI_UPDATE_LINK_TARGET_ID, theTargetId);
IAnyResource person = myEmpiControllerHelper.getLatestPersonFromIdOrThrowException(ProviderConstants.MDM_UPDATE_LINK_GOLDEN_RESOURCE_ID, thePersonId);
IAnyResource target = myEmpiControllerHelper.getLatestTargetFromIdOrThrowException(ProviderConstants.MDM_UPDATE_LINK_RESOURCE_ID, theTargetId);
myEmpiControllerHelper.validateSameVersion(person, thePersonId);
myEmpiControllerHelper.validateSameVersion(target, theTargetId);
@ -92,8 +92,8 @@ public class EmpiControllerSvcImpl implements IEmpiControllerSvc {
@Override
public void notDuplicatePerson(String thePersonId, String theTargetPersonId, EmpiTransactionContext theEmpiContext) {
IAnyResource person = myEmpiControllerHelper.getLatestPersonFromIdOrThrowException(ProviderConstants.EMPI_UPDATE_LINK_PERSON_ID, thePersonId);
IAnyResource target = myEmpiControllerHelper.getLatestPersonFromIdOrThrowException(ProviderConstants.EMPI_UPDATE_LINK_TARGET_ID, theTargetPersonId);
IAnyResource person = myEmpiControllerHelper.getLatestPersonFromIdOrThrowException(ProviderConstants.MDM_UPDATE_LINK_GOLDEN_RESOURCE_ID, thePersonId);
IAnyResource target = myEmpiControllerHelper.getLatestPersonFromIdOrThrowException(ProviderConstants.MDM_UPDATE_LINK_RESOURCE_ID, theTargetPersonId);
myIEmpiLinkUpdaterSvc.notDuplicatePerson(person, target, theEmpiContext);
}

View File

@ -98,10 +98,10 @@ public class EmpiLinkUpdaterSvcImpl implements IEmpiLinkUpdaterSvc {
}
if (!"Person".equals(personType)) {
throw new InvalidRequestException("First argument to " + ProviderConstants.EMPI_UPDATE_LINK + " must be a Person. Was " + personType);
throw new InvalidRequestException("First argument to " + ProviderConstants.MDM_UPDATE_LINK + " must be a Person. Was " + personType);
}
if (!EmpiUtil.supportedTargetType(theTargetType)) {
throw new InvalidRequestException("Second argument to " + ProviderConstants.EMPI_UPDATE_LINK + " must be a Patient or Practitioner. Was " + theTargetType);
throw new InvalidRequestException("Second argument to " + ProviderConstants.MDM_UPDATE_LINK + " must be a Patient or Practitioner. Was " + theTargetType);
}
if (!EmpiUtil.isEmpiManaged(thePerson)) {
@ -139,10 +139,10 @@ public class EmpiLinkUpdaterSvcImpl implements IEmpiLinkUpdaterSvc {
String personType = myFhirContext.getResourceType(thePerson);
String targetType = myFhirContext.getResourceType(theTarget);
if (!"Person".equals(personType)) {
throw new InvalidRequestException("First argument to " + ProviderConstants.EMPI_UPDATE_LINK + " must be a Person. Was " + personType);
throw new InvalidRequestException("First argument to " + ProviderConstants.MDM_UPDATE_LINK + " must be a Person. Was " + personType);
}
if (!"Person".equals(targetType)) {
throw new InvalidRequestException("Second argument to " + ProviderConstants.EMPI_UPDATE_LINK + " must be a Person . Was " + targetType);
throw new InvalidRequestException("Second argument to " + ProviderConstants.MDM_UPDATE_LINK + " must be a Person . Was " + targetType);
}
if (!EmpiUtil.isEmpiManaged(thePerson) || !EmpiUtil.isEmpiManaged(theTarget)) {

View File

@ -51,6 +51,6 @@ public class EmpiPersonDeletingSvc {
DeleteExpungeService myDeleteExpungeService;
public DeleteMethodOutcome expungePersonPids(List<Long> thePersonPids, ServletRequestDetails theRequestDetails) {
return myDeleteExpungeService.expungeByResourcePids(ProviderConstants.EMPI_CLEAR, "Person", new SliceImpl<>(thePersonPids), theRequestDetails);
return myDeleteExpungeService.expungeByResourcePids(ProviderConstants.MDM_CLEAR, "Person", new SliceImpl<>(thePersonPids), theRequestDetails);
}
}

View File

@ -40,7 +40,7 @@ public class EmpiProviderMergePersonsR4Test extends BaseProviderR4Test {
@Test
public void testMerge() {
//TODO GGG RP fix
IBaseResource mergedSourcePatient = myEmpiProviderR4.mergePersons(myFromSourcePatientId, myToSourcePatientId, myRequestDetails);
IBaseResource mergedSourcePatient = myEmpiProviderR4.mergeGoldenResources(myFromSourcePatientId, myToSourcePatientId, myRequestDetails);
assertEquals(myToSourcePatient.getIdElement(), mergedSourcePatient.getIdElement());
// TODO GGG RP FIX
//assertThat(mergedSourcePatient, is(sameSourceResourceAs(myToSourcePatient)));
@ -63,7 +63,7 @@ public class EmpiProviderMergePersonsR4Test extends BaseProviderR4Test {
StringType fromPersonId = new StringType(createUnmanagedSourceResource().getIdElement().getValue());
StringType toPersonId = new StringType(createUnmanagedSourceResource().getIdElement().getValue());
try {
myEmpiProviderR4.mergePersons(fromPersonId, toPersonId, myRequestDetails);
myEmpiProviderR4.mergeGoldenResources(fromPersonId, toPersonId, myRequestDetails);
fail();
} catch (InvalidRequestException e) {
assertEquals("Only EMPI managed resources can be merged. Empi managed resource have the HAPI-EMPI tag.", e.getMessage());
@ -75,7 +75,7 @@ public class EmpiProviderMergePersonsR4Test extends BaseProviderR4Test {
try {
StringType patientId = new StringType(createPatient().getIdElement().getValue());
StringType otherPatientId = new StringType(createPatient().getIdElement().getValue());
myEmpiProviderR4.mergePersons(patientId, otherPatientId, myRequestDetails);
myEmpiProviderR4.mergeGoldenResources(patientId, otherPatientId, myRequestDetails);
fail();
} catch (InvalidRequestException e) {
assertThat(e.getMessage(), endsWith("must have form Person/<id> where <id> is the id of the person"));
@ -86,19 +86,19 @@ public class EmpiProviderMergePersonsR4Test extends BaseProviderR4Test {
@Test
public void testNullParams() {
try {
myEmpiProviderR4.mergePersons(null, null, myRequestDetails);
myEmpiProviderR4.mergeGoldenResources(null, null, myRequestDetails);
fail();
} catch (InvalidRequestException e) {
assertEquals("fromPersonId cannot be null", e.getMessage());
}
try {
myEmpiProviderR4.mergePersons(null, myToSourcePatientId, myRequestDetails);
myEmpiProviderR4.mergeGoldenResources(null, myToSourcePatientId, myRequestDetails);
fail();
} catch (InvalidRequestException e) {
assertEquals("fromPersonId cannot be null", e.getMessage());
}
try {
myEmpiProviderR4.mergePersons(myFromSourcePatientId, null, myRequestDetails);
myEmpiProviderR4.mergeGoldenResources(myFromSourcePatientId, null, myRequestDetails);
fail();
} catch (InvalidRequestException e) {
assertEquals("toPersonId cannot be null", e.getMessage());
@ -108,31 +108,31 @@ public class EmpiProviderMergePersonsR4Test extends BaseProviderR4Test {
@Test
public void testBadParams() {
try {
myEmpiProviderR4.mergePersons(new StringType("Patient/1"), new StringType("Patient/2"), myRequestDetails);
myEmpiProviderR4.mergeGoldenResources(new StringType("Patient/1"), new StringType("Patient/2"), myRequestDetails);
fail();
} catch (InvalidRequestException e) {
assertThat(e.getMessage(), endsWith(" must have form Person/<id> where <id> is the id of the person"));
}
try {
myEmpiProviderR4.mergePersons(myFromSourcePatientId, new StringType("Patient/2"), myRequestDetails);
myEmpiProviderR4.mergeGoldenResources(myFromSourcePatientId, new StringType("Patient/2"), myRequestDetails);
fail();
} catch (InvalidRequestException e) {
assertThat(e.getMessage(), endsWith(" must have form Person/<id> where <id> is the id of the person"));
}
try {
myEmpiProviderR4.mergePersons(new StringType("Person/1"), new StringType("Person/1"), myRequestDetails);
myEmpiProviderR4.mergeGoldenResources(new StringType("Person/1"), new StringType("Person/1"), myRequestDetails);
fail();
} catch (InvalidRequestException e) {
assertEquals("fromPersonId must be different from toPersonId", e.getMessage());
}
try {
myEmpiProviderR4.mergePersons(new StringType("Person/abc"), myToSourcePatientId, myRequestDetails);
myEmpiProviderR4.mergeGoldenResources(new StringType("Person/abc"), myToSourcePatientId, myRequestDetails);
fail();
} catch (ResourceNotFoundException e) {
assertEquals("Resource Person/abc is not known", e.getMessage());
}
try {
myEmpiProviderR4.mergePersons(myFromSourcePatientId, new StringType("Person/abc"), myRequestDetails);
myEmpiProviderR4.mergeGoldenResources(myFromSourcePatientId, new StringType("Person/abc"), myRequestDetails);
fail();
} catch (ResourceNotFoundException e) {
assertEquals("Resource Person/abc is not known", e.getMessage());

View File

@ -32,7 +32,7 @@ public interface IEmpiExpungeSvc {
* @param theRequestDetails
* @return the count of deleted EMPI links
*/
long expungeAllEmpiLinksOfTargetType(String theResourceType, ServletRequestDetails theRequestDetails);
long expungeAllMdmLinksOfTargetType(String theResourceType, ServletRequestDetails theRequestDetails);
/**
* Delete all EMPI links, and their related Person objects.

View File

@ -44,8 +44,8 @@ public abstract class BaseEmpiProvider {
}
protected void validateMergeParameters(IPrimitiveType<String> theFromPersonId, IPrimitiveType<String> theToPersonId) {
validateNotNull(ProviderConstants.EMPI_MERGE_PERSONS_FROM_PERSON_ID, theFromPersonId);
validateNotNull(ProviderConstants.EMPI_MERGE_PERSONS_TO_PERSON_ID, theToPersonId);
validateNotNull(ProviderConstants.MDM_MERGE_GR_FROM_GOLDEN_RESOURCE_ID, theFromPersonId);
validateNotNull(ProviderConstants.MDM_MERGE_GR_TO_GOLDEN_RESOURCE_ID, theToPersonId);
if (theFromPersonId.getValue().equals(theToPersonId.getValue())) {
throw new InvalidRequestException("fromPersonId must be different from toPersonId");
}
@ -58,23 +58,23 @@ public abstract class BaseEmpiProvider {
}
protected void validateUpdateLinkParameters(IPrimitiveType<String> thePersonId, IPrimitiveType<String> theTargetId, IPrimitiveType<String> theMatchResult) {
validateNotNull(ProviderConstants.EMPI_UPDATE_LINK_PERSON_ID, thePersonId);
validateNotNull(ProviderConstants.EMPI_UPDATE_LINK_TARGET_ID, theTargetId);
validateNotNull(ProviderConstants.EMPI_UPDATE_LINK_MATCH_RESULT, theMatchResult);
validateNotNull(ProviderConstants.MDM_UPDATE_LINK_GOLDEN_RESOURCE_ID, thePersonId);
validateNotNull(ProviderConstants.MDM_UPDATE_LINK_RESOURCE_ID, theTargetId);
validateNotNull(ProviderConstants.MDM_UPDATE_LINK_MATCH_RESULT, theMatchResult);
EmpiMatchResultEnum matchResult = EmpiMatchResultEnum.valueOf(theMatchResult.getValue());
switch (matchResult) {
case NO_MATCH:
case MATCH:
break;
default:
throw new InvalidRequestException(ProviderConstants.EMPI_UPDATE_LINK + " illegal " + ProviderConstants.EMPI_UPDATE_LINK_MATCH_RESULT +
throw new InvalidRequestException(ProviderConstants.MDM_UPDATE_LINK + " illegal " + ProviderConstants.MDM_UPDATE_LINK_MATCH_RESULT +
" value '" + matchResult + "'. Must be " + EmpiMatchResultEnum.NO_MATCH + " or " + EmpiMatchResultEnum.MATCH);
}
}
protected void validateNotDuplicateParameters(IPrimitiveType<String> thePersonId, IPrimitiveType<String> theTargetId) {
validateNotNull(ProviderConstants.EMPI_UPDATE_LINK_PERSON_ID, thePersonId);
validateNotNull(ProviderConstants.EMPI_UPDATE_LINK_TARGET_ID, theTargetId);
validateNotNull(ProviderConstants.MDM_UPDATE_LINK_GOLDEN_RESOURCE_ID, thePersonId);
validateNotNull(ProviderConstants.MDM_UPDATE_LINK_RESOURCE_ID, theTargetId);
}
protected EmpiTransactionContext createEmpiContext(RequestDetails theRequestDetails, EmpiTransactionContext.OperationType theOperationType) {

View File

@ -73,8 +73,8 @@ public class EmpiControllerHelper {
}
public void validateMergeResources(IAnyResource theFromPerson, IAnyResource theToPerson) {
validateIsEmpiManaged(ProviderConstants.EMPI_MERGE_PERSONS_FROM_PERSON_ID, theFromPerson);
validateIsEmpiManaged(ProviderConstants.EMPI_MERGE_PERSONS_TO_PERSON_ID, theToPerson);
validateIsEmpiManaged(ProviderConstants.MDM_MERGE_GR_FROM_GOLDEN_RESOURCE_ID, theFromPerson);
validateIsEmpiManaged(ProviderConstants.MDM_MERGE_GR_TO_GOLDEN_RESOURCE_ID, theToPerson);
}
public String toJson(IAnyResource theAnyResource) {

View File

@ -122,19 +122,19 @@ public class EmpiProviderDstu3 extends BaseEmpiProvider {
return searchComponent;
}
@Operation(name = ProviderConstants.EMPI_MERGE_PERSONS, type = Person.class)
public Person mergePerson(@OperationParam(name=ProviderConstants.EMPI_MERGE_PERSONS_FROM_PERSON_ID, min = 1, max = 1) StringType theFromPersonId,
@OperationParam(name=ProviderConstants.EMPI_MERGE_PERSONS_TO_PERSON_ID, min = 1, max = 1) StringType theToPersonId,
@Operation(name = ProviderConstants.MDM_MERGE_GOLDEN_RESOURCES, type = Person.class)
public Person mergePerson(@OperationParam(name=ProviderConstants.MDM_MERGE_GR_FROM_GOLDEN_RESOURCE_ID, min = 1, max = 1) StringType theFromPersonId,
@OperationParam(name=ProviderConstants.MDM_MERGE_GR_TO_GOLDEN_RESOURCE_ID, min = 1, max = 1) StringType theToPersonId,
RequestDetails theRequestDetails) {
validateMergeParameters(theFromPersonId, theToPersonId);
return (Person) myEmpiControllerSvc.mergePersons(theFromPersonId.getValue(), theToPersonId.getValue(), createEmpiContext(theRequestDetails, EmpiTransactionContext.OperationType.MERGE_PERSONS));
}
@Operation(name = ProviderConstants.EMPI_UPDATE_LINK, type = Person.class)
public Person updateLink(@OperationParam(name=ProviderConstants.EMPI_UPDATE_LINK_PERSON_ID, min = 1, max = 1) StringType thePersonId,
@OperationParam(name=ProviderConstants.EMPI_UPDATE_LINK_TARGET_ID, min = 1, max = 1) StringType theTargetId,
@OperationParam(name=ProviderConstants.EMPI_UPDATE_LINK_MATCH_RESULT, min = 1, max = 1) StringType theMatchResult,
@Operation(name = ProviderConstants.MDM_UPDATE_LINK, type = Person.class)
public Person updateLink(@OperationParam(name=ProviderConstants.MDM_UPDATE_LINK_GOLDEN_RESOURCE_ID, min = 1, max = 1) StringType thePersonId,
@OperationParam(name=ProviderConstants.MDM_UPDATE_LINK_RESOURCE_ID, min = 1, max = 1) StringType theTargetId,
@OperationParam(name=ProviderConstants.MDM_UPDATE_LINK_MATCH_RESULT, min = 1, max = 1) StringType theMatchResult,
ServletRequestDetails theRequestDetails) {
validateUpdateLinkParameters(thePersonId, theTargetId, theMatchResult);
@ -142,9 +142,9 @@ public class EmpiProviderDstu3 extends BaseEmpiProvider {
return (Person) myEmpiControllerSvc.updateLink(thePersonId.getValue(), theTargetId.getValue(), theMatchResult.getValue(), createEmpiContext(theRequestDetails, EmpiTransactionContext.OperationType.UPDATE_LINK));
}
@Operation(name = ProviderConstants.EMPI_QUERY_LINKS)
public Parameters queryLinks(@OperationParam(name=ProviderConstants.EMPI_QUERY_LINKS_PERSON_ID, min = 0, max = 1) StringType thePersonId,
@OperationParam(name=ProviderConstants.EMPI_QUERY_LINKS_TARGET_ID, min = 0, max = 1) StringType theTargetId,
@Operation(name = ProviderConstants.MDM_QUERY_LINKS)
public Parameters queryLinks(@OperationParam(name=ProviderConstants.MDM_QUERY_LINKS_GOLDEN_RESOURCE_ID, min = 0, max = 1) StringType thePersonId,
@OperationParam(name=ProviderConstants.MDM_QUERY_LINKS_RESOURCE_ID, min = 0, max = 1) StringType theTargetId,
@OperationParam(name=ProviderConstants.EMPI_QUERY_LINKS_MATCH_RESULT, min = 0, max = 1) StringType theMatchResult,
@OperationParam(name=ProviderConstants.EMPI_QUERY_LINKS_MATCH_RESULT, min = 0, max = 1) StringType theLinkSource,
ServletRequestDetails theRequestDetails) {
@ -161,8 +161,8 @@ public class EmpiProviderDstu3 extends BaseEmpiProvider {
@Operation(name = ProviderConstants.EMPI_NOT_DUPLICATE)
// TODO KHS can this return void?
public Parameters notDuplicate(@OperationParam(name=ProviderConstants.EMPI_QUERY_LINKS_PERSON_ID, min = 1, max = 1) StringType thePersonId,
@OperationParam(name=ProviderConstants.EMPI_QUERY_LINKS_TARGET_ID, min = 1, max = 1) StringType theTargetId,
public Parameters notDuplicate(@OperationParam(name=ProviderConstants.MDM_QUERY_LINKS_GOLDEN_RESOURCE_ID, min = 1, max = 1) StringType thePersonId,
@OperationParam(name=ProviderConstants.MDM_QUERY_LINKS_RESOURCE_ID, min = 1, max = 1) StringType theTargetId,
ServletRequestDetails theRequestDetails) {
validateNotDuplicateParameters(thePersonId, theTargetId);
@ -174,7 +174,7 @@ public class EmpiProviderDstu3 extends BaseEmpiProvider {
}
@Operation(name = ProviderConstants.OPERATION_EMPI_SUBMIT, idempotent = false, returnParameters = {
@OperationParam(name = ProviderConstants.OPERATION_EMPI_BATCH_RUN_OUT_PARAM_SUBMIT_COUNT, type= DecimalType.class)
@OperationParam(name = ProviderConstants.OPERATION_MDM_BATCH_RUN_OUT_PARAM_SUBMIT_COUNT, type= DecimalType.class)
})
public Parameters empiBatchOnAllTargets(
@OperationParam(name= ProviderConstants.EMPI_BATCH_RUN_CRITERIA,min = 0 , max = 1) StringType theCriteria,
@ -188,25 +188,25 @@ public class EmpiProviderDstu3 extends BaseEmpiProvider {
return theCriteria == null ? null : theCriteria.getValueAsString();
}
@Operation(name = ProviderConstants.EMPI_CLEAR, returnParameters = {
@OperationParam(name = ProviderConstants.OPERATION_EMPI_BATCH_RUN_OUT_PARAM_SUBMIT_COUNT, type= DecimalType.class)
@Operation(name = ProviderConstants.MDM_CLEAR, returnParameters = {
@OperationParam(name = ProviderConstants.OPERATION_MDM_BATCH_RUN_OUT_PARAM_SUBMIT_COUNT, type= DecimalType.class)
})
public Parameters clearEmpiLinks(@OperationParam(name=ProviderConstants.EMPI_CLEAR_TARGET_TYPE, min = 0, max = 1) StringType theTargetType,
public Parameters clearEmpiLinks(@OperationParam(name=ProviderConstants.MDM_CLEAR_TARGET_TYPE, min = 0, max = 1) StringType theTargetType,
ServletRequestDetails theRequestDetails) {
long resetCount;
if (theTargetType == null || StringUtils.isBlank(theTargetType.getValue())) {
resetCount = myEmpiResetSvc.expungeAllEmpiLinks(theRequestDetails);
} else {
resetCount = myEmpiResetSvc.expungeAllEmpiLinksOfTargetType(theTargetType.getValueNotNull(), theRequestDetails);
resetCount = myEmpiResetSvc.expungeAllMdmLinksOfTargetType(theTargetType.getValueNotNull(), theRequestDetails);
}
Parameters parameters = new Parameters();
parameters.addParameter().setName(ProviderConstants.OPERATION_EMPI_CLEAR_OUT_PARAM_DELETED_COUNT)
parameters.addParameter().setName(ProviderConstants.OPERATION_MDM_CLEAR_OUT_PARAM_DELETED_COUNT)
.setValue(new DecimalType(resetCount));
return parameters;
}
@Operation(name = ProviderConstants.OPERATION_EMPI_SUBMIT, idempotent = false, type = Patient.class, returnParameters = {
@OperationParam(name = ProviderConstants.OPERATION_EMPI_BATCH_RUN_OUT_PARAM_SUBMIT_COUNT, type = DecimalType.class)
@OperationParam(name = ProviderConstants.OPERATION_MDM_BATCH_RUN_OUT_PARAM_SUBMIT_COUNT, type = DecimalType.class)
})
public Parameters empiBatchPatientInstance(
@IdParam IIdType theIdParam,
@ -216,7 +216,7 @@ public class EmpiProviderDstu3 extends BaseEmpiProvider {
}
@Operation(name = ProviderConstants.OPERATION_EMPI_SUBMIT, idempotent = false, type = Patient.class, returnParameters = {
@OperationParam(name = ProviderConstants.OPERATION_EMPI_BATCH_RUN_OUT_PARAM_SUBMIT_COUNT, type = DecimalType.class)
@OperationParam(name = ProviderConstants.OPERATION_MDM_BATCH_RUN_OUT_PARAM_SUBMIT_COUNT, type = DecimalType.class)
})
public Parameters empiBatchPatientType(
@OperationParam(name = ProviderConstants.EMPI_BATCH_RUN_CRITERIA) StringType theCriteria,
@ -227,7 +227,7 @@ public class EmpiProviderDstu3 extends BaseEmpiProvider {
}
@Operation(name = ProviderConstants.OPERATION_EMPI_SUBMIT, idempotent = false, type = Practitioner.class, returnParameters = {
@OperationParam(name = ProviderConstants.OPERATION_EMPI_BATCH_RUN_OUT_PARAM_SUBMIT_COUNT, type = DecimalType.class)
@OperationParam(name = ProviderConstants.OPERATION_MDM_BATCH_RUN_OUT_PARAM_SUBMIT_COUNT, type = DecimalType.class)
})
public Parameters empiBatchPractitionerInstance(
@IdParam IIdType theIdParam,
@ -237,7 +237,7 @@ public class EmpiProviderDstu3 extends BaseEmpiProvider {
}
@Operation(name = ProviderConstants.OPERATION_EMPI_SUBMIT, idempotent = false, type = Practitioner.class, returnParameters = {
@OperationParam(name = ProviderConstants.OPERATION_EMPI_BATCH_RUN_OUT_PARAM_SUBMIT_COUNT, type = DecimalType.class)
@OperationParam(name = ProviderConstants.OPERATION_MDM_BATCH_RUN_OUT_PARAM_SUBMIT_COUNT, type = DecimalType.class)
})
public Parameters empiBatchPractitionerType(
@OperationParam(name = ProviderConstants.EMPI_BATCH_RUN_CRITERIA) StringType theCriteria,
@ -253,7 +253,7 @@ public class EmpiProviderDstu3 extends BaseEmpiProvider {
private Parameters buildEmpiOutParametersWithCount(long theCount) {
Parameters parameters = new Parameters();
parameters.addParameter()
.setName(ProviderConstants.OPERATION_EMPI_BATCH_RUN_OUT_PARAM_SUBMIT_COUNT)
.setName(ProviderConstants.OPERATION_MDM_BATCH_RUN_OUT_PARAM_SUBMIT_COUNT)
.setValue(new DecimalType(theCount));
return parameters;
}

View File

@ -47,7 +47,6 @@ import org.hl7.fhir.r4.model.InstantType;
import org.hl7.fhir.r4.model.IntegerType;
import org.hl7.fhir.r4.model.Parameters;
import org.hl7.fhir.r4.model.Patient;
import org.hl7.fhir.r4.model.Person;
import org.hl7.fhir.r4.model.Practitioner;
import org.hl7.fhir.r4.model.Resource;
import org.hl7.fhir.r4.model.StringType;
@ -61,7 +60,7 @@ import java.util.stream.Stream;
public class EmpiProviderR4 extends BaseEmpiProvider {
private final IEmpiControllerSvc myEmpiControllerSvc;
private final IEmpiMatchFinderSvc myEmpiMatchFinderSvc;
private final IEmpiExpungeSvc myEmpiExpungeSvc;
private final IEmpiExpungeSvc myMdmExpungeSvc;
private final IEmpiSubmitSvc myEmpiSubmitSvc;
/**
@ -70,11 +69,11 @@ public class EmpiProviderR4 extends BaseEmpiProvider {
* Note that this is not a spring bean. Any necessary injections should
* happen in the constructor
*/
public EmpiProviderR4(FhirContext theFhirContext, IEmpiControllerSvc theEmpiControllerSvc, IEmpiMatchFinderSvc theEmpiMatchFinderSvc, IEmpiExpungeSvc theEmpiExpungeSvc, IEmpiSubmitSvc theEmpiSubmitSvc) {
public EmpiProviderR4(FhirContext theFhirContext, IEmpiControllerSvc theEmpiControllerSvc, IEmpiMatchFinderSvc theEmpiMatchFinderSvc, IEmpiExpungeSvc theMdmExpungeSvc, IEmpiSubmitSvc theEmpiSubmitSvc) {
super(theFhirContext);
myEmpiControllerSvc = theEmpiControllerSvc;
myEmpiMatchFinderSvc = theEmpiMatchFinderSvc;
myEmpiExpungeSvc = theEmpiExpungeSvc;
myMdmExpungeSvc = theMdmExpungeSvc;
myEmpiSubmitSvc = theEmpiSubmitSvc;
}
@ -125,46 +124,47 @@ public class EmpiProviderR4 extends BaseEmpiProvider {
}
//TODO GGG ask ken, what is the best way to genericize this? Return
@Operation(name = ProviderConstants.EMPI_MERGE_PERSONS)
public IBaseResource mergePersons(@OperationParam(name=ProviderConstants.EMPI_MERGE_PERSONS_FROM_PERSON_ID, min = 1, max = 1) StringType theFromPersonId,
@OperationParam(name=ProviderConstants.EMPI_MERGE_PERSONS_TO_PERSON_ID, min = 1, max = 1) StringType theToPersonId,
RequestDetails theRequestDetails) {
validateMergeParameters(theFromPersonId, theToPersonId);
@Operation(name = ProviderConstants.MDM_MERGE_GOLDEN_RESOURCES)
public IBaseResource mergeGoldenResources(@OperationParam(name=ProviderConstants.MDM_MERGE_GR_FROM_GOLDEN_RESOURCE_ID, min = 1, max = 1) StringType theFromGoldenResourceId,
@OperationParam(name=ProviderConstants.MDM_MERGE_GR_TO_GOLDEN_RESOURCE_ID, min = 1, max = 1) StringType theToGoldenResourceId,
RequestDetails theRequestDetails) {
validateMergeParameters(theFromGoldenResourceId, theToGoldenResourceId);
return (Person) myEmpiControllerSvc.mergePersons(theFromPersonId.getValue(), theToPersonId.getValue(), createEmpiContext(theRequestDetails, EmpiTransactionContext.OperationType.MERGE_PERSONS));
return myEmpiControllerSvc.mergePersons(theFromGoldenResourceId.getValue(), theToGoldenResourceId.getValue(), createEmpiContext(theRequestDetails, EmpiTransactionContext.OperationType.MERGE_PERSONS));
}
@Operation(name = ProviderConstants.EMPI_UPDATE_LINK, type = Person.class)
public Person updateLink(@OperationParam(name=ProviderConstants.EMPI_UPDATE_LINK_PERSON_ID, min = 1, max = 1) StringType thePersonId,
@OperationParam(name=ProviderConstants.EMPI_UPDATE_LINK_TARGET_ID, min = 1, max = 1) StringType theTargetId,
@OperationParam(name=ProviderConstants.EMPI_UPDATE_LINK_MATCH_RESULT, min = 1, max = 1) StringType theMatchResult,
@Operation(name = ProviderConstants.MDM_UPDATE_LINK)
public IBaseResource updateLink(@OperationParam(name=ProviderConstants.MDM_UPDATE_LINK_GOLDEN_RESOURCE_ID, min = 1, max = 1) StringType thePersonId,
@OperationParam(name=ProviderConstants.MDM_UPDATE_LINK_RESOURCE_ID, min = 1, max = 1) StringType theTargetId,
@OperationParam(name=ProviderConstants.MDM_UPDATE_LINK_MATCH_RESULT, min = 1, max = 1) StringType theMatchResult,
ServletRequestDetails theRequestDetails) {
validateUpdateLinkParameters(thePersonId, theTargetId, theMatchResult);
return (Person) myEmpiControllerSvc.updateLink(thePersonId.getValueNotNull(), theTargetId.getValue(), theMatchResult.getValue(), createEmpiContext(theRequestDetails, EmpiTransactionContext.OperationType.UPDATE_LINK));
return myEmpiControllerSvc.updateLink(thePersonId.getValueNotNull(), theTargetId.getValue(), theMatchResult.getValue(), createEmpiContext(theRequestDetails, EmpiTransactionContext.OperationType.UPDATE_LINK));
}
@Operation(name = ProviderConstants.EMPI_CLEAR, returnParameters = {
@OperationParam(name = ProviderConstants.OPERATION_EMPI_BATCH_RUN_OUT_PARAM_SUBMIT_COUNT, type=DecimalType.class)
@Operation(name = ProviderConstants.MDM_CLEAR, returnParameters = {
@OperationParam(name = ProviderConstants.OPERATION_MDM_BATCH_RUN_OUT_PARAM_SUBMIT_COUNT, type=DecimalType.class)
})
public Parameters clearEmpiLinks(@OperationParam(name=ProviderConstants.EMPI_CLEAR_TARGET_TYPE, min = 0, max = 1) StringType theTargetType,
public Parameters clearEmpiLinks(@OperationParam(name=ProviderConstants.MDM_CLEAR_TARGET_TYPE, min = 0, max = 1) StringType theTargetType,
ServletRequestDetails theRequestDetails) {
long resetCount;
if (theTargetType == null || StringUtils.isBlank(theTargetType.getValue())) {
resetCount = myEmpiExpungeSvc.expungeAllEmpiLinks(theRequestDetails);
resetCount = myMdmExpungeSvc.expungeAllEmpiLinks(theRequestDetails);
} else {
resetCount = myEmpiExpungeSvc.expungeAllEmpiLinksOfTargetType(theTargetType.getValueNotNull(), theRequestDetails);
resetCount = myMdmExpungeSvc.expungeAllMdmLinksOfTargetType(theTargetType.getValueNotNull(), theRequestDetails);
}
Parameters parameters = new Parameters();
parameters.addParameter().setName(ProviderConstants.OPERATION_EMPI_CLEAR_OUT_PARAM_DELETED_COUNT)
parameters.addParameter().setName(ProviderConstants.OPERATION_MDM_CLEAR_OUT_PARAM_DELETED_COUNT)
.setValue(new DecimalType(resetCount));
return parameters;
}
@Operation(name = ProviderConstants.EMPI_QUERY_LINKS, idempotent = true)
public Parameters queryLinks(@OperationParam(name=ProviderConstants.EMPI_QUERY_LINKS_PERSON_ID, min = 0, max = 1) StringType thePersonId,
@OperationParam(name=ProviderConstants.EMPI_QUERY_LINKS_TARGET_ID, min = 0, max = 1) StringType theTargetId,
@Operation(name = ProviderConstants.MDM_QUERY_LINKS, idempotent = true)
public Parameters queryLinks(@OperationParam(name=ProviderConstants.MDM_QUERY_LINKS_GOLDEN_RESOURCE_ID, min = 0, max = 1) StringType thePersonId,
@OperationParam(name=ProviderConstants.MDM_QUERY_LINKS_RESOURCE_ID, min = 0, max = 1) StringType theTargetId,
@OperationParam(name=ProviderConstants.EMPI_QUERY_LINKS_MATCH_RESULT, min = 0, max = 1) StringType theMatchResult,
@OperationParam(name=ProviderConstants.EMPI_QUERY_LINKS_LINK_SOURCE, min = 0, max = 1) StringType theLinkSource,
ServletRequestDetails theRequestDetails) {
@ -180,8 +180,8 @@ public class EmpiProviderR4 extends BaseEmpiProvider {
}
@Operation(name = ProviderConstants.EMPI_NOT_DUPLICATE)
public Parameters notDuplicate(@OperationParam(name=ProviderConstants.EMPI_QUERY_LINKS_PERSON_ID, min = 1, max = 1) StringType thePersonId,
@OperationParam(name=ProviderConstants.EMPI_QUERY_LINKS_TARGET_ID, min = 1, max = 1) StringType theTargetId,
public Parameters notDuplicate(@OperationParam(name=ProviderConstants.MDM_QUERY_LINKS_GOLDEN_RESOURCE_ID, min = 1, max = 1) StringType thePersonId,
@OperationParam(name=ProviderConstants.MDM_QUERY_LINKS_RESOURCE_ID, min = 1, max = 1) StringType theTargetId,
ServletRequestDetails theRequestDetails) {
validateNotDuplicateParameters(thePersonId, theTargetId);
@ -193,7 +193,7 @@ public class EmpiProviderR4 extends BaseEmpiProvider {
}
@Operation(name = ProviderConstants.OPERATION_EMPI_SUBMIT, idempotent = false, returnParameters = {
@OperationParam(name = ProviderConstants.OPERATION_EMPI_BATCH_RUN_OUT_PARAM_SUBMIT_COUNT, type= IntegerType.class)
@OperationParam(name = ProviderConstants.OPERATION_MDM_BATCH_RUN_OUT_PARAM_SUBMIT_COUNT, type= IntegerType.class)
})
public Parameters empiBatchOnAllTargets(
@OperationParam(name= ProviderConstants.EMPI_BATCH_RUN_CRITERIA,min = 0 , max = 1) StringType theCriteria,
@ -208,7 +208,7 @@ public class EmpiProviderR4 extends BaseEmpiProvider {
}
@Operation(name = ProviderConstants.OPERATION_EMPI_SUBMIT, idempotent = false, type = Patient.class, returnParameters = {
@OperationParam(name = ProviderConstants.OPERATION_EMPI_BATCH_RUN_OUT_PARAM_SUBMIT_COUNT, type = IntegerType.class)
@OperationParam(name = ProviderConstants.OPERATION_MDM_BATCH_RUN_OUT_PARAM_SUBMIT_COUNT, type = IntegerType.class)
})
public Parameters empiBatchPatientInstance(
@IdParam IIdType theIdParam,
@ -218,7 +218,7 @@ public class EmpiProviderR4 extends BaseEmpiProvider {
}
@Operation(name = ProviderConstants.OPERATION_EMPI_SUBMIT, idempotent = false, type = Patient.class, returnParameters = {
@OperationParam(name = ProviderConstants.OPERATION_EMPI_BATCH_RUN_OUT_PARAM_SUBMIT_COUNT, type = IntegerType.class)
@OperationParam(name = ProviderConstants.OPERATION_MDM_BATCH_RUN_OUT_PARAM_SUBMIT_COUNT, type = IntegerType.class)
})
public Parameters empiBatchPatientType(
@OperationParam(name = ProviderConstants.EMPI_BATCH_RUN_CRITERIA) StringType theCriteria,
@ -229,7 +229,7 @@ public class EmpiProviderR4 extends BaseEmpiProvider {
}
@Operation(name = ProviderConstants.OPERATION_EMPI_SUBMIT, idempotent = false, type = Practitioner.class, returnParameters = {
@OperationParam(name = ProviderConstants.OPERATION_EMPI_BATCH_RUN_OUT_PARAM_SUBMIT_COUNT, type = IntegerType.class)
@OperationParam(name = ProviderConstants.OPERATION_MDM_BATCH_RUN_OUT_PARAM_SUBMIT_COUNT, type = IntegerType.class)
})
public Parameters empiBatchPractitionerInstance(
@IdParam IIdType theIdParam,
@ -239,7 +239,7 @@ public class EmpiProviderR4 extends BaseEmpiProvider {
}
@Operation(name = ProviderConstants.OPERATION_EMPI_SUBMIT, idempotent = false, type = Practitioner.class, returnParameters = {
@OperationParam(name = ProviderConstants.OPERATION_EMPI_BATCH_RUN_OUT_PARAM_SUBMIT_COUNT, type = IntegerType.class)
@OperationParam(name = ProviderConstants.OPERATION_MDM_BATCH_RUN_OUT_PARAM_SUBMIT_COUNT, type = IntegerType.class)
})
public Parameters empiBatchPractitionerType(
@OperationParam(name = ProviderConstants.EMPI_BATCH_RUN_CRITERIA) StringType theCriteria,
@ -255,7 +255,7 @@ public class EmpiProviderR4 extends BaseEmpiProvider {
private Parameters buildEmpiOutParametersWithCount(long theCount) {
Parameters parameters = new Parameters();
parameters.addParameter()
.setName(ProviderConstants.OPERATION_EMPI_BATCH_RUN_OUT_PARAM_SUBMIT_COUNT)
.setName(ProviderConstants.OPERATION_MDM_BATCH_RUN_OUT_PARAM_SUBMIT_COUNT)
.setValue(new DecimalType(theCount));
return parameters;
}

View File

@ -67,28 +67,28 @@ public class ProviderConstants {
public static final String EMPI_MATCH_RESOURCE = "resource";
//TODO GGG MDM: rename all these vars
public static final String EMPI_MERGE_PERSONS = "$empi-merge-golden-resources";
public static final String EMPI_MERGE_PERSONS_FROM_PERSON_ID = "fromGoldenResourceId";
public static final String EMPI_MERGE_PERSONS_TO_PERSON_ID = "toGoldenResourceId";
public static final String MDM_MERGE_GOLDEN_RESOURCES = "$empi-merge-golden-resources";
public static final String MDM_MERGE_GR_FROM_GOLDEN_RESOURCE_ID = "fromGoldenResourceId";
public static final String MDM_MERGE_GR_TO_GOLDEN_RESOURCE_ID = "toGoldenResourceId";
public static final String EMPI_UPDATE_LINK = "$empi-update-link";
public static final String EMPI_UPDATE_LINK_PERSON_ID = "goldenResourceId";
public static final String EMPI_UPDATE_LINK_TARGET_ID = "resourceId";
public static final String EMPI_UPDATE_LINK_MATCH_RESULT = "matchResult";
public static final String MDM_UPDATE_LINK = "$empi-update-link";
public static final String MDM_UPDATE_LINK_GOLDEN_RESOURCE_ID = "goldenResourceId";
public static final String MDM_UPDATE_LINK_RESOURCE_ID = "resourceId";
public static final String MDM_UPDATE_LINK_MATCH_RESULT = "matchResult";
public static final String EMPI_QUERY_LINKS = "$empi-query-links";
public static final String EMPI_QUERY_LINKS_PERSON_ID = "goldenResourceId";
public static final String EMPI_QUERY_LINKS_TARGET_ID = "resourceId";
public static final String MDM_QUERY_LINKS = "$empi-query-links";
public static final String MDM_QUERY_LINKS_GOLDEN_RESOURCE_ID = "goldenResourceId";
public static final String MDM_QUERY_LINKS_RESOURCE_ID = "resourceId";
public static final String EMPI_QUERY_LINKS_MATCH_RESULT = "matchResult";
public static final String EMPI_QUERY_LINKS_LINK_SOURCE = "linkSource";
public static final String EMPI_DUPLICATE_PERSONS = "$empi-duplicate-golden-resources";
public static final String EMPI_NOT_DUPLICATE = "$empi-not-duplicate";
public static final String EMPI_CLEAR = "$empi-clear";
public static final String EMPI_CLEAR_TARGET_TYPE = "targetType";
public static final String MDM_CLEAR = "$empi-clear";
public static final String MDM_CLEAR_TARGET_TYPE = "targetType";
public static final String OPERATION_EMPI_SUBMIT = "$empi-submit";
public static final String EMPI_BATCH_RUN_CRITERIA= "criteria" ;
public static final String OPERATION_EMPI_BATCH_RUN_OUT_PARAM_SUBMIT_COUNT = "submitted" ;
public static final String OPERATION_EMPI_CLEAR_OUT_PARAM_DELETED_COUNT = "deleted";
public static final String OPERATION_MDM_BATCH_RUN_OUT_PARAM_SUBMIT_COUNT = "submitted" ;
public static final String OPERATION_MDM_CLEAR_OUT_PARAM_DELETED_COUNT = "deleted";
}