Package hibernate

Examples of hibernate.Question


        int counter = 0;
       
       
        //this loop extracts all the questions from the list and creates a new QuestionJson for each.
        for (Iterator<Question> questionIterator = questionList.iterator(); questionIterator.hasNext();) {
              Question myQuestions = questionIterator.next();
             
              // This will find the group associationed with the question
              List<Group> group = myGroupTools.getTypeList(Table.Group, Column.id, myQuestions.getGroupId());
              String groupTitle = group.get(0).getGroupTitle();
             
              //for each question, create a new QuesitonJson via the QuesitonFactory
              QuestionDetailsJson questionJson = QuestionFactory.createQuestionDetailsJson(myQuestions, groupTitle);
             
View Full Code Here


                    ObjectRetrievalTools<Question> objTool2 = new ObjectRetrievalTools<Question>();
                    List<Question> questionList = objTool2.getObjectList(Table.Question, "groupId", groupId);
                   
                    //delete the questions from the db
                    for (Iterator<Question> questIterator = questionList.iterator(); questIterator.hasNext();) {
                      Question questionDelete = questIterator.next();
                      //get questionId for answer deletion
                      int questionId = questionDelete.getId();
                      myTools.dataRemoval(questionDelete);
                     
                      //get all the answers associated with the question id
                         ObjectRetrievalTools<Answer> objTool3 = new ObjectRetrievalTools<Answer>();
                         List<Answer> answerList = objTool3.getObjectList(Table.Answer, "questionId", questionId);
View Full Code Here

              //counter for question loop
              int counter = 0;
             
              //this loop extracts all the questions from the list and creates a new QuestionJson for each.
              for (Iterator<Question> questionIterator = questionList.iterator(); questionIterator.hasNext();) {
                   Question myQuestions = questionIterator.next();
                  
                   //for each question, create a new QuesitonJson via the QuesitonFactory
                   QuestionDetailsJson questionJson = QuestionFactory.createQuestionDetailsJson(myQuestions);
                  
                   //insert QuestionJson into the QuestionJson[] for return
View Full Code Here

   
  }
 
  @Test
  public void test01(){
    Question question = QuestionFactory.createQuestionMC(1, 1, "What is the meaning of life?");

    Question questionTest = new Question();
    questionTest.setGroupId(1);
    questionTest.setQuestionText("What is the meaning of life?");
   
    if (questionTest.getGroupId() == question.getGroupId()){
     
    }
    else{
      Assert.fail("Group id's do not match");
    }
   
    if (questionTest.getQuestionText().equals(question.getQuestionText())){
     
    }
    else{
      Assert.fail("Question text does not match");
    }
View Full Code Here

   */
  public static Question createQuestionMC(int userId, int groupId, String questionText){

    Date createDate = new Date();
   
    Question questionMC = new Question(questionText);
    questionMC.setUserId(userId);
    questionMC.setGroupId(groupId);
    questionMC.setQuestionTypeId(1);
    questionMC.setCreateDate(createDate);
   
    return questionMC;
  }
View Full Code Here

   */
  public static Question createQuestionTF(int userId, int groupId, String questionText){

    Date createDate = new Date();
   
    Question questionTF = new Question(questionText);
    questionTF.setUserId(userId);
    questionTF.setGroupId(groupId);
    questionTF.setQuestionTypeId(2);
    questionTF.setCreateDate(createDate);
   
    return questionTF;
  }
View Full Code Here

           
            //user is a part of the group
            else {
             
              //create question using factory
              Question questionObj = QuestionFactory.createQuestionMC(userId, groupId, question);
             
              //add question to the database
              int newQuestionID = myTools.dataEntry(questionObj);
       
              //set up answers
View Full Code Here

            }
           
            //user is part of the group
            else {
             
               Question questionObj = QuestionFactory.createQuestionTF(userId, groupId, question);
                   
                    //add question to the database
                    int newQuestionID = myTools.dataEntry(questionObj);

                    // The logic to decide whether the correct answer is "True" or "False"
View Full Code Here

             
              //set up retrieval tools
                 ObjectRetrievalTools<Question> objTool = new ObjectRetrievalTools<Question>();
                
                 //retrieve the Question
                 Question theQuestion = (Question)objTool.getObject(Table.Question, "id", questionId);
                 // Delete the question
              myQuestionTools.dataRemoval(theQuestion);
             
              // Now check that the question is correctly stored in the database
                questionFound = myTools.dataSearch("Question", "id", questionId);
View Full Code Here

TOP

Related Classes of hibernate.Question

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.