diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2017-02-28 08:09:10 +1300 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2017-02-28 16:11:07 +1300 |
commit | 9120ff19ab2bdd466ae5c30632efd1917faa71b1 (patch) | |
tree | 7cbac795c7f2ec56a5e0ed0e474642a2113222dc | |
parent | 39452c3e0af164e6d63696afaf874c13c7ee8b5f (diff) | |
download | traccar-server-9120ff19ab2bdd466ae5c30632efd1917faa71b1.tar.gz traccar-server-9120ff19ab2bdd466ae5c30632efd1917faa71b1.tar.bz2 traccar-server-9120ff19ab2bdd466ae5c30632efd1917faa71b1.zip |
Add separate QueryIgnore annotation (fix #2962)
-rw-r--r-- | src/org/traccar/database/QueryBuilder.java | 5 | ||||
-rw-r--r-- | src/org/traccar/database/QueryIgnore.java | 26 | ||||
-rw-r--r-- | src/org/traccar/model/Calendar.java | 3 | ||||
-rw-r--r-- | src/org/traccar/model/Geofence.java | 3 |
4 files changed, 34 insertions, 3 deletions
diff --git a/src/org/traccar/database/QueryBuilder.java b/src/org/traccar/database/QueryBuilder.java index 83bc5de2e..a24e6f0bf 100644 --- a/src/org/traccar/database/QueryBuilder.java +++ b/src/org/traccar/database/QueryBuilder.java @@ -15,7 +15,6 @@ */ package org.traccar.database; -import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.core.JsonProcessingException; import org.traccar.Context; import org.traccar.helper.Log; @@ -262,7 +261,7 @@ public final class QueryBuilder { for (Method method : methods) { if (method.getName().startsWith("get") && method.getParameterTypes().length == 0 - && !method.isAnnotationPresent(JsonIgnore.class)) { + && !method.isAnnotationPresent(QueryIgnore.class)) { String name = method.getName().substring(3); try { if (method.getReturnType().equals(boolean.class)) { @@ -427,7 +426,7 @@ public final class QueryBuilder { for (final Method method : methods) { if (method.getName().startsWith("set") && method.getParameterTypes().length == 1 - && !method.isAnnotationPresent(JsonIgnore.class)) { + && !method.isAnnotationPresent(QueryIgnore.class)) { final String name = method.getName().substring(3); diff --git a/src/org/traccar/database/QueryIgnore.java b/src/org/traccar/database/QueryIgnore.java new file mode 100644 index 000000000..ac835cf2f --- /dev/null +++ b/src/org/traccar/database/QueryIgnore.java @@ -0,0 +1,26 @@ +/* + * Copyright 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.database; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +@Target(ElementType.METHOD) +@Retention(RetentionPolicy.RUNTIME) +public @interface QueryIgnore { +} diff --git a/src/org/traccar/model/Calendar.java b/src/org/traccar/model/Calendar.java index 94f6bc2a3..55f696d50 100644 --- a/src/org/traccar/model/Calendar.java +++ b/src/org/traccar/model/Calendar.java @@ -32,6 +32,7 @@ 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.traccar.database.QueryIgnore; public class Calendar extends Extensible { @@ -59,6 +60,7 @@ public class Calendar extends Extensible { private net.fortuna.ical4j.model.Calendar calendar; + @QueryIgnore @JsonIgnore public net.fortuna.ical4j.model.Calendar getCalendar() { return calendar; @@ -76,4 +78,5 @@ public class Calendar extends Extensible { } return false; } + } diff --git a/src/org/traccar/model/Geofence.java b/src/org/traccar/model/Geofence.java index ffd4876bf..dfb888852 100644 --- a/src/org/traccar/model/Geofence.java +++ b/src/org/traccar/model/Geofence.java @@ -18,6 +18,7 @@ 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; @@ -74,11 +75,13 @@ public class Geofence extends Extensible { private GeofenceGeometry geometry; + @QueryIgnore @JsonIgnore public GeofenceGeometry getGeometry() { return geometry; } + @QueryIgnore @JsonIgnore public void setGeometry(GeofenceGeometry geometry) { area = geometry.toWkt(); |