diff options
Diffstat (limited to 'src/main/java/org/onap/aai/graphgraph/SchemaResource.java')
-rw-r--r-- | src/main/java/org/onap/aai/graphgraph/SchemaResource.java | 77 |
1 files changed, 38 insertions, 39 deletions
diff --git a/src/main/java/org/onap/aai/graphgraph/SchemaResource.java b/src/main/java/org/onap/aai/graphgraph/SchemaResource.java index b38ef7b..577e235 100644 --- a/src/main/java/org/onap/aai/graphgraph/SchemaResource.java +++ b/src/main/java/org/onap/aai/graphgraph/SchemaResource.java @@ -1,21 +1,21 @@ -/** - * ============LICENSE_START======================================================= - * org.onap.aai - * ================================================================================ - * Copyright © 2019 Orange Intellectual Property. All rights reserved. - * ================================================================================ - * 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. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= +/* + ============LICENSE_START======================================================= + org.onap.aai + ================================================================================ + Copyright © 2019-2020 Orange Intellectual Property. All rights reserved. + ================================================================================ + 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. + See the License for the specific language governing permissions and + limitations under the License. + ============LICENSE_END========================================================= */ package org.onap.aai.graphgraph; @@ -43,67 +43,66 @@ public class SchemaResource { SchemaRepository repository; @RequestMapping("/schemas") - public List<String> loadSchemaNames() { + public List<String> loadSchemaNames() { return repository.getAllSchemaNames(); } - @RequestMapping("/schemas/{schema}/nodes") - public List<NodeName> loadVertexNames(@PathVariable("schema") String schemaName, - @RequestParam("edgeFilter") String edgeFilter) { + public List<NodeName> loadVertexNames( + @PathVariable("schema") String schemaName, + @RequestParam("edgeFilter") String edgeFilter) { return repository.getSchemaReader(schemaName).getAllVertexNames(edgeFilter); } @RequestMapping("/schemas/{schema}/nodes/{node}") - public List<NodeProperty> loadProperties(@PathVariable("schema") String schemaName, @PathVariable("node") String node) { + public List<NodeProperty> loadProperties( + @PathVariable("schema") String schemaName, + @PathVariable("node") String node) { return repository.getSchemaReader(schemaName).getVertexProperties(node); } - @RequestMapping("/schemas/{schema}/edges") - public List<Property> loadedgeProperties ( + public List<Property> loadEdgeProperties( @PathVariable("schema") String schemaName, @RequestParam("fromNode") String fromNodeName, @RequestParam("toNode") String toNodeName) { return repository.getSchemaReader(schemaName).getEdgeProperties(fromNodeName, toNodeName, "edgerule"); } - @RequestMapping("/schemas/{schema}/graph/basic") - public Graph loadGraph ( + public Graph loadGraph( @PathVariable("schema") String schemaName, @RequestParam("node") String initialNodeName, @RequestParam("parentHops") Integer parentHops, @RequestParam("cousinHops") Integer cousinHops, @RequestParam("childHops") Integer childHops, - @RequestParam("edgeFilter") String edgeFilter) - { - Graph graph = repository.getSchemaReader(schemaName).getGraph(initialNodeName, parentHops, cousinHops, childHops, edgeFilter); - graph.setPaths(Collections.emptyList()); - return graph; + @RequestParam("edgeFilter") String edgeFilter) { + Graph graph = repository.getSchemaReader(schemaName) + .getGraph(initialNodeName, parentHops, cousinHops, childHops, edgeFilter); + graph.setPaths(Collections.emptyList()); + return graph; } - @RequestMapping("/schemas/{schema}/graph/paths") - public Graph loadGraphWithPaths ( + public Graph loadGraphWithPaths( @PathVariable("schema") String schemaName, @RequestParam("fromNode") String fromNode, @RequestParam("toNode") String toNode, - @RequestParam("edgeFilter") String edgeFilter) - { + @RequestParam("edgeFilter") String edgeFilter) { return repository.getSchemaReader(schemaName).getGraph(fromNode, toNode, edgeFilter); } @RequestMapping("/schemas/{schema}/validation") - public ValidationProblems validateSchema ( @PathVariable("schema") String schemaName) { + public ValidationProblems validateSchema( + @PathVariable("schema") String schemaName) { return new SchemaValidator().validate(schemaName); } @RequestMapping(value = "/schemas/{schema}/xmiexport", produces = MediaType.TEXT_XML_VALUE) @ResponseBody - public String exportSchema ( @PathVariable("schema") String schemaName) { + public String exportSchema( + @PathVariable("schema") String schemaName) { return ModelExporter.exportModel(schemaName); } } - |