@@ -0,0 +1,2450 @@
+/*%0A * Copyright 2016 Gustavo Pacheco.%0A *%0A * Licensed under the Apache License, Version 2.0 (the %22License%22);%0A * you may not use this file except in compliance with the License.%0A * You may obtain a copy of the License at%0A *%0A *      http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A * See the License for the specific language governing permissions and%0A * limitations under the License.%0A */%0Apackage co.edu.unicartagena.platf.rest.resources;%0A%0Aimport co.edu.unicartagena.platf.entity.Faculty;%0Aimport co.edu.unicartagena.platf.service.FacultyService;%0Aimport co.edu.unicartagena.platf.service.FacultyServiceImpl;%0Aimport java.net.URI;%0A%0Aimport java.util.List;%0A%0Aimport javax.ws.rs.Consumes;%0Aimport javax.ws.rs.DELETE;%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(%22faculties%22)%0A@Consumes(MediaType.APPLICATION_JSON)%0A@Produces(MediaType.APPLICATION_JSON)%0Apublic class FacultyResource %7B%0A    %0A    FacultyService service = FacultyServiceImpl.getInstance();%0A    %0A    @GET%0A    public List%3CFaculty%3E getAllFaculties() %7B%0A        return service.getAll();%0A    %7D%0A    %0A    @POST%0A    public Response addFaculty(Faculty faculty, @Context UriInfo uriInfo) %7B%0A        Faculty newFaculty = service.add(faculty);%0A        String newId = String.valueOf(newFaculty.getId());%0A        URI uri = uriInfo.getAbsolutePathBuilder().path(newId).build();%0A        return Response.created(uri)%0A                .entity(newFaculty)%0A                .build();%0A    %7D%0A    %0A    @PUT%0A    @Path(%22%7BfacultyId%7D%22)%0A    public Faculty updateFaculty(@PathParam(%22facultyId%22) Integer id, Faculty faculty) %7B%0A        return service.update(id, faculty);%0A    %7D%0A    %0A    @DELETE%0A    @Path(%22%7BfacultyId%7D%22)%0A    public Faculty removeFaculty(@PathParam(%22facultyId%22) Integer id) %7B%0A        return service.remove(id);%0A    %7D%0A    %0A    @GET%0A    @Path(%22%7BfacultyId%7D%22)%0A    public Faculty getFaculty(@PathParam(%22facultyId%22) Integer id) %7B%0A        return service.get(id);%0A    %7D%0A    %0A%7D%0A

Create resource of faculty