/*
 * Copyright 2016 Gustavo Pacheco.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package co.edu.unicartagena.platf.rest.resources;

import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;

/**
 *
 * @author Gustavo Pacheco <ryctabo@gmail.com>
 * @version 1.0-SNAPSHOT
 */
@Path("users")
public class UserResource {
    
    @GET
    @Produces(MediaType.TEXT_PLAIN)
    public String test() {
        return "Hello Wolrd!";
    }
    
    @Path("login")
    public AuthenticateResource getAuthenticate() {
        return new AuthenticateResource();
    }
    
}

@@ -656,347 +656,2271 @@
 ort 
-javax.ws.rs.GET;%0Aimport javax.ws.rs.Path;%0Aimport javax.ws.rs.Produces;%0Aimport javax.ws.rs.core.MediaType;%0A%0A/**%0A *%0A * @author Gustavo Pacheco %3Cryctabo@gmail.com%3E%0A * @version 1.0-SNAPSHOT%0A */%0A@Path(%22users%22)%0Apublic class UserResource %7B%0A    %0A    @GET%0A    @Produces(MediaType.TEXT_PLAIN)%0A    public String test() %7B%0A        return %22Hello Wolrd!%22
+co.edu.unicartagena.platf.entity.Person;%0Aimport co.edu.unicartagena.platf.entity.User;%0Aimport co.edu.unicartagena.platf.service.UserService;%0Aimport co.edu.unicartagena.platf.service.UserServiceImpl;%0Aimport java.net.URI;%0Aimport java.util.ArrayList;%0Aimport java.util.List;%0Aimport javax.ws.rs.Consumes;%0Aimport javax.ws.rs.DELETE;%0A%0Aimport javax.ws.rs.GET;%0Aimport javax.ws.rs.POST;%0Aimport javax.ws.rs.PUT;%0Aimport javax.ws.rs.Path;%0Aimport javax.ws.rs.PathParam;%0Aimport javax.ws.rs.Produces;%0Aimport javax.ws.rs.core.Context;%0Aimport javax.ws.rs.core.MediaType;%0Aimport javax.ws.rs.core.Response;%0Aimport javax.ws.rs.core.UriInfo;%0A%0A/**%0A *%0A * @author Gustavo Pacheco %3Cryctabo@gmail.com%3E%0A * @version 1.0-SNAPSHOT%0A */%0A@Path(%22users%22)%0A@Consumes(MediaType.APPLICATION_JSON)%0A    @Produces(MediaType.APPLICATION_JSON)%0Apublic class UserResource %7B%0A    %0A    UserService service = UserServiceImpl.getInstance();%0A    %0A    @GET%0A    public List%3CPerson%3E getAllUsers() %7B%0A        final List%3CPerson%3E people = new ArrayList%3C%3E();%0A        for (User user : service.getAll()) %7B%0A            if (user instanceof Person) %7B%0A                people.add((Person) user);%0A            %7D%0A        %7D%0A        return people;%0A    %7D%0A    %0A    @POST%0A    public Response addUser(Person userPerson, @Context UriInfo uriInfo) %7B%0A        Person newUserPerson = (Person) service.add(userPerson);%0A        String username = newUserPerson.getUsername();%0A        URI uri = uriInfo.getAbsolutePathBuilder().path(username).build();%0A        return Response.created(uri)%0A                .entity(newUserPerson)%0A                .build();%0A    %7D%0A    %0A    @PUT%0A    @Path(%22%7BuserId%7D%22)%0A    public Person updateUser(@PathParam(%22userId%22) Integer userId, Person person) %7B%0A        return (Person) service.update(userId, person);%0A    %7D%0A    %0A    @DELETE%0A    @Path(%22%7BuserId%7D%22)%0A    public User deleteUser(@PathParam(%22userId%22) Integer userId) %7B%0A        return service.remove(userId);%0A    %7D%0A    %0A    @GET%0A    @Path(%22%7Busername%7D%22)%0A    public Response getUserByUsername(@PathParam(%22username%22) String username) %7B%0A        User user = service.findByUsernameOrEmail(username);%0A        if (user instanceof Person) %7B%0A            Person person = (Person) user;%0A            return Response.ok(person).build();%0A        %7D%0A        return Response.ok(user).build()
 ;%0A  

Implement user resource