Package se.inera.ifv.casebox.core.entity

Examples of se.inera.ifv.casebox.core.entity.Answer


        careUnit = careGiverAndCareUnit.substring(careGiverAndCareUnit.lastIndexOf("#")+1, careGiverAndCareUnit.length());
      }

            log.debug("Received MedicalCertificateAnswer for care unit={}", careUnit);

      Answer answer = new Answer(careUnit, parameters.getAnswer());
      answerService.saveAnswer(answer);
     
     
      ResultOfCall value = new ResultOfCall();
      value.setResultCode(ResultCodeEnum.OK);
View Full Code Here


    @PersistenceContext
    EntityManager entityManager;

    @Test
    public void persist() throws Exception {
        Answer answer = new Answer("kalle", "Some serializable object");
        answerRepository.persist(answer);

        ITable result = getConnection().createQueryTable("ANSWER", "SELECT * FROM ANSWER");
        Assert.assertNotNull(result.getValue(0, "ID"));
        Assert.assertEquals("kalle", result.getValue(0, "CARE_UNIT"));
View Full Code Here

    }

    @Test
    public void testFindMaxNumberOfAnswers() throws Exception {
        for(int i = 0 ; i < 9 ; i++) {
            entityManager.persist(new Answer("careUnit1","Some content"));
        }
       
        entityManager.flush();
        entityManager.clear();
       
View Full Code Here

  

    @Test
    public void testOrder() throws Exception {
        for(int i = 0 ; i < 5 ; i++) {
            entityManager.persist(new Answer("careUnit1","Some content"));
        }
       
        entityManager.flush();
        entityManager.clear();
       
View Full Code Here

   
    @Test
    public void findByCareUnit() throws Exception {
        DatabaseOperation.CLEAN_INSERT.execute(getConnection(), getXmlDataSet("answer.xml"));

        Answer answer = new Answer("kalle", "Some serializable object");
        answerRepository.persist(answer);

        List<Answer> questions = answerRepository.findAllForCareUnit("kalle");
        Assert.assertEquals(1, questions.size());
    }
View Full Code Here

        Assert.assertEquals(1, questions.size());
    }

    @Test
    public void removeAnswer() throws Exception {
        Answer answer = new Answer("benny1", "Some serializable object");
        answer = answerRepository.persist(answer);
        answerRepository.remove(answer);

        entityManager.flush();
View Full Code Here

    @PersistenceContext
    EntityManager entityManager;

    @Test
    public void deleteAnswers() throws Exception {
        Answer answer = new Answer("careUnit", "Some serializable object");
        answerService.saveAnswer(answer);

        entityManager.flush();

        Set<Long> ids = new HashSet<Long>();
        ids.add(answer.getId());
        try {
            answerService.deleteAnswersForCareUnit("careUnit", ids);
            fail("Expected IllegalStateException");
        } catch (IllegalStateException e) {
            // Expected
View Full Code Here

        // TODO: How can we check that the transaction is marked for rolled back?
    }

    @Test
    public void checkStatistics() throws Exception {
        Answer answer = new Answer("careUnit", "Some serializable object");
        answer.setStatusRetrieved();
        answerService.saveAnswer(answer);

        Set<Long> ids = new HashSet<Long>();
        ids.add(answer.getId());
        answerService.deleteAnswersForCareUnit("careUnit", ids);

        entityManager.flush();

        ITable result = getConnection().createQueryTable("STATISTIC",
View Full Code Here

    @Test
    public void createStatisticsForSameDay() throws Exception {
       
        // Create first answer and delete it
        Answer answer = new Answer("careUnit", "Some serializable object");
        answer.setStatusRetrieved();
        answerService.saveAnswer(answer);

        Set<Long> ids = new HashSet<Long>();
        ids.add(answer.getId());

        // delete answers
        answerService.deleteAnswersForCareUnit("careUnit", ids);
        entityManager.flush();
       
        // create second answer and delete it
        answer = new Answer("careUnit", "Some serializable object");
        answer.setStatusRetrieved();
        answerService.saveAnswer(answer);
       
        ids = new HashSet<Long>();
        ids.add(answer.getId());
       
        answerService.deleteAnswersForCareUnit("careUnit", ids);
        entityManager.flush();

        // Check so that it only exist one statistics row for this careunit and day
View Full Code Here

        return new AnswersValue(answers, questionsLeft);
    }

    public Long saveAnswer(Answer answer) {
        Answer result = answerRepository.persist(answer);
        return result.getId();
    }
View Full Code Here

TOP

Related Classes of se.inera.ifv.casebox.core.entity.Answer

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.