| |
---|
| | Voicememos voicememos = Voicememos.getInstance(); |
---|
| | Accounts accounts = Accounts.getInstance(); |
---|
| | |
---|
| | @GET |
---|
| | @Produces(MediaType.APPLICATION_JSON) |
---|
| | public String getVoicememos(@QueryParam("latmax") double latmax, @QueryParam("latmin") double latmin, @QueryParam("longmax") double longmax, @QueryParam("longmin") double longmin) { |
---|
| | String vidlist = ""; |
---|
| | // for (Voicememo v : |
---|
| | // voicememos) { |
---|
| | // String vid = v.getVid(); |
---|
| | // double latitude = v.getLatitude(); |
---|
| | // double longitude = v.getLongitude(); |
---|
| | // if (latmax > latitude && latitude > latmin && longmax > longitude && longmin > longitude) { |
---|
| | // vidlist = vidlist + vid; |
---|
| | // } |
---|
| | // } |
---|
| | for (Voicememo v : |
---|
| | voicememos.getVoicememos()) { |
---|
| | String vid = v.getVid(); |
---|
| | double latitude = v.getLatitude(); |
---|
| | double longitude = v.getLongitude(); |
---|
| | if (latmax > latitude && latitude > latmin && longmax > longitude && longmin > longitude) { |
---|
| | vidlist = vidlist + vid; |
---|
| | } |
---|
| | } |
---|
| | return vidlist; |
---|
| | } |
---|
| | |
---|
| | @POST |
---|
| | @Produces(MediaType.APPLICATION_JSON) |
---|
| | public String addVoicememos(@FormParam("token") String client_token, @FormParam("uid") String uid, @FormParam("time") int time, @FormParam("data") String data, @FormParam("latitude") double latitude, @FormParam("longitude") double longitude, @FormParam("title") String title, @FormParam("summary") String summary) { |
---|
| | String vid = ""; |
---|
| | Account account = accounts.getAccount(uid); |
---|
| | String server_token = account.getToken(); |
---|
| | if (client_token == server_token) { |
---|
| | UUID uuid = UUID.randomUUID(); |
---|
| | vid = uuid.toString(); |
---|
| | voicememos.createVoicememo(uid, time, data, latitude, longitude, title, summary); |
---|
| | if (client_token.equals(server_token)) { |
---|
| | Voicememo v = voicememos.createVoicememo(uid, time, data, latitude, longitude, title, summary); |
---|
| | String vid = v.getVid(); |
---|
| | return vid; |
---|
| | } |
---|
| | return null; |
---|
| | } |
---|
| | |
---|
| | @Path("/{vid}") |
---|
| | @GET |
---|
| | public String getVoicememo() { |
---|
| | String voicememo = ""; |
---|
| | return voicememo; |
---|
| | @Produces(MediaType.APPLICATION_JSON) |
---|
| | public Voicememo getVoicememo(@PathParam("vid") String vid, @QueryParam("token") String client_token, @QueryParam("uid") String uid, @QueryParam("time") int time) { |
---|
| | Account account = accounts.getAccount(uid); |
---|
| | String server_token = account.getToken(); |
---|
| | if (client_token.equals(server_token)) { |
---|
| | Voicememo voicememo = voicememos.getVoicememo(vid); |
---|
| | return voicememo; |
---|
| | } |
---|
| | return null; |
---|
| | } |
---|
| | |
---|
| | @Path("/{vid}") |
---|
| | @PUT |
---|
| | public void correctVicememo() { |
---|
| | @Produces(MediaType.APPLICATION_JSON) |
---|
| | public void correctVoicememo(@PathParam("vid") String vid, @FormParam("token") String client_token, @FormParam("uid") String uid, @FormParam("title") String title, @FormParam("summary") String summary) { |
---|
| | Account account = accounts.getAccount(uid); |
---|
| | String server_token = account.getToken(); |
---|
| | if (client_token.equals(server_token)) { |
---|
| | Voicememo v = voicememos.getVoicememo(vid); |
---|
| | v.setSummary(summary); |
---|
| | v.setTitle(title); |
---|
| | return; |
---|
| | } |
---|
| | |
---|
| | } |
---|
| | |
---|
| | @Path("/{vid}") |
---|
| | @DELETE |
---|
| | @Produces(MediaType.APPLICATION_JSON) |
---|
| | public void deleteVoicememo(@PathParam("vid") String vid, @FormParam("token") String client_token, @FormParam("uid") String uid){ |
---|
| | Account account = accounts.getAccount(uid); |
---|
| | String server_token = account.getToken(); |
---|
| | if (client_token.equals(server_token)) { |
---|
| | voicememos.removeVoicememo(vid); |
---|
| | return; |
---|
| | } |
---|
| | |
---|
| | } |
---|
| | |
---|
| | } |
---|
| | |
No description provided.
voicememos/vidのget,put,deleteを書きました
54cd2d6
intomaster
fromhorinouchi_612
on 13 Jun 2020