Examples of ArticleDto


Examples of com.dream.dto.article.ArticleDTO

    @Override
    protected Object formBackingObject(HttpServletRequest request) throws Exception {
        String articleGuid = ServletRequestUtils.getStringParameter(request, "guid");
        if (ValidateUtil.isEmptyText(articleGuid)) {
            return new ArticleDTO();
        }
        return articleService.loadArticleByGuid(articleGuid);
    }
View Full Code Here

Examples of com.dream.dto.article.ArticleDTO

        return articleService.loadArticleByGuid(articleGuid);
    }

    @Override
    protected ModelAndView onSubmit(HttpServletRequest request, HttpServletResponse response, Object command, BindException errors) throws Exception {
        ArticleDTO articleDTO = (ArticleDTO) command;
        articleService.saveOrUpdate(articleDTO);
        return new ModelAndView("redirect:/article/overview");
    }
View Full Code Here

Examples of com.dream.dto.article.ArticleDTO

        return ArticleDTO.class.equals(clazz);
    }

    @Override
    public void validate(Object target, Errors errors) {
        ArticleDTO articleDTO = (ArticleDTO) target;

        String title = articleDTO.getTitle();
        if (ValidateUtil.isEmptyText(title)) {
            errors.rejectValue("title", null, "Title should not be empty!");
        }

        String content = articleDTO.getContent();
        if (ValidateUtil.isEmptyText(content)) {
            errors.rejectValue("content", null, "Content should not be empty!");
        }
    }
View Full Code Here

Examples of com.dream.dto.article.ArticleDTO

    private ArticleService articleService;

    @Override
    protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception {
        String articleGuid = ServletRequestUtils.getRequiredStringParameter(request, "guid");
        ArticleDTO articleDTO = articleService.loadArticleByGuid(articleGuid);
        return new ModelAndView("article/articleView", "articleDTO", articleDTO);
    }
View Full Code Here

Examples of com.dream.dto.article.ArticleDTO

    private ArticleDao articleDao;

    @Override
    public ArticleDTO loadArticleByGuid(String guid) {
        Article article = articleDao.findByGuid(Article.class, guid);
        return new ArticleDTO(article);
    }
View Full Code Here

Examples of models.ArticleDto

        sayNextSection("Posting new article (Json)");
       
        say("Posting a new article is a post request to " + POST_ARTICLE_URL);
        say("Please note that you have to be authenticated in order to be allowed to post.");
       
        ArticleDto articleDto = new ArticleDto();
        articleDto.content = "contentcontent";
        articleDto.title = "new title new title";

        response = sayAndMakeRequest(
                Request.POST().url(
View Full Code Here

Examples of models.ArticleDto

        sayNextSection("Posting new article (Json)");
       
        say("Posting a new article is a post request to " + POST_ARTICLE_URL);
        say("Please note that you have to be authenticated in order to be allowed to post.");
       
        ArticleDto articleDto = new ArticleDto();
        articleDto.content = "contentcontent";
        articleDto.title = "new title new title";

        response = sayAndMakeRequest(
                Request.POST().url(
View Full Code Here

Examples of models.ArticleDto

        sayNextSection("Posting new article (Json)");
       
        say("Posting a new article is a post request to " + POST_ARTICLE_URL);
        say("Please note that you have to be authenticated in order to be allowed to post.");
       
        ArticleDto articleDto = new ArticleDto();
        articleDto.content = "contentcontent";
        articleDto.title = "new title new title";

        apiResponse = makePostRequest(buildUri(POST_ARTICLE_URL.replace("{username}", USER)), articleDto);
        assertEqualsAndSay(403, apiResponse.httpStatus, "You have to be authenticated in order to post articles");
View Full Code Here

Examples of models.ArticleDto

        assertEquals(3, articlesDto.articles.size());

        // /////////////////////////////////////////////////////////////////////
        // Post new article:
        // /////////////////////////////////////////////////////////////////////
        ArticleDto articleDto = new ArticleDto();
        articleDto.content = "contentcontent";
        articleDto.title = "new title new title";

        response = ninjaTestBrowser.postJson(getServerAddress()
                + "api/bob@gmail.com/article.json", articleDto);
View Full Code Here

Examples of models.ArticleDto

        assertEquals(3, articlesDto.articles.size());

        // /////////////////////////////////////////////////////////////////////
        // Post new article:
        // /////////////////////////////////////////////////////////////////////
        ArticleDto articleDto = new ArticleDto();
        articleDto.content = "contentcontent";
        articleDto.title = "new title new title";

        response = ninjaTestBrowser.postXml(getServerAddress()
                + "api/bob@gmail.com/article.xml", articleDto);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.