From 94a2a94330d82fa1c1960b8783e5061c188196e3 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Sat, 4 Jun 2022 10:55:50 -0700 Subject: Rename report models --- src/main/java/org/traccar/reports/Events.java | 6 +- src/main/java/org/traccar/reports/Route.java | 6 +- src/main/java/org/traccar/reports/Stops.java | 18 +-- src/main/java/org/traccar/reports/Summary.java | 22 ++-- src/main/java/org/traccar/reports/Trips.java | 20 ++-- .../org/traccar/reports/common/ReportUtils.java | 22 ++-- .../java/org/traccar/reports/model/BaseReport.java | 126 -------------------- .../org/traccar/reports/model/BaseReportItem.java | 126 ++++++++++++++++++++ .../org/traccar/reports/model/DeviceReport.java | 55 --------- .../traccar/reports/model/DeviceReportSection.java | 55 +++++++++ .../java/org/traccar/reports/model/StopReport.java | 80 ------------- .../org/traccar/reports/model/StopReportItem.java | 80 +++++++++++++ .../org/traccar/reports/model/SummaryReport.java | 30 ----- .../traccar/reports/model/SummaryReportItem.java | 30 +++++ .../java/org/traccar/reports/model/TripReport.java | 130 --------------------- .../org/traccar/reports/model/TripReportItem.java | 130 +++++++++++++++++++++ 16 files changed, 468 insertions(+), 468 deletions(-) delete mode 100644 src/main/java/org/traccar/reports/model/BaseReport.java create mode 100644 src/main/java/org/traccar/reports/model/BaseReportItem.java delete mode 100644 src/main/java/org/traccar/reports/model/DeviceReport.java create mode 100644 src/main/java/org/traccar/reports/model/DeviceReportSection.java delete mode 100644 src/main/java/org/traccar/reports/model/StopReport.java create mode 100644 src/main/java/org/traccar/reports/model/StopReportItem.java delete mode 100644 src/main/java/org/traccar/reports/model/SummaryReport.java create mode 100644 src/main/java/org/traccar/reports/model/SummaryReportItem.java delete mode 100644 src/main/java/org/traccar/reports/model/TripReport.java create mode 100644 src/main/java/org/traccar/reports/model/TripReportItem.java (limited to 'src/main/java/org/traccar/reports') diff --git a/src/main/java/org/traccar/reports/Events.java b/src/main/java/org/traccar/reports/Events.java index c5db305ed..130fba724 100644 --- a/src/main/java/org/traccar/reports/Events.java +++ b/src/main/java/org/traccar/reports/Events.java @@ -34,7 +34,7 @@ import org.traccar.model.Geofence; import org.traccar.model.Group; import org.traccar.model.Maintenance; import org.traccar.reports.common.ReportUtils; -import org.traccar.reports.model.DeviceReport; +import org.traccar.reports.model.DeviceReportSection; import org.traccar.storage.Storage; import org.traccar.storage.StorageException; @@ -73,7 +73,7 @@ public final class Events { Collection deviceIds, Collection groupIds, Collection types, Date from, Date to) throws StorageException, IOException { ReportUtils.checkPeriodLimit(from, to); - ArrayList devicesEvents = new ArrayList<>(); + ArrayList devicesEvents = new ArrayList<>(); ArrayList sheetNames = new ArrayList<>(); HashMap geofenceNames = new HashMap<>(); HashMap maintenanceNames = new HashMap<>(); @@ -107,7 +107,7 @@ public final class Events { iterator.remove(); } } - DeviceReport deviceEvents = new DeviceReport(); + DeviceReportSection deviceEvents = new DeviceReportSection(); Device device = Context.getIdentityManager().getById(deviceId); deviceEvents.setDeviceName(device.getName()); sheetNames.add(WorkbookUtil.createSafeSheetName(deviceEvents.getDeviceName())); diff --git a/src/main/java/org/traccar/reports/Route.java b/src/main/java/org/traccar/reports/Route.java index d7745157a..5b8629aad 100644 --- a/src/main/java/org/traccar/reports/Route.java +++ b/src/main/java/org/traccar/reports/Route.java @@ -30,7 +30,7 @@ import org.traccar.model.Device; import org.traccar.model.Group; import org.traccar.model.Position; import org.traccar.reports.common.ReportUtils; -import org.traccar.reports.model.DeviceReport; +import org.traccar.reports.model.DeviceReportSection; import org.traccar.storage.StorageException; public final class Route { @@ -53,13 +53,13 @@ public final class Route { long userId, Collection deviceIds, Collection groupIds, Date from, Date to) throws StorageException, IOException { ReportUtils.checkPeriodLimit(from, to); - ArrayList devicesRoutes = new ArrayList<>(); + ArrayList devicesRoutes = new ArrayList<>(); ArrayList sheetNames = new ArrayList<>(); for (long deviceId: ReportUtils.getDeviceList(deviceIds, groupIds)) { Context.getPermissionsManager().checkDevice(userId, deviceId); Collection positions = Context.getDataManager() .getPositions(deviceId, from, to); - DeviceReport deviceRoutes = new DeviceReport(); + DeviceReportSection deviceRoutes = new DeviceReportSection(); Device device = Context.getIdentityManager().getById(deviceId); deviceRoutes.setDeviceName(device.getName()); sheetNames.add(WorkbookUtil.createSafeSheetName(deviceRoutes.getDeviceName())); diff --git a/src/main/java/org/traccar/reports/Stops.java b/src/main/java/org/traccar/reports/Stops.java index 82eb62f66..e688d53da 100644 --- a/src/main/java/org/traccar/reports/Stops.java +++ b/src/main/java/org/traccar/reports/Stops.java @@ -33,8 +33,8 @@ import org.traccar.database.IdentityManager; import org.traccar.model.Device; import org.traccar.model.Group; import org.traccar.reports.common.ReportUtils; -import org.traccar.reports.model.DeviceReport; -import org.traccar.reports.model.StopReport; +import org.traccar.reports.model.DeviceReportSection; +import org.traccar.reports.model.StopReportItem; import org.traccar.storage.StorageException; public final class Stops { @@ -42,7 +42,7 @@ public final class Stops { private Stops() { } - private static Collection detectStops(long deviceId, Date from, Date to) throws StorageException { + private static Collection detectStops(long deviceId, Date from, Date to) throws StorageException { boolean ignoreOdometer = Context.getDeviceManager() .lookupAttributeBoolean(deviceId, "report.ignoreOdometer", false, false, true); @@ -51,14 +51,14 @@ public final class Stops { return ReportUtils.detectTripsAndStops( identityManager, deviceManager, Context.getDataManager().getPositions(deviceId, from, to), - Context.getTripsConfig(), ignoreOdometer, StopReport.class); + Context.getTripsConfig(), ignoreOdometer, StopReportItem.class); } - public static Collection getObjects( + public static Collection getObjects( long userId, Collection deviceIds, Collection groupIds, Date from, Date to) throws StorageException { ReportUtils.checkPeriodLimit(from, to); - ArrayList result = new ArrayList<>(); + ArrayList result = new ArrayList<>(); for (long deviceId: ReportUtils.getDeviceList(deviceIds, groupIds)) { Context.getPermissionsManager().checkDevice(userId, deviceId); result.addAll(detectStops(deviceId, from, to)); @@ -70,12 +70,12 @@ public final class Stops { OutputStream outputStream, long userId, Collection deviceIds, Collection groupIds, Date from, Date to) throws StorageException, IOException { ReportUtils.checkPeriodLimit(from, to); - ArrayList devicesStops = new ArrayList<>(); + ArrayList devicesStops = new ArrayList<>(); ArrayList sheetNames = new ArrayList<>(); for (long deviceId: ReportUtils.getDeviceList(deviceIds, groupIds)) { Context.getPermissionsManager().checkDevice(userId, deviceId); - Collection stops = detectStops(deviceId, from, to); - DeviceReport deviceStops = new DeviceReport(); + Collection stops = detectStops(deviceId, from, to); + DeviceReportSection deviceStops = new DeviceReportSection(); Device device = Context.getIdentityManager().getById(deviceId); deviceStops.setDeviceName(device.getName()); sheetNames.add(WorkbookUtil.createSafeSheetName(deviceStops.getDeviceName())); diff --git a/src/main/java/org/traccar/reports/Summary.java b/src/main/java/org/traccar/reports/Summary.java index 20d80a9f5..30c4cb057 100644 --- a/src/main/java/org/traccar/reports/Summary.java +++ b/src/main/java/org/traccar/reports/Summary.java @@ -30,7 +30,7 @@ import org.traccar.Context; import org.traccar.helper.UnitsConverter; import org.traccar.model.Position; import org.traccar.reports.common.ReportUtils; -import org.traccar.reports.model.SummaryReport; +import org.traccar.reports.model.SummaryReportItem; import org.traccar.storage.StorageException; public final class Summary { @@ -38,8 +38,8 @@ public final class Summary { private Summary() { } - private static SummaryReport calculateSummaryResult(long deviceId, Collection positions) { - SummaryReport result = new SummaryReport(); + private static SummaryReportItem calculateSummaryResult(long deviceId, Collection positions) { + SummaryReportItem result = new SummaryReportItem(); result.setDeviceId(deviceId); result.setDeviceName(Context.getIdentityManager().getById(deviceId).getName()); if (positions != null && !positions.isEmpty()) { @@ -97,12 +97,12 @@ public final class Summary { return calendar.get(Calendar.DAY_OF_MONTH); } - private static Collection calculateSummaryResults( + private static Collection calculateSummaryResults( long userId, long deviceId, Date from, Date to, boolean daily) throws StorageException { ArrayList positions = new ArrayList<>(Context.getDataManager().getPositions(deviceId, from, to)); - ArrayList results = new ArrayList<>(); + ArrayList results = new ArrayList<>(); if (daily && !positions.isEmpty()) { int startIndex = 0; int startDay = getDay(userId, positions.iterator().next().getFixTime()); @@ -122,14 +122,14 @@ public final class Summary { return results; } - public static Collection getObjects(long userId, Collection deviceIds, - Collection groupIds, Date from, Date to, boolean daily) throws StorageException { + public static Collection getObjects(long userId, Collection deviceIds, + Collection groupIds, Date from, Date to, boolean daily) throws StorageException { ReportUtils.checkPeriodLimit(from, to); - ArrayList result = new ArrayList<>(); + ArrayList result = new ArrayList<>(); for (long deviceId: ReportUtils.getDeviceList(deviceIds, groupIds)) { Context.getPermissionsManager().checkDevice(userId, deviceId); - Collection deviceResults = calculateSummaryResults(userId, deviceId, from, to, daily); - for (SummaryReport summaryReport : deviceResults) { + Collection deviceResults = calculateSummaryResults(userId, deviceId, from, to, daily); + for (SummaryReportItem summaryReport : deviceResults) { if (summaryReport.getStartTime() != null && summaryReport.getEndTime() != null) { result.add(summaryReport); } @@ -142,7 +142,7 @@ public final class Summary { long userId, Collection deviceIds, Collection groupIds, Date from, Date to, boolean daily) throws StorageException, IOException { ReportUtils.checkPeriodLimit(from, to); - Collection summaries = getObjects(userId, deviceIds, groupIds, from, to, daily); + Collection summaries = getObjects(userId, deviceIds, groupIds, from, to, daily); String templatePath = Context.getConfig().getString("report.templatesPath", "templates/export/"); try (InputStream inputStream = new FileInputStream(templatePath + "/summary.xlsx")) { diff --git a/src/main/java/org/traccar/reports/Trips.java b/src/main/java/org/traccar/reports/Trips.java index 58131debb..74e24cf2f 100644 --- a/src/main/java/org/traccar/reports/Trips.java +++ b/src/main/java/org/traccar/reports/Trips.java @@ -32,8 +32,8 @@ import org.traccar.database.IdentityManager; import org.traccar.model.Device; import org.traccar.model.Group; import org.traccar.reports.common.ReportUtils; -import org.traccar.reports.model.DeviceReport; -import org.traccar.reports.model.TripReport; +import org.traccar.reports.model.DeviceReportSection; +import org.traccar.reports.model.TripReportItem; import org.traccar.storage.StorageException; public final class Trips { @@ -41,7 +41,7 @@ public final class Trips { private Trips() { } - private static Collection detectTrips(long deviceId, Date from, Date to) throws StorageException { + private static Collection detectTrips(long deviceId, Date from, Date to) throws StorageException { boolean ignoreOdometer = Context.getDeviceManager() .lookupAttributeBoolean(deviceId, "report.ignoreOdometer", false, false, true); @@ -50,13 +50,13 @@ public final class Trips { return ReportUtils.detectTripsAndStops( identityManager, deviceManager, Context.getDataManager().getPositions(deviceId, from, to), - Context.getTripsConfig(), ignoreOdometer, TripReport.class); + Context.getTripsConfig(), ignoreOdometer, TripReportItem.class); } - public static Collection getObjects(long userId, Collection deviceIds, Collection groupIds, - Date from, Date to) throws StorageException { + public static Collection getObjects(long userId, Collection deviceIds, Collection groupIds, + Date from, Date to) throws StorageException { ReportUtils.checkPeriodLimit(from, to); - ArrayList result = new ArrayList<>(); + ArrayList result = new ArrayList<>(); for (long deviceId: ReportUtils.getDeviceList(deviceIds, groupIds)) { Context.getPermissionsManager().checkDevice(userId, deviceId); result.addAll(detectTrips(deviceId, from, to)); @@ -68,12 +68,12 @@ public final class Trips { long userId, Collection deviceIds, Collection groupIds, Date from, Date to) throws StorageException, IOException { ReportUtils.checkPeriodLimit(from, to); - ArrayList devicesTrips = new ArrayList<>(); + ArrayList devicesTrips = new ArrayList<>(); ArrayList sheetNames = new ArrayList<>(); for (long deviceId: ReportUtils.getDeviceList(deviceIds, groupIds)) { Context.getPermissionsManager().checkDevice(userId, deviceId); - Collection trips = detectTrips(deviceId, from, to); - DeviceReport deviceTrips = new DeviceReport(); + Collection trips = detectTrips(deviceId, from, to); + DeviceReportSection deviceTrips = new DeviceReportSection(); Device device = Context.getIdentityManager().getById(deviceId); deviceTrips.setDeviceName(device.getName()); sheetNames.add(WorkbookUtil.createSafeSheetName(deviceTrips.getDeviceName())); diff --git a/src/main/java/org/traccar/reports/common/ReportUtils.java b/src/main/java/org/traccar/reports/common/ReportUtils.java index 27972b453..b56b58a58 100644 --- a/src/main/java/org/traccar/reports/common/ReportUtils.java +++ b/src/main/java/org/traccar/reports/common/ReportUtils.java @@ -37,9 +37,9 @@ import org.traccar.session.DeviceState; import org.traccar.model.Driver; import org.traccar.model.Event; import org.traccar.model.Position; -import org.traccar.reports.model.BaseReport; -import org.traccar.reports.model.StopReport; -import org.traccar.reports.model.TripReport; +import org.traccar.reports.model.BaseReportItem; +import org.traccar.reports.model.StopReportItem; +import org.traccar.reports.model.TripReportItem; import org.traccar.storage.Storage; import org.traccar.storage.StorageException; import org.traccar.storage.query.Columns; @@ -185,7 +185,7 @@ public final class ReportUtils { transformer.write(); } - private static TripReport calculateTrip( + private static TripReportItem calculateTrip( IdentityManager identityManager, ArrayList positions, int startIndex, int endIndex, boolean ignoreOdometer) { @@ -200,7 +200,7 @@ public final class ReportUtils { } } - TripReport trip = new TripReport(); + TripReportItem trip = new TripReportItem(); long tripDuration = endTrip.getFixTime().getTime() - startTrip.getFixTime().getTime(); long deviceId = startTrip.getDeviceId(); @@ -253,14 +253,14 @@ public final class ReportUtils { return trip; } - private static StopReport calculateStop( + private static StopReportItem calculateStop( IdentityManager identityManager, ArrayList positions, int startIndex, int endIndex, boolean ignoreOdometer) { Position startStop = positions.get(startIndex); Position endStop = positions.get(endIndex); - StopReport stop = new StopReport(); + StopReportItem stop = new StopReportItem(); long deviceId = startStop.getDeviceId(); stop.setDeviceId(deviceId); @@ -302,11 +302,11 @@ public final class ReportUtils { } - private static T calculateTripOrStop( + private static T calculateTripOrStop( IdentityManager identityManager, ArrayList positions, int startIndex, int endIndex, boolean ignoreOdometer, Class reportClass) { - if (reportClass.equals(TripReport.class)) { + if (reportClass.equals(TripReportItem.class)) { return (T) calculateTrip(identityManager, positions, startIndex, endIndex, ignoreOdometer); } else { return (T) calculateStop(identityManager, positions, startIndex, endIndex, ignoreOdometer); @@ -333,7 +333,7 @@ public final class ReportUtils { } } - public static Collection detectTripsAndStops( + public static Collection detectTripsAndStops( IdentityManager identityManager, DeviceManager deviceManager, Collection positionCollection, TripsConfig tripsConfig, boolean ignoreOdometer, Class reportClass) { @@ -342,7 +342,7 @@ public final class ReportUtils { ArrayList positions = new ArrayList<>(positionCollection); if (!positions.isEmpty()) { - boolean trips = reportClass.equals(TripReport.class); + boolean trips = reportClass.equals(TripReportItem.class); MotionEventHandler motionHandler = new MotionEventHandler(identityManager, deviceManager, tripsConfig); DeviceState deviceState = new DeviceState(); deviceState.setMotionState(isMoving(positions, 0, tripsConfig)); diff --git a/src/main/java/org/traccar/reports/model/BaseReport.java b/src/main/java/org/traccar/reports/model/BaseReport.java deleted file mode 100644 index 928c0557d..000000000 --- a/src/main/java/org/traccar/reports/model/BaseReport.java +++ /dev/null @@ -1,126 +0,0 @@ -/* - * Copyright 2016 - 2020 Anton Tananaev (anton@traccar.org) - * Copyright 2016 Andrey Kunitsyn (andrey@traccar.org) - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.traccar.reports.model; - -import java.util.Date; - -public class BaseReport { - - private long deviceId; - - public long getDeviceId() { - return deviceId; - } - - public void setDeviceId(long deviceId) { - this.deviceId = deviceId; - } - - private String deviceName; - - public String getDeviceName() { - return deviceName; - } - - public void setDeviceName(String deviceName) { - this.deviceName = deviceName; - } - - private double distance; - - public double getDistance() { - return distance; - } - - public void setDistance(double distance) { - this.distance = distance; - } - - public void addDistance(double distance) { - this.distance += distance; - } - - private double averageSpeed; - - public double getAverageSpeed() { - return averageSpeed; - } - - public void setAverageSpeed(double averageSpeed) { - this.averageSpeed = averageSpeed; - } - - private double maxSpeed; - - public double getMaxSpeed() { - return maxSpeed; - } - - public void setMaxSpeed(double maxSpeed) { - this.maxSpeed = maxSpeed; - } - - private double spentFuel; - - public double getSpentFuel() { - return spentFuel; - } - - public void setSpentFuel(double spentFuel) { - this.spentFuel = spentFuel; - } - - private double startOdometer; - - public double getStartOdometer() { - return startOdometer; - } - - public void setStartOdometer(double startOdometer) { - this.startOdometer = startOdometer; - } - private double endOdometer; - - public double getEndOdometer() { - return endOdometer; - } - - public void setEndOdometer(double endOdometer) { - this.endOdometer = endOdometer; - } - - private Date startTime; - - public Date getStartTime() { - return startTime; - } - - public void setStartTime(Date startTime) { - this.startTime = startTime; - } - - private Date endTime; - - public Date getEndTime() { - return endTime; - } - - public void setEndTime(Date endTime) { - this.endTime = endTime; - } - -} diff --git a/src/main/java/org/traccar/reports/model/BaseReportItem.java b/src/main/java/org/traccar/reports/model/BaseReportItem.java new file mode 100644 index 000000000..6e270dfe3 --- /dev/null +++ b/src/main/java/org/traccar/reports/model/BaseReportItem.java @@ -0,0 +1,126 @@ +/* + * Copyright 2016 - 2020 Anton Tananaev (anton@traccar.org) + * Copyright 2016 Andrey Kunitsyn (andrey@traccar.org) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.traccar.reports.model; + +import java.util.Date; + +public class BaseReportItem { + + private long deviceId; + + public long getDeviceId() { + return deviceId; + } + + public void setDeviceId(long deviceId) { + this.deviceId = deviceId; + } + + private String deviceName; + + public String getDeviceName() { + return deviceName; + } + + public void setDeviceName(String deviceName) { + this.deviceName = deviceName; + } + + private double distance; + + public double getDistance() { + return distance; + } + + public void setDistance(double distance) { + this.distance = distance; + } + + public void addDistance(double distance) { + this.distance += distance; + } + + private double averageSpeed; + + public double getAverageSpeed() { + return averageSpeed; + } + + public void setAverageSpeed(double averageSpeed) { + this.averageSpeed = averageSpeed; + } + + private double maxSpeed; + + public double getMaxSpeed() { + return maxSpeed; + } + + public void setMaxSpeed(double maxSpeed) { + this.maxSpeed = maxSpeed; + } + + private double spentFuel; + + public double getSpentFuel() { + return spentFuel; + } + + public void setSpentFuel(double spentFuel) { + this.spentFuel = spentFuel; + } + + private double startOdometer; + + public double getStartOdometer() { + return startOdometer; + } + + public void setStartOdometer(double startOdometer) { + this.startOdometer = startOdometer; + } + private double endOdometer; + + public double getEndOdometer() { + return endOdometer; + } + + public void setEndOdometer(double endOdometer) { + this.endOdometer = endOdometer; + } + + private Date startTime; + + public Date getStartTime() { + return startTime; + } + + public void setStartTime(Date startTime) { + this.startTime = startTime; + } + + private Date endTime; + + public Date getEndTime() { + return endTime; + } + + public void setEndTime(Date endTime) { + this.endTime = endTime; + } + +} diff --git a/src/main/java/org/traccar/reports/model/DeviceReport.java b/src/main/java/org/traccar/reports/model/DeviceReport.java deleted file mode 100644 index 932753d15..000000000 --- a/src/main/java/org/traccar/reports/model/DeviceReport.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright 2016 Anton Tananaev (anton@traccar.org) - * Copyright 2016 Andrey Kunitsyn (andrey@traccar.org) - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.traccar.reports.model; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; - -public class DeviceReport { - - private String deviceName; - - public String getDeviceName() { - return deviceName; - } - - public void setDeviceName(String deviceName) { - this.deviceName = deviceName; - } - - private String groupName = ""; - - public String getGroupName() { - return groupName; - } - - public void setGroupName(String groupName) { - this.groupName = groupName; - } - - private List objects; - - public Collection getObjects() { - return objects; - } - - public void setObjects(Collection objects) { - this.objects = new ArrayList<>(objects); - } - -} diff --git a/src/main/java/org/traccar/reports/model/DeviceReportSection.java b/src/main/java/org/traccar/reports/model/DeviceReportSection.java new file mode 100644 index 000000000..ffc4d774f --- /dev/null +++ b/src/main/java/org/traccar/reports/model/DeviceReportSection.java @@ -0,0 +1,55 @@ +/* + * Copyright 2016 Anton Tananaev (anton@traccar.org) + * Copyright 2016 Andrey Kunitsyn (andrey@traccar.org) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.traccar.reports.model; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; + +public class DeviceReportSection { + + private String deviceName; + + public String getDeviceName() { + return deviceName; + } + + public void setDeviceName(String deviceName) { + this.deviceName = deviceName; + } + + private String groupName = ""; + + public String getGroupName() { + return groupName; + } + + public void setGroupName(String groupName) { + this.groupName = groupName; + } + + private List objects; + + public Collection getObjects() { + return objects; + } + + public void setObjects(Collection objects) { + this.objects = new ArrayList<>(objects); + } + +} diff --git a/src/main/java/org/traccar/reports/model/StopReport.java b/src/main/java/org/traccar/reports/model/StopReport.java deleted file mode 100644 index e20f2c503..000000000 --- a/src/main/java/org/traccar/reports/model/StopReport.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright 2017 - 2020 Anton Tananaev (anton@traccar.org) - * Copyright 2017 Andrey Kunitsyn (andrey@traccar.org) - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.traccar.reports.model; - -public class StopReport extends BaseReport { - - private long positionId; - - public long getPositionId() { - return positionId; - } - - public void setPositionId(long positionId) { - this.positionId = positionId; - } - - private double latitude; - - public double getLatitude() { - return latitude; - } - - public void setLatitude(double latitude) { - this.latitude = latitude; - } - - private double longitude; - - public double getLongitude() { - return longitude; - } - - public void setLongitude(double longitude) { - this.longitude = longitude; - } - - private String address; - - public String getAddress() { - return address; - } - - public void setAddress(String address) { - this.address = address; - } - - private long duration; - - public long getDuration() { - return duration; - } - - public void setDuration(long duration) { - this.duration = duration; - } - - private long engineHours; // milliseconds - - public long getEngineHours() { - return engineHours; - } - - public void setEngineHours(long engineHours) { - this.engineHours = engineHours; - } -} diff --git a/src/main/java/org/traccar/reports/model/StopReportItem.java b/src/main/java/org/traccar/reports/model/StopReportItem.java new file mode 100644 index 000000000..3c35bdc21 --- /dev/null +++ b/src/main/java/org/traccar/reports/model/StopReportItem.java @@ -0,0 +1,80 @@ +/* + * Copyright 2017 - 2020 Anton Tananaev (anton@traccar.org) + * Copyright 2017 Andrey Kunitsyn (andrey@traccar.org) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.traccar.reports.model; + +public class StopReportItem extends BaseReportItem { + + private long positionId; + + public long getPositionId() { + return positionId; + } + + public void setPositionId(long positionId) { + this.positionId = positionId; + } + + private double latitude; + + public double getLatitude() { + return latitude; + } + + public void setLatitude(double latitude) { + this.latitude = latitude; + } + + private double longitude; + + public double getLongitude() { + return longitude; + } + + public void setLongitude(double longitude) { + this.longitude = longitude; + } + + private String address; + + public String getAddress() { + return address; + } + + public void setAddress(String address) { + this.address = address; + } + + private long duration; + + public long getDuration() { + return duration; + } + + public void setDuration(long duration) { + this.duration = duration; + } + + private long engineHours; // milliseconds + + public long getEngineHours() { + return engineHours; + } + + public void setEngineHours(long engineHours) { + this.engineHours = engineHours; + } +} diff --git a/src/main/java/org/traccar/reports/model/SummaryReport.java b/src/main/java/org/traccar/reports/model/SummaryReport.java deleted file mode 100644 index 886f8b9e2..000000000 --- a/src/main/java/org/traccar/reports/model/SummaryReport.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright 2016 - 2020 Anton Tananaev (anton@traccar.org) - * Copyright 2016 - 2017 Andrey Kunitsyn (andrey@traccar.org) - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.traccar.reports.model; - -public class SummaryReport extends BaseReport { - - private long engineHours; // milliseconds - - public long getEngineHours() { - return engineHours; - } - - public void setEngineHours(long engineHours) { - this.engineHours = engineHours; - } -} diff --git a/src/main/java/org/traccar/reports/model/SummaryReportItem.java b/src/main/java/org/traccar/reports/model/SummaryReportItem.java new file mode 100644 index 000000000..44a15cf1d --- /dev/null +++ b/src/main/java/org/traccar/reports/model/SummaryReportItem.java @@ -0,0 +1,30 @@ +/* + * Copyright 2016 - 2020 Anton Tananaev (anton@traccar.org) + * Copyright 2016 - 2017 Andrey Kunitsyn (andrey@traccar.org) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.traccar.reports.model; + +public class SummaryReportItem extends BaseReportItem { + + private long engineHours; // milliseconds + + public long getEngineHours() { + return engineHours; + } + + public void setEngineHours(long engineHours) { + this.engineHours = engineHours; + } +} diff --git a/src/main/java/org/traccar/reports/model/TripReport.java b/src/main/java/org/traccar/reports/model/TripReport.java deleted file mode 100644 index 151c34bd5..000000000 --- a/src/main/java/org/traccar/reports/model/TripReport.java +++ /dev/null @@ -1,130 +0,0 @@ -/* - * Copyright 2016 Anton Tananaev (anton@traccar.org) - * Copyright 2016 Andrey Kunitsyn (andrey@traccar.org) - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.traccar.reports.model; - -public class TripReport extends BaseReport { - - private long startPositionId; - - public long getStartPositionId() { - return startPositionId; - } - - public void setStartPositionId(long startPositionId) { - this.startPositionId = startPositionId; - } - - private long endPositionId; - - public long getEndPositionId() { - return endPositionId; - } - - public void setEndPositionId(long endPositionId) { - this.endPositionId = endPositionId; - } - - private double startLat; - - public double getStartLat() { - return startLat; - } - - public void setStartLat(double startLat) { - this.startLat = startLat; - } - - private double startLon; - - public double getStartLon() { - return startLon; - } - - public void setStartLon(double startLon) { - this.startLon = startLon; - } - - private double endLat; - - public double getEndLat() { - return endLat; - } - - public void setEndLat(double endLat) { - this.endLat = endLat; - } - - private double endLon; - - public double getEndLon() { - return endLon; - } - - public void setEndLon(double endLon) { - this.endLon = endLon; - } - - private String startAddress; - - public String getStartAddress() { - return startAddress; - } - - public void setStartAddress(String address) { - this.startAddress = address; - } - - private String endAddress; - - public String getEndAddress() { - return endAddress; - } - - public void setEndAddress(String address) { - this.endAddress = address; - } - - private long duration; - - public long getDuration() { - return duration; - } - - public void setDuration(long duration) { - this.duration = duration; - } - - private String driverUniqueId; - - public String getDriverUniqueId() { - return driverUniqueId; - } - - public void setDriverUniqueId(String driverUniqueId) { - this.driverUniqueId = driverUniqueId; - } - - private String driverName; - - public String getDriverName() { - return driverName; - } - - public void setDriverName(String driverName) { - this.driverName = driverName; - } -} diff --git a/src/main/java/org/traccar/reports/model/TripReportItem.java b/src/main/java/org/traccar/reports/model/TripReportItem.java new file mode 100644 index 000000000..332a34cca --- /dev/null +++ b/src/main/java/org/traccar/reports/model/TripReportItem.java @@ -0,0 +1,130 @@ +/* + * Copyright 2016 Anton Tananaev (anton@traccar.org) + * Copyright 2016 Andrey Kunitsyn (andrey@traccar.org) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.traccar.reports.model; + +public class TripReportItem extends BaseReportItem { + + private long startPositionId; + + public long getStartPositionId() { + return startPositionId; + } + + public void setStartPositionId(long startPositionId) { + this.startPositionId = startPositionId; + } + + private long endPositionId; + + public long getEndPositionId() { + return endPositionId; + } + + public void setEndPositionId(long endPositionId) { + this.endPositionId = endPositionId; + } + + private double startLat; + + public double getStartLat() { + return startLat; + } + + public void setStartLat(double startLat) { + this.startLat = startLat; + } + + private double startLon; + + public double getStartLon() { + return startLon; + } + + public void setStartLon(double startLon) { + this.startLon = startLon; + } + + private double endLat; + + public double getEndLat() { + return endLat; + } + + public void setEndLat(double endLat) { + this.endLat = endLat; + } + + private double endLon; + + public double getEndLon() { + return endLon; + } + + public void setEndLon(double endLon) { + this.endLon = endLon; + } + + private String startAddress; + + public String getStartAddress() { + return startAddress; + } + + public void setStartAddress(String address) { + this.startAddress = address; + } + + private String endAddress; + + public String getEndAddress() { + return endAddress; + } + + public void setEndAddress(String address) { + this.endAddress = address; + } + + private long duration; + + public long getDuration() { + return duration; + } + + public void setDuration(long duration) { + this.duration = duration; + } + + private String driverUniqueId; + + public String getDriverUniqueId() { + return driverUniqueId; + } + + public void setDriverUniqueId(String driverUniqueId) { + this.driverUniqueId = driverUniqueId; + } + + private String driverName; + + public String getDriverName() { + return driverName; + } + + public void setDriverName(String driverName) { + this.driverName = driverName; + } +} -- cgit v1.2.3