Search in sources :

Example 1 with IdentifiableType

use of org.openehealth.ipf.commons.ihe.xds.core.stub.ebrs30.rim.IdentifiableType in project MobileAccessGateway by i4mi.

the class Iti66ResponseBugfix method fixResponse.

/**
 * bugfix: add missing type classification to SubmissionSets in ITI-18 response
 * @param response
 * @return
 */
public AdhocQueryResponse fixResponse(@Body AdhocQueryResponse response) {
    RegistryObjectListType registryObjectList = response.getRegistryObjectList();
    if (registryObjectList != null) {
        var registryPackages = registryObjectList.getIdentifiable();
        if (registryPackages != null) {
            for (var possibleRegistryPackage : registryPackages) {
                IdentifiableType type = possibleRegistryPackage.getValue();
                if (type instanceof RegistryPackageType) {
                    RegistryPackageType registryPackageType = (RegistryPackageType) type;
                    boolean foundTypeClassification = false;
                    for (var classification : registryPackageType.getClassification()) {
                        if ("urn:uuid:a54d6aa5-d40d-43f9-88c5-b4633d873bdd".equals(classification.getClassificationNode()) || "urn:uuid:d9d542f3-6cc4-48b6-8870-ea235fbc94c2".equals(classification.getClassificationNode()))
                            foundTypeClassification = true;
                    }
                    // If not found add SubmissionSet classification
                    if (!foundTypeClassification) {
                        ClassificationType missing = new ClassificationType();
                        missing.setClassificationNode("urn:uuid:a54d6aa5-d40d-43f9-88c5-b4633d873bdd");
                        missing.setClassifiedObject(registryPackageType.getId());
                        registryPackageType.getClassification().add(missing);
                    }
                }
            }
        }
    }
    return response;
}
Also used : RegistryObjectListType(org.openehealth.ipf.commons.ihe.xds.core.stub.ebrs30.rim.RegistryObjectListType) IdentifiableType(org.openehealth.ipf.commons.ihe.xds.core.stub.ebrs30.rim.IdentifiableType) RegistryPackageType(org.openehealth.ipf.commons.ihe.xds.core.stub.ebrs30.rim.RegistryPackageType) ClassificationType(org.openehealth.ipf.commons.ihe.xds.core.stub.ebrs30.rim.ClassificationType)

Aggregations

ClassificationType (org.openehealth.ipf.commons.ihe.xds.core.stub.ebrs30.rim.ClassificationType)1 IdentifiableType (org.openehealth.ipf.commons.ihe.xds.core.stub.ebrs30.rim.IdentifiableType)1 RegistryObjectListType (org.openehealth.ipf.commons.ihe.xds.core.stub.ebrs30.rim.RegistryObjectListType)1 RegistryPackageType (org.openehealth.ipf.commons.ihe.xds.core.stub.ebrs30.rim.RegistryPackageType)1