From a9478ded48de140d47d17def1ee5329267fe6088 Mon Sep 17 00:00:00 2001 From: Abyss777 Date: Wed, 19 Jul 2017 15:24:55 +0500 Subject: Refactored four managers --- src/org/traccar/model/CalendarPermission.java | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) (limited to 'src/org/traccar/model/CalendarPermission.java') diff --git a/src/org/traccar/model/CalendarPermission.java b/src/org/traccar/model/CalendarPermission.java index 59f54e07b..d95e51b0e 100644 --- a/src/org/traccar/model/CalendarPermission.java +++ b/src/org/traccar/model/CalendarPermission.java @@ -16,17 +16,7 @@ */ package org.traccar.model; -public class CalendarPermission { - - private long userId; - - public long getUserId() { - return userId; - } - - public void setUserId(long userId) { - this.userId = userId; - } +public class CalendarPermission extends BaseUserPermission { private long calendarId; @@ -37,4 +27,9 @@ public class CalendarPermission { public void setCalendarId(long calendarId) { this.calendarId = calendarId; } + + @Override + public long getSlaveId() { + return calendarId; + } } -- cgit v1.2.3 From 839e741653c9b61e573fa1cdd0dad0641c79bcec Mon Sep 17 00:00:00 2001 From: Abyss777 Date: Fri, 21 Jul 2017 09:59:27 +0500 Subject: Abolish permissions classes and get permissions as Map from DB --- src/org/traccar/database/AttributesManager.java | 5 +-- src/org/traccar/database/CalendarManager.java | 3 +- src/org/traccar/database/DataManager.java | 8 +++++ src/org/traccar/database/DriversManager.java | 5 +-- .../traccar/database/ExtendedObjectManager.java | 33 ++++++----------- src/org/traccar/database/GeofenceManager.java | 5 +-- src/org/traccar/database/PermissionsManager.java | 24 ++++++------- src/org/traccar/database/QueryBuilder.java | 25 +++++++++++++ src/org/traccar/database/SimpleObjectManager.java | 23 +++++++----- src/org/traccar/model/AttributePermission.java | 36 ------------------- src/org/traccar/model/BaseDevicePermission.java | 31 ---------------- src/org/traccar/model/BaseGroupPermission.java | 31 ---------------- src/org/traccar/model/BasePermission.java | 23 ------------ src/org/traccar/model/BaseUserPermission.java | 31 ---------------- src/org/traccar/model/CalendarPermission.java | 35 ------------------ src/org/traccar/model/DeviceAttribute.java | 35 ------------------ src/org/traccar/model/DeviceDriver.java | 36 ------------------- src/org/traccar/model/DeviceGeofence.java | 35 ------------------ src/org/traccar/model/DevicePermission.java | 40 --------------------- src/org/traccar/model/DriverPermission.java | 35 ------------------ src/org/traccar/model/GeofencePermission.java | 35 ------------------ src/org/traccar/model/GroupAttribute.java | 35 ------------------ src/org/traccar/model/GroupDriver.java | 36 ------------------- src/org/traccar/model/GroupGeofence.java | 35 ------------------ src/org/traccar/model/GroupPermission.java | 40 --------------------- src/org/traccar/model/UserPermission.java | 41 ---------------------- 26 files changed, 74 insertions(+), 647 deletions(-) delete mode 100644 src/org/traccar/model/AttributePermission.java delete mode 100644 src/org/traccar/model/BaseDevicePermission.java delete mode 100644 src/org/traccar/model/BaseGroupPermission.java delete mode 100644 src/org/traccar/model/BasePermission.java delete mode 100644 src/org/traccar/model/BaseUserPermission.java delete mode 100644 src/org/traccar/model/CalendarPermission.java delete mode 100644 src/org/traccar/model/DeviceAttribute.java delete mode 100644 src/org/traccar/model/DeviceDriver.java delete mode 100644 src/org/traccar/model/DeviceGeofence.java delete mode 100644 src/org/traccar/model/DevicePermission.java delete mode 100644 src/org/traccar/model/DriverPermission.java delete mode 100644 src/org/traccar/model/GeofencePermission.java delete mode 100644 src/org/traccar/model/GroupAttribute.java delete mode 100644 src/org/traccar/model/GroupDriver.java delete mode 100644 src/org/traccar/model/GroupGeofence.java delete mode 100644 src/org/traccar/model/GroupPermission.java delete mode 100644 src/org/traccar/model/UserPermission.java (limited to 'src/org/traccar/model/CalendarPermission.java') diff --git a/src/org/traccar/database/AttributesManager.java b/src/org/traccar/database/AttributesManager.java index 6531019d1..266fc5526 100644 --- a/src/org/traccar/database/AttributesManager.java +++ b/src/org/traccar/database/AttributesManager.java @@ -18,16 +18,13 @@ package org.traccar.database; import java.sql.SQLException; -import org.traccar.model.AttributePermission; import org.traccar.model.Attribute; -import org.traccar.model.DeviceAttribute; -import org.traccar.model.GroupAttribute; import org.traccar.model.BaseModel; public class AttributesManager extends ExtendedObjectManager { public AttributesManager(DataManager dataManager) { - super(dataManager, Attribute.class, AttributePermission.class, DeviceAttribute.class, GroupAttribute.class); + super(dataManager, Attribute.class); refreshItems(); refreshExtendedPermissions(); } diff --git a/src/org/traccar/database/CalendarManager.java b/src/org/traccar/database/CalendarManager.java index e00b4faa6..80bb79db2 100644 --- a/src/org/traccar/database/CalendarManager.java +++ b/src/org/traccar/database/CalendarManager.java @@ -17,12 +17,11 @@ package org.traccar.database; import org.traccar.model.Calendar; -import org.traccar.model.CalendarPermission; public class CalendarManager extends SimpleObjectManager { public CalendarManager(DataManager dataManager) { - super(dataManager, Calendar.class, CalendarPermission.class); + super(dataManager, Calendar.class); refreshItems(); } diff --git a/src/org/traccar/database/DataManager.java b/src/org/traccar/database/DataManager.java index 7497294a1..39ffe6552 100644 --- a/src/org/traccar/database/DataManager.java +++ b/src/org/traccar/database/DataManager.java @@ -285,6 +285,14 @@ public class DataManager { return QueryBuilder.create(dataSource, getQuery(query)).executeQuery(clazz); } + public Collection> getPermissions(String owner, String property) throws SQLException { + String query = "database.select" + + owner.substring(0, 1).toUpperCase() + owner.substring(1) + + property.substring(0, 1).toUpperCase() + property.substring(1) + + "s"; + return QueryBuilder.create(dataSource, getQuery(query)).executeMapQuery(Long.class); + } + public void addObject(BaseModel entity) throws SQLException { String query = "database.insert" + entity.getClass().getSimpleName(); entity.setId(QueryBuilder.create(dataSource, getQuery(query), true) diff --git a/src/org/traccar/database/DriversManager.java b/src/org/traccar/database/DriversManager.java index dba06a37f..8c35f3ddf 100644 --- a/src/org/traccar/database/DriversManager.java +++ b/src/org/traccar/database/DriversManager.java @@ -21,10 +21,7 @@ import java.util.Map; import java.util.concurrent.ConcurrentHashMap; import org.traccar.helper.Log; -import org.traccar.model.DeviceDriver; import org.traccar.model.Driver; -import org.traccar.model.DriverPermission; -import org.traccar.model.GroupDriver; import org.traccar.model.BaseModel; public class DriversManager extends ExtendedObjectManager { @@ -32,7 +29,7 @@ public class DriversManager extends ExtendedObjectManager { private final Map driversByUniqueId = new ConcurrentHashMap<>(); public DriversManager(DataManager dataManager) { - super(dataManager, Driver.class, DriverPermission.class, DeviceDriver.class, GroupDriver.class); + super(dataManager, Driver.class); refreshItems(); refreshExtendedPermissions(); } diff --git a/src/org/traccar/database/ExtendedObjectManager.java b/src/org/traccar/database/ExtendedObjectManager.java index caad989c2..fce32fb41 100644 --- a/src/org/traccar/database/ExtendedObjectManager.java +++ b/src/org/traccar/database/ExtendedObjectManager.java @@ -25,9 +25,6 @@ import java.util.concurrent.ConcurrentHashMap; import org.traccar.Context; import org.traccar.helper.Log; -import org.traccar.model.BaseDevicePermission; -import org.traccar.model.BaseGroupPermission; -import org.traccar.model.BaseUserPermission; import org.traccar.model.Device; import org.traccar.model.BaseModel; @@ -37,17 +34,9 @@ public abstract class ExtendedObjectManager extends SimpleObjectManager { private final Map> deviceItemsWithGroups = new ConcurrentHashMap<>(); private final Map> groupItems = new ConcurrentHashMap<>(); - private Class devicePermissionClass; - private Class groupPermissionClass; - protected ExtendedObjectManager(DataManager dataManager, - Class baseClass, - Class permissionClass, - Class devicePermissionClass, - Class groupPermissionClass) { - super(dataManager, baseClass, permissionClass); - this.devicePermissionClass = devicePermissionClass; - this.groupPermissionClass = groupPermissionClass; + Class baseClass) { + super(dataManager, baseClass); } public final Set getGroupItems(long groupId) { @@ -89,24 +78,24 @@ public abstract class ExtendedObjectManager extends SimpleObjectManager { if (getDataManager() != null) { try { - Collection databaseGroupPermissions = - getDataManager().getObjects(groupPermissionClass); + Collection> databaseGroupPermissions = + getDataManager().getPermissions("Group", getBaseClassName()); clearGroupItems(); - for (BaseGroupPermission groupPermission : databaseGroupPermissions) { - getGroupItems(groupPermission.getGroupId()).add(groupPermission.getSlaveId()); + for (Map groupPermission : databaseGroupPermissions) { + getGroupItems(groupPermission.get("groupId")).add(groupPermission.get(getBaseClassIdName())); } - Collection databaseDevicePermissions = - getDataManager().getObjects(devicePermissionClass); + Collection> databaseDevicePermissions = + getDataManager().getPermissions("Device", getBaseClassName()); Collection allDevices = Context.getDeviceManager().getAllDevices(); clearDeviceItems(); deviceItemsWithGroups.clear(); - for (BaseDevicePermission devicePermission : databaseDevicePermissions) { - getDeviceItems(devicePermission.getDeviceId()).add(devicePermission.getSlaveId()); - getAllDeviceItems(devicePermission.getDeviceId()).add(devicePermission.getSlaveId()); + for (Map devicePermission : databaseDevicePermissions) { + getDeviceItems(devicePermission.get("deviceId")).add(devicePermission.get(getBaseClassIdName())); + getAllDeviceItems(devicePermission.get("deviceId")).add(devicePermission.get(getBaseClassIdName())); } for (Device device : allDevices) { diff --git a/src/org/traccar/database/GeofenceManager.java b/src/org/traccar/database/GeofenceManager.java index ed1f26f78..bc2c27a65 100644 --- a/src/org/traccar/database/GeofenceManager.java +++ b/src/org/traccar/database/GeofenceManager.java @@ -20,16 +20,13 @@ import java.util.List; import org.traccar.Context; import org.traccar.model.Device; -import org.traccar.model.DeviceGeofence; import org.traccar.model.Geofence; -import org.traccar.model.GeofencePermission; -import org.traccar.model.GroupGeofence; import org.traccar.model.Position; public class GeofenceManager extends ExtendedObjectManager { public GeofenceManager(DataManager dataManager) { - super(dataManager, Geofence.class, GeofencePermission.class, DeviceGeofence.class, GroupGeofence.class); + super(dataManager, Geofence.class); refreshItems(); refreshExtendedPermissions(); } diff --git a/src/org/traccar/database/PermissionsManager.java b/src/org/traccar/database/PermissionsManager.java index caae86b84..4646071aa 100644 --- a/src/org/traccar/database/PermissionsManager.java +++ b/src/org/traccar/database/PermissionsManager.java @@ -18,12 +18,9 @@ package org.traccar.database; import org.traccar.Context; import org.traccar.helper.Log; import org.traccar.model.Device; -import org.traccar.model.DevicePermission; import org.traccar.model.Group; -import org.traccar.model.GroupPermission; import org.traccar.model.Server; import org.traccar.model.User; -import org.traccar.model.UserPermission; import java.lang.reflect.Method; import java.sql.SQLException; @@ -112,8 +109,8 @@ public class PermissionsManager { public final void refreshUserPermissions() { userPermissions.clear(); try { - for (UserPermission permission : dataManager.getObjects(UserPermission.class)) { - getUserPermissions(permission.getUserId()).add(permission.getManagedUserId()); + for (Map permission : dataManager.getPermissions("User", "Permission")) { + getUserPermissions(permission.get("userId")).add(permission.get("managedUserId")); } } catch (SQLException error) { Log.warning(error); @@ -126,19 +123,20 @@ public class PermissionsManager { try { GroupTree groupTree = new GroupTree(Context.getDeviceManager().getAllGroups(), Context.getDeviceManager().getAllDevices()); - for (GroupPermission permission : dataManager.getObjects(GroupPermission.class)) { - Set userGroupPermissions = getGroupPermissions(permission.getUserId()); - Set userDevicePermissions = getDevicePermissions(permission.getUserId()); - userGroupPermissions.add(permission.getGroupId()); - for (Group group : groupTree.getGroups(permission.getGroupId())) { + for (Map groupPermission : dataManager.getPermissions("Group", "Permission")) { + Set userGroupPermissions = getGroupPermissions(groupPermission.get("userId")); + Set userDevicePermissions = getDevicePermissions(groupPermission.get("userId")); + userGroupPermissions.add(groupPermission.get("groupId")); + for (Group group : groupTree.getGroups(groupPermission.get("groupId"))) { userGroupPermissions.add(group.getId()); } - for (Device device : groupTree.getDevices(permission.getGroupId())) { + for (Device device : groupTree.getDevices(groupPermission.get("groupId"))) { userDevicePermissions.add(device.getId()); } } - for (DevicePermission permission : dataManager.getObjects(DevicePermission.class)) { - getDevicePermissions(permission.getUserId()).add(permission.getDeviceId()); + + for (Map devicePermission : dataManager.getPermissions("Device", "Permission")) { + getDevicePermissions(devicePermission.get("userId")).add(devicePermission.get("deviceId")); } groupDevices.clear(); diff --git a/src/org/traccar/database/QueryBuilder.java b/src/org/traccar/database/QueryBuilder.java index a24e6f0bf..440690a76 100644 --- a/src/org/traccar/database/QueryBuilder.java +++ b/src/org/traccar/database/QueryBuilder.java @@ -35,6 +35,7 @@ import java.sql.Types; import java.util.Collection; import java.util.Date; import java.util.HashMap; +import java.util.LinkedHashMap; import java.util.LinkedList; import java.util.List; import java.util.Map; @@ -487,4 +488,28 @@ public final class QueryBuilder { return 0; } + public Collection> executeMapQuery(Class clazz) throws SQLException { + List> result = new LinkedList<>(); + if (query != null) { + try { + try (ResultSet resultSet = statement.executeQuery()) { + ResultSetMetaData resultMetaData = resultSet.getMetaData(); + while (resultSet.next()) { + LinkedHashMap map = new LinkedHashMap<>(); + for (int i = 1; i <= resultMetaData.getColumnCount(); i++) { + String label = resultMetaData.getColumnLabel(i); + map.put(label, resultSet.getObject(label, clazz)); + } + result.add(map); + } + } + } finally { + statement.close(); + connection.close(); + } + } + + return result; + } + } diff --git a/src/org/traccar/database/SimpleObjectManager.java b/src/org/traccar/database/SimpleObjectManager.java index aae407b56..c4fc0e97a 100644 --- a/src/org/traccar/database/SimpleObjectManager.java +++ b/src/org/traccar/database/SimpleObjectManager.java @@ -26,7 +26,6 @@ import java.util.concurrent.ConcurrentHashMap; import org.traccar.Context; import org.traccar.helper.Log; -import org.traccar.model.BaseUserPermission; import org.traccar.model.BaseModel; public abstract class SimpleObjectManager { @@ -37,14 +36,14 @@ public abstract class SimpleObjectManager { private final Map> userItems = new ConcurrentHashMap<>(); private Class baseClass; - private Class permissionClass; + private String baseClassName; + private String baseClassIdName; - protected SimpleObjectManager(DataManager dataManager, - Class baseClass, - Class permissionClass) { + protected SimpleObjectManager(DataManager dataManager, Class baseClass) { this.dataManager = dataManager; this.baseClass = baseClass; - this.permissionClass = permissionClass; + baseClassName = baseClass.getSimpleName(); + baseClassIdName = baseClassName.substring(0, 1).toLowerCase() + baseClassName.substring(1) + "Id"; } protected final DataManager getDataManager() { @@ -55,6 +54,14 @@ public abstract class SimpleObjectManager { return baseClass; } + protected final String getBaseClassName() { + return baseClassName; + } + + protected final String getBaseClassIdName() { + return baseClassIdName; + } + public final BaseModel getById(long itemId) { return items.get(itemId); } @@ -104,8 +111,8 @@ public abstract class SimpleObjectManager { if (dataManager != null) { try { clearUserItems(); - for (BaseUserPermission permission : dataManager.getObjects(this.permissionClass)) { - getUserItems(permission.getUserId()).add(permission.getSlaveId()); + for (Map permission : dataManager.getPermissions(baseClassName, "Permission")) { + getUserItems(permission.get("userId")).add(permission.get(baseClassIdName)); } } catch (SQLException error) { Log.warning(error); diff --git a/src/org/traccar/model/AttributePermission.java b/src/org/traccar/model/AttributePermission.java deleted file mode 100644 index e6bbb0f91..000000000 --- a/src/org/traccar/model/AttributePermission.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright 2017 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.model; - -public class AttributePermission extends BaseUserPermission { - - private long attributeId; - - public long getAttributeId() { - return attributeId; - } - - public void setAttributeId(long attributeId) { - this.attributeId = attributeId; - } - - @Override - public long getSlaveId() { - return attributeId; - } - -} diff --git a/src/org/traccar/model/BaseDevicePermission.java b/src/org/traccar/model/BaseDevicePermission.java deleted file mode 100644 index 6eda15d0e..000000000 --- a/src/org/traccar/model/BaseDevicePermission.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright 2017 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.model; - -public abstract class BaseDevicePermission implements BasePermission { - - private long deviceId; - - public long getDeviceId() { - return deviceId; - } - - public void setDeviceId(long deviceId) { - this.deviceId = deviceId; - } - -} diff --git a/src/org/traccar/model/BaseGroupPermission.java b/src/org/traccar/model/BaseGroupPermission.java deleted file mode 100644 index 5a289cad2..000000000 --- a/src/org/traccar/model/BaseGroupPermission.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright 2017 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.model; - -public abstract class BaseGroupPermission implements BasePermission { - - private long groupId; - - public long getGroupId() { - return groupId; - } - - public void setGroupId(long groupId) { - this.groupId = groupId; - } - -} diff --git a/src/org/traccar/model/BasePermission.java b/src/org/traccar/model/BasePermission.java deleted file mode 100644 index 6f1baffdc..000000000 --- a/src/org/traccar/model/BasePermission.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright 2017 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.model; - -public interface BasePermission { - - long getSlaveId(); - -} diff --git a/src/org/traccar/model/BaseUserPermission.java b/src/org/traccar/model/BaseUserPermission.java deleted file mode 100644 index 64a7be82a..000000000 --- a/src/org/traccar/model/BaseUserPermission.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright 2017 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.model; - -public abstract class BaseUserPermission implements BasePermission { - - private long userId; - - public long getUserId() { - return userId; - } - - public void setUserId(long userId) { - this.userId = userId; - } - -} diff --git a/src/org/traccar/model/CalendarPermission.java b/src/org/traccar/model/CalendarPermission.java deleted file mode 100644 index d95e51b0e..000000000 --- a/src/org/traccar/model/CalendarPermission.java +++ /dev/null @@ -1,35 +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.model; - -public class CalendarPermission extends BaseUserPermission { - - private long calendarId; - - public long getCalendarId() { - return calendarId; - } - - public void setCalendarId(long calendarId) { - this.calendarId = calendarId; - } - - @Override - public long getSlaveId() { - return calendarId; - } -} diff --git a/src/org/traccar/model/DeviceAttribute.java b/src/org/traccar/model/DeviceAttribute.java deleted file mode 100644 index bfcd873fa..000000000 --- a/src/org/traccar/model/DeviceAttribute.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright 2017 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.model; - -public class DeviceAttribute extends BaseDevicePermission { - - private long attributeId; - - public long getAttributeId() { - return attributeId; - } - - public void setAttributeId(long attributeId) { - this.attributeId = attributeId; - } - - @Override - public long getSlaveId() { - return attributeId; - } -} diff --git a/src/org/traccar/model/DeviceDriver.java b/src/org/traccar/model/DeviceDriver.java deleted file mode 100644 index f5257531d..000000000 --- a/src/org/traccar/model/DeviceDriver.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright 2017 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.model; - -public class DeviceDriver extends BaseDevicePermission { - - private long driverId; - - public long getDriverId() { - return driverId; - } - - public void setDriverId(long driverId) { - this.driverId = driverId; - } - - @Override - public long getSlaveId() { - return driverId; - } - -} diff --git a/src/org/traccar/model/DeviceGeofence.java b/src/org/traccar/model/DeviceGeofence.java deleted file mode 100644 index 7ea4d3bea..000000000 --- a/src/org/traccar/model/DeviceGeofence.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright 2016 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.model; - -public class DeviceGeofence extends BaseDevicePermission { - - private long geofenceId; - - public long getGeofenceId() { - return geofenceId; - } - - public void setGeofenceId(long geofenceId) { - this.geofenceId = geofenceId; - } - - @Override - public long getSlaveId() { - return geofenceId; - } - -} diff --git a/src/org/traccar/model/DevicePermission.java b/src/org/traccar/model/DevicePermission.java deleted file mode 100644 index c62173132..000000000 --- a/src/org/traccar/model/DevicePermission.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright 2015 - 2016 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.model; - -public class DevicePermission { - - private long userId; - - public long getUserId() { - return userId; - } - - public void setUserId(long userId) { - this.userId = userId; - } - - private long deviceId; - - public long getDeviceId() { - return deviceId; - } - - public void setDeviceId(long deviceId) { - this.deviceId = deviceId; - } - -} diff --git a/src/org/traccar/model/DriverPermission.java b/src/org/traccar/model/DriverPermission.java deleted file mode 100644 index 44f34c8e6..000000000 --- a/src/org/traccar/model/DriverPermission.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright 2017 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.model; - -public class DriverPermission extends BaseUserPermission { - - private long driverId; - - public long getDriverId() { - return driverId; - } - - public void setDriverId(long driverId) { - this.driverId = driverId; - } - - @Override - public long getSlaveId() { - return driverId; - } -} diff --git a/src/org/traccar/model/GeofencePermission.java b/src/org/traccar/model/GeofencePermission.java deleted file mode 100644 index 8606cc3e7..000000000 --- a/src/org/traccar/model/GeofencePermission.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright 2016 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.model; - -public class GeofencePermission extends BaseUserPermission { - - private long geofenceId; - - public long getGeofenceId() { - return geofenceId; - } - - public void setGeofenceId(long geofenceId) { - this.geofenceId = geofenceId; - } - - @Override - public long getSlaveId() { - return geofenceId; - } - -} diff --git a/src/org/traccar/model/GroupAttribute.java b/src/org/traccar/model/GroupAttribute.java deleted file mode 100644 index cfaf9cc2f..000000000 --- a/src/org/traccar/model/GroupAttribute.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright 2017 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.model; - -public class GroupAttribute extends BaseGroupPermission { - - private long attributeId; - - public long getAttributeId() { - return attributeId; - } - - public void setAttributeId(long attributeId) { - this.attributeId = attributeId; - } - - @Override - public long getSlaveId() { - return attributeId; - } -} diff --git a/src/org/traccar/model/GroupDriver.java b/src/org/traccar/model/GroupDriver.java deleted file mode 100644 index 9bf74c214..000000000 --- a/src/org/traccar/model/GroupDriver.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright 2017 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.model; - -public class GroupDriver extends BaseGroupPermission { - - private long driverId; - - public long getDriverId() { - return driverId; - } - - public void setDriverId(long driverId) { - this.driverId = driverId; - } - - @Override - public long getSlaveId() { - return driverId; - } - -} diff --git a/src/org/traccar/model/GroupGeofence.java b/src/org/traccar/model/GroupGeofence.java deleted file mode 100644 index 89830324d..000000000 --- a/src/org/traccar/model/GroupGeofence.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright 2016 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.model; - -public class GroupGeofence extends BaseGroupPermission { - - private long geofenceId; - - public long getGeofenceId() { - return geofenceId; - } - - public void setGeofenceId(long geofenceId) { - this.geofenceId = geofenceId; - } - - @Override - public long getSlaveId() { - return geofenceId; - } - -} diff --git a/src/org/traccar/model/GroupPermission.java b/src/org/traccar/model/GroupPermission.java deleted file mode 100644 index 59b41b049..000000000 --- a/src/org/traccar/model/GroupPermission.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright 2016 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.model; - -public class GroupPermission { - - private long userId; - - public long getUserId() { - return userId; - } - - public void setUserId(long userId) { - this.userId = userId; - } - - private long groupId; - - public long getGroupId() { - return groupId; - } - - public void setGroupId(long groupId) { - this.groupId = groupId; - } - -} diff --git a/src/org/traccar/model/UserPermission.java b/src/org/traccar/model/UserPermission.java deleted file mode 100644 index 39ead5ef1..000000000 --- a/src/org/traccar/model/UserPermission.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright 2017 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.model; - -public class UserPermission { - - private long userId; - - public long getUserId() { - return userId; - } - - public void setUserId(long userId) { - this.userId = userId; - } - - private long managedUserId; - - public long getManagedUserId() { - return managedUserId; - } - - public void setManagedUserId(long managedUserId) { - this.managedUserId = managedUserId; - } - -} -- cgit v1.2.3