diff --git a/src/main/java/org/ntlab/citrusserver/resources/ScheduleRest.java b/src/main/java/org/ntlab/citrusserver/resources/ScheduleRest.java index d336014..e25f64f 100644 --- a/src/main/java/org/ntlab/citrusserver/resources/ScheduleRest.java +++ b/src/main/java/org/ntlab/citrusserver/resources/ScheduleRest.java @@ -8,6 +8,9 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; +import java.util.ArrayList; +import java.util.HashMap; + @Path("/accounts") @Component @@ -21,57 +24,141 @@ accountManager = ac; } - //@Path("/{account_id}/schedule") - //@GET//登録されたスケジュールのidを返す - //@Produces(MediaType.APPLICATION_JSON) +// @Path("/{account_id}/schedule") +// @GET//登録されたスケジュールのidを返す +// @Produces(MediaType.APPLICATION_JSON) +// public ArrayList getScheduleAll(@PathParam("account_id") String accountId, @QueryParam("token") String token){ +// if(accountManager.checkToken(accountId,token)) { +// return scheduleManager.getScheduleAll(accountId); +// } +// return null; +// } - //@Path("/{account_id}/schedule/{year}") - //@GET//登録されたスケジュールのidを年単位で返す - //@Produces(MediaType.APPLICATION_JSON) +// @Path("/{account_id}/schedule/{year}") +// @GET//登録されたスケジュールのidを年単位で返す +// @Produces(MediaType.APPLICATION_JSON) +// public ArrayList getScheduleYear(@PathParam("account_id") String accountId, @PathParam("year") Integer year,@QueryParam("token") String token){ +// if(accountManager.checkToken(accountId,token)) { +// return scheduleManager.getScheduleYear(accountId,year); +// } +// return null; +// } - //@Path("/{account_id}/schedule/{year}/{month}") - //@GET//登録されたスケジュールのidを月単位で返す - //@Produces(MediaType.APPLICATION_JSON) +// @Path("/{account_id}/schedule/{year}/{month}") +// @GET//登録されたスケジュールのidを月単位で返す +// @Produces(MediaType.APPLICATION_JSON) +// public ArrayList getScheduleMonth(@PathParam("account_id") String accountId, @PathParam("year") Integer year,@PathParam("month") Integer month, +// @QueryParam("token") String token){ +// if(accountManager.checkToken(accountId,token)) { +// return scheduleManager.getScheduleMonth(accountId,year,month); +// } +// return null; +// } - //@Path("/{account_id}/schedule/{year}/{month}/{day}") - //@GET//登録されたスケジュールのidを日ごとで返す - //@Produces(MediaType.APPLICATION_JSON) +// @Path("/{account_id}/schedule/{year}/{month}/{day}") +// @GET//登録されたスケジュールのidを日ごとで返す +// @Produces(MediaType.APPLICATION_JSON) +// public ArrayList getScheduleDay(@PathParam("account_id") String accountId, @PathParam("year") Integer year,@PathParam("month") Integer month, +// @PathParam("day") Integer day,@QueryParam("token") String token){ +// if(accountManager.checkToken(accountId,token)) { +// return scheduleManager.getScheduleYear(accountId,year,month,day); +// } +// return null; +// } - //@Path("/{account_id}/schedule/{year}/{month}/{day}") - //@POST//スケジュールの新規作成 - //@Produces(MediaType.APPLICATION_JSON) +// @Path("/{account_id}/schedule/{year}/{month}/{day}") +// @POST//スケジュールの新規作成 +// @Consumes(MediaType.APPLICATION_FORM_URLENCODED) +// @Produces(MediaType.APPLICATION_JSON) +// public Schedule addSchedule(@PathParam("account_id") String accountId, @PathParam("year") Integer year, +// @PathParam("month") Integer month, @PathParam("day") Integer day,@QueryParam("token") String token) { +// if(accountManager.checkToken(accountId,token)) { +// return scheduleManager.addSchedule(accountId, year, month, day); +// } +// return null; +// } @Path("/{account_id}/schedule/{year}/{month}/{day}/{schedule_id}") @GET//スケジュールの情報を返す @Produces(MediaType.APPLICATION_JSON) - public Schedule getScheduleInfo(@PathParam("account_id") String account_id, @PathParam("year") Integer year, + public Schedule getScheduleInfo(@PathParam("account_id") String accountId, @PathParam("year") Integer year, @PathParam("month") Integer month, @PathParam("day") Integer day, - @PathParam("schedule_id") Integer schedule_id, @QueryParam("token") String token) { - if(accountManager.checkToken(account_id,token)) { - Schedule schedule = scheduleManager.getScheduleId(account_id, year, month, day, schedule_id);//token後でつける + @PathParam("schedule_id") Integer scheduleId, @QueryParam("token") String token) { + if(accountManager.checkToken(accountId,token)) { + Schedule schedule = scheduleManager.getScheduleId(accountId, year, month, day, scheduleId); return schedule; } return null; } - //@Path("/{account_id}/schedule/{year}/{month}/{day}/{schedule_id}") - //@DELETE//特定のスケジュールを削除する - //@Consumes(MediaType.APPLICATION_FORM_URLENCODED) +// @Path("/{account_id}/schedule/{year}/{month}/{day}/{schedule_id}") +// @DELETE//特定のスケジュールを削除する +// @Produces(MediaType.TEXT_PLAIN) +// @Consumes(MediaType.APPLICATION_FORM_URLENCODED) +// public Schedule deleteSchedule(@PathParam("account_id") String accountId, @PathParam("year") Integer year, +// @PathParam("month") Integer month, @PathParam("day") Integer day, +// @PathParam("schedule_id") Integer scheduleId, @QueryParam("token") String token) { +// if(accountManager.checkToken(accountId,token)) { +// scheduleManager.deleteSchedule(accountId, year, month, day, scheduleId); +// return "success"; +// } +// return null; +// } - //@Path("/{account_id}/schedule/{year}/{month}/{day}/{schedule_id}/start_time") - //@PUT//スケジュールの開始時刻の新規作成・変更 - //@Consumes(MediaType.APPLICATION_FORM_URLENCODED) +// @Path("/{account_id}/schedule/{year}/{month}/{day}/{schedule_id}/start_time") +// @PUT//スケジュールの開始時刻の新規作成・変更 +// @Produces(MediaType.TEXT_PLAIN) +// @Consumes(MediaType.APPLICATION_FORM_URLENCODED) +// public Schedule setScheduleStartTime(@PathParam("account_id") String accountId, @PathParam("year") Integer year, +// @PathParam("month") Integer month, @PathParam("day") Integer day, +// @PathParam("schedule_id") Integer scheduleId, @QueryParam("token") String token) { +// if(accountManager.checkToken(accountId,token)) { +// scheduleManager.setScheduleStartTime(accountId, year, month, day, scheduleId); +// return "success"; +// } +// return null; +// } - //@Path("/{account_id}/schedule/{year}/{month}/{day}/{schedule_id}/end_time") - //@PUT//スケジュールの終了時刻の新規作成・変更 - //@Consumes(MediaType.APPLICATION_FORM_URLENCODED) +// @Path("/{account_id}/schedule/{year}/{month}/{day}/{schedule_id}/end_time") +// @PUT//スケジュールの終了時刻の新規作成・変更 +// @Produces(MediaType.TEXT_PLAIN) +// @Consumes(MediaType.APPLICATION_FORM_URLENCODED) +// public Schedule setScheduleEndTime(@PathParam("account_id") String accountId, @PathParam("year") Integer year, +// @PathParam("month") Integer month, @PathParam("day") Integer day, +// @PathParam("schedule_id") Integer scheduleId, @QueryParam("token") String token) { +// if(accountManager.checkToken(accountId,token)) { +// scheduleManager.setScheduleEndTime(accountId, year, month, day, scheduleId); +// return "success"; +// } +// return null; +// } - //@Path("/{account_id}/schedule/{year}/{month}/{day}/{schedule_id}/title") - //@PUT//スケジュールのタイトルの変更 - //@Consumes(MediaType.APPLICATION_FORM_URLENCODED) +// @Path("/{account_id}/schedule/{year}/{month}/{day}/{schedule_id}/title") +// @PUT//スケジュールのタイトルの変更 +// @Produces(MediaType.TEXT_PLAIN) +// @Consumes(MediaType.APPLICATION_FORM_URLENCODED) +// public Schedule setScheduleTitle(@PathParam("account_id") String accountId, @PathParam("year") Integer year, +// @PathParam("month") Integer month, @PathParam("day") Integer day, +// @PathParam("schedule_id") Integer scheduleId, @QueryParam("token") String token) { +// if(accountManager.checkToken(accountId,token)) { +// scheduleManager.setScheduleTitle(accountId, year, month, day, scheduleId); +// return schedule; +// } +// return null; +// } - //@Path("/{account_id}/schedule/{year}/{month}/{day}/{schedule_id}/book_id") - //@PUT//スケジュールの所属している本の新規設定・変更 - //@Consumes(MediaType.APPLICATION_FORM_URLENCODED) +// @Path("/{account_id}/schedule/{year}/{month}/{day}/{schedule_id}/book_id") +// @PUT//スケジュールの所属している本の新規設定・変更 +// @Produces(MediaType.TEXT_PLAIN) +// @Consumes(MediaType.APPLICATION_FORM_URLENCODED) +// public Schedule setSchedulesBook(@PathParam("account_id") String accountId, @PathParam("year") Integer year, +// @PathParam("month") Integer month, @PathParam("day") Integer day, +// @PathParam("schedule_id") Integer scheduleId, @QueryParam("token") String token) { +// if(accountManager.checkToken(accountId,token)) { +// scheduleManager.setSchedulesBook(accountId, year, month, day, scheduleId);//token後でつける +// return "success"; +// } +// return null; +// } }