Package org.encuestame.persistence.domain.survey

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


                "What is your favourite season", "pattern");
        final Poll poll = createPoll(new Date(), question,
                getSpringSecurityLoggedUserAccount(), Boolean.TRUE,
                Boolean.TRUE);
        Assert.assertNotNull(poll);
        final PollFolder pfolder = createPollFolder("My Polls folder",
                getSpringSecurityLoggedUserAccount());
        poll.setPollFolder(pfolder);
        Assert.assertNotNull(pfolder);

        // Search Poll by folder.
View Full Code Here


     * @return
     * @throws EnMeNoResultsFoundException
     */

    public List<PollBean> searchPollsByFolder(final Long folderId, final String username) throws EnMeNoResultsFoundException{
        final PollFolder pollFolder = getPollDao().getPollFolderById(folderId);
        List<Poll> polls = new ArrayList<Poll>();
        if (pollFolder != null){
            polls = getPollDao().getPollsByPollFolderId(getUserAccount(getUserPrincipalUsername()), pollFolder);
        }
        log.info("search polls by folder size "+polls.size());
View Full Code Here

     * @return
     * @throws EnMeNoResultsFoundException
     */

    public FolderBean createPollFolder(final String folderName) throws EnMeNoResultsFoundException {
        final PollFolder pollFolder = new PollFolder();
        pollFolder.setCreatedBy(getUserAccount(getUserPrincipalUsername()));
        pollFolder.setCreatedAt(Calendar.getInstance().getTime());
        pollFolder.setFolderName(folderName);
        pollFolder.setUsers(getUserAccount(getUserPrincipalUsername()).getAccount());
        this.getPollDao().saveOrUpdate(pollFolder);
        return ConvertDomainBean.convertFolderToBeanFolder(pollFolder);
    }
View Full Code Here

     * @throws EnMeNoResultsFoundException exception
     */
    public FolderBean updateFolderName(final Long folderId,
            final String newFolderName,
            final String username) throws EnMeNoResultsFoundException{
        final PollFolder folder = this.getPollFolder(folderId);
        if(folder == null){
            throw new EnMeNoResultsFoundException("poll folder not found");
        } else {
            folder.setFolderName(newFolderName);
            getPollDao().saveOrUpdate(folder);
        }
        return ConvertDomainBean.convertFolderToBeanFolder(folder);
    }
View Full Code Here

     * Remove PollFolder.
     * @param folderId
     * @throws EnMeNoResultsFoundException
     */
    public void removePollFolder(final Long folderId) throws EnMeNoResultsFoundException{
        final PollFolder folder = this.getPollFolder(folderId);
        if(folder != null){
            getPollDao().delete(folder);
        } else {
            throw new EnMeNoResultsFoundException("poll folder not found");
        }
View Full Code Here

     * @throws EnMeNoResultsFoundException
     */

    public void addPollToFolder(final Long folderId, final Long pollId)
                                throws EnMeNoResultsFoundException{
        final PollFolder pfolder = this.getPollFolderByFolderIdandUser(folderId, getUserAccount(getUserPrincipalUsername()));
        if (pfolder != null) {
            final Poll poll = getPollDao().getPollById(pollId, getUserAccount(getUserPrincipalUsername()));
            if (poll == null){
                throw new EnMeNoResultsFoundException("TweetPoll not found");
             }
View Full Code Here

     * @param folderName folder name
     * @param users {@link Account}
     * @return {@link PollFolder}.
     */
    public PollFolder createPollFolder(final String folderName, final UserAccount users){
        final PollFolder folder = new PollFolder();
        folder.setCreatedAt(new Date());
        folder.setFolderName(folderName);
        folder.setUsers(users.getAccount());
        folder.setStatus(Status.ACTIVE);
        folder.setCreatedBy(users);
        getPollDao().saveOrUpdate(folder);
        return folder;
    }
View Full Code Here

     * @param pollId
     * @return
     * @throws EnMeNoResultsFoundException
     */
    public Poll addPollToFolder(final Long folderId, final UserAccount userAccount, final Long pollId) throws EnMeNoResultsFoundException{
        final PollFolder pfolder = getPollDao().getPollFolderById(folderId);
        final Poll poll = getPollDao().getPollById(pollId, userAccount);
        poll.setPollFolder(pfolder);
        getPollDao().saveOrUpdate(poll);
        return poll;
    }
View Full Code Here

     * @throws EnMeNoResultsFoundException exception
     */
    @Test
    public void testupdateFolderName() throws EnMeNoResultsFoundException{
        this.pollService.updateFolderName(this.folder.getId(), "newFolderName", this.userAccount.getUsername());
        final PollFolder folder = this.getPollDao().getPollFolderById(this.folder.getId());
        assertEquals(folder.getFolderName(), "newFolderName");
    }
View Full Code Here

     /** Test Poll. **/
     public void testPoll(){
         final Poll poll = new Poll();
         final Question question = createQuestion("Where do you live?", "");
         final UserAccount user = createUserAccount("diana", createAccount());
         final PollFolder pollFolder = createPollFolder("My polls", user);
         poll.setPollCompleted(null);
         poll.setCreateDate(Calendar.getInstance().getTime());
         poll.setEndDate(Calendar.getInstance().getTime());
         poll.setUpdatedDate(Calendar.getInstance().getTime());
         poll.setPollHash(RandomStringUtils.randomAlphanumeric(5));
View Full Code Here

TOP

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

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.