2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright © 2017-18 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=========================================================
20 package org.onap.aai.setup;
22 import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression;
23 import org.springframework.context.annotation.PropertySource;
24 import org.springframework.stereotype.Component;
25 import javax.annotation.PostConstruct;
26 import java.util.List;
27 import java.util.stream.Collectors;
29 @Component("schemaServiceVersions")
30 @ConditionalOnExpression("'${schema.translator.list}'.contains('schema-service')")
31 @PropertySource(value = "classpath:schema-ingest.properties", ignoreResourceNotFound = true)
32 @PropertySource(value = "file:${schema.ingest.file}", ignoreResourceNotFound = true)
33 public class SchemaServiceVersions extends SchemaVersions {
34 private List<String> versions;
35 private String edgeVersion;
36 private String defaultVersion;
37 private String depthVersion;
38 private String appRootVersion;
39 private String relatedLinkVersion;
40 private String namespaceChangeVersion;
42 public List<String> getVersionsAll() {
46 public void setVersions(List<String> versions) {
47 this.versions = versions;
51 public void initializeFromSchemaService() throws ExceptionInInitializerError{
53 versionsValue = versions.stream().map(SchemaVersion::new).collect(Collectors.toList());
54 edgeLabelVersionValue = new SchemaVersion(edgeVersion);
55 defaultVersionValue = new SchemaVersion(defaultVersion);
56 depthVersionValue = new SchemaVersion(depthVersion);
57 appRootVersionValue = new SchemaVersion(appRootVersion);
58 relatedLinkVersionValue = new SchemaVersion(relatedLinkVersion);
59 namespaceChangeVersionValue = new SchemaVersion(namespaceChangeVersion);
65 * TODO Change Method names
67 public void initializeFromSchemaConfig(SchemaConfigVersions schemaConfigVersion) throws ExceptionInInitializerError{
69 versions = schemaConfigVersion.getApiVersions();
70 appRootVersion = schemaConfigVersion.getAppRootStartVersion();
71 defaultVersion = schemaConfigVersion.getDefaultApiVersion();
72 depthVersion = schemaConfigVersion.getDepthStartVersion();
73 edgeVersion = schemaConfigVersion.getEdgeLabelStartVersion();
74 namespaceChangeVersion = schemaConfigVersion.getNamespaceChangeStartVersion();
75 relatedLinkVersion = schemaConfigVersion.getRelatedLinkStartVersion();
76 this.initializeFromSchemaService();