aboutsummaryrefslogtreecommitdiff
path: root/src/org
diff options
context:
space:
mode:
Diffstat (limited to 'src/org')
-rw-r--r--src/org/traccar/Context.java3
-rw-r--r--src/org/traccar/database/NotificationManager.java4
-rw-r--r--src/org/traccar/events/MaintenanceEventHandler.java6
-rw-r--r--src/org/traccar/model/Maintenance.java10
4 files changed, 11 insertions, 12 deletions
diff --git a/src/org/traccar/Context.java b/src/org/traccar/Context.java
index a1a5f5a8e..67fd02f75 100644
--- a/src/org/traccar/Context.java
+++ b/src/org/traccar/Context.java
@@ -393,8 +393,6 @@ public final class Context {
commandsManager = new CommandsManager(dataManager);
- maintenancesManager = new MaintenancesManager(dataManager);
-
statisticsManager = new StatisticsManager();
if (config.getBoolean("sms.smpp.enable")) {
@@ -429,6 +427,7 @@ public final class Context {
geofenceManager = new GeofenceManager(dataManager);
calendarManager = new CalendarManager(dataManager);
+ maintenancesManager = new MaintenancesManager(dataManager);
notificationManager = new NotificationManager(dataManager);
Properties velocityProperties = new Properties();
velocityProperties.setProperty("file.resource.loader.path",
diff --git a/src/org/traccar/database/NotificationManager.java b/src/org/traccar/database/NotificationManager.java
index 9f2606f7f..3bc048356 100644
--- a/src/org/traccar/database/NotificationManager.java
+++ b/src/org/traccar/database/NotificationManager.java
@@ -78,8 +78,8 @@ public class NotificationManager extends ExtendedObjectManager<Notification> {
usersToForward = new HashSet<>();
}
for (long userId : users) {
- if ((event.getGeofenceId() == 0 || Context.getGeofenceManager() != null
- && Context.getGeofenceManager().checkItemPermission(userId, event.getGeofenceId()))
+ if ((event.getGeofenceId() == 0
+ || Context.getGeofenceManager().checkItemPermission(userId, event.getGeofenceId()))
&& (event.getMaintenanceId() == 0
|| Context.getMaintenancesManager().checkItemPermission(userId, event.getMaintenanceId()))) {
if (usersToForward != null) {
diff --git a/src/org/traccar/events/MaintenanceEventHandler.java b/src/org/traccar/events/MaintenanceEventHandler.java
index b556e1003..4a6122826 100644
--- a/src/org/traccar/events/MaintenanceEventHandler.java
+++ b/src/org/traccar/events/MaintenanceEventHandler.java
@@ -42,12 +42,12 @@ public class MaintenanceEventHandler extends BaseEventHandler {
Map<Event, Position> events = new HashMap<>();
for (long maintenanceId : Context.getMaintenancesManager().getAllDeviceItems(position.getDeviceId())) {
Maintenance maintenance = Context.getMaintenancesManager().getById(maintenanceId);
- if (maintenance.getLapse() != 0) {
+ if (maintenance.getPeriod() != 0) {
double oldValue = lastPosition.getDouble(maintenance.getType());
double newValue = position.getDouble(maintenance.getType());
if (oldValue != 0.0 && newValue != 0.0
- && (long) ((oldValue - maintenance.getStart()) / maintenance.getLapse())
- < (long) ((newValue - maintenance.getStart()) / maintenance.getLapse())) {
+ && (long) ((oldValue - maintenance.getStart()) / maintenance.getPeriod())
+ < (long) ((newValue - maintenance.getStart()) / maintenance.getPeriod())) {
Event event = new Event(Event.TYPE_MAINTENANCE, position.getDeviceId(), position.getId());
event.setMaintenanceId(maintenanceId);
event.set(maintenance.getType(), newValue);
diff --git a/src/org/traccar/model/Maintenance.java b/src/org/traccar/model/Maintenance.java
index 82052e160..73f67ea96 100644
--- a/src/org/traccar/model/Maintenance.java
+++ b/src/org/traccar/model/Maintenance.java
@@ -48,14 +48,14 @@ public class Maintenance extends ExtendedModel {
this.start = start;
}
- private double lapse;
+ private double period;
- public double getLapse() {
- return lapse;
+ public double getPeriod() {
+ return period;
}
- public void setLapse(double lapse) {
- this.lapse = lapse;
+ public void setPeriod(double period) {
+ this.period = period;
}
}