use of org.openehealth.ipf.commons.ihe.xds.core.requests.query.FindSubmissionSetsQuery in project ipf by oehf.
the class FindSubmissionSetsQueryTransformerTest method testFromEbXMLNull.
@Test
public void testFromEbXMLNull() {
var result = new FindSubmissionSetsQuery();
transformer.fromEbXML(result, null);
assertEquals(new FindSubmissionSetsQuery(), result);
}
use of org.openehealth.ipf.commons.ihe.xds.core.requests.query.FindSubmissionSetsQuery in project ipf by oehf.
the class FindSubmissionSetsQueryTransformerTest method setUp.
@BeforeEach
public void setUp() {
transformer = new FindSubmissionSetsQueryTransformer();
query = new FindSubmissionSetsQuery();
query.setPatientId(new Identifiable("id1", new AssigningAuthority("uni1", "uniType1")));
query.setContentTypeCodes(Arrays.asList(new Code("code1", null, "system1"), new Code("code2", null, "system2")));
query.getSubmissionTime().setFrom("20150102030405");
query.getSubmissionTime().setTo("20150102030406");
query.setAuthorPerson("per'son1");
query.setStatus(Arrays.asList(AvailabilityStatus.APPROVED, AvailabilityStatus.SUBMITTED));
query.setHomeCommunityId("12.21.41");
ebXML = new EbXMLFactory30().createAdhocQueryRequest();
}
use of org.openehealth.ipf.commons.ihe.xds.core.requests.query.FindSubmissionSetsQuery in project MobileAccessGateway by i4mi.
the class Iti66RequestConverter method searchParameterIti66ToFindSubmissionSetsQuery.
/**
* convert ITI-66 request to ITI-18 request
* @param searchParameter
* @return
*/
public QueryRegistry searchParameterIti66ToFindSubmissionSetsQuery(@Body Iti66SearchParameters searchParameter) {
boolean getLeafClass = true;
Query searchQuery = null;
if (searchParameter.getIdentifier() != null || searchParameter.get_id() != null) {
final GetSubmissionSetAndContentsQuery query = new GetSubmissionSetAndContentsQuery();
if (searchParameter.getIdentifier() != null) {
String val = searchParameter.getIdentifier().getValue();
if (val.startsWith("urn:oid:")) {
query.setUniqueId(val.substring("urn:oid:".length()));
} else if (val.startsWith("urn:uuid:")) {
query.setUuid(val.substring("urn:uuid:".length()));
}
} else {
query.setUuid(searchParameter.get_id().getValue());
}
searchQuery = query;
} else {
final FindSubmissionSetsQuery query = new FindSubmissionSetsQuery();
if (searchParameter.getCode() != null && !searchParameter.getCode().getValue().equals("submissionset")) {
throw new InvalidRequestException("Only search for submissionsets supported.");
}
// patient or patient.identifier -> $XDSSubmissionSetPatientId
TokenParam tokenIdentifier = searchParameter.getPatientIdentifier();
if (tokenIdentifier != null) {
String system = getScheme(tokenIdentifier.getSystem());
if (system == null)
throw new InvalidRequestException("Missing OID for patient");
/*if (system.startsWith("urn:oid:")) {
system = system.substring(8);
}*/
query.setPatientId(new Identifiable(tokenIdentifier.getValue(), new AssigningAuthority(system)));
}
ReferenceParam patientRef = searchParameter.getPatientReference();
if (patientRef != null) {
Identifiable id = transformReference(patientRef.getValue());
query.setPatientId(id);
}
// created Note 1 -> $XDSSubmissionSetSubmissionTimeFrom
// created Note 2 -> $XDSSubmissionSetSubmissionTimeTo
DateRangeParam createdRange = searchParameter.getDate();
if (createdRange != null) {
DateParam creationTimeFrom = createdRange.getLowerBound();
DateParam creationTimeTo = createdRange.getUpperBound();
query.getSubmissionTime().setFrom(timestampFromDateParam(creationTimeFrom));
query.getSubmissionTime().setTo(timestampFromDateParam(creationTimeTo));
}
// TODO author.given / author.family -> $XDSSubmissionSetAuthorPerson
StringParam authorGivenName = searchParameter.getSourceGiven();
StringParam authorFamilyName = searchParameter.getSourceFamily();
if (authorGivenName != null || authorFamilyName != null) {
String author = (authorGivenName != null ? authorGivenName.getValue() : "%") + " " + (authorFamilyName != null ? authorFamilyName.getValue() : "%");
query.setAuthorPerson(author);
}
// type -> $XDSSubmissionSetContentType
TokenOrListParam types = searchParameter.getDesignationType();
query.setContentTypeCodes(codesFromTokens(types));
// source -> $XDSSubmissionSetSourceId
TokenOrListParam sources = searchParameter.getSourceId();
query.setSourceIds(urisFromTokens(sources));
// status -> $XDSSubmissionSetStatus
TokenOrListParam status = searchParameter.getStatus();
if (status != null) {
List<AvailabilityStatus> availabilites = new ArrayList<AvailabilityStatus>();
for (TokenParam statusToken : status.getValuesAsQueryTokens()) {
String tokenValue = statusToken.getValue();
if (tokenValue.equals("current"))
availabilites.add(AvailabilityStatus.APPROVED);
else if (tokenValue.equals("superseded"))
availabilites.add(AvailabilityStatus.DEPRECATED);
}
query.setStatus(availabilites);
}
searchQuery = query;
}
final QueryRegistry queryRegistry = new QueryRegistry(searchQuery);
queryRegistry.setReturnType((getLeafClass) ? QueryReturnType.LEAF_CLASS : QueryReturnType.OBJECT_REF);
return queryRegistry;
}
use of org.openehealth.ipf.commons.ihe.xds.core.requests.query.FindSubmissionSetsQuery in project ipf by oehf.
the class FindSubmissionSetsQueryTransformerTest method testToEbXMLEmpty.
@Test
public void testToEbXMLEmpty() {
transformer.toEbXML(new FindSubmissionSetsQuery(), ebXML);
assertEquals(0, ebXML.getSlots().size());
}
use of org.openehealth.ipf.commons.ihe.xds.core.requests.query.FindSubmissionSetsQuery in project ipf by oehf.
the class FindSubmissionSetsQueryTransformerTest method testFromEbXMLEmpty.
@Test
public void testFromEbXMLEmpty() {
var result = new FindSubmissionSetsQuery();
transformer.fromEbXML(result, ebXML);
assertEquals(new FindSubmissionSetsQuery(), result);
}
Aggregations