@@ -0,0 +1,1907 @@
+package net.worldline.training.angular.ws.service;%0A%0A%0Aimport net.worldline.training.angular.data.user.RoleConsts;%0Aimport net.worldline.training.angular.entity.News;%0Aimport net.worldline.training.angular.services.NewsDAO;%0A%0Aimport org.apache.tapestry5.ioc.annotations.Inject;%0A%0Aimport javax.annotation.security.PermitAll;%0Aimport javax.annotation.security.RolesAllowed;%0Aimport javax.ws.rs.*;%0Aimport javax.ws.rs.core.Response;%0A%0Aimport java.util.List;%0A%0A@Path(%22/app%22)%0Apublic class NewsService %7B%0A%0A  %0A    @Inject%0A    NewsDAO newsDaoService;%0A%0A    @POST%0A    @Path(%22/news%22)%0A    @Consumes(%22application/json%22)%0A    @PermitAll%0A    //@RolesAllowed(RoleConsts.USER_ROLE)%0A    public Response postNews(News news) %7B%0A%0A        news.setLikes(0);%0A        newsDaoService.add(news);%0A        return Response.status(201).entity(news).build();%0A%0A    %7D%0A%0A%0A    @GET%0A    @Path(%22/news%22)%0A    @Consumes(%22application/json%22)%0A    @PermitAll%0A    public List%3CNews%3E getNews() %7B%0A%0A        List%3CNews%3E ret = newsDaoService.getNews();%0A        return ret;%0A%0A    %7D%0A%0A    @GET%0A    @Path(%22/news/%7Bid%7D%22)%0A    @Consumes(%22application/json%22)%0A    @PermitAll%0A    public News getNewsById(@PathParam(%22id%22)int id) %7B%0A%0A        News ret = newsDaoService.getNewsById(id);%0A        return ret;%0A%0A    %7D%0A    %0A    @GET%0A    @Path(%22/news/random%22)%0A    @Consumes(%22application/json%22)%0A    @PermitAll%0A    public News getRandomNews() %7B%0A%0A        News ret = newsDaoService.getRandomNews();%0A        return ret;%0A%0A    %7D%0A    %0A%0A    @GET%0A    @Path(%22/news/like/%7Bid%7D%22)%0A    @Consumes(%22application/json%22)%0A    @PermitAll%0A    public News incLike(@PathParam(%22id%22)int id) %7B%0A%0A        News ret = newsDaoService.incLike(id);%0A        return ret;%0A%0A    %7D%0A%0A%0A    @DELETE%0A    @Path(%22/news/%7Bid%7D%22)%0A    @Consumes(%22application/json%22)%0A    @PermitAll%0A    //@RolesAllowed(RoleConsts.ADMIN_ROLE)%0A    public News deleteComment(@PathParam(%22id%22)int id) %7B%0A%0A    %09News ret = newsDaoService.delete(id);%0A        return ret;%0A%0A    %7D%0A%0A%7D

Add News REST service