Increase length, add test
This commit is contained in:
parent
95f951e776
commit
e15825b336
|
@ -8,22 +8,29 @@ import ca.uhn.fhir.jpa.model.util.UcumServiceUtil;
|
|||
import ca.uhn.fhir.jpa.searchparam.SearchParameterMap;
|
||||
import ca.uhn.fhir.rest.api.server.IBundleProvider;
|
||||
import ca.uhn.fhir.rest.param.QuantityParam;
|
||||
import ca.uhn.fhir.rest.param.ReferenceParam;
|
||||
import ca.uhn.fhir.rest.param.StringParam;
|
||||
import ca.uhn.fhir.rest.param.TokenParam;
|
||||
import ca.uhn.fhir.rest.server.exceptions.ResourceNotFoundException;
|
||||
import ca.uhn.fhir.rest.server.exceptions.ResourceVersionConflictException;
|
||||
import ca.uhn.fhir.rest.server.exceptions.UnprocessableEntityException;
|
||||
import org.apache.commons.lang3.time.DateUtils;
|
||||
import org.hl7.fhir.instance.model.api.IBaseResource;
|
||||
import org.hl7.fhir.instance.model.api.IIdType;
|
||||
import org.hl7.fhir.r4.model.BooleanType;
|
||||
import org.hl7.fhir.r4.model.Bundle;
|
||||
import org.hl7.fhir.r4.model.DateType;
|
||||
import org.hl7.fhir.r4.model.DecimalType;
|
||||
import org.hl7.fhir.r4.model.Enumerations;
|
||||
import org.hl7.fhir.r4.model.IdType;
|
||||
import org.hl7.fhir.r4.model.Location;
|
||||
import org.hl7.fhir.r4.model.Observation;
|
||||
import org.hl7.fhir.r4.model.Organization;
|
||||
import org.hl7.fhir.r4.model.Patient;
|
||||
import org.hl7.fhir.r4.model.Practitioner;
|
||||
import org.hl7.fhir.r4.model.PractitionerRole;
|
||||
import org.hl7.fhir.r4.model.Quantity;
|
||||
import org.hl7.fhir.r4.model.Reference;
|
||||
import org.hl7.fhir.r4.model.SampledData;
|
||||
import org.hl7.fhir.r4.model.SearchParameter;
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
|
@ -42,7 +49,9 @@ import static org.hamcrest.MatcherAssert.assertThat;
|
|||
import static org.hamcrest.Matchers.contains;
|
||||
import static org.hamcrest.Matchers.containsString;
|
||||
import static org.hamcrest.Matchers.empty;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
import static org.hamcrest.Matchers.matchesPattern;
|
||||
import static org.hamcrest.Matchers.is;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
import static org.junit.jupiter.api.Assertions.fail;
|
||||
|
@ -750,4 +759,5 @@ public class FhirResourceDaoR4CreateTest extends BaseJpaR4Test {
|
|||
assertThat(searchSql, containsString("t0.SP_VALUE = '0.0000012'"));
|
||||
assertEquals(1, ids.size());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -24,6 +24,7 @@ import org.hamcrest.Matchers;
|
|||
import org.hl7.fhir.instance.model.api.IIdType;
|
||||
import org.hl7.fhir.r4.model.Appointment;
|
||||
import org.hl7.fhir.r4.model.Appointment.AppointmentStatus;
|
||||
import org.hl7.fhir.r4.model.BooleanType;
|
||||
import org.hl7.fhir.r4.model.Bundle;
|
||||
import org.hl7.fhir.r4.model.ChargeItem;
|
||||
import org.hl7.fhir.r4.model.CodeType;
|
||||
|
@ -47,6 +48,7 @@ import org.hl7.fhir.r4.model.MessageHeader;
|
|||
import org.hl7.fhir.r4.model.Observation;
|
||||
import org.hl7.fhir.r4.model.Patient;
|
||||
import org.hl7.fhir.r4.model.Practitioner;
|
||||
import org.hl7.fhir.r4.model.PractitionerRole;
|
||||
import org.hl7.fhir.r4.model.Reference;
|
||||
import org.hl7.fhir.r4.model.SearchParameter;
|
||||
import org.hl7.fhir.r4.model.ServiceRequest;
|
||||
|
@ -1508,6 +1510,44 @@ public class FhirResourceDaoR4SearchCustomSearchParamTest extends BaseJpaR4Test
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testSearchParametersWithVeryLongFhirPathExpressionsAreAccepted() {
|
||||
//Given
|
||||
String twoHundredCharUrl = "http://urlurlurlsurlurlurlsurlurlurlsurlurlurlsurlurlurlsurlurlurlsurlurlurlsurlurlurlsurlurlurlsurlurlurlsurlurlurlsurlurlurlsurlurlurlsurlurlurlsurlurlurlsurlurlurlsurlurlurlsurlurlurlsurlurlurlsurlurlurls.com";
|
||||
SearchParameter searchParameter = new SearchParameter();
|
||||
searchParameter.setExpression("PractitionerRole.extension.where(url='" + twoHundredCharUrl + "').value.as(Reference)");
|
||||
searchParameter.addBase("PractitionerRole");
|
||||
searchParameter.setId("random-extension-sp");
|
||||
searchParameter.setCode("random-extension");
|
||||
searchParameter.setStatus(Enumerations.PublicationStatus.ACTIVE);
|
||||
searchParameter.setType(Enumerations.SearchParamType.REFERENCE);
|
||||
mySearchParameterDao.update(searchParameter);
|
||||
|
||||
mySearchParamRegistry.forceRefresh();
|
||||
mySearchParamRegistry.refreshCacheIfNecessary();
|
||||
|
||||
Practitioner p = new Practitioner();
|
||||
p.setId("Practitioner/P123");
|
||||
myPractitionerDao.update(p);
|
||||
|
||||
//When
|
||||
PractitionerRole pr = new PractitionerRole();
|
||||
pr.addExtension().setUrl(twoHundredCharUrl).setValue(new Reference("Practitioner/P123"));
|
||||
pr.setPractitioner(new Reference("Practitioner/P123"));
|
||||
pr.setId("PractitionerRole/PR123");
|
||||
myCaptureQueriesListener.clear();
|
||||
myPractitionerRoleDao.update(pr);
|
||||
myCaptureQueriesListener.logInsertQueries();
|
||||
|
||||
//Then
|
||||
SearchParameterMap searchParameterMap = new SearchParameterMap();
|
||||
searchParameterMap.setLoadSynchronous(true);
|
||||
searchParameterMap.add("random-extension", new TokenParam("true"));
|
||||
IBundleProvider search = myPractitionerRoleDao.search(searchParameterMap);
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSearchWithCustomParamDraft() {
|
||||
|
||||
|
|
|
@ -88,4 +88,5 @@ public class FhirResourceDaoSearchParameterR4Test {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -119,6 +119,8 @@ public class HapiFhirJpaMigrationTasks extends BaseMigrationTasks<VersionEnum> {
|
|||
blkImportJobFileTable.addForeignKey("20210410.6", "FK_BLKIMJOBFILE_JOB").toColumn("JOB_PID").references("HFJ_BLK_IMPORT_JOB", "PID");
|
||||
version.addIdGenerator("20210410.7", "SEQ_BLKIMJOBFILE_PID");
|
||||
|
||||
//Increase ResourceLink path length
|
||||
version.onTable("HFJ_RES_LINK").modifyColumn("20210505.1", "SRC_PATH").nonNullable().withType(ColumnTypeEnum.STRING, 500);
|
||||
}
|
||||
|
||||
private void init530() {
|
||||
|
|
|
@ -22,11 +22,9 @@ package ca.uhn.fhir.jpa.model.entity;
|
|||
|
||||
import ca.uhn.fhir.interceptor.model.RequestPartitionId;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Embeddable;
|
||||
import javax.validation.constraints.Null;
|
||||
import java.time.LocalDate;
|
||||
|
||||
@Embeddable
|
||||
|
|
|
@ -52,7 +52,7 @@ import java.util.Date;
|
|||
})
|
||||
public class ResourceLink extends BaseResourceIndex {
|
||||
|
||||
public static final int SRC_PATH_LENGTH = 200;
|
||||
public static final int SRC_PATH_LENGTH = 500;
|
||||
private static final long serialVersionUID = 1L;
|
||||
@SequenceGenerator(name = "SEQ_RESLINK_ID", sequenceName = "SEQ_RESLINK_ID")
|
||||
@GeneratedValue(strategy = GenerationType.AUTO, generator = "SEQ_RESLINK_ID")
|
||||
|
|
Loading…
Reference in New Issue