diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2021-08-24 23:14:30 -0700 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2021-08-24 23:14:30 -0700 |
commit | 297e330ead69b92a4723369098e7c4dbf7aa5694 (patch) | |
tree | 9643153ca03841a76e76789750e2d6769b673225 /src/main/java/org/traccar/database | |
parent | 0a98b2b5471526d9d166c4b81f1500fd1edb60df (diff) | |
download | trackermap-server-297e330ead69b92a4723369098e7c4dbf7aa5694.tar.gz trackermap-server-297e330ead69b92a4723369098e7c4dbf7aa5694.tar.bz2 trackermap-server-297e330ead69b92a4723369098e7c4dbf7aa5694.zip |
Implement orders functionality
Diffstat (limited to 'src/main/java/org/traccar/database')
-rw-r--r-- | src/main/java/org/traccar/database/DataManager.java | 3 | ||||
-rw-r--r-- | src/main/java/org/traccar/database/OrderManager.java | 26 | ||||
-rw-r--r-- | src/main/java/org/traccar/database/PermissionsManager.java | 9 |
3 files changed, 37 insertions, 1 deletions
diff --git a/src/main/java/org/traccar/database/DataManager.java b/src/main/java/org/traccar/database/DataManager.java index de6da8f23..00c802fde 100644 --- a/src/main/java/org/traccar/database/DataManager.java +++ b/src/main/java/org/traccar/database/DataManager.java @@ -41,6 +41,7 @@ import org.traccar.model.Group; import org.traccar.model.Maintenance; import org.traccar.model.ManagedUser; import org.traccar.model.Notification; +import org.traccar.model.Order; import org.traccar.model.Permission; import org.traccar.model.Position; import org.traccar.model.Server; @@ -388,6 +389,8 @@ public class DataManager { return Maintenance.class; case "notification": return Notification.class; + case "order": + return Order.class; default: throw new ClassNotFoundException(); } diff --git a/src/main/java/org/traccar/database/OrderManager.java b/src/main/java/org/traccar/database/OrderManager.java new file mode 100644 index 000000000..c3253e52f --- /dev/null +++ b/src/main/java/org/traccar/database/OrderManager.java @@ -0,0 +1,26 @@ +/* + * Copyright 2021 Anton Tananaev (anton@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.database; + +import org.traccar.model.Order; + +public class OrderManager extends ExtendedObjectManager<Order> { + + public OrderManager(DataManager dataManager) { + super(dataManager, Order.class); + } + +} diff --git a/src/main/java/org/traccar/database/PermissionsManager.java b/src/main/java/org/traccar/database/PermissionsManager.java index a27eac069..32464cf90 100644 --- a/src/main/java/org/traccar/database/PermissionsManager.java +++ b/src/main/java/org/traccar/database/PermissionsManager.java @@ -1,5 +1,5 @@ /* - * Copyright 2015 - 2018 Anton Tananaev (anton@traccar.org) + * Copyright 2015 - 2021 Anton Tananaev (anton@traccar.org) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -29,6 +29,7 @@ import org.traccar.model.Group; import org.traccar.model.Maintenance; import org.traccar.model.ManagedUser; import org.traccar.model.Notification; +import org.traccar.model.Order; import org.traccar.model.Permission; import org.traccar.model.Server; import org.traccar.model.User; @@ -395,6 +396,8 @@ public class PermissionsManager { manager = Context.getMaintenancesManager(); } else if (object.equals(Notification.class)) { manager = Context.getNotificationManager(); + } else if (object.equals(Order.class)) { + manager = Context.getOrderManager(); } else { throw new IllegalArgumentException("Unknown object type"); } @@ -454,6 +457,8 @@ public class PermissionsManager { Context.getCommandsManager().refreshUserItems(); } else if (permission.getPropertyClass().equals(Maintenance.class)) { Context.getMaintenancesManager().refreshUserItems(); + } else if (permission.getPropertyClass().equals(Order.class)) { + Context.getOrderManager().refreshUserItems(); } else if (permission.getPropertyClass().equals(Notification.class) && Context.getNotificationManager() != null) { Context.getNotificationManager().refreshUserItems(); @@ -469,6 +474,8 @@ public class PermissionsManager { Context.getCommandsManager().refreshExtendedPermissions(); } else if (permission.getPropertyClass().equals(Maintenance.class)) { Context.getMaintenancesManager().refreshExtendedPermissions(); + } else if (permission.getPropertyClass().equals(Order.class)) { + Context.getOrderManager().refreshExtendedPermissions(); } else if (permission.getPropertyClass().equals(Notification.class) && Context.getNotificationManager() != null) { Context.getNotificationManager().refreshExtendedPermissions(); |