Compare commits
1 Commits
master
...
feature/24
Author | SHA1 | Date |
---|---|---|
luca.frosini | 93642a67f7 |
|
@ -2,11 +2,6 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
|
|||
|
||||
# Changelog for Resource Registry Query Template Client
|
||||
|
||||
## [v1.2.0-SNAPSHOT]
|
||||
|
||||
- Added support for paginated results [#24648]
|
||||
|
||||
|
||||
## [v1.1.1]
|
||||
|
||||
- Migrated code to reorganized E/R format [#24992]
|
||||
|
|
6
pom.xml
6
pom.xml
|
@ -10,7 +10,7 @@
|
|||
|
||||
<groupId>org.gcube.information-system</groupId>
|
||||
<artifactId>resource-registry-query-template-client</artifactId>
|
||||
<version>1.2.0-SNAPSHOT</version>
|
||||
<version>1.1.1</version>
|
||||
<name>Resource Registry Query Template Client</name>
|
||||
<description>Resource Registry Query Template Client is a library designed to interact with Resource Registry Query Template APIs</description>
|
||||
|
||||
|
@ -50,6 +50,10 @@
|
|||
<groupId>org.gcube.common</groupId>
|
||||
<artifactId>gxHTTP</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.gcube.common</groupId>
|
||||
<artifactId>common-utility-sg3</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-api</artifactId>
|
||||
|
|
|
@ -42,6 +42,8 @@ public class ResourceRegistryQueryTemplateClientImpl extends BaseRequestInfo imp
|
|||
protected Map<String, String> headers;
|
||||
|
||||
private void addOptionalQueryParameters(Map<String,String> queryParams) throws UnsupportedEncodingException {
|
||||
addHierarchicalMode(queryParams);
|
||||
addIncludeContexts(queryParams);
|
||||
addIncludeMeta(queryParams);
|
||||
addIncludeAllMeta(queryParams);
|
||||
}
|
||||
|
@ -59,6 +61,18 @@ public class ResourceRegistryQueryTemplateClientImpl extends BaseRequestInfo imp
|
|||
return gxHTTPStringRequest.queryParams(queryParams);
|
||||
}
|
||||
|
||||
private void addHierarchicalMode(Map<String,String> queryParams) throws UnsupportedEncodingException{
|
||||
if(hierarchicalMode) {
|
||||
queryParams.put(AccessPath.HIERARCHICAL_MODE_QUERY_PARAMETER, Boolean.toString(hierarchicalMode));
|
||||
}
|
||||
}
|
||||
|
||||
private void addIncludeContexts(Map<String,String> queryParams) throws UnsupportedEncodingException{
|
||||
if(includeContexts) {
|
||||
queryParams.put(AccessPath.INCLUDE_CONTEXTS_QUERY_PARAMETER, Boolean.toString(includeContexts));
|
||||
}
|
||||
}
|
||||
|
||||
private void addIncludeMeta(Map<String,String> queryParams) throws UnsupportedEncodingException{
|
||||
if(includeMeta) {
|
||||
queryParams.put(AccessPath.INCLUDE_META_QUERY_PARAMETER, Boolean.toString(includeMeta));
|
||||
|
@ -71,18 +85,6 @@ public class ResourceRegistryQueryTemplateClientImpl extends BaseRequestInfo imp
|
|||
}
|
||||
}
|
||||
|
||||
private void addOffset(Map<String,String> queryParams) throws UnsupportedEncodingException{
|
||||
if(offset!=null) {
|
||||
queryParams.put(AccessPath.OFFSET_QUERY_PARAMETER, offset.toString());
|
||||
}
|
||||
}
|
||||
|
||||
private void addLimit(Map<String,String> queryParams) throws UnsupportedEncodingException{
|
||||
if(limit!=null) {
|
||||
queryParams.put(AccessPath.LIMIT_QUERY_PARAMETER, limit.toString());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addHeader(String name, String value) {
|
||||
headers.put(name, value);
|
||||
|
@ -98,12 +100,9 @@ public class ResourceRegistryQueryTemplateClientImpl extends BaseRequestInfo imp
|
|||
}
|
||||
|
||||
public ResourceRegistryQueryTemplateClientImpl(String address) {
|
||||
super();
|
||||
this.address = address;
|
||||
this.headers = new HashMap<>();
|
||||
this.hierarchicalMode = false;
|
||||
this.includeContexts = false;
|
||||
this.includeMeta = false;
|
||||
this.allMeta = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -117,8 +116,6 @@ public class ResourceRegistryQueryTemplateClientImpl extends BaseRequestInfo imp
|
|||
Map<String,String> parameters = new HashMap<>();
|
||||
addIncludeMeta(parameters);
|
||||
addIncludeAllMeta(parameters);
|
||||
addOffset(parameters);
|
||||
addLimit(parameters);
|
||||
gxHTTPStringRequest.queryParams(parameters);
|
||||
|
||||
HttpURLConnection httpURLConnection = gxHTTPStringRequest.get();
|
||||
|
|
Loading…
Reference in New Issue