From 489343746ccbb0d1864911b53c7ab354ea32bec1 Mon Sep 17 00:00:00 2001 From: Rich Tabedzki Date: Fri, 1 Feb 2019 13:45:04 -0500 Subject: improved handling of indexed data Changes made: * improve handling of indexed data in sli-adaptors:aai-service update request * added code to convert index based data to daat array based to better fit AAI UPDATE processing Change-Id: Ic5b457f546a70c82278c4f2c6b126b77e8d27eae Issue-ID: CCSDK-1013 Signed-off-by: Rich Tabedzki --- .../src/main/java/META-INF/sun-jaxb.episode | 376 --------------------- .../org/onap/ccsdk/sli/adaptors/aai/AAIClient.java | 5 +- .../sli/adaptors/aai/AAIClientRESTExecutor.java | 2 +- .../ccsdk/sli/adaptors/aai/AAIDeclarations.java | 4 + .../sli/adaptors/aai/AAIExecutorInterface.java | 5 +- .../onap/ccsdk/sli/adaptors/aai/AAIRequest.java | 5 +- .../onap/ccsdk/sli/adaptors/aai/AAIService.java | 5 +- .../sli/adaptors/aai/AAIServiceException.java | 5 +- .../ccsdk/sli/adaptors/aai/AAIServiceProvider.java | 5 +- .../ccsdk/sli/adaptors/aai/AAIServiceUtils.java | 5 +- .../ccsdk/sli/adaptors/aai/AAITrinityService.java | 5 +- .../ccsdk/sli/adaptors/aai/CustomQueryRequest.java | 5 +- .../onap/ccsdk/sli/adaptors/aai/EchoRequest.java | 5 +- .../sli/adaptors/aai/GenericQueryRequest.java | 5 +- .../ccsdk/sli/adaptors/aai/GenericRequest.java | 5 +- .../onap/ccsdk/sli/adaptors/aai/HttpMethod.java | 5 +- .../ccsdk/sli/adaptors/aai/NamedQueryRequest.java | 5 +- .../ccsdk/sli/adaptors/aai/NodesQueryRequest.java | 5 +- .../onap/ccsdk/sli/adaptors/aai/PathRequest.java | 5 +- .../sli/adaptors/aai/RelationshipListRequest.java | 5 +- .../sli/adaptors/aai/RelationshipRequest.java | 5 +- .../ccsdk/sli/adaptors/aai/SelfLinkRequest.java | 5 +- .../onap/ccsdk/sli/adaptors/aai/UpdateRequest.java | 174 ++++++---- 23 files changed, 190 insertions(+), 461 deletions(-) delete mode 100755 aai-service/provider/src/main/java/META-INF/sun-jaxb.episode mode change 100644 => 100755 aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIServiceException.java mode change 100644 => 100755 aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAITrinityService.java mode change 100644 => 100755 aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/CustomQueryRequest.java mode change 100644 => 100755 aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/EchoRequest.java mode change 100644 => 100755 aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/GenericQueryRequest.java mode change 100644 => 100755 aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/PathRequest.java mode change 100644 => 100755 aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/SelfLinkRequest.java (limited to 'aai-service/provider/src/main/java') diff --git a/aai-service/provider/src/main/java/META-INF/sun-jaxb.episode b/aai-service/provider/src/main/java/META-INF/sun-jaxb.episode deleted file mode 100755 index f14c7d47..00000000 --- a/aai-service/provider/src/main/java/META-INF/sun-jaxb.episode +++ /dev/null @@ -1,376 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIClient.java b/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIClient.java index 6af6ad6a..752bd9f3 100755 --- a/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIClient.java +++ b/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIClient.java @@ -19,7 +19,10 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - +/** + * @author Rich Tabedzki + * + */ package org.onap.ccsdk.sli.adaptors.aai; import java.io.IOException; diff --git a/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIClientRESTExecutor.java b/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIClientRESTExecutor.java index a3aecda1..c4f9464e 100755 --- a/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIClientRESTExecutor.java +++ b/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIClientRESTExecutor.java @@ -67,7 +67,7 @@ import org.apache.http.impl.EnglishReasonPhraseCatalog; /** * The AAIClientRESTExecutor class provides CRUD API for AAI Client service. - * @author richtabedzki + * @author Rich Tabedzki */ public class AAIClientRESTExecutor implements AAIExecutorInterface { diff --git a/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIDeclarations.java b/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIDeclarations.java index 20f92656..3fa95495 100755 --- a/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIDeclarations.java +++ b/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIDeclarations.java @@ -21,6 +21,10 @@ * ============LICENSE_END========================================================= */ +/** + * @author Rich Tabedzki + * + */ package org.onap.ccsdk.sli.adaptors.aai; import java.io.IOException; diff --git a/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIExecutorInterface.java b/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIExecutorInterface.java index 9203daa1..d02f14a9 100755 --- a/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIExecutorInterface.java +++ b/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIExecutorInterface.java @@ -18,7 +18,10 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - +/** + * @author Rich Tabedzki + * + */ package org.onap.ccsdk.sli.adaptors.aai; public interface AAIExecutorInterface { diff --git a/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIRequest.java b/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIRequest.java index c66ae06f..04312fd7 100755 --- a/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIRequest.java +++ b/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIRequest.java @@ -20,7 +20,10 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - +/** + * @author Rich Tabedzki + * + */ package org.onap.ccsdk.sli.adaptors.aai; import java.io.IOException; diff --git a/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIService.java b/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIService.java index 43038947..2411d292 100755 --- a/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIService.java +++ b/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIService.java @@ -20,7 +20,10 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - +/** + * @author Rich Tabedzki + * + */ package org.onap.ccsdk.sli.adaptors.aai; import java.io.BufferedReader; diff --git a/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIServiceException.java b/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIServiceException.java old mode 100644 new mode 100755 index 9fac977d..2f774e40 --- a/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIServiceException.java +++ b/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIServiceException.java @@ -18,7 +18,10 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - +/** + * @author Rich Tabedzki + * + */ package org.onap.ccsdk.sli.adaptors.aai; import org.onap.ccsdk.sli.adaptors.aai.data.ErrorResponse; diff --git a/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIServiceProvider.java b/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIServiceProvider.java index 36c34e29..9888c838 100755 --- a/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIServiceProvider.java +++ b/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIServiceProvider.java @@ -18,7 +18,10 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - +/** + * @author Rich Tabedzki + * + */ package org.onap.ccsdk.sli.adaptors.aai; import java.io.File; diff --git a/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIServiceUtils.java b/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIServiceUtils.java index 6c48c63d..3bd6ac49 100755 --- a/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIServiceUtils.java +++ b/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIServiceUtils.java @@ -20,7 +20,10 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - +/** + * @author Rich Tabedzki + * + */ package org.onap.ccsdk.sli.adaptors.aai; import java.lang.annotation.Annotation; diff --git a/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAITrinityService.java b/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAITrinityService.java old mode 100644 new mode 100755 index 6c627ff6..d1abda13 --- a/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAITrinityService.java +++ b/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAITrinityService.java @@ -18,7 +18,10 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - +/** + * @author Rich Tabedzki + * + */ package org.onap.ccsdk.sli.adaptors.aai; import org.slf4j.Logger; diff --git a/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/CustomQueryRequest.java b/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/CustomQueryRequest.java old mode 100644 new mode 100755 index aaae11a9..89228865 --- a/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/CustomQueryRequest.java +++ b/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/CustomQueryRequest.java @@ -19,7 +19,10 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - +/** + * @author Rich Tabedzki + * + */ package org.onap.ccsdk.sli.adaptors.aai; import java.io.IOException; diff --git a/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/EchoRequest.java b/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/EchoRequest.java old mode 100644 new mode 100755 index 6011858d..8e6af010 --- a/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/EchoRequest.java +++ b/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/EchoRequest.java @@ -19,7 +19,10 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - +/** + * @author Rich Tabedzki + * + */ package org.onap.ccsdk.sli.adaptors.aai; import java.io.UnsupportedEncodingException; diff --git a/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/GenericQueryRequest.java b/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/GenericQueryRequest.java old mode 100644 new mode 100755 index 35f190e5..07bb69d8 --- a/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/GenericQueryRequest.java +++ b/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/GenericQueryRequest.java @@ -20,7 +20,10 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - +/** + * @author Rich Tabedzki + * + */ package org.onap.ccsdk.sli.adaptors.aai; import java.io.UnsupportedEncodingException; diff --git a/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/GenericRequest.java b/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/GenericRequest.java index 45824846..59aba1b8 100755 --- a/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/GenericRequest.java +++ b/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/GenericRequest.java @@ -20,7 +20,10 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - + /** + * @author Rich Tabedzki + * + */ package org.onap.ccsdk.sli.adaptors.aai; import java.io.UnsupportedEncodingException; diff --git a/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/HttpMethod.java b/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/HttpMethod.java index 28d79cfc..8f7abe60 100755 --- a/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/HttpMethod.java +++ b/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/HttpMethod.java @@ -1,5 +1,8 @@ package org.onap.ccsdk.sli.adaptors.aai; - +/** + * @author Rich Tabedzki + * + */ public interface HttpMethod { public static final String GET = "GET"; public static final String HEAD = "HEAD"; diff --git a/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/NamedQueryRequest.java b/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/NamedQueryRequest.java index d1995f04..d6df6286 100755 --- a/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/NamedQueryRequest.java +++ b/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/NamedQueryRequest.java @@ -20,7 +20,10 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - +/** + * @author Rich Tabedzki + * + */ package org.onap.ccsdk.sli.adaptors.aai; import java.io.UnsupportedEncodingException; diff --git a/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/NodesQueryRequest.java b/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/NodesQueryRequest.java index dafc4a70..6b050b5a 100755 --- a/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/NodesQueryRequest.java +++ b/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/NodesQueryRequest.java @@ -20,7 +20,10 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - +/** + * @author Rich Tabedzki + * + */ package org.onap.ccsdk.sli.adaptors.aai; import java.io.UnsupportedEncodingException; diff --git a/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/PathRequest.java b/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/PathRequest.java old mode 100644 new mode 100755 index cab601ac..68aff1f9 --- a/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/PathRequest.java +++ b/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/PathRequest.java @@ -18,7 +18,10 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - +/** + * @author Rich Tabedzki + * + */ package org.onap.ccsdk.sli.adaptors.aai; import java.io.UnsupportedEncodingException; diff --git a/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/RelationshipListRequest.java b/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/RelationshipListRequest.java index 847bdea0..8cd7a44e 100755 --- a/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/RelationshipListRequest.java +++ b/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/RelationshipListRequest.java @@ -18,7 +18,10 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - +/** + * @author Rich Tabedzki + * + */ package org.onap.ccsdk.sli.adaptors.aai; import java.io.UnsupportedEncodingException; diff --git a/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/RelationshipRequest.java b/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/RelationshipRequest.java index bc97e1a5..e26421aa 100755 --- a/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/RelationshipRequest.java +++ b/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/RelationshipRequest.java @@ -19,7 +19,10 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - +/** + * @author Rich Tabedzki + * + */ package org.onap.ccsdk.sli.adaptors.aai; import java.io.UnsupportedEncodingException; diff --git a/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/SelfLinkRequest.java b/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/SelfLinkRequest.java old mode 100644 new mode 100755 index 1e9915a0..0094b45f --- a/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/SelfLinkRequest.java +++ b/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/SelfLinkRequest.java @@ -18,7 +18,10 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - +/** + * @author Rich Tabedzki + * + */ package org.onap.ccsdk.sli.adaptors.aai; import java.io.UnsupportedEncodingException; diff --git a/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/UpdateRequest.java b/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/UpdateRequest.java index 8ecc0b3e..8046ca5e 100755 --- a/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/UpdateRequest.java +++ b/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/UpdateRequest.java @@ -3,15 +3,15 @@ * openECOMP : SDN-C * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights - * reserved. + * reserved. * Modifications Copyright (C) 2018 IBM. * ================================================================================ * 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. @@ -19,6 +19,10 @@ * limitations under the License. * ============LICENSE_END========================================================= */ +/** + * The UpdateRequest class provides processing related to update transaction. + * @author richtabedzki + */ package org.onap.ccsdk.sli.adaptors.aai; @@ -26,8 +30,12 @@ import java.io.UnsupportedEncodingException; import java.net.MalformedURLException; import java.net.URISyntaxException; import java.net.URL; +import java.util.ArrayList; +import java.util.List; import java.util.Map; import java.util.Properties; +import java.util.Set; +import java.util.stream.Collectors; import org.onap.ccsdk.sli.adaptors.aai.data.AAIDatum; @@ -35,74 +43,110 @@ import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; public class UpdateRequest extends AAIRequest { - - private AAIRequest request; - private Map params; + + private AAIRequest request; + private Map params; + + public UpdateRequest(AAIRequest request, Map parms) { + this.request = request; + this.params = parms; + } - public UpdateRequest(AAIRequest request, Map parms) { - this.request = request; - this.params = parms; - } + @Override + public URL getRequestUrl(String method, String resourceVersion) + throws UnsupportedEncodingException, MalformedURLException, URISyntaxException { + return request.getRequestUrl(method, resourceVersion); + } - @Override - public URL getRequestUrl(String method, String resourceVersion) - throws UnsupportedEncodingException, MalformedURLException, URISyntaxException { - return request.getRequestUrl(method, resourceVersion); - } + @Override + public URL getRequestQueryUrl(String method) throws UnsupportedEncodingException, MalformedURLException, URISyntaxException { + return request.getRequestQueryUrl(method); + } - @Override - public URL getRequestQueryUrl(String method) throws UnsupportedEncodingException, MalformedURLException, URISyntaxException { - return request.getRequestQueryUrl(method); - } + @Override + public String toJSONString() { + updateArrayEntries(params); + ObjectMapper mapper = AAIService.getObjectMapper(); + String json = null; + + try { + json = mapper.writeValueAsString(params); + } catch (JsonProcessingException e) { + LOG.error("Could not convert parameters of " + request.getRequestObject().getClass().getName(), e); + } + + return json; + } - @Override - public String toJSONString() { - ObjectMapper mapper = AAIService.getObjectMapper(); - String json = null; - - try { - json = mapper.writeValueAsString(params); - } catch (JsonProcessingException e) { - LOG.error("Could not convert parameters of " + request.getRequestObject().getClass().getName(), e); - } - - return json; - } + /** + * + * Update array entries. + * The method converts indexed data entries to an array of values + * + * @param data Map containing String:String values representing input data + */ + private void updateArrayEntries( Map data) { + Set set = data.keySet() + .stream() + .filter(s -> s.endsWith("_length")) + .collect(Collectors.toSet()); + + for(String lenghtKey : set) { + String key = lenghtKey.replace("_length", ""); +// String index = data.get(lenghtKey); + List array = new ArrayList<>(); + + Set subset = data.keySet() + .stream() + .filter(s -> s.startsWith(String.format("%s[",key))) + .collect(Collectors.toSet()); + for(String subKey : subset) { + String subValue = data.get(subKey); + array.add(subValue); + LOG.trace("{} : {} ", subKey, subValue); + } + data.put(key, array.toString()); + data.remove(lenghtKey); + for(String subKey : subset) { + data.remove(subKey); + } + } + } - @Override - public String[] getArgsList() { - return request.getArgsList(); - } + @Override + public String[] getArgsList() { + return request.getArgsList(); + } - @Override - public Class getModelClass() { - return request.getModelClass(); - } - - @Override - public void addRequestProperty(String key, String value) { - request.requestProperties.put(key, value); - } + @Override + public Class getModelClass() { + return request.getModelClass(); + } + + @Override + public void addRequestProperty(String key, String value) { + request.requestProperties.put(key, value); + } - public static String processPathData(String requestUrl, Properties requestProperties) { - -// if(request != null) { -// Class clazz = request.getClass(); -// Method function = null; -// try { -// function = clazz.getMethod("processPathData", request_url.getClass(), requestProperties.getClass()); -// request_url = (String) function.invoke(null, request_url, requestProperties); -// } catch (Exception e) { -// e.printStackTrace(); -// } -// } - -// request.processPathData(request_url, requestProperties); - return requestUrl; - } - - public void processRequestPathValues(Map nameValues) { - request.processRequestPathValues(nameValues); - } + public static String processPathData(String requestUrl, Properties requestProperties) { + +// if(request != null) { +// Class clazz = request.getClass(); +// Method function = null; +// try { +// function = clazz.getMethod("processPathData", request_url.getClass(), requestProperties.getClass()); +// request_url = (String) function.invoke(null, request_url, requestProperties); +// } catch (Exception e) { +// e.printStackTrace(); +// } +// } + +// request.processPathData(request_url, requestProperties); + return requestUrl; + } + + public void processRequestPathValues(Map nameValues) { + request.processRequestPathValues(nameValues); + } } -- cgit 1.2.3-korg