aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar/model
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/org/traccar/model')
-rw-r--r--src/main/java/org/traccar/model/Attribute.java3
-rw-r--r--src/main/java/org/traccar/model/Calendar.java2
-rw-r--r--src/main/java/org/traccar/model/Command.java8
-rw-r--r--src/main/java/org/traccar/model/Device.java7
-rw-r--r--src/main/java/org/traccar/model/Driver.java4
-rw-r--r--src/main/java/org/traccar/model/Event.java3
-rw-r--r--src/main/java/org/traccar/model/Geofence.java2
-rw-r--r--src/main/java/org/traccar/model/Group.java3
-rw-r--r--src/main/java/org/traccar/model/Maintenance.java3
-rw-r--r--src/main/java/org/traccar/model/Notification.java4
-rw-r--r--src/main/java/org/traccar/model/Order.java3
-rw-r--r--src/main/java/org/traccar/model/Position.java15
-rw-r--r--src/main/java/org/traccar/model/Server.java2
-rw-r--r--src/main/java/org/traccar/model/Statistics.java3
-rw-r--r--src/main/java/org/traccar/model/User.java2
15 files changed, 60 insertions, 4 deletions
diff --git a/src/main/java/org/traccar/model/Attribute.java b/src/main/java/org/traccar/model/Attribute.java
index 45d40b3ec..65f2e3881 100644
--- a/src/main/java/org/traccar/model/Attribute.java
+++ b/src/main/java/org/traccar/model/Attribute.java
@@ -16,6 +16,9 @@
*/
package org.traccar.model;
+import org.traccar.storage.StorageName;
+
+@StorageName("tc_attributes")
public class Attribute extends BaseModel {
private String description;
diff --git a/src/main/java/org/traccar/model/Calendar.java b/src/main/java/org/traccar/model/Calendar.java
index af6364626..102c0be52 100644
--- a/src/main/java/org/traccar/model/Calendar.java
+++ b/src/main/java/org/traccar/model/Calendar.java
@@ -25,6 +25,7 @@ import net.fortuna.ical4j.model.DateTime;
import net.fortuna.ical4j.model.Period;
import net.fortuna.ical4j.model.component.CalendarComponent;
import org.traccar.storage.QueryIgnore;
+import org.traccar.storage.StorageName;
import java.io.ByteArrayInputStream;
import java.io.IOException;
@@ -32,6 +33,7 @@ import java.time.Duration;
import java.util.Collection;
import java.util.Date;
+@StorageName("tc_calendars")
public class Calendar extends ExtendedModel {
private String name;
diff --git a/src/main/java/org/traccar/model/Command.java b/src/main/java/org/traccar/model/Command.java
index 71bc232e9..03961c7b2 100644
--- a/src/main/java/org/traccar/model/Command.java
+++ b/src/main/java/org/traccar/model/Command.java
@@ -18,7 +18,9 @@ package org.traccar.model;
import org.traccar.storage.QueryIgnore;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import org.traccar.storage.StorageName;
+@StorageName("tc_commands")
@JsonIgnoreProperties(ignoreUnknown = true)
public class Command extends Message implements Cloneable {
@@ -104,6 +106,12 @@ public class Command extends Message implements Cloneable {
return super.getDeviceId();
}
+ @QueryIgnore
+ @Override
+ public void setDeviceId(long deviceId) {
+ super.setDeviceId(deviceId);
+ }
+
private String description;
public String getDescription() {
diff --git a/src/main/java/org/traccar/model/Device.java b/src/main/java/org/traccar/model/Device.java
index 46de8003d..836a6709c 100644
--- a/src/main/java/org/traccar/model/Device.java
+++ b/src/main/java/org/traccar/model/Device.java
@@ -20,7 +20,9 @@ import java.util.List;
import org.traccar.storage.QueryExtended;
import org.traccar.storage.QueryIgnore;
+import org.traccar.storage.StorageName;
+@StorageName("tc_devices")
public class Device extends GroupedModel {
private String name;
@@ -54,13 +56,13 @@ public class Device extends GroupedModel {
return status != null ? status : STATUS_OFFLINE;
}
+ @QueryIgnore
public void setStatus(String status) {
this.status = status;
}
private Date lastUpdate;
- @QueryExtended
public Date getLastUpdate() {
if (lastUpdate != null) {
return new Date(lastUpdate.getTime());
@@ -69,6 +71,7 @@ public class Device extends GroupedModel {
}
}
+ @QueryExtended
public void setLastUpdate(Date lastUpdate) {
if (lastUpdate != null) {
this.lastUpdate = new Date(lastUpdate.getTime());
@@ -84,6 +87,7 @@ public class Device extends GroupedModel {
return positionId;
}
+ @QueryIgnore
public void setPositionId(long positionId) {
this.positionId = positionId;
}
@@ -95,6 +99,7 @@ public class Device extends GroupedModel {
return geofenceIds;
}
+ @QueryIgnore
public void setGeofenceIds(List<Long> geofenceIds) {
this.geofenceIds = geofenceIds;
}
diff --git a/src/main/java/org/traccar/model/Driver.java b/src/main/java/org/traccar/model/Driver.java
index 05f52fd4d..b9e023088 100644
--- a/src/main/java/org/traccar/model/Driver.java
+++ b/src/main/java/org/traccar/model/Driver.java
@@ -16,6 +16,9 @@
*/
package org.traccar.model;
+import org.traccar.storage.StorageName;
+
+@StorageName("tc_drivers")
public class Driver extends ExtendedModel {
private String name;
@@ -37,4 +40,5 @@ public class Driver extends ExtendedModel {
public void setUniqueId(String uniqueId) {
this.uniqueId = uniqueId;
}
+
}
diff --git a/src/main/java/org/traccar/model/Event.java b/src/main/java/org/traccar/model/Event.java
index a7a134ecf..6e3953fda 100644
--- a/src/main/java/org/traccar/model/Event.java
+++ b/src/main/java/org/traccar/model/Event.java
@@ -15,8 +15,11 @@
*/
package org.traccar.model;
+import org.traccar.storage.StorageName;
+
import java.util.Date;
+@StorageName("tc_events")
public class Event extends Message {
public Event(String type, Position position) {
diff --git a/src/main/java/org/traccar/model/Geofence.java b/src/main/java/org/traccar/model/Geofence.java
index a451da9f5..5b857580d 100644
--- a/src/main/java/org/traccar/model/Geofence.java
+++ b/src/main/java/org/traccar/model/Geofence.java
@@ -26,7 +26,9 @@ import org.traccar.geofence.GeofencePolygon;
import org.traccar.geofence.GeofencePolyline;
import com.fasterxml.jackson.annotation.JsonIgnore;
+import org.traccar.storage.StorageName;
+@StorageName("tc_geofences")
public class Geofence extends ScheduledModel {
public static final String TYPE_GEOFENCE_CILCLE = "geofenceCircle";
diff --git a/src/main/java/org/traccar/model/Group.java b/src/main/java/org/traccar/model/Group.java
index 91ea2319d..ff69f61fa 100644
--- a/src/main/java/org/traccar/model/Group.java
+++ b/src/main/java/org/traccar/model/Group.java
@@ -15,6 +15,9 @@
*/
package org.traccar.model;
+import org.traccar.storage.StorageName;
+
+@StorageName("tc_groups")
public class Group extends GroupedModel {
private String name;
diff --git a/src/main/java/org/traccar/model/Maintenance.java b/src/main/java/org/traccar/model/Maintenance.java
index 73f67ea96..cad100a3a 100644
--- a/src/main/java/org/traccar/model/Maintenance.java
+++ b/src/main/java/org/traccar/model/Maintenance.java
@@ -16,6 +16,9 @@
*/
package org.traccar.model;
+import org.traccar.storage.StorageName;
+
+@StorageName("tc_maintenances")
public class Maintenance extends ExtendedModel {
private String name;
diff --git a/src/main/java/org/traccar/model/Notification.java b/src/main/java/org/traccar/model/Notification.java
index 01ca2711c..95e446132 100644
--- a/src/main/java/org/traccar/model/Notification.java
+++ b/src/main/java/org/traccar/model/Notification.java
@@ -21,7 +21,9 @@ import java.util.Set;
import org.traccar.storage.QueryIgnore;
import com.fasterxml.jackson.annotation.JsonIgnore;
+import org.traccar.storage.StorageName;
+@StorageName("tc_notifications")
public class Notification extends ScheduledModel {
private boolean always;
@@ -44,7 +46,6 @@ public class Notification extends ScheduledModel {
this.type = type;
}
-
private String notificators;
public String getNotificators() {
@@ -55,7 +56,6 @@ public class Notification extends ScheduledModel {
this.notificators = transports;
}
-
@JsonIgnore
@QueryIgnore
public Set<String> getNotificatorsTypes() {
diff --git a/src/main/java/org/traccar/model/Order.java b/src/main/java/org/traccar/model/Order.java
index fe6d926b8..7d09b0a47 100644
--- a/src/main/java/org/traccar/model/Order.java
+++ b/src/main/java/org/traccar/model/Order.java
@@ -15,6 +15,9 @@
*/
package org.traccar.model;
+import org.traccar.storage.StorageName;
+
+@StorageName("tc_orders")
public class Order extends ExtendedModel {
private String uniqueId;
diff --git a/src/main/java/org/traccar/model/Position.java b/src/main/java/org/traccar/model/Position.java
index bbea58901..348370e2c 100644
--- a/src/main/java/org/traccar/model/Position.java
+++ b/src/main/java/org/traccar/model/Position.java
@@ -17,8 +17,11 @@ package org.traccar.model;
import java.util.Date;
+import com.fasterxml.jackson.annotation.JsonIgnore;
import org.traccar.storage.QueryIgnore;
+import org.traccar.storage.StorageName;
+@StorageName("tc_positions")
public class Position extends Message {
public static final String KEY_ORIGINAL = "raw";
@@ -190,6 +193,7 @@ public class Position extends Message {
this.fixTime = fixTime;
}
+ @QueryIgnore
public void setTime(Date time) {
setDeviceTime(time);
setFixTime(time);
@@ -202,6 +206,7 @@ public class Position extends Message {
return outdated;
}
+ @QueryIgnore
public void setOutdated(boolean outdated) {
this.outdated = outdated;
}
@@ -296,10 +301,18 @@ public class Position extends Message {
this.network = network;
}
- @Override
+ @JsonIgnore
@QueryIgnore
+ @Override
public String getType() {
return super.getType();
}
+ @JsonIgnore
+ @QueryIgnore
+ @Override
+ public void setType(String type) {
+ super.setType(type);
+ }
+
}
diff --git a/src/main/java/org/traccar/model/Server.java b/src/main/java/org/traccar/model/Server.java
index fdb071a18..b48e84939 100644
--- a/src/main/java/org/traccar/model/Server.java
+++ b/src/main/java/org/traccar/model/Server.java
@@ -18,7 +18,9 @@ package org.traccar.model;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import org.traccar.Context;
import org.traccar.storage.QueryIgnore;
+import org.traccar.storage.StorageName;
+@StorageName("tc_servers")
@JsonIgnoreProperties(ignoreUnknown = true)
public class Server extends ExtendedModel {
diff --git a/src/main/java/org/traccar/model/Statistics.java b/src/main/java/org/traccar/model/Statistics.java
index a9a117aef..0dc1b98e8 100644
--- a/src/main/java/org/traccar/model/Statistics.java
+++ b/src/main/java/org/traccar/model/Statistics.java
@@ -15,9 +15,12 @@
*/
package org.traccar.model;
+import org.traccar.storage.StorageName;
+
import java.util.Date;
import java.util.Map;
+@StorageName("tc_statistics")
public class Statistics extends ExtendedModel {
private Date captureTime;
diff --git a/src/main/java/org/traccar/model/User.java b/src/main/java/org/traccar/model/User.java
index 447cf691c..94828ab95 100644
--- a/src/main/java/org/traccar/model/User.java
+++ b/src/main/java/org/traccar/model/User.java
@@ -20,9 +20,11 @@ import com.fasterxml.jackson.annotation.JsonIgnore;
import org.traccar.storage.QueryExtended;
import org.traccar.storage.QueryIgnore;
import org.traccar.helper.Hashing;
+import org.traccar.storage.StorageName;
import java.util.Date;
+@StorageName("tc_users")
public class User extends ExtendedModel {
private String name;