Commit 77b9461d authored by luc chatty's avatar luc chatty

PATREG-33 | integrate new search version

parent 34c58de3
Pipeline #136905 failed with stages
in 18 minutes and 27 seconds
......@@ -44,6 +44,7 @@
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<finalName>patient-registry-${project.version}</finalName>
<appendAssemblyId>false</appendAssemblyId>
</configuration>
<executions>
<execution>
......
......@@ -32,11 +32,10 @@ public class PatientSearchCriterionJPAMappingService implements SearchCriterionJ
* {@inheritDoc}
*/
@Override
public From from(SearchCriterionKey searchCriterionKey) {
public From from(SearchCriterionKey searchCriterionKey, From from) {
PatientSearchCriterionKey patientSearchCriterionKey = castToPatientKey(searchCriterionKey);
if (PatientSearchCriterionKey.UUID.equals(patientSearchCriterionKey)) {
CriteriaQuery<PatientDB> criteriaQuery = criteriaBuilder.createQuery(PatientDB.class);
return criteriaQuery.from(PatientDB.class);
if (PatientSearchCriterionKey.UUID.equals(patientSearchCriterionKey)) {;
return from;
} else {
throw new IllegalArgumentException("Unsupported test key : " + patientSearchCriterionKey);
}
......
package net.ihe.gazelle.app.patientregistryservice.adapter.dao.pamsimulator.service.patient.search;
import javax.persistence.criteria.*;
import javax.persistence.metamodel.*;
import java.util.Collection;
import java.util.List;
import java.util.Set;
public class FromTestModel implements From {
@Override
public Set<Join> getJoins() {
return null;
}
@Override
public boolean isCorrelated() {
return false;
}
@Override
public From getCorrelationParent() {
return null;
}
@Override
public MapJoin joinMap(String s, JoinType joinType) {
return null;
}
@Override
public ListJoin joinList(String s, JoinType joinType) {
return null;
}
@Override
public SetJoin joinSet(String s, JoinType joinType) {
return null;
}
@Override
public CollectionJoin joinCollection(String s, JoinType joinType) {
return null;
}
@Override
public Join join(String s, JoinType joinType) {
return null;
}
@Override
public MapJoin joinMap(String s) {
return null;
}
@Override
public ListJoin joinList(String s) {
return null;
}
@Override
public SetJoin joinSet(String s) {
return null;
}
@Override
public CollectionJoin joinCollection(String s) {
return null;
}
@Override
public Join join(String s) {
return null;
}
@Override
public MapJoin join(MapAttribute mapAttribute, JoinType joinType) {
return null;
}
@Override
public ListJoin join(ListAttribute listAttribute, JoinType joinType) {
return null;
}
@Override
public SetJoin join(SetAttribute setAttribute, JoinType joinType) {
return null;
}
@Override
public CollectionJoin join(CollectionAttribute collectionAttribute, JoinType joinType) {
return null;
}
@Override
public MapJoin join(MapAttribute mapAttribute) {
return null;
}
@Override
public ListJoin join(ListAttribute listAttribute) {
return null;
}
@Override
public SetJoin join(SetAttribute setAttribute) {
return null;
}
@Override
public CollectionJoin join(CollectionAttribute collectionAttribute) {
return null;
}
@Override
public Join join(SingularAttribute singularAttribute, JoinType joinType) {
return null;
}
@Override
public Join join(SingularAttribute singularAttribute) {
return null;
}
@Override
public Set<Fetch> getFetches() {
return null;
}
@Override
public Fetch fetch(String s, JoinType joinType) {
return null;
}
@Override
public Fetch fetch(String s) {
return null;
}
@Override
public Fetch fetch(PluralAttribute pluralAttribute, JoinType joinType) {
return null;
}
@Override
public Fetch fetch(PluralAttribute pluralAttribute) {
return null;
}
@Override
public Fetch fetch(SingularAttribute singularAttribute, JoinType joinType) {
return null;
}
@Override
public Fetch fetch(SingularAttribute singularAttribute) {
return null;
}
@Override
public Bindable getModel() {
return null;
}
@Override
public Path<?> getParentPath() {
return null;
}
@Override
public Expression<Class> type() {
return null;
}
@Override
public Path get(String s) {
return null;
}
@Override
public Expression get(MapAttribute mapAttribute) {
return null;
}
@Override
public Expression get(PluralAttribute pluralAttribute) {
return null;
}
@Override
public Path get(SingularAttribute singularAttribute) {
return null;
}
@Override
public Predicate isNull() {
return null;
}
@Override
public Predicate isNotNull() {
return null;
}
@Override
public Predicate in(Object... objects) {
return null;
}
@Override
public Expression as(Class aClass) {
return null;
}
@Override
public Predicate in(Expression expression) {
return null;
}
@Override
public Predicate in(Collection collection) {
return null;
}
@Override
public Predicate in(Expression[] expressions) {
return null;
}
@Override
public Selection alias(String s) {
return null;
}
@Override
public boolean isCompoundSelection() {
return false;
}
@Override
public List<Selection<?>> getCompoundSelectionItems() {
return null;
}
@Override
public Class getJavaType() {
return null;
}
@Override
public String getAlias() {
return null;
}
}
......@@ -11,8 +11,7 @@ import javax.persistence.EntityManager;
import javax.persistence.Persistence;
import javax.persistence.criteria.From;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.*;
public class PatientSearchCriterionJPAMappingServiceTest {
......@@ -34,9 +33,11 @@ public class PatientSearchCriterionJPAMappingServiceTest {
*/
@Test
public void from_uuid(){
From from = new PatientSearchCriterionJPAMappingService(entityManager).from(PatientSearchCriterionKey.UUID);
From originalFrom = new FromTestModel();
assertNotNull(from);
From from = new PatientSearchCriterionJPAMappingService(entityManager).from(PatientSearchCriterionKey.UUID, originalFrom);
assertEquals(originalFrom, from);
}
/**
......@@ -60,6 +61,6 @@ public class PatientSearchCriterionJPAMappingServiceTest {
public Class getValueClass() {
return null;
}
}));
},null));
}
}
......@@ -70,7 +70,7 @@ public class PatientSearchDAOTest {
SearchCriteria searchCriteria = new SearchCriteria();
SearchCriterion searchCriterion = new StringSearchCriterion(PatientSearchCriterionKey.UUID);
searchCriterion.setValue(uuid);
searchCriteria.setSearchCriterion(searchCriterion);
searchCriteria.addSearchCriterion(searchCriterion);
List<Patient> retrievedPatients = patientSearchDAO.search(searchCriteria);
......@@ -98,7 +98,7 @@ public class PatientSearchDAOTest {
SearchCriteria searchCriteria = new SearchCriteria();
SearchCriterion searchCriterion = new StringSearchCriterion(PatientSearchCriterionKey.UUID);
searchCriterion.setValue(uuid);
searchCriteria.setSearchCriterion(searchCriterion);
searchCriteria.addSearchCriterion(searchCriterion);
List<Patient> retrievedPatients = patientSearchDAO.search(searchCriteria);
......@@ -128,7 +128,7 @@ public class PatientSearchDAOTest {
SearchCriteria searchCriteria = new SearchCriteria();
SearchCriterion searchCriterion = new StringSearchCriterion(PatientSearchCriterionKey.UUID);
searchCriterion.setValue("Tralalilalere");
searchCriteria.setSearchCriterion(searchCriterion);
searchCriteria.addSearchCriterion(searchCriterion);
List<Patient> retrievedPatients = patientSearchDAO.search(searchCriteria);
......
......@@ -212,7 +212,7 @@ public class FeedExecutionStepDefinition {
@Then("fed patient has returned new assigned uuid")
public void fed_patient_has_the_returned_new_assigned_uuid() throws SearchException {
SearchCriteria searchCriteria = new SearchCriteria();
searchCriteria.setSearchCriterion(getSearchCriterionForUUID(uuidOfFedPatient));
searchCriteria.addSearchCriterion(getSearchCriterionForUUID(uuidOfFedPatient));
List<Patient> searchedPatients = patientSearchClient.search(searchCriteria);
assertNotNull(searchedPatients);
assertEquals(1, searchedPatients.size());
......
......@@ -262,7 +262,7 @@ public class FeedExecutionStepDefinition {
@Then("fed patient has returned new assigned uuid")
public void fed_patient_has_the_returned_new_assigned_uuid() throws SearchException {
SearchCriteria searchCriteria = new SearchCriteria();
searchCriteria.setSearchCriterion(getSearchCriterionForUUID(uuidOfFedPatient));
searchCriteria.addSearchCriterion(getSearchCriterionForUUID(uuidOfFedPatient));
List<Patient> searchedPatients = patientSearchClient.search(searchCriteria);
assertNotNull(searchedPatients);
assertEquals(1, searchedPatients.size());
......
......@@ -110,10 +110,10 @@ public class SearchExecutionStepDefinition {
public void search_criterion(String searchCriteriaName, String searchCriteriaVerbText, String searchCriteriaValue) {
if (searchCriteriaName != null) {
if (searchCriteriaName.equals("tmpuuid")) {
this.searchCriteria.setSearchCriterion(createStringSearchCriterion(PatientSearchCriterionKey.UUID,
this.searchCriteria.addSearchCriterion(createStringSearchCriterion(PatientSearchCriterionKey.UUID,
getStringSearchCriterionOperator(searchCriteriaVerbText), uuidOfFedPatients.get(searchCriteriaValue)));
} else if (searchCriteriaName.equals("uuid")) {
this.searchCriteria.setSearchCriterion(createStringSearchCriterion(PatientSearchCriterionKey.UUID,
this.searchCriteria.addSearchCriterion(createStringSearchCriterion(PatientSearchCriterionKey.UUID,
getStringSearchCriterionOperator(searchCriteriaVerbText), searchCriteriaValue));
} else {
fail(String.format("Unsupported criteria %s", searchCriteriaName));
......
......@@ -175,10 +175,10 @@ public class SearchExecutionStepDefinition {
public void search_criterion(String searchCriteriaName, String searchCriteriaVerbText, String searchCriteriaValue) {
if (searchCriteriaName != null) {
if (searchCriteriaName.equals("tmpuuid")) {
this.searchCriteria.setSearchCriterion(createStringSearchCriterion(PatientSearchCriterionKey.UUID,
this.searchCriteria.addSearchCriterion(createStringSearchCriterion(PatientSearchCriterionKey.UUID,
getStringSearchCriterionOperator(searchCriteriaVerbText), uuidOfFedPatients.get(searchCriteriaValue)));
} else if (searchCriteriaName.equals("uuid")) {
this.searchCriteria.setSearchCriterion(createStringSearchCriterion(PatientSearchCriterionKey.UUID,
this.searchCriteria.addSearchCriterion(createStringSearchCriterion(PatientSearchCriterionKey.UUID,
getStringSearchCriterionOperator(searchCriteriaVerbText), searchCriteriaValue));
} else {
fail(String.format("Unsupported criteria %s", searchCriteriaName));
......
......@@ -275,13 +275,13 @@
<dependency>
<groupId>net.ihe.gazelle</groupId>
<artifactId>lib.search-model-api</artifactId>
<version>1.0.1</version>
<version>1.0.2-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>net.ihe.gazelle</groupId>
<artifactId>lib.search-jpa-dao</artifactId>
<version>1.0.1</version>
<version>1.0.2-SNAPSHOT</version>
</dependency>
<dependency>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment