From 3f5aef83e284a1c4f4e608d57d7f3330af6ea12a Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Wed, 7 Oct 2015 19:27:47 +1300 Subject: Clean up rest of the models --- src/org/traccar/model/Device.java | 30 ++++++-- src/org/traccar/model/Permission.java | 20 ++++- src/org/traccar/model/Position.java | 80 ++++++++++++++++---- src/org/traccar/model/Schema.java | 10 ++- src/org/traccar/model/Server.java | 110 +++++++++++++++++++++------ src/org/traccar/model/User.java | 136 +++++++++++++++++++++++++++------- 6 files changed, 309 insertions(+), 77 deletions(-) (limited to 'src') diff --git a/src/org/traccar/model/Device.java b/src/org/traccar/model/Device.java index 4d97e166d..09d9ce0ab 100644 --- a/src/org/traccar/model/Device.java +++ b/src/org/traccar/model/Device.java @@ -25,16 +25,34 @@ public class Device implements Factory { } private long id; - public long getId() { return id; } - public void setId(long id) { this.id = id; } + + public long getId() { + return id; + } + + public void setId(long id) { + this.id = id; + } private String name; - public String getName() { return name; } - public void setName(String name) { this.name = 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 String getUniqueId() { + return uniqueId; + } + + public void setUniqueId(String uniqueId) { + this.uniqueId = uniqueId; + } private String status; diff --git a/src/org/traccar/model/Permission.java b/src/org/traccar/model/Permission.java index c37c750ef..065295ff9 100644 --- a/src/org/traccar/model/Permission.java +++ b/src/org/traccar/model/Permission.java @@ -23,11 +23,23 @@ public class Permission implements Factory { } private long userId; - public long getUserId() { return userId; } - public void setUserId(long userId) { this.userId = 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; } + + public long getDeviceId() { + return deviceId; + } + + public void setDeviceId(long deviceId) { + this.deviceId = deviceId; + } } diff --git a/src/org/traccar/model/Position.java b/src/org/traccar/model/Position.java index 964327a5f..ab535ba2b 100644 --- a/src/org/traccar/model/Position.java +++ b/src/org/traccar/model/Position.java @@ -25,8 +25,14 @@ public class Position extends Event implements Factory { } private Date fixTime; - public Date getFixTime() { return fixTime; } - public void setFixTime(Date fixTime) { this.fixTime = fixTime; } + + public Date getFixTime() { + return fixTime; + } + + public void setFixTime(Date fixTime) { + this.fixTime = fixTime; + } public void setTime(Date time) { setDeviceTime(time); @@ -34,31 +40,73 @@ public class Position extends Event implements Factory { } private boolean valid; - public boolean getValid() { return valid; } - public void setValid(boolean valid) { this.valid = 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; } + + 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; } + + public double getLongitude() { + return longitude; + } + + public void setLongitude(double longitude) { + this.longitude = longitude; + } private double altitude; - public double getAltitude() { return altitude; } - public void setAltitude(double altitude) { this.altitude = altitude; } + + 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; } + + 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; } + + 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; } + + public String getAddress() { + return address; + } + + public void setAddress(String address) { + this.address = address; + } } diff --git a/src/org/traccar/model/Schema.java b/src/org/traccar/model/Schema.java index a4109bea1..3d1ce755f 100644 --- a/src/org/traccar/model/Schema.java +++ b/src/org/traccar/model/Schema.java @@ -23,7 +23,13 @@ public class Schema implements Factory { } private int version; - public int getVersion() { return version; } - public void setVersion(int version) { this.version = version; } + + public int getVersion() { + return version; + } + + public void setVersion(int version) { + this.version = version; + } } diff --git a/src/org/traccar/model/Server.java b/src/org/traccar/model/Server.java index f16863d1c..e96a40e27 100644 --- a/src/org/traccar/model/Server.java +++ b/src/org/traccar/model/Server.java @@ -23,47 +23,113 @@ public class Server implements Factory { } private long id; - public long getId() { return id; } - public void setId(long id) { this.id = id; } + + public long getId() { + return id; + } + + public void setId(long id) { + this.id = id; + } private boolean registration; - public boolean getRegistration() { return registration; } - public void setRegistration(boolean registration) { this.registration = registration; } + + public boolean getRegistration() { + return registration; + } + + public void setRegistration(boolean registration) { + this.registration = registration; + } private String map; - public String getMap() { return map; } - public void setMap(String map) { this.map = 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; } + + 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; } + + public String getMapUrl() { + return mapUrl; + } + + public void setMapUrl(String mapUrl) { + this.mapUrl = mapUrl; + } private String language; - public String getLanguage() { return language; } - public void setLanguage(String language) { this.language = language; } + + public String getLanguage() { + return language; + } + + public void setLanguage(String language) { + this.language = language; + } private String distanceUnit; - public String getDistanceUnit() { return distanceUnit; } - public void setDistanceUnit(String distanceUnit) { this.distanceUnit = distanceUnit; } + + public String getDistanceUnit() { + return distanceUnit; + } + + public void setDistanceUnit(String distanceUnit) { + this.distanceUnit = distanceUnit; + } private String speedUnit; - public String getSpeedUnit() { return speedUnit; } - public void setSpeedUnit(String speedUnit) { this.speedUnit = speedUnit; } + + public String getSpeedUnit() { + return speedUnit; + } + + public void setSpeedUnit(String speedUnit) { + this.speedUnit = speedUnit; + } private double latitude; - public double getLatitude() { return latitude; } - public void setLatitude(double latitude) { this.latitude = 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; } + + 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; } + + public int getZoom() { + return zoom; + } + + public void setZoom(int zoom) { + this.zoom = zoom; + } } diff --git a/src/org/traccar/model/User.java b/src/org/traccar/model/User.java index 401f64245..05437dd97 100644 --- a/src/org/traccar/model/User.java +++ b/src/org/traccar/model/User.java @@ -26,53 +26,123 @@ public class User implements Factory { } private long id; - public long getId() { return id; } - public void setId(long id) { this.id = id; } + + public long getId() { + return id; + } + + public void setId(long id) { + this.id = id; + } private String name; - public String getName() { return name; } - public void setName(String name) { this.name = 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; } + + public String getEmail() { + return email; + } + + public void setEmail(String email) { + this.email = email; + } private boolean readonly; private boolean admin; - public boolean getAdmin() { return admin; } - public void setAdmin(boolean admin) { this.admin = 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; } + + public String getMap() { + return map; + } + + public void setMap(String map) { + this.map = map; + } private String language; - public String getLanguage() { return language; } - public void setLanguage(String language) { this.language = language; } + + public String getLanguage() { + return language; + } + + public void setLanguage(String language) { + this.language = language; + } private String distanceUnit; - public String getDistanceUnit() { return distanceUnit; } - public void setDistanceUnit(String distanceUnit) { this.distanceUnit = distanceUnit; } + + public String getDistanceUnit() { + return distanceUnit; + } + + public void setDistanceUnit(String distanceUnit) { + this.distanceUnit = distanceUnit; + } private String speedUnit; - public String getSpeedUnit() { return speedUnit; } - public void setSpeedUnit(String speedUnit) { this.speedUnit = speedUnit; } + + public String getSpeedUnit() { + return speedUnit; + } + + public void setSpeedUnit(String speedUnit) { + this.speedUnit = speedUnit; + } private double latitude; - public double getLatitude() { return latitude; } - public void setLatitude(double latitude) { this.latitude = 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; } + + 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; } + + public int getZoom() { + return zoom; + } + + public void setZoom(int zoom) { + this.zoom = zoom; + } private String password; - public String getPassword() { return password; } + + public String getPassword() { + return password; + } + public void setPassword(String password) { this.password = password; if (password != null && !password.isEmpty()) { @@ -83,14 +153,26 @@ public class User implements Factory { } private String hashedPassword; + @JsonIgnore - public String getHashedPassword() { return hashedPassword; } - public void setHashedPassword(String hashedPassword) { this.hashedPassword = hashedPassword; } + public String getHashedPassword() { + return hashedPassword; + } + + public void setHashedPassword(String hashedPassword) { + this.hashedPassword = hashedPassword; + } private String salt; + @JsonIgnore - public String getSalt() { return salt; } - public void setSalt(String salt) { this.salt = salt; } + public String getSalt() { + return salt; + } + + public void setSalt(String salt) { + this.salt = salt; + } public boolean isPasswordValid(String password) { return Hashing.validatePassword(password, hashedPassword, salt); -- cgit v1.2.3