Package org.encuestame.persistence.domain.survey

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


        List<UnitSurveySection> surveySections = new ArrayList<UnitSurveySection>();
        try {
            if (surveyId == null) {
                log.debug("survey id is missing");
            } else {
                final Survey survey = getSurveyService().getSurveyById(surveyId);
                surveySections = getSurveyService().retrieveSectionsBySurvey(survey);
            }

            jsonResponse.put("sections", surveySections);
            setItemResponse(jsonResponse);
View Full Code Here


        try {
            if (surveyId == null)  {
                log.debug("survey section id is missing");
            } else {

                final Survey survey = getSurveyService()
                        .getSurveyById(surveyId);
                final QuestionAnswer qAnswer = getSurveyService()
                        .getQuestionAnswerById(qanswer);
                final Question question = getSurveyService().getQuestionById(
                        questionId);
View Full Code Here

        Assert.assertEquals(array4.size(), 1);

         //LASTWEEK
        final Calendar lastWeek = Calendar.getInstance();
        lastWeek.add(Calendar.DATE, -8);
        final Survey lastweetkSurvey = createSurvey(null, new Date(),
                new Date(), userAccount.getAccount(), lastWeek.getTime(),
                this.format, "My Survey", lastWeek.getTime());

        lastweetkSurvey.setEditorOwner(userAccount);
        getSurveyDaoImp().saveOrUpdate(lastweetkSurvey);

        initService("/api/survey/search.json", MethodJson.GET);
        setParameter("typeSearch", "LASTWEEK");
        setParameter("max", "100");
View Full Code Here

        /* Poll **/
        final Poll myPoll = createPoll(creationDate, question, userAcc, Boolean.TRUE, Boolean.TRUE);

        /* Survey **/
        final Survey mySurvey = createDefaultSurvey(userAcc.getAccount(), "My First Encuestame Survey", creationDate);

        // 2- Add HashTag to TweetPoll, Poll or Survey
        myTweetPoll.getHashTags().add(hashtag1);
        getTweetPoll().saveOrUpdate(myTweetPoll);

        myPoll.getHashTags().add(hashtag1);
        getPollDao().saveOrUpdate(myPoll);

        mySurvey.getHashTags().add(hashtag1);
        getSurveyDaoImp().saveOrUpdate(mySurvey);

        // 3- Create TweetPollSavedPublishedStatus -- Create Social network link.

        //Total Usage by Social Networks
View Full Code Here

             comments.addAll(this.getCommentsbyTweetPoll(tweetPoll, max, start));
        } else if (searchResult.equals(TypeSearchResult.POLL)) {
            final Poll poll = getPollService().getPollById(itemId);
            comments.addAll(getCommentsOperations().getCommentsbPoll(poll, max, start));
        } else if (searchResult.equals(TypeSearchResult.SURVEY)) {
            final Survey survey = null;
            //TODO:
        } else {
            throw new EnMeExpcetion("invalid type");
        }
        return comments;
View Full Code Here

        request, null);
    final String sectionDescDefault = getMessage(
        "survey.section.name.description.default", request, null);

    // 1- Create survey with possible options
    final Survey surveyDomain = this.newSurvey(surveyBean);
    if (surveyDomain != null) {
      final UnitSurveySection sectionBean = this
          .createDefaultSurveySection(sectionNameDefault, sectionDescDefault, surveyDomain);
      this.newSurveySection(sectionBean, surveyDomain);
      // 2- Create a section by default
    }
    if (surveyBean.getHashTags().size() > 0) {
      surveyDomain.getHashTags().addAll(
          retrieveListOfHashTags(surveyBean.getHashTags()));
      log.debug("Update Hash Tag");
      getSurveyDaoImp().saveOrUpdate(surveyDomain);
    }
    return surveyDomain;
View Full Code Here

    /*
     * (non-Javadoc)
     * @see org.encuestame.core.service.imp.ISurveyService#newSurvey(org.encuestame.utils.web.SurveyBean)
     */
    private Survey newSurvey(final SurveyBean surveyBean){
         final Survey surveyDomain = new Survey();
            surveyDomain.setTicket(surveyBean.getTicket());
            surveyDomain.setStartDate(surveyBean.getStartDate());
            surveyDomain.setEndDate(surveyBean.getEndDate());
            surveyDomain.setDateInterview(surveyBean.getDateInterview());
            surveyDomain.setComplete(surveyBean.getComplete());
            surveyDomain.setCustomMessage(surveyBean.getCustomMessage());
            surveyDomain.setCustomStartMessages(surveyBean.getCustomStartMessages());
            surveyDomain.setShowProgressBar(surveyBean.getShowProgressBar());
            surveyDomain.setOptionalTitle(surveyBean.getOptionalTitle());
            surveyDomain.setPassProtection(surveyBean.getPassProtection());
            surveyDomain.setIpProtection(surveyBean.getIpProtection());
            surveyDomain.setIpRestriction(surveyBean.getIpRestriction());
            surveyDomain.setPasswordRestrictions(surveyBean.getPasswordRestrictions());
            surveyDomain.setCloseAfterDate(surveyBean.getCloseAfterDate());
            surveyDomain.setCloseAfterquota(surveyBean.getCloseAfterquota());
            surveyDomain.setCloseAfterquota(surveyBean.getCloseAfterquota());
            surveyDomain.setClosedQuota(surveyBean.getClosedQuota());
            //surveyDomain.setShowResults(surveyBean.getShowResults());
            surveyDomain.setNumbervotes(surveyBean.getNumbervotes());
            surveyDomain.setHits(surveyBean.getHits());
            surveyDomain.setAdditionalInfo(surveyBean.getAdditionalInfo());
            surveyDomain.setShowAdditionalInfo(surveyBean.getShowAdditionalInfo());
            surveyDomain.setNotifications(surveyBean.getNotifications());
            surveyDomain.setName(surveyBean.getName());
            surveyDomain.setCreateDate(surveyBean.getCreatedAt());
            surveyDomain.setFavourites(surveyBean.getFavorites());
            try {
                surveyDomain.setOwner(getAccount(surveyBean.getOwnerUsername()));
                surveyDomain.setEditorOwner(getUserAccount(surveyBean.getOwnerUsername()));
            } catch (EnMeNoResultsFoundException e) {
                log.debug("Survey user not found");
            }

            getSurveyDaoImp().saveOrUpdate(surveyDomain);
View Full Code Here

     * @throws EnMeNoResultsFoundException
     */
    public void addSurveyToFolder(final Long folderId, final String username, final Long surveyId) throws EnMeNoResultsFoundException{
        final SurveyFolder surveyFolder = this.getSurveysFolderByFolderIdandUser(folderId, getUserAccountId(username));
        if(surveyFolder!=null) {
            final Survey survey = getSurveyDaoImp().getSurveyByIdandUserId(surveyId, getUserAccountId(username));
            survey.setSurveysfolder(surveyFolder);
            getSurveyDaoImp().saveOrUpdate(survey);
            } else {
            throw new EnMeNoResultsFoundException("Survey folder not found");
        }
   }
View Full Code Here

     * @param username
     * @return
     * @throws EnMeNoResultsFoundException
     */
    public Survey getSurvey(final Long surveyId, final String username) throws EnMeNoResultsFoundException {
        Survey survey = new Survey();
        if (username != null) {
            survey = getSurveyDaoImp()
                    .getSurveyByIdandUserId(surveyId, getUserAccountonSecurityContext().getAccount().getUid());
        } else {
View Full Code Here

                        ipAddress, rate);
            }
            // Survey Access rate item.
            if (type.equals(TypeSearchResult.SURVEY)) {
                // Find survey by itemId.
                final Survey survey = this.getSurvey(itemId);
                Assert.assertNotNull(survey);
                // Check if exist a previous survey access record.
                recordAccessRate = this.checkExistSurveyPreviousRecord(survey,
                        ipAddress, rate);
            }
View Full Code Here

TOP

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

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.