Links WIP 2
This commit is contained in:
parent
1ad0246c2a
commit
0ad1b129d3
|
@ -78,7 +78,7 @@ public class EmpiLinkUpdaterSvcImpl implements IEmpiLinkUpdaterSvc {
|
|||
|
||||
Optional<EmpiLink> oEmpiLink = myEmpiLinkDaoSvc.getLinkBySourceResourcePidAndTargetResourcePid(personId, targetId);
|
||||
if (!oEmpiLink.isPresent()) {
|
||||
throw new InvalidRequestException("No link exists between " + thePerson.getIdElement().toVersionless() + " and " + theTarget.getIdElement().toVersionless());
|
||||
throw new InvalidRequestException(myMessageHelper.getMessageForNoLink(thePerson, theTarget));
|
||||
}
|
||||
EmpiLink empiLink = oEmpiLink.get();
|
||||
if (empiLink.getMatchResult() == theMatchResult) {
|
||||
|
|
|
@ -27,15 +27,9 @@ import static org.junit.jupiter.api.Assertions.fail;
|
|||
|
||||
public class EmpiProviderUpdateLinkR4Test extends BaseLinkR4Test {
|
||||
|
||||
// @Autowired
|
||||
// private IEmpiSettings myEmpiSettings;
|
||||
|
||||
@Autowired
|
||||
private MessageHelper myMessageHelper;
|
||||
|
||||
@Autowired
|
||||
private EmpiControllerHelper myEmpiControllerHelper;
|
||||
|
||||
@Test
|
||||
public void testUpdateLinkNoMatch() {
|
||||
assertLinkCount(1);
|
||||
|
|
|
@ -79,6 +79,8 @@ public abstract class BaseEmpiProvider {
|
|||
|
||||
protected MdmTransactionContext createMdmContext(RequestDetails theRequestDetails, MdmTransactionContext.OperationType theOperationType) {
|
||||
TransactionLogMessages transactionLogMessages = TransactionLogMessages.createFromTransactionGuid(theRequestDetails.getTransactionGuid());
|
||||
if (true)
|
||||
throw new RuntimeException("FIXME - NG - We need a way to set resource type here");
|
||||
return new MdmTransactionContext(transactionLogMessages, theOperationType);
|
||||
}
|
||||
|
||||
|
|
|
@ -160,7 +160,6 @@ public class EmpiProviderR4 extends BaseEmpiProvider {
|
|||
ServletRequestDetails theRequestDetails) {
|
||||
|
||||
validateUpdateLinkParameters(theGoldenResourceId, theResourceId, theMatchResult);
|
||||
|
||||
return myEmpiControllerSvc.updateLink(theGoldenResourceId.getValueNotNull(), theResourceId.getValue(), theMatchResult.getValue(), createMdmContext(theRequestDetails, MdmTransactionContext.OperationType.UPDATE_LINK));
|
||||
}
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@ import ca.uhn.fhir.empi.api.IEmpiLinkQuerySvc;
|
|||
import ca.uhn.fhir.empi.api.IEmpiSettings;
|
||||
import ca.uhn.fhir.rest.server.provider.ProviderConstants;
|
||||
import org.hl7.fhir.instance.model.api.IAnyResource;
|
||||
import org.hl7.fhir.instance.model.api.IIdType;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
|
@ -62,4 +63,13 @@ public class MessageHelper {
|
|||
return "The target is marked with the " + EmpiConstants.CODE_NO_EMPI_MANAGED
|
||||
+ " tag which means it may not be EMPI linked.";
|
||||
}
|
||||
|
||||
public String getMessageForNoLink(IAnyResource theGoldenRecord, IAnyResource theTarget) {
|
||||
return getMessageForNoLink(theGoldenRecord.getIdElement().toVersionless().toString(),
|
||||
theTarget.getIdElement().toVersionless().toString());
|
||||
}
|
||||
|
||||
public String getMessageForNoLink(String theGoldenRecord, String theTarget) {
|
||||
return "No link exists between " + theGoldenRecord + " and " + theTarget;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue