Skip to content

Commit fa6a478

Browse files
committed
Cleaned up REST method annotations
1 parent a5be9f5 commit fa6a478

File tree

4 files changed

+14
-54
lines changed

4 files changed

+14
-54
lines changed

src/main/java/com/atomgraph/linkeddatahub/resource/Add.java

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -19,26 +19,21 @@
1919
import com.atomgraph.core.MediaTypes;
2020
import com.atomgraph.core.vocabulary.SD;
2121
import com.atomgraph.linkeddatahub.client.GraphStoreClient;
22-
import com.atomgraph.linkeddatahub.model.Service;
2322
import com.atomgraph.linkeddatahub.server.security.AgentContext;
2423
import java.io.InputStream;
2524
import java.io.OutputStream;
2625
import java.net.URI;
2726
import java.util.Optional;
2827
import jakarta.inject.Inject;
2928
import jakarta.ws.rs.BadRequestException;
30-
import jakarta.ws.rs.DefaultValue;
3129
import jakarta.ws.rs.POST;
32-
import jakarta.ws.rs.QueryParam;
3330
import jakarta.ws.rs.client.Entity;
3431
import jakarta.ws.rs.core.Context;
3532
import jakarta.ws.rs.core.Request;
3633
import jakarta.ws.rs.core.Response;
37-
import jakarta.ws.rs.core.SecurityContext;
3834
import jakarta.ws.rs.core.StreamingOutput;
3935
import jakarta.ws.rs.core.UriInfo;
4036
import jakarta.ws.rs.ext.Providers;
41-
import org.apache.jena.ontology.Ontology;
4237
import org.apache.jena.rdf.model.Model;
4338
import org.apache.jena.rdf.model.ResIterator;
4439
import org.apache.jena.rdf.model.Resource;
@@ -67,18 +62,13 @@ public class Add
6762
* @param request current request
6863
* @param uriInfo current URI info
6964
* @param mediaTypes supported media types
70-
* @param application matched application
71-
* @param ontology matched application's ontology
72-
* @param service matched application's service
7365
* @param providers JAX-RS providers
7466
* @param system system application
75-
* @param securityContext JAX-RS security context
7667
* @param agentContext authenticated agent's context
7768
*/
7869
@Inject
7970
public Add(@Context Request request, @Context UriInfo uriInfo, MediaTypes mediaTypes,
80-
com.atomgraph.linkeddatahub.apps.model.Application application, Optional<Ontology> ontology, Optional<Service> service,
81-
@Context SecurityContext securityContext, Optional<AgentContext> agentContext,
71+
Optional<AgentContext> agentContext,
8272
@Context Providers providers, com.atomgraph.linkeddatahub.Application system)
8373
{
8474
this.uriInfo = uriInfo;
@@ -92,12 +82,10 @@ public Add(@Context Request request, @Context UriInfo uriInfo, MediaTypes mediaT
9282
* Expects a model containing a resource with dct:source (source URI) and sd:name (target graph URI) properties.
9383
*
9484
* @param model the RDF model containing the import parameters
95-
* @param defaultGraph whether to import into the default graph
96-
* @param graphUri the target graph URI
9785
* @return JAX-RS response with the imported data
9886
*/
9987
@POST
100-
public Response post(Model model, @QueryParam("default") @DefaultValue("false") Boolean defaultGraph, @QueryParam("graph") URI graphUri)
88+
public Response post(Model model)
10189
{
10290
ResIterator it = model.listSubjectsWithProperty(DCTerms.source);
10391
try

src/main/java/com/atomgraph/linkeddatahub/resource/Generate.java

Lines changed: 6 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,10 @@
1616
*/
1717
package com.atomgraph.linkeddatahub.resource;
1818

19-
import com.atomgraph.client.util.DataManager;
2019
import com.atomgraph.core.MediaTypes;
2120
import com.atomgraph.linkeddatahub.apps.model.Application;
2221
import com.atomgraph.linkeddatahub.client.GraphStoreClient;
2322
import com.atomgraph.linkeddatahub.imports.QueryLoader;
24-
import com.atomgraph.linkeddatahub.model.Service;
2523
import com.atomgraph.linkeddatahub.server.security.AgentContext;
2624
import com.atomgraph.linkeddatahub.server.util.Skolemizer;
2725
import com.atomgraph.linkeddatahub.vocabulary.LDH;
@@ -36,20 +34,15 @@
3634
import java.util.UUID;
3735
import jakarta.inject.Inject;
3836
import jakarta.ws.rs.BadRequestException;
39-
import jakarta.ws.rs.DefaultValue;
4037
import jakarta.ws.rs.InternalServerErrorException;
4138
import jakarta.ws.rs.POST;
42-
import jakarta.ws.rs.QueryParam;
4339
import jakarta.ws.rs.container.ResourceContext;
4440
import jakarta.ws.rs.core.Context;
4541
import jakarta.ws.rs.core.Request;
4642
import jakarta.ws.rs.core.Response;
4743
import jakarta.ws.rs.core.Response.Status;
48-
import jakarta.ws.rs.core.SecurityContext;
4944
import jakarta.ws.rs.core.UriBuilder;
5045
import jakarta.ws.rs.core.UriInfo;
51-
import jakarta.ws.rs.ext.Providers;
52-
import org.apache.jena.ontology.Ontology;
5346
import org.apache.jena.query.ParameterizedSparqlString;
5447
import org.apache.jena.query.Query;
5548
import org.apache.jena.query.Syntax;
@@ -86,21 +79,14 @@ public class Generate
8679
* @param uriInfo current URI info
8780
* @param mediaTypes supported media types
8881
* @param application matched application
89-
* @param ontology matched application's ontology
90-
* @param service matched application's service
91-
* @param providers JAX-RS providers
9282
* @param system system application
93-
* @param securityContext JAX-RS security context
9483
* @param agentContext authenticated agent's context
95-
* @param dataManager RDF data manager
9684
* @param resourceContext resource context for creating resources
9785
*/
9886
@Inject
9987
public Generate(@Context Request request, @Context UriInfo uriInfo, MediaTypes mediaTypes,
100-
com.atomgraph.linkeddatahub.apps.model.Application application, Optional<Ontology> ontology, Optional<Service> service,
101-
@Context SecurityContext securityContext, Optional<AgentContext> agentContext,
102-
@Context Providers providers, com.atomgraph.linkeddatahub.Application system,
103-
DataManager dataManager, @Context ResourceContext resourceContext)
88+
com.atomgraph.linkeddatahub.apps.model.Application application, Optional<AgentContext> agentContext,
89+
com.atomgraph.linkeddatahub.Application system, @Context ResourceContext resourceContext)
10490
{
10591
this.uriInfo = uriInfo;
10692
this.mediaTypes = mediaTypes;
@@ -112,17 +98,15 @@ public Generate(@Context Request request, @Context UriInfo uriInfo, MediaTypes m
11298

11399
/**
114100
* Generates containers for given classes.
115-
* Expects a model containing a parent container (sioc:has_parent) and one or more class specifications
116-
* with void:class and spin:query properties. Creates a new container for each class with a view based
117-
* on the provided SPARQL SELECT query.
101+
* Expects a model containing a parent container (<samp>sioc:has_parent</samp>) and one or more class specifications
102+
* with <samp>void:class</samp> and <samp>spin:query</samp> properties. Creates a new container for each class with a view based
103+
* on the provided SPARQL <samp>SELECT</samp> query.
118104
*
119105
* @param model the RDF model containing the generation parameters
120-
* @param defaultGraph whether to use the default graph
121-
* @param graphUri the target graph URI
122106
* @return JAX-RS response indicating success or failure
123107
*/
124108
@POST
125-
public Response post(Model model, @QueryParam("default") @DefaultValue("false") Boolean defaultGraph, @QueryParam("graph") URI graphUri)
109+
public Response post(Model model)
126110
{
127111
ResIterator it = model.listSubjectsWithProperty(SIOC.HAS_PARENT);
128112
try

src/main/java/com/atomgraph/linkeddatahub/resource/acl/AccessRequest.java

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,10 @@
3030
import com.atomgraph.linkeddatahub.vocabulary.SIOC;
3131
import jakarta.inject.Inject;
3232
import jakarta.servlet.ServletConfig;
33-
import jakarta.ws.rs.DefaultValue;
3433
import jakarta.ws.rs.GET;
3534
import jakarta.ws.rs.InternalServerErrorException;
3635
import jakarta.ws.rs.NotAllowedException;
3736
import jakarta.ws.rs.POST;
38-
import jakarta.ws.rs.QueryParam;
3937
import jakarta.ws.rs.core.Context;
4038
import jakarta.ws.rs.core.Response;
4139
import jakarta.ws.rs.core.UriBuilder;
@@ -100,12 +98,10 @@ public AccessRequest(com.atomgraph.linkeddatahub.apps.model.Application applicat
10098
/**
10199
* Implements the HTTP GET method.
102100
*
103-
* @param defaultGraph default graph flag
104-
* @param graphUri graph URI
105101
* @return response object
106102
*/
107103
@GET
108-
public Response get(@QueryParam("default") @DefaultValue("false") Boolean defaultGraph, @QueryParam("graph") URI graphUri)
104+
public Response get()
109105
{
110106
throw new NotAllowedException("GET is not allowed on this endpoint");
111107
}
@@ -114,12 +110,10 @@ public Response get(@QueryParam("default") @DefaultValue("false") Boolean defaul
114110
* Implements the HTTP POST method for submitting access requests.
115111
*
116112
* @param model RDF model with access request data
117-
* @param defaultGraph default graph flag
118-
* @param graphUri graph URI
119113
* @return response object
120114
*/
121115
@POST
122-
public Response post(Model model, @QueryParam("default") @DefaultValue("false") Boolean defaultGraph, @QueryParam("graph") URI graphUri)
116+
public Response post(Model model)
123117
{
124118
ResIterator it = model.listResourcesWithProperty(RDF.type, ACL.Authorization);
125119
try
@@ -128,7 +122,7 @@ public Response post(Model model, @QueryParam("default") @DefaultValue("false")
128122
{
129123
Resource authorization = it.next();
130124

131-
graphUri = getAuthRequestContainerUriBuilder().path(UUID.randomUUID().toString() + "/").build(); // URI of the new access request graph
125+
URI graphUri = getAuthRequestContainerUriBuilder().path(UUID.randomUUID().toString() + "/").build(); // URI of the new access request graph
132126
Model requestModel = ModelFactory.createDefaultModel();
133127

134128
Resource agent = authorization.getPropertyResourceValue(ACL.agent);

src/main/java/com/atomgraph/linkeddatahub/resource/upload/Item.java

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,17 +30,14 @@
3030
import com.atomgraph.linkeddatahub.model.Service;
3131
import com.atomgraph.linkeddatahub.server.io.FileRangeOutput;
3232
import com.atomgraph.linkeddatahub.server.security.AgentContext;
33-
import java.util.ArrayList;
3433
import java.util.Collections;
3534
import java.util.Date;
3635
import java.util.Optional;
3736
import jakarta.annotation.PostConstruct;
3837
import jakarta.inject.Inject;
39-
import jakarta.ws.rs.DefaultValue;
4038
import jakarta.ws.rs.GET;
4139
import jakarta.ws.rs.NotAcceptableException;
4240
import jakarta.ws.rs.NotFoundException;
43-
import jakarta.ws.rs.QueryParam;
4441
import jakarta.ws.rs.WebApplicationException;
4542
import jakarta.ws.rs.core.EntityTag;
4643
import jakarta.ws.rs.core.HttpHeaders;
@@ -113,9 +110,9 @@ public void init()
113110

114111
@GET
115112
@Override
116-
public Response get(@QueryParam("default") @DefaultValue("false") Boolean defaultGraph, @QueryParam("graph") URI graphUri)
113+
public Response get()
117114
{
118-
return getResponseBuilder(getResource().getModel(), graphUri).build();
115+
return getResponseBuilder(getResource().getModel(), getURI()).build();
119116
}
120117

121118
@Override
@@ -275,10 +272,7 @@ public jakarta.ws.rs.core.MediaType getMediaType()
275272
@Override
276273
public List<jakarta.ws.rs.core.MediaType> getWritableMediaTypes(Class clazz)
277274
{
278-
List<jakarta.ws.rs.core.MediaType> list = new ArrayList<>();
279-
list.add(getMediaType());
280-
281-
return list;
275+
return List.of(getMediaType());
282276
}
283277

284278
/**

0 commit comments

Comments
 (0)