Package ke.go.moh.oec.reception.data

Examples of ke.go.moh.oec.reception.data.RequestResult


        return session;
    }

    public SearchProcessResult findHouseholdMembers(PersonWrapper searchPersonWrapper) {
        List<Person> householdMemberList = new ArrayList<Person>();
        RequestResult kisumuHdssRequestResult = new RequestResult();
        PersonRequest personRequest = new PersonRequest();
        personRequest.setRequestReference(session.getReference());
        personRequest.setPerson(searchPersonWrapper.unwrap());
        RequestDispatcher.dispatch(personRequest, kisumuHdssRequestResult,
                RequestDispatcher.DispatchType.FIND, Server.KISUMU_HDSS);
        if (kisumuHdssRequestResult.isSuccessful()) {
            List<Person> searchPersonList = (List<Person>) kisumuHdssRequestResult.getData();
            if (!searchPersonList.isEmpty()) {
                Person searchPerson = searchPersonList.get(0);
                for (RelatedPerson relatedPerson : searchPerson.getHouseholdMembers()) {
                    householdMemberList.add(relatedPerson.getPerson());
                }
View Full Code Here


            session.setRejectedLPICandidateList(null);
        }
        List<Person> mpiPersonList = null;
        List<Person> lpiPersonList = null;
        session.setSearchPersonWrapper(searchPersonWrapper);
        RequestResult mpiRequestResult = session.getMpiRequestResult();
        RequestResult lpiRequestResult = session.getLpiRequestResult();
        RequestDispatcher.dispatch(createPersonRequest(searchPersonWrapper),
                mpiRequestResult, lpiRequestResult, RequestDispatcher.DispatchType.FIND, targetServer);
        if (mpiRequestResult.isSuccessful()
                && lpiRequestResult.isSuccessful()) {
            mpiPersonList = (List<Person>) mpiRequestResult.getData();
            lpiPersonList = (List<Person>) lpiRequestResult.getData();

            if (!lastResort || (lastResort && targetServer == Server.MPI_LPI)) {
                if (checkForLinkedCandidates(lpiPersonList)) {
                    return new SearchProcessResult(SearchProcessResult.Type.LIST, new SearchServerResponse(Server.LPI, removeRejectedLpiCandidates(lpiPersonList)));
                } else {
                    if (checkForFingerprintCandidates(mpiPersonList)) {
                        return new SearchProcessResult(SearchProcessResult.Type.LIST, new SearchServerResponse(Server.MPI, removeRejectedMpiCandidates(mpiPersonList)));
                    } else {
                        if (!minimumSearchFingerprintsTaken()) {
                            return new SearchProcessResult(SearchProcessResult.Type.NEXT_FINGERPRINT, null);
                        } else {
                            if (!session.getAnyUnsentFingerprints().isEmpty()) {
                                for (ImagedFingerprint imagedFingerprint : session.getAnyUnsentFingerprints()) {
                                    session.setActiveImagedFingerprint(imagedFingerprint);
                                    searchPersonWrapper.addFingerprint(imagedFingerprint);
                                    break;
                                }
                                return findPerson(Server.MPI_LPI, searchPersonWrapper);
                            } else {
                                if (!removeRejectedLpiCandidates(lpiPersonList).isEmpty()) {
                                    return new SearchProcessResult(SearchProcessResult.Type.LIST, new SearchServerResponse(Server.LPI, lpiPersonList));
                                } else {
                                    if (!removeRejectedMpiCandidates(mpiPersonList).isEmpty()) {
                                        return new SearchProcessResult(SearchProcessResult.Type.LIST, new SearchServerResponse(Server.MPI, mpiPersonList));
                                    } else {
                                        return new SearchProcessResult(SearchProcessResult.Type.EXIT, null);
                                    }
                                }
                            }
                        }
                    }
                }
            } else if (lastResort && targetServer == Server.MPI) {
                if (!removeRejectedMpiCandidates(mpiPersonList).isEmpty()) {
                    return new SearchProcessResult(SearchProcessResult.Type.LIST, new SearchServerResponse(Server.MPI, mpiPersonList));
                } else {
                    return new SearchProcessResult(SearchProcessResult.Type.EXIT, null);
                }
            } else if (lastResort && targetServer == Server.LPI) {
                if (!removeRejectedLpiCandidates(lpiPersonList).isEmpty()) {
                    return new SearchProcessResult(SearchProcessResult.Type.LIST, new SearchServerResponse(Server.LPI, lpiPersonList));
                } else {
                    return new SearchProcessResult(SearchProcessResult.Type.EXIT, null);
                }
            } else {
                //this is not expected to happen
                Mediator.getLogger(MainViewHelper.class.getName()).log(Level.SEVERE, "Illogical condition occured in findPerson() at line 195.");
                return new SearchProcessResult(SearchProcessResult.Type.EXIT, null);
            }

        } else {
            //only offer retry for non-last resort searches
            if (!lastResort) {
                if (!mpiRequestResult.isSuccessful()
                        && !lpiRequestResult.isSuccessful()) {
                    if (mainView.showConfirmMessage("Both the Master and the Local Person Indices could not be contacted. "
                            + "Would you like to try contacting them again?", ((MainView) mainView).getFrame())) {
                        return findPerson(Server.MPI_LPI, searchPersonWrapper);
                    }
                } else {
                    if (!mpiRequestResult.isSuccessful()
                            && lpiRequestResult.isSuccessful()) {
                        lpiPersonList = (List<Person>) lpiRequestResult.getData();
                        if (mainView.showConfirmMessage("The Master Person Index could not be contacted. "
                                + "Would you like to try contacting it again?", ((MainView) mainView).getFrame())) {
                            return findPerson(Server.MPI, searchPersonWrapper);
                        }
                        if (!removeRejectedLpiCandidates(lpiPersonList).isEmpty()) {
                            return new SearchProcessResult(SearchProcessResult.Type.LIST, new SearchServerResponse(Server.LPI, lpiPersonList));
                        } else {
                            return new SearchProcessResult(SearchProcessResult.Type.EXIT, null);
                        }
                    } else if (!lpiRequestResult.isSuccessful()
                            && mpiRequestResult.isSuccessful()) {
                        mpiPersonList = (List<Person>) mpiRequestResult.getData();
                        if (mainView.showConfirmMessage("The Local Person Index could not be contacted. "
                                + "Would you like to try contacting it again?", ((MainView) mainView).getFrame())) {
                            return findPerson(Server.LPI, searchPersonWrapper);
View Full Code Here

TOP

Related Classes of ke.go.moh.oec.reception.data.RequestResult

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.