2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=========================================================
21 package org.onap.aai.parsers.query;
23 import java.io.UnsupportedEncodingException;
25 import org.onap.aai.config.SpringContextAware;
26 import org.onap.aai.edges.EdgeIngestor;
27 import org.onap.aai.exceptions.AAIException;
28 import org.onap.aai.introspection.Introspector;
29 import org.onap.aai.introspection.Loader;
30 import org.onap.aai.introspection.ModelType;
31 import org.onap.aai.parsers.relationship.RelationshipToURI;
32 import org.onap.aai.parsers.uri.URIParser;
33 import org.onap.aai.query.builder.QueryBuilder;
34 import org.slf4j.Logger;
35 import org.slf4j.LoggerFactory;
36 import org.springframework.context.ApplicationContext;
39 * The Class RelationshipQueryParser.
41 public class RelationshipQueryParser extends LegacyQueryParser {
43 private static final Logger logger = LoggerFactory.getLogger(RelationshipQueryParser.class);
45 private Introspector relationship = null;
47 private ModelType modelType = null;
49 private EdgeIngestor edgeRules = null;
52 * Instantiates a new relationship query parser.
54 * @param loader the loader
55 * @param queryBuilder the query builder
57 * @throws UnsupportedEncodingException the unsupported encoding exception
58 * @throws AAIException the AAI exception
60 public RelationshipQueryParser(Loader loader, QueryBuilder queryBuilder, Introspector obj)
61 throws UnsupportedEncodingException, AAIException {
62 super(loader, queryBuilder);
63 this.relationship = obj;
64 this.modelType = obj.getModelType();
66 RelationshipToURI rToUri = new RelationshipToURI(loader, obj);
67 this.uri = rToUri.getUri();
68 URIParser parser = new URIParser(loader, uri);
72 private void initBeans() {
73 ApplicationContext ctx = SpringContextAware.getApplicationContext();
75 logger.warn("Unable to retrieve the spring context");
77 EdgeIngestor ei = ctx.getBean(EdgeIngestor.class);