Examples of RequestResult


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

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

            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

Examples of org.neo4j.rest.graphdb.RequestResult

    private static void tryConnect() {
        int retryCount = 3;
        for (int i = 0; i < retryCount; i++) {
            try {
                RequestResult result = new ExecutingRestRequest(SERVER_ROOT_URI).get("");
                assertEquals(200, result.getStatus());
                System.err.println("Successful HTTP connection to "+SERVER_ROOT_URI);
                return;
            } catch (Exception e) {
                System.err.println("Error retrieving ROOT URI " + e.getMessage());
                try {
View Full Code Here

Examples of org.neo4j.rest.graphdb.RequestResult

        neoServer.stop();
    }

    @Test
    public void shouldInjectInterface() throws Exception {
        RequestResult requestResult = sendRequest( "testInterface" );

        Assert.assertEquals( 204, requestResult.getStatus() );
        Assert.assertEquals( 1, touched );
    }
View Full Code Here

Examples of org.neo4j.rest.graphdb.RequestResult

        Assert.assertEquals( 1, touched );
    }

    @Test
    public void shouldWorkWithThirdPartyJaxrs() throws Exception {
        RequestResult requestResult = sendRequest( "testNoContext" );

        Assert.assertEquals( 204, requestResult.getStatus() );
    }
View Full Code Here

Examples of org.neo4j.rest.graphdb.RequestResult

    private static void tryConnect() throws InterruptedException {
        int retryCount = 3;
        for (int i = 0; i < retryCount; i++) {
            try {
                RequestResult result = new ExecutingRestRequest(SERVER_ROOT_URI).get("");
                assertEquals(200, result.getStatus());
                System.err.println("Successful HTTP connection to "+SERVER_ROOT_URI);
                return;
            } catch (Exception e) {
                System.err.println("Error retrieving ROOT URI " + e.getMessage());
                Thread.sleep(500);
View Full Code Here

Examples of org.neo4j.rest.graphdb.RequestResult

    }

    @Test
    public void testGetFriends() throws IOException {
        Person person = persistedPerson("Michael", 35);
        final RequestResult requestResult = RequestResult.extractFrom(createRequest("ext/TestServerPlugin/graphdb/person").post(ClientResponse.class, "{\"name\":\"" + person.getName() + "\"}"));
        assertEquals(200, requestResult.getStatus());
        final String result = requestResult.getText();
        final Map data = (Map) new ObjectMapper().readValue(result, Object.class);
        assertEquals(person.getName(),((Map)data.get("data")).get("name"));

    }
View Full Code Here

Examples of org.neo4j.rest.graphdb.RequestResult

//    }

    public Map<Long, Object> executeBatchRequest() {
        stop();
        RestOperations operations = restRequest.getOperations();
        RequestResult response = restApi.batch(createBatchRequestData(operations));
        return convertRequestResultToEntities(operations, response);
    }
View Full Code Here

Examples of org.neo4j.rest.graphdb.RequestResult

        for (Map<String, Object> entry : responseCollection) {
            if (RestResultException.isExceptionResult(entry)) {
                throw new RestResultException(entry);
            }
            final Long batchId = getBatchId(entry);
            final RequestResult subResult = RequestResult.extractFrom(entry);
            RestOperations.RestOperation restOperation = operations.getOperation(batchId);
            Object entity = restOperation.getResultConverter().convertFromRepresentation(subResult);
            mappedObjects.put(batchId, entity);

        }
View Full Code Here

Examples of org.springframework.data.neo4j.rest.RequestResult

        neoServer.stop();
    }

    @Test
    public void shouldInjectInterface() throws Exception {
        RequestResult requestResult = sendRequest( "testInterface" );

        Assert.assertEquals( 204, requestResult.getStatus() );
        Assert.assertEquals( 1, touched );
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.