aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/api/resource/CalendarResource.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/org/traccar/api/resource/CalendarResource.java')
-rw-r--r--src/org/traccar/api/resource/CalendarResource.java40
1 files changed, 6 insertions, 34 deletions
diff --git a/src/org/traccar/api/resource/CalendarResource.java b/src/org/traccar/api/resource/CalendarResource.java
index f8d78a847..d43a3b02e 100644
--- a/src/org/traccar/api/resource/CalendarResource.java
+++ b/src/org/traccar/api/resource/CalendarResource.java
@@ -21,27 +21,25 @@ import java.util.Collection;
import java.util.Set;
import javax.ws.rs.Consumes;
-import javax.ws.rs.DELETE;
import javax.ws.rs.GET;
-import javax.ws.rs.POST;
-import javax.ws.rs.PUT;
import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
import org.traccar.Context;
-import org.traccar.api.BaseResource;
+import org.traccar.api.BaseObjectResource;
import org.traccar.database.CalendarManager;
import org.traccar.model.Calendar;
-import org.traccar.model.User;
@Path("calendars")
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
-public class CalendarResource extends BaseResource {
+public class CalendarResource extends BaseObjectResource<Calendar> {
+
+ public CalendarResource() {
+ super(Calendar.class);
+ }
@GET
public Collection<Calendar> get(
@@ -66,30 +64,4 @@ public class CalendarResource extends BaseResource {
return calendarManager.getItems(result);
}
- @POST
- public Response add(Calendar entity) throws SQLException {
- Context.getPermissionsManager().checkReadonly(getUserId());
- Context.getCalendarManager().addItem(entity);
- Context.getDataManager().linkObject(User.class, getUserId(), entity.getClass(), entity.getId(), true);
- Context.getCalendarManager().refreshUserItems();
- return Response.ok(entity).build();
- }
-
- @Path("{id}")
- @PUT
- public Response update(Calendar entity) throws SQLException {
- Context.getPermissionsManager().checkReadonly(getUserId());
- Context.getPermissionsManager().checkPermission(Calendar.class, getUserId(), entity.getId());
- Context.getCalendarManager().updateItem(entity);
- return Response.ok(entity).build();
- }
-
- @Path("{id}")
- @DELETE
- public Response remove(@PathParam("id") long id) throws SQLException {
- Context.getPermissionsManager().checkReadonly(getUserId());
- Context.getPermissionsManager().checkPermission(Calendar.class, getUserId(), id);
- Context.getCalendarManager().removeItem(id);
- return Response.noContent().build();
- }
}