Biblioteca Java - Blame information for rev 30

Subversion Repositories:
Rev:
Rev Author Line No. Line
30 mihai 1 package com.linkscreens.userprofile.webservice;
2  
3 import net.vz.mongodb.jackson.JacksonDBCollection;
4 import net.vz.mongodb.jackson.WriteResult;
5  
6 import javax.ws.rs.*;
7 import javax.ws.rs.core.MediaType;
8  
9 import com.linkscreens.userprofile.UserProfileServer;
10 import com.linkscreens.userprofile.entity.UserProfile;
11  
12 import java.util.List;
13  
14 @Path("/")
15 public class UserProfileResource {
16  
17     private JacksonDBCollection<UserProfile, String> getJacksonDBCollection() {
18         return JacksonDBCollection.wrap(UserProfileServer.mongoDB.getCollection(UserProfile.class.getSimpleName().toLowerCase()), UserProfile.class, String.class);
19     }
20  
21     @Path("profile")
22     @POST
23     @Consumes(MediaType.APPLICATION_JSON)
24     @Produces(MediaType.APPLICATION_JSON)
25     public UserProfile addProfile(UserProfile bar) {
26         WriteResult<UserProfile, String> result = getJacksonDBCollection().insert(bar);
27         return result.getSavedObject();
28     }
29  
30     @Path("profile")
31     @GET
32     @Produces(MediaType.APPLICATION_JSON)
33     public List<UserProfile> getAllProfiles() {
34         return getJacksonDBCollection().find().toArray();
35     }
36  
37  
38  
39  
40  
41  
42  
43 }