From aa289b8600d9a55fdd053e003705de116ab25f2e Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Sun, 11 Oct 2015 13:50:13 +1300 Subject: Make changes to model hierarchy --- src/org/traccar/model/Command.java | 35 +++++++++++++----------------- src/org/traccar/model/Event.java | 10 --------- src/org/traccar/model/Extensible.java | 2 +- src/org/traccar/model/Message.java | 40 +++++++++++++++++++++++++++++++++++ 4 files changed, 56 insertions(+), 31 deletions(-) create mode 100644 src/org/traccar/model/Message.java (limited to 'src/org') diff --git a/src/org/traccar/model/Command.java b/src/org/traccar/model/Command.java index 09bb81a74..99525a02b 100644 --- a/src/org/traccar/model/Command.java +++ b/src/org/traccar/model/Command.java @@ -1,3 +1,18 @@ +/* + * Copyright 2015 Anton Tananaev (anton.tananaev@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 Command extends Extensible implements Factory { @@ -21,24 +36,4 @@ public class Command extends Extensible implements Factory { return new Command(); } - 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/Event.java b/src/org/traccar/model/Event.java index 586885c4a..172203a86 100644 --- a/src/org/traccar/model/Event.java +++ b/src/org/traccar/model/Event.java @@ -80,16 +80,6 @@ public abstract class Event extends Extensible { 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() { diff --git a/src/org/traccar/model/Extensible.java b/src/org/traccar/model/Extensible.java index d32fec61a..a821d0e43 100644 --- a/src/org/traccar/model/Extensible.java +++ b/src/org/traccar/model/Extensible.java @@ -18,7 +18,7 @@ package org.traccar.model; import java.util.LinkedHashMap; import java.util.Map; -public abstract class Extensible { +public abstract class Extensible extends Message { private Map attributes = new LinkedHashMap<>(); diff --git a/src/org/traccar/model/Message.java b/src/org/traccar/model/Message.java new file mode 100644 index 000000000..bac6661a8 --- /dev/null +++ b/src/org/traccar/model/Message.java @@ -0,0 +1,40 @@ +/* + * Copyright 2013 - 2015 Anton Tananaev (anton.tananaev@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 Message { + + 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; + } + +} -- cgit v1.2.3