Examples of FindAllQuestionsResponseType


Examples of se.inera.ifv.findallquestionsresponder.v1.FindAllQuestionsResponseType

    public void setQuestionService(QuestionService questionService) {
        this.questionService = questionService;
    }

    public FindAllQuestionsResponseType findAllQuestions(AttributedURIType address, FindAllQuestionsType parameters) {
        FindAllQuestionsResponseType response = new FindAllQuestionsResponseType();
        try {
            String careUnit = parameters.getCareUnitId().getExtension();
            log.debug("FindAllQuestions called for careunit:" + careUnit);
           
            QuestionsValue questionValue = questionService.getQuestionsForCareUnit(careUnit);

            response.setResult(new ResultOfCall());
            response.getResult().setResultCode(ResultCodeEnum.OK);
            response.setQuestionsLeft(questionValue.getQuestionsLeft());
            response.setQuestions(new QuestionsType());

            for (Question q : questionValue.getQuestions()) {
                QuestionFromFkType questionFromFk = (QuestionFromFkType) q.getMessage();
                QuestionType qt = new QuestionType();
                qt.setId(q.getId().toString());
                qt.setReceivedDate(q.getArrived());
                qt.setQuestion(questionFromFk);

                response.getQuestions().getQuestion().add(qt);

                q.setStatusRetrieved();
            }

            log.debug("FindAllQuestions found " + questionValue.getQuestions().size() " questions for careunit " + careUnit);

        } catch (Exception e) {
            log.warn("Failed to handle FindAllQuestions", e);
            response.setResult(new ResultOfCall());
            response.getResult().setResultCode(ResultCodeEnum.ERROR);
            response.getResult().setErrorText(e.getMessage());           
        }
        return response;
    }
View Full Code Here

Examples of se.inera.ifv.findallquestionsresponder.v1.FindAllQuestionsResponseType

            client.receive(logicalAddress);
        }
       
        assertEquals(26, simpleJdbcTemplate.queryForInt("SELECT COUNT(*) FROM QUESTION"));
       
        FindAllQuestionsResponseType resp = client.findAllQuestions(logicalAddress);
       
        assertEquals(10, resp.getQuestions().getQuestion().size());
        assertEquals(16, resp.getQuestionsLeft());

        client.deleteQuestions(logicalAddress, resp.getQuestions().getQuestion());

        assertEquals(16, simpleJdbcTemplate.queryForInt("SELECT COUNT(*) FROM QUESTION"));
      
        resp = client.findAllQuestions(logicalAddress);
       
        assertEquals(10, resp.getQuestions().getQuestion().size());
        assertEquals(6, resp.getQuestionsLeft());

        client.deleteQuestions(logicalAddress, resp.getQuestions().getQuestion());

        assertEquals(6, simpleJdbcTemplate.queryForInt("SELECT COUNT(*) FROM QUESTION"));

        resp = client.findAllQuestions(logicalAddress);
       
        assertEquals(6, resp.getQuestions().getQuestion().size());
        assertEquals(0, resp.getQuestionsLeft());

        client.deleteQuestions(logicalAddress, resp.getQuestions().getQuestion());
       
        assertEquals(0, simpleJdbcTemplate.queryForInt("SELECT COUNT(*) FROM QUESTION"));
    }
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.