From 3bf3ade7e1e0f7abf69d0e98ed064f455e2cff69 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Wed, 7 Oct 2015 19:17:59 +1300 Subject: Clean up some model classes --- src/org/traccar/model/Event.java | 84 ++++++++++++++++++++++++---------------- 1 file changed, 51 insertions(+), 33 deletions(-) (limited to 'src/org/traccar/model/Event.java') diff --git a/src/org/traccar/model/Event.java b/src/org/traccar/model/Event.java index 953bd1770..9ad54adbf 100644 --- a/src/org/traccar/model/Event.java +++ b/src/org/traccar/model/Event.java @@ -16,40 +16,8 @@ package org.traccar.model; import java.util.Date; -import java.util.LinkedHashMap; -import java.util.Map; -public abstract class Event { - - private long id; - public long getId() { return id; } - public void setId(long id) { this.id = id; } - - private String protocol; - public String getProtocol() { return protocol; } - public void setProtocol(String protocol) { this.protocol = protocol; } - - private long deviceId; - public long getDeviceId() { return deviceId; } - public void setDeviceId(long deviceId) { this.deviceId = deviceId; } - - private Date serverTime; - public Date getServerTime() { return serverTime; } - public void setServerTime(Date serverTime) { this.serverTime = serverTime; } - - private Date deviceTime; - public Date getDeviceTime() { return deviceTime; } - public void setDeviceTime(Date deviceTime) { this.deviceTime = deviceTime; } - - private Map attributes = new LinkedHashMap<>(); - public Map getAttributes() { return attributes; } - public void setAttributes(Map attributes) { this.attributes = attributes; } - - public void set(String key, boolean value) { attributes.put(key, value); } - public void set(String key, int value) { attributes.put(key, value); } - public void set(String key, long value) { attributes.put(key, value); } - public void set(String key, double value) { attributes.put(key, value); } - public void set(String key, String value) { if (value != null && !value.isEmpty()) attributes.put(key, value); } +public abstract class Event extends Extensible { // Words separated by dashes (word-second-third) public static final String KEY_INDEX = "index"; @@ -91,4 +59,54 @@ public abstract class Event { public static final String PREFIX_IO = "io"; public static final String PREFIX_COUNT = "count"; + private long id; + + public long getId() { + return id; + } + + public void setId(long id) { + this.id = id; + } + + private String protocol; + + public String getProtocol() { + return protocol; + } + + public void setProtocol(String protocol) { + this.protocol = protocol; + } + + private long deviceId; + + public long getDeviceId() { + return deviceId; + } + + public void setDeviceId(long deviceId) { + this.deviceId = deviceId; + } + + private Date serverTime; + + public Date getServerTime() { + return serverTime; + } + + public void setServerTime(Date serverTime) { + this.serverTime = serverTime; + } + + private Date deviceTime; + + public Date getDeviceTime() { + return deviceTime; + } + + public void setDeviceTime(Date deviceTime) { + this.deviceTime = deviceTime; + } + } -- cgit v1.2.3