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.java6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/org/traccar/api/resource/CalendarResource.java b/src/org/traccar/api/resource/CalendarResource.java
index be675fc79..f4ff9d4e9 100644
--- a/src/org/traccar/api/resource/CalendarResource.java
+++ b/src/org/traccar/api/resource/CalendarResource.java
@@ -18,6 +18,7 @@ package org.traccar.api.resource;
import java.sql.SQLException;
import java.util.Collection;
+import java.util.LinkedHashMap;
import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE;
@@ -66,7 +67,10 @@ public class CalendarResource extends BaseResource {
public Response add(Calendar entity) throws SQLException {
Context.getPermissionsManager().checkReadonly(getUserId());
Context.getCalendarManager().addItem(entity);
- Context.getDataManager().linkCalendar(getUserId(), entity.getId());
+ LinkedHashMap<String, Long> link = new LinkedHashMap<>();
+ link.put("userId", getUserId());
+ link.put("calendarId", entity.getId());
+ Context.getDataManager().linkObject(link, true);
Context.getCalendarManager().refreshUserItems();
return Response.ok(entity).build();
}