diff options
author | vasraz <vasyl.razinkov@est.tech> | 2021-03-27 22:58:29 +0000 |
---|---|---|
committer | Christophe Closset <christophe.closset@intl.att.com> | 2021-03-29 07:15:14 +0000 |
commit | 04c236567737c965545f64c9542a7d75ed6f9046 (patch) | |
tree | 8d2a3ea1bcb80b8d66603bb31a8b6877a98d84f8 /common/onap-generic-artifact-browser | |
parent | be66acfea37b8d96cbb1b1e14592de57ec3bc4ae (diff) |
Reformat common
Signed-off-by: Vasyl Razinkov <vasyl.razinkov@est.tech>
Issue-ID: SDC-3449
Change-Id: Ifa1412b8a614f7cdb4c52f05d811ab5e9cf20d83
Diffstat (limited to 'common/onap-generic-artifact-browser')
8 files changed, 25 insertions, 58 deletions
diff --git a/common/onap-generic-artifact-browser/onap-generic-artifact-browser-service/src/main/java/org/onap/sdc/gab/GABService.java b/common/onap-generic-artifact-browser/onap-generic-artifact-browser-service/src/main/java/org/onap/sdc/gab/GABService.java index 0ac976a18a..5a3a36c753 100644 --- a/common/onap-generic-artifact-browser/onap-generic-artifact-browser-service/src/main/java/org/onap/sdc/gab/GABService.java +++ b/common/onap-generic-artifact-browser/onap-generic-artifact-browser-service/src/main/java/org/onap/sdc/gab/GABService.java @@ -17,7 +17,6 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - package org.onap.sdc.gab; import java.io.IOException; @@ -28,9 +27,9 @@ import org.onap.sdc.gab.model.GABResults; * <pre> * SDC/DCAE-DS FM/PM artifact browser service. * </pre> - * - * Currently the artifact browser is able to parse VES_EVENT_REGISTRATION action (registering of all VES events - - * including alarms/faults) to serve required data from the given document. + * <p> + * Currently the artifact browser is able to parse VES_EVENT_REGISTRATION action (registering of all VES events - including alarms/faults) to serve + * required data from the given document. * * @version %I%, %G% * @since 1.4.0-SNAPSHOT @@ -41,17 +40,13 @@ public interface GABService { * Extracting event data based on given YAML paths. As an output, a list of results is returned. * * @param gabQuery the parameter should contain three entries: - * <br>* JSON paths for querying specific data - * <br>* path/content of YAML document containing faults/measurements data - * <br>* type of the query - can be defined as a PATH or CONTENT depends of document-parameter type - * - * @exception IOException thrown in case of file/content problem. + * <br>* JSON paths for querying specific data + * <br>* path/content of YAML document containing faults/measurements data + * <br>* type of the query - can be defined as a PATH or CONTENT depends of document-parameter type * @return Result of search the query inside the given document. - * + * @throws IOException thrown in case of file/content problem. * @see GABResults * @see GABQuery */ GABResults searchFor(GABQuery gabQuery) throws IOException; - } - diff --git a/common/onap-generic-artifact-browser/onap-generic-artifact-browser-service/src/main/java/org/onap/sdc/gab/GABServiceImpl.java b/common/onap-generic-artifact-browser/onap-generic-artifact-browser-service/src/main/java/org/onap/sdc/gab/GABServiceImpl.java index 0a8a206e0b..900c71a931 100644 --- a/common/onap-generic-artifact-browser/onap-generic-artifact-browser-service/src/main/java/org/onap/sdc/gab/GABServiceImpl.java +++ b/common/onap-generic-artifact-browser/onap-generic-artifact-browser-service/src/main/java/org/onap/sdc/gab/GABServiceImpl.java @@ -17,11 +17,9 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - package org.onap.sdc.gab; import java.io.IOException; - import org.onap.sdc.gab.model.GABQuery; import org.onap.sdc.gab.model.GABQuery.GABQueryType; import org.onap.sdc.gab.model.GABResults; @@ -37,7 +35,7 @@ public class GABServiceImpl implements GABService { } private GABYamlParser parse(GABQuery gabQuery, GABYamlParser gabYamlParser) { - return gabQuery.getType() == GABQueryType.PATH - ? gabYamlParser.parseFile(gabQuery.getDocument()) : gabYamlParser.parseContent(gabQuery.getDocument()); + return gabQuery.getType() == GABQueryType.PATH ? gabYamlParser.parseFile(gabQuery.getDocument()) + : gabYamlParser.parseContent(gabQuery.getDocument()); } } diff --git a/common/onap-generic-artifact-browser/onap-generic-artifact-browser-service/src/main/java/org/onap/sdc/gab/model/GABQuery.java b/common/onap-generic-artifact-browser/onap-generic-artifact-browser-service/src/main/java/org/onap/sdc/gab/model/GABQuery.java index cbe7ef31cf..201579029d 100644 --- a/common/onap-generic-artifact-browser/onap-generic-artifact-browser-service/src/main/java/org/onap/sdc/gab/model/GABQuery.java +++ b/common/onap-generic-artifact-browser/onap-generic-artifact-browser-service/src/main/java/org/onap/sdc/gab/model/GABQuery.java @@ -17,7 +17,6 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - package org.onap.sdc.gab.model; import java.util.Set; @@ -32,29 +31,21 @@ import lombok.Getter; public class GABQuery { /** - * PATH - when provided path to the yaml file - * CONTENT - when provided yaml file content - */ - public enum GABQueryType { - PATH, CONTENT - } - - /** * JSON paths for querying specific data (this will be the definition of a "column"). */ private Set<String> fields; - /** * An YAML document path/content */ private String document; - /** * Used for query type checking. * * @see GABQueryType - * */ private GABQueryType type; - + /** + * PATH - when provided path to the yaml file CONTENT - when provided yaml file content + */ + public enum GABQueryType {PATH, CONTENT} } diff --git a/common/onap-generic-artifact-browser/onap-generic-artifact-browser-service/src/main/java/org/onap/sdc/gab/model/GABResult.java b/common/onap-generic-artifact-browser/onap-generic-artifact-browser-service/src/main/java/org/onap/sdc/gab/model/GABResult.java index 3338024db8..13d713a4f1 100644 --- a/common/onap-generic-artifact-browser/onap-generic-artifact-browser-service/src/main/java/org/onap/sdc/gab/model/GABResult.java +++ b/common/onap-generic-artifact-browser/onap-generic-artifact-browser-service/src/main/java/org/onap/sdc/gab/model/GABResult.java @@ -17,7 +17,6 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - package org.onap.sdc.gab.model; import com.google.common.base.MoreObjects; @@ -44,5 +43,4 @@ public class GABResult { public String toString() { return MoreObjects.toStringHelper(this).add("entries", entries).toString(); } - } diff --git a/common/onap-generic-artifact-browser/onap-generic-artifact-browser-service/src/main/java/org/onap/sdc/gab/model/GABResultEntry.java b/common/onap-generic-artifact-browser/onap-generic-artifact-browser-service/src/main/java/org/onap/sdc/gab/model/GABResultEntry.java index cc6abd5170..f953577272 100644 --- a/common/onap-generic-artifact-browser/onap-generic-artifact-browser-service/src/main/java/org/onap/sdc/gab/model/GABResultEntry.java +++ b/common/onap-generic-artifact-browser/onap-generic-artifact-browser-service/src/main/java/org/onap/sdc/gab/model/GABResultEntry.java @@ -17,7 +17,6 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - package org.onap.sdc.gab.model; import com.google.common.base.MoreObjects; @@ -30,22 +29,20 @@ import lombok.Getter; @Getter @AllArgsConstructor public class GABResultEntry { + /** * Path of queried data. */ private String path; - /** * Specific events-template data served by the GABService + * * @see GABService */ private Object data; @Override public String toString() { - return MoreObjects.toStringHelper(this) - .add("path", path) - .add("data", data) - .toString(); + return MoreObjects.toStringHelper(this).add("path", path).add("data", data).toString(); } } diff --git a/common/onap-generic-artifact-browser/onap-generic-artifact-browser-service/src/main/java/org/onap/sdc/gab/model/GABResults.java b/common/onap-generic-artifact-browser/onap-generic-artifact-browser-service/src/main/java/org/onap/sdc/gab/model/GABResults.java index 23d026b2f4..f0871ec65a 100644 --- a/common/onap-generic-artifact-browser/onap-generic-artifact-browser-service/src/main/java/org/onap/sdc/gab/model/GABResults.java +++ b/common/onap-generic-artifact-browser/onap-generic-artifact-browser-service/src/main/java/org/onap/sdc/gab/model/GABResults.java @@ -17,7 +17,6 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - package org.onap.sdc.gab.model; import com.google.common.base.MoreObjects; diff --git a/common/onap-generic-artifact-browser/onap-generic-artifact-browser-service/src/main/java/org/onap/sdc/gab/yaml/GABYamlParser.java b/common/onap-generic-artifact-browser/onap-generic-artifact-browser-service/src/main/java/org/onap/sdc/gab/yaml/GABYamlParser.java index fae94421ae..3b9ff09a18 100644 --- a/common/onap-generic-artifact-browser/onap-generic-artifact-browser-service/src/main/java/org/onap/sdc/gab/yaml/GABYamlParser.java +++ b/common/onap-generic-artifact-browser/onap-generic-artifact-browser-service/src/main/java/org/onap/sdc/gab/yaml/GABYamlParser.java @@ -17,7 +17,6 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - package org.onap.sdc.gab.yaml; import java.io.IOException; @@ -94,21 +93,18 @@ public class GABYamlParser implements AutoCloseable { /** * Collects the results from parsed yaml file and applied filters. * - * @exception IOException Means that yaml file has invalid content. * @return {@link GABResults} + * @throws IOException Means that yaml file has invalid content. */ public GABResults collect() throws IOException { - return new GABResults(yamlParser.collect().stream() - .map(results -> new GABResult(createGabResultEntryList(results))) - .collect(Collectors.toList())); + return new GABResults( + yamlParser.collect().stream().map(results -> new GABResult(createGabResultEntryList(results))).collect(Collectors.toList())); } private List<GABResultEntry> createGabResultEntryList(List<SimpleEntry<String, ? extends Collection<Object>>> parsedContent) { return Objects.isNull(parsedContent) ? Collections.emptyList() : parsedContent.stream() - .map(result -> result.getValue().stream() - .map(entry -> new GABResultEntry(result.getKey(), entry)) - .collect(Collectors.toList())).flatMap(Collection::stream) - .collect(Collectors.toList()); + .map(result -> result.getValue().stream().map(entry -> new GABResultEntry(result.getKey(), entry)).collect(Collectors.toList())) + .flatMap(Collection::stream).collect(Collectors.toList()); } @Override diff --git a/common/onap-generic-artifact-browser/onap-generic-artifact-browser-service/src/main/java/org/onap/sdc/gab/yaml/YamlParser.java b/common/onap-generic-artifact-browser/onap-generic-artifact-browser-service/src/main/java/org/onap/sdc/gab/yaml/YamlParser.java index 2dbb8adfa3..ab8bb9d174 100644 --- a/common/onap-generic-artifact-browser/onap-generic-artifact-browser-service/src/main/java/org/onap/sdc/gab/yaml/YamlParser.java +++ b/common/onap-generic-artifact-browser/onap-generic-artifact-browser-service/src/main/java/org/onap/sdc/gab/yaml/YamlParser.java @@ -17,7 +17,6 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - package org.onap.sdc.gab.yaml; import com.google.gson.Gson; @@ -54,7 +53,6 @@ import org.yaml.snakeyaml.Yaml; public class YamlParser implements AutoCloseable { private static final Logger LOGGER = Logger.getLogger(YamlParser.class.getName()); - private Stream<Object> parsedYamlContent; private InputStream inputStream; private Set<String> filters; @@ -119,8 +117,8 @@ public class YamlParser implements AutoCloseable { /** * Collects the results from parsed yaml file and applied filters. * - * @exception IOException Means that yaml file has invalid content. * @return List of List of simple entry 'key: collection of data' + * @throws IOException Means that yaml file has invalid content. */ List<List<SimpleEntry<String, ? extends Collection<Object>>>> collect() throws IOException { try { @@ -145,12 +143,8 @@ public class YamlParser implements AutoCloseable { } } - private List<SimpleEntry<String, ? extends Collection<Object>>> findInJson(Set<String> keys, - JsonElement document) { - return keys.stream() - .map(getEntryForKeyFunction(document)) - .filter(notEmptyEntryPredicate()) - .collect(Collectors.toList()); + private List<SimpleEntry<String, ? extends Collection<Object>>> findInJson(Set<String> keys, JsonElement document) { + return keys.stream().map(getEntryForKeyFunction(document)).filter(notEmptyEntryPredicate()).collect(Collectors.toList()); } private Predicate<? super List<SimpleEntry<String, ? extends Collection<Object>>>> notEmptyListPredicate() { @@ -161,8 +155,7 @@ public class YamlParser implements AutoCloseable { return entry -> !entry.getValue().isEmpty(); } - private Function<String, SimpleEntry<String, ? extends Collection<Object>>> getEntryForKeyFunction( - JsonElement document) { + private Function<String, SimpleEntry<String, ? extends Collection<Object>>> getEntryForKeyFunction(JsonElement document) { return key -> { JsonSurfer surfer = JsonSurferGson.INSTANCE; try { |