/*
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
 *  
 * Copyright 2010(Year date of delivery) United States Government, as represented by the Secretary of Health and Human Services.  All rights reserved.
 *  
 */
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package gov.hhs.fha.nhinc.mpi.adapter.component;

import gov.hhs.fha.nhinc.mpilib.Patients;

/**
 *
 * @author rayj
 */
public class CommonChecks {

    public static boolean isSingleSearchResult(Patients patients) {
        return ((patients != null) && (patients.size() == 1));
    }

    public static boolean isMultipleSearchResult(Patients patients) {
        return ((patients != null) && (patients.size() > 1));
    }

    public static boolean isZeroSearchResult(Patients patients) {
        return ((patients == null) || (patients.size() == 0));
    }

}

@@ -225,199 +225,213 @@
  */%0A
-/*%0A * To change this template, choose Tools %7C Templates%0A * and open the template in the editor.%0A */%0A%0Apackage gov.hhs.fha.nhinc.mpi.adapter.component;%0A%0Aimport gov.hhs.fha.nhinc.mpilib.Patients
+package gov.hhs.fha.nhinc.mpi.adapter.component;%0A%0Aimport gov.hhs.fha.nhinc.mpilib.Patients;%0Aimport gov.hhs.fha.nhinc.patientdb.model.*;%0Aimport java.util.HashMap;%0Aimport java.util.List;%0Aimport java.util.Map
 ;%0A%0A/
@@ -485,16 +485,39 @@
 ecks %7B%0A%0A
+    // MPI XML Checks%0A%0A
     publ
@@ -921,10 +921,898 @@
 %0A    %7D%0A%0A
+    // MPI DB Checks%0A%0A    public static boolean isSinglePerAASearchResult(List%3CPatient%3E patients) %7B%0A        boolean result = true;%0A%0A        Map testMap = new HashMap();%0A        if (patients != null) %7B%0A            for (Patient patient : patients) %7B%0A                if (patient.getIdentifiers() != null &&%0A                        patient.getIdentifiers().size() %3E 0 &&%0A                        patient.getIdentifiers().get(0) != null) %7B%0A                    String orgId = patient.getIdentifiers().get(0).getOrganizationId();%0A                    if (testMap.containsKey(orgId)) %7B%0A                        result = false;%0A                        break;%0A                    %7D%0A                %7D%0A            %7D%0A        %7D%0A%0A        return result;%0A    %7D%0A%0A    public static boolean isZeroPerAASearchResult(List%3CPatient%3E patients) %7B%0A        return ((patients == null) %7C%7C (patients.size() == 0));%0A    %7D%0A%0A
 %7D%0A

CONNECT MPI Adapter - DB implementation - implemented MPI DB Checks