Merge pull request 'Feature #21584 added support for /ServiceEndpoint/{category} REST call' (#1) from Feature/21584 into master
Reviewed-on: #1
This commit is contained in:
commit
3a1fd378ec
|
@ -3,6 +3,10 @@
|
||||||
All notable changes to this project will be documented in this file.
|
All notable changes to this project will be documented in this file.
|
||||||
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||||
|
|
||||||
|
## [v1.2.0-SNAPSHOT] - [2021-06-08]
|
||||||
|
|
||||||
|
- Feature #21584 added support for /ServiceEndpoint/{category} REST call
|
||||||
|
|
||||||
## [v1.1.0-SNAPSHOT] - [2016-10-03]
|
## [v1.1.0-SNAPSHOT] - [2016-10-03]
|
||||||
|
|
||||||
- porting to auth v.2
|
- porting to auth v.2
|
||||||
|
|
2
pom.xml
2
pom.xml
|
@ -11,7 +11,7 @@
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<groupId>org.gcube.information-system</groupId>
|
<groupId>org.gcube.information-system</groupId>
|
||||||
<artifactId>icproxy</artifactId>
|
<artifactId>icproxy</artifactId>
|
||||||
<version>1.1.1-SNAPSHOT</version>
|
<version>1.2.0-SNAPSHOT</version>
|
||||||
<name>ICProxy</name>
|
<name>ICProxy</name>
|
||||||
|
|
||||||
<packaging>war</packaging>
|
<packaging>war</packaging>
|
||||||
|
|
|
@ -24,6 +24,19 @@ import org.gcube.resources.discovery.client.queries.api.SimpleQuery;
|
||||||
@Path("ServiceEndpoint")
|
@Path("ServiceEndpoint")
|
||||||
public class ServiceEndpointResource {
|
public class ServiceEndpointResource {
|
||||||
|
|
||||||
|
@GET
|
||||||
|
@Path("/{category}")
|
||||||
|
@Produces(MediaType.APPLICATION_XML)
|
||||||
|
public List<ServiceEndpoint> retrieve(@NotNull @PathParam("category") String resourceCategory) {
|
||||||
|
log.info("ServiceEndpoint called with category {} in context {}",resourceCategory, ScopeProvider.instance.get());
|
||||||
|
|
||||||
|
DiscoveryClient<ServiceEndpoint> client = clientFor(ServiceEndpoint.class);
|
||||||
|
|
||||||
|
List<ServiceEndpoint> endpoints = client.submit(getQuery(resourceCategory));
|
||||||
|
log.debug("retrieved resources are "+endpoints.size());
|
||||||
|
return endpoints;
|
||||||
|
}
|
||||||
|
|
||||||
@GET
|
@GET
|
||||||
@Path("/{category}/{name}")
|
@Path("/{category}/{name}")
|
||||||
@Produces(MediaType.APPLICATION_XML)
|
@Produces(MediaType.APPLICATION_XML)
|
||||||
|
@ -72,4 +85,10 @@ public class ServiceEndpointResource {
|
||||||
return query;
|
return query;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private SimpleQuery getQuery(String resourceCategory){
|
||||||
|
SimpleQuery query = queryFor(ServiceEndpoint.class);
|
||||||
|
query.addCondition(String.format("$resource/Profile/Category/text() eq '%s'",resourceCategory));
|
||||||
|
return query;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue