Package org.encuestame.persistence.domain.survey

Examples of org.encuestame.persistence.domain.survey.SurveySection


        try {
            if (sectionId == null) {
                log.debug("survey section id is missing");
            } else {
                final SurveySection section = getSurveyService()
                        .retrieveSurveySectionById(sectionId);
                final QuestionPattern questionPattern = QuestionPattern
                        .getQuestionPattern(pattern);
                final UserAccount account = getUserAccount();
                final Question questionAdded = getSurveyService().addQuestionToSurveySection(question,
View Full Code Here


   */
  @Test
  public void testAddQuestionToSurveySection() throws ServletException,
      IOException {
    Assert.assertNotNull(survey);
    final SurveySection section1 = createDefaultSection("SurveySection 2",
        this.survey);
    final String question = "What is your marital status?";
    // Search All surveys.
    initService("/api/survey/addquestion.json", MethodJson.GET);
    setParameter("ssid", section1.getSsid().toString());
    setParameter("pattern", QuestionPattern.MULTIPLE_SELECTION.toString());
    setParameter("question", question);

    final JSONObject response = callJsonService();
    // assertSuccessResponse(response);
View Full Code Here

     * Create Survey Section.
     * @param surveySectionBean
     */
  public SurveySection createSurveySection(
      final UnitSurveySection surveySectionBean, final Survey survey) {
    SurveySection surveySectionDomain = new SurveySection();
    
      surveySectionDomain = this
          .newSurveySection(surveySectionBean, survey);
    return surveySectionDomain;
  }
View Full Code Here

     * @param sectionBean
     * @param survey
     * @return
     */
    private SurveySection newSurveySection(final UnitSurveySection sectionBean, final Survey survey){
      final SurveySection surveySection = new SurveySection();
    surveySection.setDescSection(sectionBean.getDescription());
    surveySection.setSectionName(sectionBean.getName());
    surveySection.setSurvey(survey);
    getSurveyDaoImp().saveOrUpdate(surveySection);
      return surveySection;
     
    }
View Full Code Here

   * (non-Javadoc)
   * @see org.encuestame.core.service.imp.ISurveyService#retrieveSurveySectionById(java.lang.Long)
   */
  public SurveySection retrieveSurveySectionById(final Long sectionId)
      throws EnMeSurveyNotFoundException {
    final SurveySection section = getSurveyDaoImp()
        .retrieveSurveySectionById(sectionId);
    if (section == null) {
      throw new EnMeSurveyNotFoundException(
          "Section not found with this id: " + sectionId);
    } else {
View Full Code Here

     * @param descSection
     * @return
     */
    public SurveySection createSurveySection(
            final String descSection){
        final SurveySection surveySection = new SurveySection();
        surveySection.setDescSection(descSection);
      /*  surveySection.getQuestionSection().add(createDefaultQuestion("Why is your favourite movie"));
        surveySection.getQuestionSection().add(createDefaultQuestion("Where do you live"));
        surveySection.getQuestionSection().add(createDefaultQuestion("What do you do at home"));*/
        getSurveyDaoImp().saveOrUpdate(surveySection);
        return surveySection;
View Full Code Here

     * @param name
     * @param survey
     * @return
     */
    public SurveySection createDefaultSection(final String name, final Survey survey){
        final SurveySection surveySection = new SurveySection();
        surveySection.setDescSection(name);
        surveySection.setSurvey(survey);
        surveySection.setSectionName(name);
        getSurveyDaoImp().saveOrUpdate(surveySection);
        return surveySection;
    }
View Full Code Here

  @Test
  public void testAddQuestionToSurveySection() throws EnMeExpcetion,
      NoSuchAlgorithmException, UnsupportedEncodingException {
    final String questionName = "What is your favorite superhero?";
    final Survey defaultSurvey = createDefaultSurvey(this.user);
    final SurveySection defaultSection = createDefaultSection("Comics",
        defaultSurvey);

    final Question questionAdded = surveyService
        .addQuestionToSurveySection(questionName, userSecondary,
            defaultSection, QuestionPattern.MULTIPLE_SELECTION,
            null);

    assertEquals("should be equals", defaultSection.getSsid(),
        questionAdded.getSection().getSsid());
  }
View Full Code Here

    /**
     * Test Retrieve Survey Section by Id.
     */
    @Test
    public void testRetrieveSurveySectionById(){
        final SurveySection section = getSurveyDaoImp().retrieveSurveySectionById(surveySection.getSsid());
        assertEquals("Should be equals", "My Section", section.getDescSection());
    }
View Full Code Here

    @SuppressWarnings("unchecked")
   // @Test
    public void testRetrieveSectionByPagination(){
         this.surveyPag = createSurveyPagination(1, surveySection,this.survey);
         final SurveySection s2 = createSurveySection("Second Section");
         createSurveyPagination(1, s2, this.survey);
         //log.debug(surveyPag.getPageNumber());
         //log.debug(surveyPag.getSurveySection().getSsid());
         //log.debug(surveyPag.getSurveySection().getDescSection());
         //log.debug(surveyPag.getSurvey().getName());
View Full Code Here

TOP

Related Classes of org.encuestame.persistence.domain.survey.SurveySection

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.