aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar/api/resource
diff options
context:
space:
mode:
authorAnton Tananaev <anton@traccar.org>2022-02-18 00:00:12 -0800
committerAnton Tananaev <anton@traccar.org>2022-02-18 00:00:12 -0800
commitb5b9eb8207f42235f7ed2a52a6424f5629590992 (patch)
tree011b444c6c9d71447c0f5c8d0ae3daa4021b7f8c /src/main/java/org/traccar/api/resource
parente901e80d26544e86a9e3509532de92ceed0b87a8 (diff)
downloadtrackermap-server-b5b9eb8207f42235f7ed2a52a6424f5629590992.tar.gz
trackermap-server-b5b9eb8207f42235f7ed2a52a6424f5629590992.tar.bz2
trackermap-server-b5b9eb8207f42235f7ed2a52a6424f5629590992.zip
Migrate server API to storage
Diffstat (limited to 'src/main/java/org/traccar/api/resource')
-rw-r--r--src/main/java/org/traccar/api/resource/ServerResource.java17
1 files changed, 10 insertions, 7 deletions
diff --git a/src/main/java/org/traccar/api/resource/ServerResource.java b/src/main/java/org/traccar/api/resource/ServerResource.java
index 8096c66fa..2d17d5e47 100644
--- a/src/main/java/org/traccar/api/resource/ServerResource.java
+++ b/src/main/java/org/traccar/api/resource/ServerResource.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015 - 2020 Anton Tananaev (anton@traccar.org)
+ * Copyright 2015 - 2022 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.
@@ -19,9 +19,13 @@ import org.traccar.Context;
import org.traccar.api.BaseResource;
import org.traccar.helper.LogAction;
import org.traccar.model.Server;
+import org.traccar.storage.Storage;
import org.traccar.storage.StorageException;
+import org.traccar.storage.query.Columns;
+import org.traccar.storage.query.Request;
import javax.annotation.security.PermitAll;
+import javax.inject.Inject;
import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
import javax.ws.rs.PUT;
@@ -36,14 +40,13 @@ import javax.ws.rs.core.Response;
@Consumes(MediaType.APPLICATION_JSON)
public class ServerResource extends BaseResource {
+ @Inject
+ private Storage storage;
+
@PermitAll
@GET
- public Server get(@QueryParam("force") boolean force) throws StorageException {
- if (force) {
- return Context.getDataManager().getServer();
- } else {
- return Context.getPermissionsManager().getServer();
- }
+ public Server get() throws StorageException {
+ return storage.getObject(Server.class, new Request(new Columns.All()));
}
@PUT