aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/model
diff options
context:
space:
mode:
Diffstat (limited to 'src/org/traccar/model')
-rw-r--r--src/org/traccar/model/Attribute.java61
-rw-r--r--src/org/traccar/model/BaseModel.java31
-rw-r--r--src/org/traccar/model/Calendar.java82
-rw-r--r--src/org/traccar/model/CellTower.java115
-rw-r--r--src/org/traccar/model/Command.java111
-rw-r--r--src/org/traccar/model/Device.java152
-rw-r--r--src/org/traccar/model/DeviceState.java61
-rw-r--r--src/org/traccar/model/DeviceTotalDistance.java41
-rw-r--r--src/org/traccar/model/Driver.java40
-rw-r--r--src/org/traccar/model/Event.java102
-rw-r--r--src/org/traccar/model/ExtendedModel.java127
-rw-r--r--src/org/traccar/model/Geofence.java100
-rw-r--r--src/org/traccar/model/Group.java40
-rw-r--r--src/org/traccar/model/ManagedUser.java21
-rw-r--r--src/org/traccar/model/Message.java40
-rw-r--r--src/org/traccar/model/MiscFormatter.java56
-rw-r--r--src/org/traccar/model/Network.java117
-rw-r--r--src/org/traccar/model/Notification.java69
-rw-r--r--src/org/traccar/model/Permission.java57
-rw-r--r--src/org/traccar/model/Position.java309
-rw-r--r--src/org/traccar/model/Server.java160
-rw-r--r--src/org/traccar/model/Statistics.java130
-rw-r--r--src/org/traccar/model/Typed.java33
-rw-r--r--src/org/traccar/model/User.java264
-rw-r--r--src/org/traccar/model/WifiAccessPoint.java66
25 files changed, 0 insertions, 2385 deletions
diff --git a/src/org/traccar/model/Attribute.java b/src/org/traccar/model/Attribute.java
deleted file mode 100644
index 45d40b3ec..000000000
--- a/src/org/traccar/model/Attribute.java
+++ /dev/null
@@ -1,61 +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 Attribute extends BaseModel {
-
- private String description;
-
- public String getDescription() {
- return description;
- }
-
- public void setDescription(String description) {
- this.description = description;
- }
-
- private String attribute;
-
- public String getAttribute() {
- return attribute;
- }
-
- public void setAttribute(String attribute) {
- this.attribute = attribute;
- }
-
- private String expression;
-
- public String getExpression() {
- return expression;
- }
-
- public void setExpression(String expression) {
- this.expression = expression;
- }
-
- private String type;
-
- public String getType() {
- return type;
- }
-
- public void setType(String type) {
- this.type = type;
- }
-
-}
diff --git a/src/org/traccar/model/BaseModel.java b/src/org/traccar/model/BaseModel.java
deleted file mode 100644
index 8bdb916e8..000000000
--- a/src/org/traccar/model/BaseModel.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 class BaseModel {
-
- private long id;
-
- public final long getId() {
- return id;
- }
-
- public final void setId(long id) {
- this.id = id;
- }
-
-}
diff --git a/src/org/traccar/model/Calendar.java b/src/org/traccar/model/Calendar.java
deleted file mode 100644
index 56d3eb74c..000000000
--- a/src/org/traccar/model/Calendar.java
+++ /dev/null
@@ -1,82 +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;
-
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.util.Collection;
-import java.util.Date;
-
-import com.fasterxml.jackson.annotation.JsonIgnore;
-
-import net.fortuna.ical4j.data.CalendarBuilder;
-import net.fortuna.ical4j.data.ParserException;
-import net.fortuna.ical4j.filter.Filter;
-import net.fortuna.ical4j.filter.PeriodRule;
-import net.fortuna.ical4j.model.DateTime;
-import net.fortuna.ical4j.model.Dur;
-import net.fortuna.ical4j.model.Period;
-import net.fortuna.ical4j.model.component.CalendarComponent;
-import org.apache.commons.collections4.Predicate;
-import org.traccar.database.QueryIgnore;
-
-public class Calendar extends ExtendedModel {
-
- private String name;
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- private byte[] data;
-
- public byte[] getData() {
- return data.clone();
- }
-
- public void setData(byte[] data) throws IOException, ParserException {
- CalendarBuilder builder = new CalendarBuilder();
- calendar = builder.build(new ByteArrayInputStream(data));
- this.data = data.clone();
- }
-
- private net.fortuna.ical4j.model.Calendar calendar;
-
- @QueryIgnore
- @JsonIgnore
- public net.fortuna.ical4j.model.Calendar getCalendar() {
- return calendar;
- }
-
- public boolean checkMoment(Date date) {
- if (calendar != null) {
- Period period = new Period(new DateTime(date), new Dur(0, 0, 0, 0));
- Predicate<CalendarComponent> periodRule = new PeriodRule<>(period);
- Filter<CalendarComponent> filter = new Filter<>(new Predicate[] {periodRule}, Filter.MATCH_ANY);
- Collection<CalendarComponent> events = filter.filter(calendar.getComponents(CalendarComponent.VEVENT));
- if (events != null && !events.isEmpty()) {
- return true;
- }
- }
- return false;
- }
-
-}
diff --git a/src/org/traccar/model/CellTower.java b/src/org/traccar/model/CellTower.java
deleted file mode 100644
index 6d1dfbd7f..000000000
--- a/src/org/traccar/model/CellTower.java
+++ /dev/null
@@ -1,115 +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;
-
-import com.fasterxml.jackson.annotation.JsonInclude;
-import org.traccar.Context;
-
-@JsonInclude(JsonInclude.Include.NON_NULL)
-public class CellTower {
-
- public static CellTower from(int mcc, int mnc, int lac, long cid) {
- CellTower cellTower = new CellTower();
- cellTower.setMobileCountryCode(mcc);
- cellTower.setMobileNetworkCode(mnc);
- cellTower.setLocationAreaCode(lac);
- cellTower.setCellId(cid);
- return cellTower;
- }
-
- public static CellTower from(int mcc, int mnc, int lac, long cid, int rssi) {
- CellTower cellTower = CellTower.from(mcc, mnc, lac, cid);
- cellTower.setSignalStrength(rssi);
- return cellTower;
- }
-
- public static CellTower fromLacCid(int lac, long cid) {
- return from(
- Context.getConfig().getInteger("geolocation.mcc"),
- Context.getConfig().getInteger("geolocation.mnc"), lac, cid);
- }
-
- public static CellTower fromCidLac(long cid, int lac) {
- return fromLacCid(lac, cid);
- }
-
- private String radioType;
-
- public String getRadioType() {
- return radioType;
- }
-
- public void setRadioType(String radioType) {
- this.radioType = radioType;
- }
-
- private Long cellId;
-
- public Long getCellId() {
- return cellId;
- }
-
- public void setCellId(Long cellId) {
- this.cellId = cellId;
- }
-
- private Integer locationAreaCode;
-
- public Integer getLocationAreaCode() {
- return locationAreaCode;
- }
-
- public void setLocationAreaCode(Integer locationAreaCode) {
- this.locationAreaCode = locationAreaCode;
- }
-
- private Integer mobileCountryCode;
-
- public Integer getMobileCountryCode() {
- return mobileCountryCode;
- }
-
- public void setMobileCountryCode(Integer mobileCountryCode) {
- this.mobileCountryCode = mobileCountryCode;
- }
-
- private Integer mobileNetworkCode;
-
- public Integer getMobileNetworkCode() {
- return mobileNetworkCode;
- }
-
- public void setMobileNetworkCode(Integer mobileNetworkCode) {
- this.mobileNetworkCode = mobileNetworkCode;
- }
-
- private Integer signalStrength;
-
- public Integer getSignalStrength() {
- return signalStrength;
- }
-
- public void setSignalStrength(Integer signalStrength) {
- this.signalStrength = signalStrength;
- }
-
- public void setOperator(long operator) {
- String operatorString = String.valueOf(operator);
- mobileCountryCode = Integer.parseInt(operatorString.substring(0, 3));
- mobileNetworkCode = Integer.parseInt(operatorString.substring(3));
- }
-
-}
diff --git a/src/org/traccar/model/Command.java b/src/org/traccar/model/Command.java
deleted file mode 100644
index 16205ede1..000000000
--- a/src/org/traccar/model/Command.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- * Copyright 2015 - 2017 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;
-
-import org.traccar.database.QueryIgnore;
-
-import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
-
-@JsonIgnoreProperties(ignoreUnknown = true)
-public class Command extends Message implements Cloneable {
-
- public static final String TYPE_CUSTOM = "custom";
- public static final String TYPE_IDENTIFICATION = "deviceIdentification";
- public static final String TYPE_POSITION_SINGLE = "positionSingle";
- public static final String TYPE_POSITION_PERIODIC = "positionPeriodic";
- public static final String TYPE_POSITION_STOP = "positionStop";
- public static final String TYPE_ENGINE_STOP = "engineStop";
- public static final String TYPE_ENGINE_RESUME = "engineResume";
- public static final String TYPE_ALARM_ARM = "alarmArm";
- public static final String TYPE_ALARM_DISARM = "alarmDisarm";
- public static final String TYPE_SET_TIMEZONE = "setTimezone";
- public static final String TYPE_REQUEST_PHOTO = "requestPhoto";
- public static final String TYPE_REBOOT_DEVICE = "rebootDevice";
- public static final String TYPE_SEND_SMS = "sendSms";
- public static final String TYPE_SEND_USSD = "sendUssd";
- public static final String TYPE_SOS_NUMBER = "sosNumber";
- public static final String TYPE_SILENCE_TIME = "silenceTime";
- public static final String TYPE_SET_PHONEBOOK = "setPhonebook";
- public static final String TYPE_VOICE_MESSAGE = "voiceMessage";
- public static final String TYPE_OUTPUT_CONTROL = "outputControl";
- public static final String TYPE_VOICE_MONITORING = "voiceMonitoring";
- public static final String TYPE_SET_AGPS = "setAgps";
- public static final String TYPE_SET_INDICATOR = "setIndicator";
- public static final String TYPE_CONFIGURATION = "configuration";
- public static final String TYPE_GET_VERSION = "getVersion";
- public static final String TYPE_FIRMWARE_UPDATE = "firmwareUpdate";
- public static final String TYPE_SET_CONNECTION = "setConnection";
- public static final String TYPE_SET_ODOMETER = "setOdometer";
- public static final String TYPE_GET_MODEM_STATUS = "getModemStatus";
- public static final String TYPE_GET_DEVICE_STATUS = "getDeviceStatus";
-
- public static final String TYPE_MODE_POWER_SAVING = "modePowerSaving";
- public static final String TYPE_MODE_DEEP_SLEEP = "modeDeepSleep";
-
- public static final String TYPE_ALARM_GEOFENCE = "movementAlarm";
- public static final String TYPE_ALARM_BATTERY = "alarmBattery";
- public static final String TYPE_ALARM_SOS = "alarmSos";
- public static final String TYPE_ALARM_REMOVE = "alarmRemove";
- public static final String TYPE_ALARM_CLOCK = "alarmClock";
- public static final String TYPE_ALARM_SPEED = "alarmSpeed";
- public static final String TYPE_ALARM_FALL = "alarmFall";
- public static final String TYPE_ALARM_VIBRATION = "alarmVibration";
-
- public static final String KEY_UNIQUE_ID = "uniqueId";
- public static final String KEY_FREQUENCY = "frequency";
- public static final String KEY_TIMEZONE = "timezone";
- public static final String KEY_DEVICE_PASSWORD = "devicePassword";
- public static final String KEY_RADIUS = "radius";
- public static final String KEY_MESSAGE = "message";
- public static final String KEY_ENABLE = "enable";
- public static final String KEY_DATA = "data";
- public static final String KEY_INDEX = "index";
- public static final String KEY_PHONE = "phone";
- public static final String KEY_SERVER = "server";
- public static final String KEY_PORT = "port";
-
- @Override
- public Command clone() throws CloneNotSupportedException {
- return (Command) super.clone();
- }
-
- private boolean textChannel;
-
- public boolean getTextChannel() {
- return textChannel;
- }
-
- public void setTextChannel(boolean textChannel) {
- this.textChannel = textChannel;
- }
-
- @QueryIgnore
- @Override
- public long getDeviceId() {
- return super.getDeviceId();
- }
-
- private String description;
-
- public String getDescription() {
- return description;
- }
-
- public void setDescription(String description) {
- this.description = description;
- }
-
-}
diff --git a/src/org/traccar/model/Device.java b/src/org/traccar/model/Device.java
deleted file mode 100644
index c8a28404c..000000000
--- a/src/org/traccar/model/Device.java
+++ /dev/null
@@ -1,152 +0,0 @@
-/*
- * Copyright 2012 - 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;
-
-import java.util.Date;
-import java.util.List;
-
-import org.traccar.database.QueryExtended;
-import org.traccar.database.QueryIgnore;
-
-public class Device extends ExtendedModel {
-
- private String name;
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- private String uniqueId;
-
- public String getUniqueId() {
- return uniqueId;
- }
-
- public void setUniqueId(String uniqueId) {
- this.uniqueId = uniqueId;
- }
-
- public static final String STATUS_UNKNOWN = "unknown";
- public static final String STATUS_ONLINE = "online";
- public static final String STATUS_OFFLINE = "offline";
-
- private String status;
-
- @QueryIgnore
- public String getStatus() {
- return status != null ? status : STATUS_OFFLINE;
- }
-
- public void setStatus(String status) {
- this.status = status;
- }
-
- private Date lastUpdate;
-
- @QueryExtended
- public Date getLastUpdate() {
- if (lastUpdate != null) {
- return new Date(lastUpdate.getTime());
- } else {
- return null;
- }
- }
-
- public void setLastUpdate(Date lastUpdate) {
- if (lastUpdate != null) {
- this.lastUpdate = new Date(lastUpdate.getTime());
- } else {
- this.lastUpdate = null;
- }
- }
-
- private long positionId;
-
- @QueryIgnore
- public long getPositionId() {
- return positionId;
- }
-
- public void setPositionId(long positionId) {
- this.positionId = positionId;
- }
-
- private long groupId;
-
- public long getGroupId() {
- return groupId;
- }
-
- public void setGroupId(long groupId) {
- this.groupId = groupId;
- }
-
- private List<Long> geofenceIds;
-
- @QueryIgnore
- public List<Long> getGeofenceIds() {
- return geofenceIds;
- }
-
- public void setGeofenceIds(List<Long> geofenceIds) {
- this.geofenceIds = geofenceIds;
- }
-
- private String phone;
-
- public String getPhone() {
- return phone;
- }
-
- public void setPhone(String phone) {
- this.phone = phone;
- }
-
- private String model;
-
- public String getModel() {
- return model;
- }
-
- public void setModel(String model) {
- this.model = model;
- }
-
- private String contact;
-
- public String getContact() {
- return contact;
- }
-
- public void setContact(String contact) {
- this.contact = contact;
- }
-
- private String category;
-
- public String getCategory() {
- return category;
- }
-
- public void setCategory(String category) {
- this.category = category;
- }
-
-}
diff --git a/src/org/traccar/model/DeviceState.java b/src/org/traccar/model/DeviceState.java
deleted file mode 100644
index f2d0ff614..000000000
--- a/src/org/traccar/model/DeviceState.java
+++ /dev/null
@@ -1,61 +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 DeviceState {
-
- private Boolean motionState;
-
- public void setMotionState(boolean motionState) {
- this.motionState = motionState;
- }
-
- public Boolean getMotionState() {
- return motionState;
- }
-
- private Position motionPosition;
-
- public void setMotionPosition(Position motionPosition) {
- this.motionPosition = motionPosition;
- }
-
- public Position getMotionPosition() {
- return motionPosition;
- }
-
- private Boolean overspeedState;
-
- public void setOverspeedState(boolean overspeedState) {
- this.overspeedState = overspeedState;
- }
-
- public Boolean getOverspeedState() {
- return overspeedState;
- }
-
- private Position overspeedPosition;
-
- public void setOverspeedPosition(Position overspeedPosition) {
- this.overspeedPosition = overspeedPosition;
- }
-
- public Position getOverspeedPosition() {
- return overspeedPosition;
- }
-
-}
diff --git a/src/org/traccar/model/DeviceTotalDistance.java b/src/org/traccar/model/DeviceTotalDistance.java
deleted file mode 100644
index 4c89b7689..000000000
--- a/src/org/traccar/model/DeviceTotalDistance.java
+++ /dev/null
@@ -1,41 +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 DeviceTotalDistance {
-
- private long deviceId;
-
- public long getDeviceId() {
- return deviceId;
- }
-
- public void setDeviceId(long deviceId) {
- this.deviceId = deviceId;
- }
-
- private double totalDistance;
-
- public double getTotalDistance() {
- return totalDistance;
- }
-
- public void setTotalDistance(double totalDistance) {
- this.totalDistance = totalDistance;
- }
-
-}
diff --git a/src/org/traccar/model/Driver.java b/src/org/traccar/model/Driver.java
deleted file mode 100644
index 05f52fd4d..000000000
--- a/src/org/traccar/model/Driver.java
+++ /dev/null
@@ -1,40 +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 Driver extends ExtendedModel {
-
- private String name;
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- private String uniqueId;
-
- public String getUniqueId() {
- return uniqueId;
- }
-
- public void setUniqueId(String uniqueId) {
- this.uniqueId = uniqueId;
- }
-}
diff --git a/src/org/traccar/model/Event.java b/src/org/traccar/model/Event.java
deleted file mode 100644
index 47b60af01..000000000
--- a/src/org/traccar/model/Event.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- * Copyright 2016 - 2017 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;
-
-import java.util.Date;
-
-public class Event extends Message {
-
- public Event(String type, long deviceId, long positionId) {
- this(type, deviceId);
- setPositionId(positionId);
- }
-
- public Event(String type, long deviceId) {
- setType(type);
- setDeviceId(deviceId);
- this.serverTime = new Date();
- }
-
- public Event() {
- }
-
- public static final String ALL_EVENTS = "allEvents";
-
- public static final String TYPE_COMMAND_RESULT = "commandResult";
-
- public static final String TYPE_DEVICE_ONLINE = "deviceOnline";
- public static final String TYPE_DEVICE_UNKNOWN = "deviceUnknown";
- public static final String TYPE_DEVICE_OFFLINE = "deviceOffline";
-
- public static final String TYPE_DEVICE_MOVING = "deviceMoving";
- public static final String TYPE_DEVICE_STOPPED = "deviceStopped";
-
- public static final String TYPE_DEVICE_OVERSPEED = "deviceOverspeed";
- public static final String TYPE_DEVICE_FUEL_DROP = "deviceFuelDrop";
-
- public static final String TYPE_GEOFENCE_ENTER = "geofenceEnter";
- public static final String TYPE_GEOFENCE_EXIT = "geofenceExit";
-
- public static final String TYPE_ALARM = "alarm";
-
- public static final String TYPE_IGNITION_ON = "ignitionOn";
- public static final String TYPE_IGNITION_OFF = "ignitionOff";
-
- public static final String TYPE_MAINTENANCE = "maintenance";
-
- public static final String TYPE_TEXT_MESSAGE = "textMessage";
-
- public static final String TYPE_DRIVER_CHANGED = "driverChanged";
-
- private Date serverTime;
-
- public Date getServerTime() {
- if (serverTime != null) {
- return new Date(serverTime.getTime());
- } else {
- return null;
- }
- }
-
- public void setServerTime(Date serverTime) {
- if (serverTime != null) {
- this.serverTime = new Date(serverTime.getTime());
- } else {
- this.serverTime = null;
- }
- }
-
- private long positionId;
-
- public long getPositionId() {
- return positionId;
- }
-
- public void setPositionId(long positionId) {
- this.positionId = positionId;
- }
-
- private long geofenceId = 0;
-
- public long getGeofenceId() {
- return geofenceId;
- }
-
- public void setGeofenceId(long geofenceId) {
- this.geofenceId = geofenceId;
- }
-
-}
diff --git a/src/org/traccar/model/ExtendedModel.java b/src/org/traccar/model/ExtendedModel.java
deleted file mode 100644
index 8353d0e66..000000000
--- a/src/org/traccar/model/ExtendedModel.java
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
- * Copyright 2016 - 2017 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;
-
-import java.util.LinkedHashMap;
-import java.util.Map;
-
-public class ExtendedModel extends BaseModel {
-
- private Map<String, Object> attributes = new LinkedHashMap<>();
-
- public Map<String, Object> getAttributes() {
- return attributes;
- }
-
- public void setAttributes(Map<String, Object> attributes) {
- this.attributes = attributes;
- }
-
- public void set(String key, Boolean value) {
- if (value != null) {
- attributes.put(key, value);
- }
- }
-
- public void set(String key, Byte value) {
- if (value != null) {
- attributes.put(key, value.intValue());
- }
- }
-
- public void set(String key, Short value) {
- if (value != null) {
- attributes.put(key, value.intValue());
- }
- }
-
- public void set(String key, Integer value) {
- if (value != null) {
- attributes.put(key, value);
- }
- }
-
- public void set(String key, Long value) {
- if (value != null) {
- attributes.put(key, value);
- }
- }
-
- public void set(String key, Float value) {
- if (value != null) {
- attributes.put(key, value.doubleValue());
- }
- }
-
- public void set(String key, Double value) {
- if (value != null) {
- attributes.put(key, value);
- }
- }
-
- public void set(String key, String value) {
- if (value != null && !value.isEmpty()) {
- attributes.put(key, value);
- }
- }
-
- public void add(Map.Entry<String, Object> entry) {
- if (entry != null && entry.getValue() != null) {
- attributes.put(entry.getKey(), entry.getValue());
- }
- }
-
- public String getString(String key) {
- if (attributes.containsKey(key)) {
- return (String) attributes.get(key);
- } else {
- return null;
- }
- }
-
- public double getDouble(String key) {
- if (attributes.containsKey(key)) {
- return ((Number) attributes.get(key)).doubleValue();
- } else {
- return 0.0;
- }
- }
-
- public boolean getBoolean(String key) {
- if (attributes.containsKey(key)) {
- return (Boolean) attributes.get(key);
- } else {
- return false;
- }
- }
-
- public int getInteger(String key) {
- if (attributes.containsKey(key)) {
- return ((Number) attributes.get(key)).intValue();
- } else {
- return 0;
- }
- }
-
- public long getLong(String key) {
- if (attributes.containsKey(key)) {
- return ((Number) attributes.get(key)).longValue();
- } else {
- return 0;
- }
- }
-
-}
diff --git a/src/org/traccar/model/Geofence.java b/src/org/traccar/model/Geofence.java
deleted file mode 100644
index 21c196da9..000000000
--- a/src/org/traccar/model/Geofence.java
+++ /dev/null
@@ -1,100 +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;
-
-import java.text.ParseException;
-
-import org.traccar.Context;
-import org.traccar.database.QueryIgnore;
-import org.traccar.geofence.GeofenceCircle;
-import org.traccar.geofence.GeofenceGeometry;
-import org.traccar.geofence.GeofencePolygon;
-import org.traccar.geofence.GeofencePolyline;
-
-import com.fasterxml.jackson.annotation.JsonIgnore;
-
-public class Geofence extends ExtendedModel {
-
- public static final String TYPE_GEOFENCE_CILCLE = "geofenceCircle";
- public static final String TYPE_GEOFENCE_POLYGON = "geofencePolygon";
- public static final String TYPE_GEOFENCE_POLYLINE = "geofencePolyline";
-
- private String name;
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- private String description;
-
- public String getDescription() {
- return description;
- }
-
- public void setDescription(String description) {
- this.description = description;
- }
-
- private String area;
-
- public String getArea() {
- return area;
- }
-
- public void setArea(String area) throws ParseException {
-
- if (area.startsWith("CIRCLE")) {
- geometry = new GeofenceCircle(area);
- } else if (area.startsWith("POLYGON")) {
- geometry = new GeofencePolygon(area);
- } else if (area.startsWith("LINESTRING")) {
- geometry = new GeofencePolyline(area, Context.getConfig().getDouble("geofence.polylineDistance", 25));
- } else {
- throw new ParseException("Unknown geometry type", 0);
- }
-
- this.area = area;
- }
-
- private GeofenceGeometry geometry;
-
- @QueryIgnore
- @JsonIgnore
- public GeofenceGeometry getGeometry() {
- return geometry;
- }
-
- @QueryIgnore
- @JsonIgnore
- public void setGeometry(GeofenceGeometry geometry) {
- area = geometry.toWkt();
- this.geometry = geometry;
- }
-
- private long calendarId;
-
- public long getCalendarId() {
- return calendarId;
- }
-
- public void setCalendarId(long calendarId) {
- this.calendarId = calendarId;
- }
-}
diff --git a/src/org/traccar/model/Group.java b/src/org/traccar/model/Group.java
deleted file mode 100644
index aad206aad..000000000
--- a/src/org/traccar/model/Group.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 Group extends ExtendedModel {
-
- private String name;
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- private long groupId;
-
- public long getGroupId() {
- return groupId;
- }
-
- public void setGroupId(long groupId) {
- this.groupId = groupId;
- }
-
-}
diff --git a/src/org/traccar/model/ManagedUser.java b/src/org/traccar/model/ManagedUser.java
deleted file mode 100644
index 03c5ef48d..000000000
--- a/src/org/traccar/model/ManagedUser.java
+++ /dev/null
@@ -1,21 +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 ManagedUser extends User {
-
-}
diff --git a/src/org/traccar/model/Message.java b/src/org/traccar/model/Message.java
deleted file mode 100644
index dad9c20f0..000000000
--- a/src/org/traccar/model/Message.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright 2013 - 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 Message extends ExtendedModel {
-
- private long deviceId;
-
- public long getDeviceId() {
- return deviceId;
- }
-
- public void setDeviceId(long deviceId) {
- this.deviceId = deviceId;
- }
-
- private String type;
-
- public String getType() {
- return type;
- }
-
- public void setType(String type) {
- this.type = type;
- }
-
-}
diff --git a/src/org/traccar/model/MiscFormatter.java b/src/org/traccar/model/MiscFormatter.java
deleted file mode 100644
index c6511f063..000000000
--- a/src/org/traccar/model/MiscFormatter.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Copyright 2013 - 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;
-
-
-import java.text.DecimalFormat;
-import java.util.Map;
-
-public final class MiscFormatter {
-
- private MiscFormatter() {
- }
-
- private static final String XML_ROOT_NODE = "info";
-
- private static final DecimalFormat DECIMAL_FORMAT = new DecimalFormat("#.##");
-
- private static String format(Object value) {
- if (value instanceof Double || value instanceof Float) {
- return DECIMAL_FORMAT.format(value);
- } else {
- return value.toString();
- }
- }
-
- public static String toXmlString(Map<String, Object> attributes) {
- StringBuilder result = new StringBuilder();
-
- result.append("<").append(XML_ROOT_NODE).append(">");
-
- for (Map.Entry<String, Object> entry : attributes.entrySet()) {
-
- result.append("<").append(entry.getKey()).append(">");
- result.append(format(entry.getValue()));
- result.append("</").append(entry.getKey()).append(">");
- }
-
- result.append("</").append(XML_ROOT_NODE).append(">");
-
- return result.toString();
- }
-
-}
diff --git a/src/org/traccar/model/Network.java b/src/org/traccar/model/Network.java
deleted file mode 100644
index 2d56950f1..000000000
--- a/src/org/traccar/model/Network.java
+++ /dev/null
@@ -1,117 +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;
-
-import com.fasterxml.jackson.annotation.JsonInclude;
-
-import java.util.ArrayList;
-import java.util.Collection;
-
-@JsonInclude(JsonInclude.Include.NON_NULL)
-public class Network {
-
- public Network() {
- }
-
- public Network(CellTower cellTower) {
- addCellTower(cellTower);
- }
-
- private Integer homeMobileCountryCode;
-
- public Integer getHomeMobileCountryCode() {
- return homeMobileCountryCode;
- }
-
- public void setHomeMobileCountryCode(Integer homeMobileCountryCode) {
- this.homeMobileCountryCode = homeMobileCountryCode;
- }
-
- private Integer homeMobileNetworkCode;
-
- public Integer getHomeMobileNetworkCode() {
- return homeMobileNetworkCode;
- }
-
- public void setHomeMobileNetworkCode(Integer homeMobileNetworkCode) {
- this.homeMobileNetworkCode = homeMobileNetworkCode;
- }
-
- private String radioType = "gsm";
-
- public String getRadioType() {
- return radioType;
- }
-
- public void setRadioType(String radioType) {
- this.radioType = radioType;
- }
-
- private String carrier;
-
- public String getCarrier() {
- return carrier;
- }
-
- public void setCarrier(String carrier) {
- this.carrier = carrier;
- }
-
- private Boolean considerIp = false;
-
- public Boolean getConsiderIp() {
- return considerIp;
- }
-
- public void setConsiderIp(Boolean considerIp) {
- this.considerIp = considerIp;
- }
-
- private Collection<CellTower> cellTowers;
-
- public Collection<CellTower> getCellTowers() {
- return cellTowers;
- }
-
- public void setCellTowers(Collection<CellTower> cellTowers) {
- this.cellTowers = cellTowers;
- }
-
- public void addCellTower(CellTower cellTower) {
- if (cellTowers == null) {
- cellTowers = new ArrayList<>();
- }
- cellTowers.add(cellTower);
- }
-
- private Collection<WifiAccessPoint> wifiAccessPoints;
-
- public Collection<WifiAccessPoint> getWifiAccessPoints() {
- return wifiAccessPoints;
- }
-
- public void setWifiAccessPoints(Collection<WifiAccessPoint> wifiAccessPoints) {
- this.wifiAccessPoints = wifiAccessPoints;
- }
-
- public void addWifiAccessPoint(WifiAccessPoint wifiAccessPoint) {
- if (wifiAccessPoints == null) {
- wifiAccessPoints = new ArrayList<>();
- }
- wifiAccessPoints.add(wifiAccessPoint);
- }
-
-}
diff --git a/src/org/traccar/model/Notification.java b/src/org/traccar/model/Notification.java
deleted file mode 100644
index 9d6034fff..000000000
--- a/src/org/traccar/model/Notification.java
+++ /dev/null
@@ -1,69 +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 Notification extends ExtendedModel {
-
- private boolean always;
-
- public boolean getAlways() {
- return always;
- }
-
- public void setAlways(boolean always) {
- this.always = always;
- }
-
- private String type;
-
- public String getType() {
- return type;
- }
-
- public void setType(String type) {
- this.type = type;
- }
-
- private boolean web;
-
- public boolean getWeb() {
- return web;
- }
-
- public void setWeb(boolean web) {
- this.web = web;
- }
-
- private boolean mail;
-
- public boolean getMail() {
- return mail;
- }
-
- public void setMail(boolean mail) {
- this.mail = mail;
- }
-
- private boolean sms;
-
- public boolean getSms() {
- return sms;
- }
-
- public void setSms(boolean sms) {
- this.sms = sms;
- }
-}
diff --git a/src/org/traccar/model/Permission.java b/src/org/traccar/model/Permission.java
deleted file mode 100644
index 1006b1c47..000000000
--- a/src/org/traccar/model/Permission.java
+++ /dev/null
@@ -1,57 +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;
-
-import java.util.Iterator;
-import java.util.LinkedHashMap;
-import java.util.Map;
-
-import org.traccar.database.DataManager;
-
-public class Permission {
-
- private Class<?> ownerClass;
- private long ownerId;
- private Class<?> propertyClass;
- private long propertyId;
-
- public Permission(LinkedHashMap<String, Long> permissionMap) throws ClassNotFoundException {
- Iterator<Map.Entry<String, Long>> iterator = permissionMap.entrySet().iterator();
- String owner = iterator.next().getKey();
- ownerClass = DataManager.getClassByName(owner);
- String property = iterator.next().getKey();
- propertyClass = DataManager.getClassByName(property);
- ownerId = permissionMap.get(owner);
- propertyId = permissionMap.get(property);
- }
-
- public Class<?> getOwnerClass() {
- return ownerClass;
- }
-
- public long getOwnerId() {
- return ownerId;
- }
-
- public Class<?> getPropertyClass() {
- return propertyClass;
- }
-
- public long getPropertyId() {
- return propertyId;
- }
-}
diff --git a/src/org/traccar/model/Position.java b/src/org/traccar/model/Position.java
deleted file mode 100644
index 099e6d686..000000000
--- a/src/org/traccar/model/Position.java
+++ /dev/null
@@ -1,309 +0,0 @@
-/*
- * Copyright 2012 - 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;
-
-import java.util.Date;
-
-import org.traccar.database.QueryIgnore;
-
-public class Position extends Message {
-
- public static final String KEY_ORIGINAL = "raw";
- public static final String KEY_INDEX = "index";
- public static final String KEY_HDOP = "hdop";
- public static final String KEY_VDOP = "vdop";
- public static final String KEY_PDOP = "pdop";
- public static final String KEY_SATELLITES = "sat"; // in use
- public static final String KEY_SATELLITES_VISIBLE = "satVisible";
- public static final String KEY_RSSI = "rssi";
- public static final String KEY_GPS = "gps";
- public static final String KEY_ROAMING = "roaming";
- public static final String KEY_EVENT = "event";
- public static final String KEY_ALARM = "alarm";
- public static final String KEY_STATUS = "status";
- public static final String KEY_ODOMETER = "odometer"; // meters
- public static final String KEY_ODOMETER_SERVICE = "serviceOdometer"; // meters
- public static final String KEY_ODOMETER_TRIP = "tripOdometer"; // meters
- public static final String KEY_HOURS = "hours";
- public static final String KEY_STEPS = "steps";
- public static final String KEY_INPUT = "input";
- public static final String KEY_OUTPUT = "output";
- public static final String KEY_IMAGE = "image";
- public static final String KEY_VIDEO = "video";
- public static final String KEY_AUDIO = "audio";
-
- // The units for the below four KEYs currently vary.
- // The preferred units of measure are specified in the comment for each.
- public static final String KEY_POWER = "power"; // volts
- public static final String KEY_BATTERY = "battery"; // volts
- public static final String KEY_BATTERY_LEVEL = "batteryLevel"; // percentage
- public static final String KEY_FUEL_LEVEL = "fuel"; // liters
- public static final String KEY_FUEL_CONSUMPTION = "fuelConsumption"; // liters/hour
-
- public static final String KEY_VERSION_FW = "versionFw";
- public static final String KEY_VERSION_HW = "versionHw";
- public static final String KEY_TYPE = "type";
- public static final String KEY_IGNITION = "ignition";
- public static final String KEY_FLAGS = "flags";
- public static final String KEY_CHARGE = "charge";
- public static final String KEY_IP = "ip";
- public static final String KEY_ARCHIVE = "archive";
- public static final String KEY_DISTANCE = "distance"; // meters
- public static final String KEY_TOTAL_DISTANCE = "totalDistance"; // meters
- public static final String KEY_RPM = "rpm";
- public static final String KEY_VIN = "vin";
- public static final String KEY_APPROXIMATE = "approximate";
- public static final String KEY_THROTTLE = "throttle";
- public static final String KEY_MOTION = "motion";
- public static final String KEY_ARMED = "armed";
- public static final String KEY_GEOFENCE = "geofence";
- public static final String KEY_ACCELERATION = "acceleration";
- public static final String KEY_DEVICE_TEMP = "deviceTemp"; // celsius
- public static final String KEY_COOLANT_TEMP = "coolantTemp"; // celsius
- public static final String KEY_ENGINE_LOAD = "engineLoad";
- public static final String KEY_OPERATOR = "operator";
- public static final String KEY_COMMAND = "command";
- public static final String KEY_BLOCKED = "blocked";
- public static final String KEY_DOOR = "door";
-
- public static final String KEY_DTCS = "dtcs";
- public static final String KEY_OBD_SPEED = "obdSpeed"; // knots
- public static final String KEY_OBD_ODOMETER = "obdOdometer"; // meters
-
- public static final String KEY_RESULT = "result";
-
- public static final String KEY_DRIVER_UNIQUE_ID = "driverUniqueId";
-
- // Start with 1 not 0
- public static final String PREFIX_TEMP = "temp";
- public static final String PREFIX_ADC = "adc";
- public static final String PREFIX_IO = "io";
- public static final String PREFIX_COUNT = "count";
- public static final String PREFIX_IN = "in";
- public static final String PREFIX_OUT = "out";
-
- public static final String ALARM_GENERAL = "general";
- public static final String ALARM_SOS = "sos";
- public static final String ALARM_VIBRATION = "vibration";
- public static final String ALARM_MOVEMENT = "movement";
- public static final String ALARM_LOW_SPEED = "lowspeed";
- public static final String ALARM_OVERSPEED = "overspeed";
- public static final String ALARM_FALL_DOWN = "fallDown";
- public static final String ALARM_LOW_POWER = "lowPower";
- public static final String ALARM_LOW_BATTERY = "lowBattery";
- public static final String ALARM_FAULT = "fault";
- public static final String ALARM_POWER_OFF = "powerOff";
- public static final String ALARM_POWER_ON = "powerOn";
- public static final String ALARM_DOOR = "door";
- public static final String ALARM_GEOFENCE = "geofence";
- public static final String ALARM_GEOFENCE_ENTER = "geofenceEnter";
- public static final String ALARM_GEOFENCE_EXIT = "geofenceExit";
- public static final String ALARM_GPS_ANTENNA_CUT = "gpsAntennaCut";
- public static final String ALARM_ACCIDENT = "accident";
- public static final String ALARM_TOW = "tow";
- public static final String ALARM_ACCELERATION = "hardAcceleration";
- public static final String ALARM_BRAKING = "hardBraking";
- public static final String ALARM_CORNERING = "hardCornering";
- public static final String ALARM_FATIGUE_DRIVING = "fatigueDriving";
- public static final String ALARM_POWER_CUT = "powerCut";
- public static final String ALARM_POWER_RESTORED = "powerRestored";
- public static final String ALARM_JAMMING = "jamming";
- public static final String ALARM_TEMPERATURE = "temperature";
- public static final String ALARM_PARKING = "parking";
- public static final String ALARM_SHOCK = "shock";
- public static final String ALARM_BONNET = "bonnet";
- public static final String ALARM_FOOT_BRAKE = "footBrake";
- public static final String ALARM_OIL_LEAK = "oilLeak";
- public static final String ALARM_TAMPERING = "tampering";
- public static final String ALARM_REMOVING = "removing";
-
- private String protocol;
-
- public String getProtocol() {
- return protocol;
- }
-
- public void setProtocol(String protocol) {
- this.protocol = protocol;
- }
-
- private Date serverTime;
-
- public Date getServerTime() {
- if (serverTime != null) {
- return new Date(serverTime.getTime());
- } else {
- return null;
- }
- }
-
- public void setServerTime(Date serverTime) {
- if (serverTime != null) {
- this.serverTime = new Date(serverTime.getTime());
- } else {
- this.serverTime = null;
- }
- }
-
- private Date deviceTime;
-
- public Date getDeviceTime() {
- if (deviceTime != null) {
- return new Date(deviceTime.getTime());
- } else {
- return null;
- }
- }
-
- public void setDeviceTime(Date deviceTime) {
- if (deviceTime != null) {
- this.deviceTime = new Date(deviceTime.getTime());
- } else {
- this.deviceTime = null;
- }
- }
-
- private Date fixTime;
-
- public Date getFixTime() {
- if (fixTime != null) {
- return new Date(fixTime.getTime());
- } else {
- return null;
- }
- }
-
- public void setFixTime(Date fixTime) {
- if (fixTime != null) {
- this.fixTime = new Date(fixTime.getTime());
- } else {
- this.fixTime = null;
- }
- }
-
- public void setTime(Date time) {
- setDeviceTime(time);
- setFixTime(time);
- }
-
- private boolean outdated;
-
- @QueryIgnore
- public boolean getOutdated() {
- return outdated;
- }
-
- public void setOutdated(boolean outdated) {
- this.outdated = outdated;
- }
-
- private boolean valid;
-
- public boolean getValid() {
- return valid;
- }
-
- public void setValid(boolean valid) {
- this.valid = valid;
- }
-
- 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 double altitude; // value in meters
-
- public double getAltitude() {
- return altitude;
- }
-
- public void setAltitude(double altitude) {
- this.altitude = altitude;
- }
-
- private double speed; // value in knots
-
- public double getSpeed() {
- return speed;
- }
-
- public void setSpeed(double speed) {
- this.speed = speed;
- }
-
- private double course;
-
- public double getCourse() {
- return course;
- }
-
- public void setCourse(double course) {
- this.course = course;
- }
-
- private String address;
-
- public String getAddress() {
- return address;
- }
-
- public void setAddress(String address) {
- this.address = address;
- }
-
- private double accuracy;
-
- public double getAccuracy() {
- return accuracy;
- }
-
- public void setAccuracy(double accuracy) {
- this.accuracy = accuracy;
- }
-
- private Network network;
-
- public Network getNetwork() {
- return network;
- }
-
- public void setNetwork(Network network) {
- this.network = network;
- }
-
- @Override
- @QueryIgnore
- public String getType() {
- return super.getType();
- }
-
-}
diff --git a/src/org/traccar/model/Server.java b/src/org/traccar/model/Server.java
deleted file mode 100644
index 072e85d55..000000000
--- a/src/org/traccar/model/Server.java
+++ /dev/null
@@ -1,160 +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;
-
-import org.traccar.database.QueryIgnore;
-import org.traccar.helper.Log;
-
-public class Server extends ExtendedModel {
-
- @QueryIgnore
- public String getVersion() {
- return Log.getAppVersion();
- }
-
- public void setVersion(String version) {
- }
-
- private boolean registration;
-
- public boolean getRegistration() {
- return registration;
- }
-
- public void setRegistration(boolean registration) {
- this.registration = registration;
- }
-
- private boolean readonly;
-
- public boolean getReadonly() {
- return readonly;
- }
-
- public void setReadonly(boolean readonly) {
- this.readonly = readonly;
- }
-
- private boolean deviceReadonly;
-
- public boolean getDeviceReadonly() {
- return deviceReadonly;
- }
-
- public void setDeviceReadonly(boolean deviceReadonly) {
- this.deviceReadonly = deviceReadonly;
- }
-
- private String map;
-
- public String getMap() {
- return map;
- }
-
- public void setMap(String map) {
- this.map = map;
- }
-
- private String bingKey;
-
- public String getBingKey() {
- return bingKey;
- }
-
- public void setBingKey(String bingKey) {
- this.bingKey = bingKey;
- }
-
- private String mapUrl;
-
- public String getMapUrl() {
- return mapUrl;
- }
-
- public void setMapUrl(String mapUrl) {
- this.mapUrl = mapUrl;
- }
-
- 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 int zoom;
-
- public int getZoom() {
- return zoom;
- }
-
- public void setZoom(int zoom) {
- this.zoom = zoom;
- }
-
- private boolean twelveHourFormat;
-
- public boolean getTwelveHourFormat() {
- return twelveHourFormat;
- }
-
- public void setTwelveHourFormat(boolean twelveHourFormat) {
- this.twelveHourFormat = twelveHourFormat;
- }
-
- private boolean forceSettings;
-
- public boolean getForceSettings() {
- return forceSettings;
- }
-
- public void setForceSettings(boolean forceSettings) {
- this.forceSettings = forceSettings;
- }
-
- private String coordinateFormat;
-
- public String getCoordinateFormat() {
- return coordinateFormat;
- }
-
- public void setCoordinateFormat(String coordinateFormat) {
- this.coordinateFormat = coordinateFormat;
- }
-
- private boolean limitCommands;
-
- public boolean getLimitCommands() {
- return limitCommands;
- }
-
- public void setLimitCommands(boolean limitCommands) {
- this.limitCommands = limitCommands;
- }
-}
diff --git a/src/org/traccar/model/Statistics.java b/src/org/traccar/model/Statistics.java
deleted file mode 100644
index 2acf8514f..000000000
--- a/src/org/traccar/model/Statistics.java
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
- * Copyright 2016 - 2017 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;
-
-import java.util.Date;
-
-public class Statistics extends ExtendedModel {
-
- private Date captureTime;
-
- public Date getCaptureTime() {
- if (captureTime != null) {
- return new Date(captureTime.getTime());
- } else {
- return null;
- }
- }
-
- public void setCaptureTime(Date captureTime) {
- if (captureTime != null) {
- this.captureTime = new Date(captureTime.getTime());
- } else {
- this.captureTime = null;
- }
- }
-
- private int activeUsers;
-
- public int getActiveUsers() {
- return activeUsers;
- }
-
- public void setActiveUsers(int activeUsers) {
- this.activeUsers = activeUsers;
- }
-
- private int activeDevices;
-
- public int getActiveDevices() {
- return activeDevices;
- }
-
- public void setActiveDevices(int activeDevices) {
- this.activeDevices = activeDevices;
- }
-
- private int requests;
-
- public int getRequests() {
- return requests;
- }
-
- public void setRequests(int requests) {
- this.requests = requests;
- }
-
- private int messagesReceived;
-
- public int getMessagesReceived() {
- return messagesReceived;
- }
-
- public void setMessagesReceived(int messagesReceived) {
- this.messagesReceived = messagesReceived;
- }
-
- private int messagesStored;
-
- public int getMessagesStored() {
- return messagesStored;
- }
-
- public void setMessagesStored(int messagesStored) {
- this.messagesStored = messagesStored;
- }
-
- private int mailSent;
-
- public int getMailSent() {
- return mailSent;
- }
-
- public void setMailSent(int mailSent) {
- this.mailSent = mailSent;
- }
-
- private int smsSent;
-
- public int getSmsSent() {
- return smsSent;
- }
-
- public void setSmsSent(int smsSent) {
- this.smsSent = smsSent;
- }
-
- private int geocoderRequests;
-
- public int getGeocoderRequests() {
- return geocoderRequests;
- }
-
- public void setGeocoderRequests(int geocoderRequests) {
- this.geocoderRequests = geocoderRequests;
- }
-
- private int geolocationRequests;
-
- public int getGeolocationRequests() {
- return geolocationRequests;
- }
-
- public void setGeolocationRequests(int geolocationRequests) {
- this.geolocationRequests = geolocationRequests;
- }
-
-}
diff --git a/src/org/traccar/model/Typed.java b/src/org/traccar/model/Typed.java
deleted file mode 100644
index 313ec7bcd..000000000
--- a/src/org/traccar/model/Typed.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Copyright 2016 Gabor Somogyi (gabor.g.somogyi@gmail.com)
- *
- * 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 Typed {
-
- private String type;
-
- public Typed(String type) {
- this.type = type;
- }
-
- public String getType() {
- return type;
- }
-
- public void setType(String type) {
- this.type = type;
- }
-}
diff --git a/src/org/traccar/model/User.java b/src/org/traccar/model/User.java
deleted file mode 100644
index 5d89dcfae..000000000
--- a/src/org/traccar/model/User.java
+++ /dev/null
@@ -1,264 +0,0 @@
-/*
- * Copyright 2013 - 2017 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;
-
-import com.fasterxml.jackson.annotation.JsonIgnore;
-
-import org.traccar.database.QueryExtended;
-import org.traccar.database.QueryIgnore;
-import org.traccar.helper.Hashing;
-
-import java.util.Date;
-
-public class User extends ExtendedModel {
-
- private String name;
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- private String email;
-
- public String getEmail() {
- return email;
- }
-
- public void setEmail(String email) {
- this.email = email.trim();
- }
-
- private String phone;
-
- public String getPhone() {
- return phone;
- }
-
- public void setPhone(String phone) {
- this.phone = phone;
- }
-
- private boolean readonly;
-
- public boolean getReadonly() {
- return readonly;
- }
-
- public void setReadonly(boolean readonly) {
- this.readonly = readonly;
- }
-
- private boolean admin;
-
- public boolean getAdmin() {
- return admin;
- }
-
- public void setAdmin(boolean admin) {
- this.admin = admin;
- }
-
- private String map;
-
- public String getMap() {
- return map;
- }
-
- public void setMap(String map) {
- this.map = map;
- }
-
- 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 int zoom;
-
- public int getZoom() {
- return zoom;
- }
-
- public void setZoom(int zoom) {
- this.zoom = zoom;
- }
-
- private boolean twelveHourFormat;
-
- public boolean getTwelveHourFormat() {
- return twelveHourFormat;
- }
-
- public void setTwelveHourFormat(boolean twelveHourFormat) {
- this.twelveHourFormat = twelveHourFormat;
- }
-
- private String coordinateFormat;
-
- public String getCoordinateFormat() {
- return coordinateFormat;
- }
-
- public void setCoordinateFormat(String coordinateFormat) {
- this.coordinateFormat = coordinateFormat;
- }
-
- private boolean disabled;
-
- public boolean getDisabled() {
- return disabled;
- }
-
- public void setDisabled(boolean disabled) {
- this.disabled = disabled;
- }
-
- private Date expirationTime;
-
- public Date getExpirationTime() {
- if (expirationTime != null) {
- return new Date(expirationTime.getTime());
- } else {
- return null;
- }
- }
-
- public void setExpirationTime(Date expirationTime) {
- if (expirationTime != null) {
- this.expirationTime = new Date(expirationTime.getTime());
- } else {
- this.expirationTime = null;
- }
- }
-
- private int deviceLimit;
-
- public int getDeviceLimit() {
- return deviceLimit;
- }
-
- public void setDeviceLimit(int deviceLimit) {
- this.deviceLimit = deviceLimit;
- }
-
- private int userLimit;
-
- public int getUserLimit() {
- return userLimit;
- }
-
- public void setUserLimit(int userLimit) {
- this.userLimit = userLimit;
- }
-
- private boolean deviceReadonly;
-
- public boolean getDeviceReadonly() {
- return deviceReadonly;
- }
-
- public void setDeviceReadonly(boolean deviceReadonly) {
- this.deviceReadonly = deviceReadonly;
- }
-
- private String token;
-
- public String getToken() {
- return token;
- }
-
- public void setToken(String token) {
- if (token != null && !token.isEmpty()) {
- if (!token.matches("^[a-zA-Z0-9]{16,}$")) {
- throw new IllegalArgumentException("Illegal token");
- }
- this.token = token;
- } else {
- this.token = null;
- }
- }
-
- private boolean limitCommands;
-
- public boolean getLimitCommands() {
- return limitCommands;
- }
-
- public void setLimitCommands(boolean limitCommands) {
- this.limitCommands = limitCommands;
- }
-
- @QueryIgnore
- public String getPassword() {
- return null;
- }
-
- public void setPassword(String password) {
- if (password != null && !password.isEmpty()) {
- Hashing.HashingResult hashingResult = Hashing.createHash(password);
- hashedPassword = hashingResult.getHash();
- salt = hashingResult.getSalt();
- }
- }
-
- private String hashedPassword;
-
- @JsonIgnore
- @QueryExtended
- public String getHashedPassword() {
- return hashedPassword;
- }
-
- public void setHashedPassword(String hashedPassword) {
- this.hashedPassword = hashedPassword;
- }
-
- private String salt;
-
- @JsonIgnore
- @QueryExtended
- public String getSalt() {
- return salt;
- }
-
- public void setSalt(String salt) {
- this.salt = salt;
- }
-
- public boolean isPasswordValid(String password) {
- return Hashing.validatePassword(password, hashedPassword, salt);
- }
-
-}
diff --git a/src/org/traccar/model/WifiAccessPoint.java b/src/org/traccar/model/WifiAccessPoint.java
deleted file mode 100644
index 87a77f3c0..000000000
--- a/src/org/traccar/model/WifiAccessPoint.java
+++ /dev/null
@@ -1,66 +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;
-
-import com.fasterxml.jackson.annotation.JsonInclude;
-
-@JsonInclude(JsonInclude.Include.NON_NULL)
-public class WifiAccessPoint {
-
- public static WifiAccessPoint from(String macAddress, int signalStrength) {
- WifiAccessPoint wifiAccessPoint = new WifiAccessPoint();
- wifiAccessPoint.setMacAddress(macAddress);
- wifiAccessPoint.setSignalStrength(signalStrength);
- return wifiAccessPoint;
- }
-
- public static WifiAccessPoint from(String macAddress, int signalStrength, int channel) {
- WifiAccessPoint wifiAccessPoint = from(macAddress, signalStrength);
- wifiAccessPoint.setChannel(channel);
- return wifiAccessPoint;
- }
-
- private String macAddress;
-
- public String getMacAddress() {
- return macAddress;
- }
-
- public void setMacAddress(String macAddress) {
- this.macAddress = macAddress;
- }
-
- private Integer signalStrength;
-
- public Integer getSignalStrength() {
- return signalStrength;
- }
-
- public void setSignalStrength(Integer signalStrength) {
- this.signalStrength = signalStrength;
- }
-
- private Integer channel;
-
- public Integer getChannel() {
- return channel;
- }
-
- public void setChannel(Integer channel) {
- this.channel = channel;
- }
-
-}