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=========================================================
21 package org.onap.aai.setup;
23 import java.util.List;
24 import java.util.stream.Collectors;
26 import javax.annotation.PostConstruct;
28 import org.springframework.beans.factory.annotation.Value;
29 import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression;
30 import org.springframework.context.annotation.PropertySource;
31 import org.springframework.stereotype.Component;
33 @Component("schemaConfigVersions")
34 @ConditionalOnExpression("'${schema.translator.list:config}'.contains('config') || '${schema.service.versions.override:false}'.equals('true')")
35 @PropertySource(value = "classpath:schema-ingest.properties", ignoreResourceNotFound = true)
36 @PropertySource(value = "file:${schema.ingest.file}", ignoreResourceNotFound = true)
37 public class SchemaConfigVersions extends SchemaVersions {
39 @Value("#{'${schema.version.list:''}'.split(',')}")
40 private List<String> apiVersions;
41 @Value("${schema.version.api.default}")
42 private String defaultApiVersion;
43 @Value("${schema.version.edge.label.start:''}")
44 private String edgeLabelStartVersion;
45 @Value("${schema.version.depth.start:''}")
46 private String depthStartVersion;
47 @Value("${schema.version.app.root.start:''}")
48 private String appRootStartVersion;
49 @Value("${schema.version.related.link.start:''}")
50 private String relatedLinkStartVersion;
51 @Value("${schema.version.namespace.change.start:''}")
52 protected String namespaceChangeStartVersion;
54 public List<String> getApiVersions() {
58 public String getDefaultApiVersion() {
59 return defaultApiVersion;
62 public String getEdgeLabelStartVersion() {
63 return edgeLabelStartVersion;
66 public String getDepthStartVersion() {
67 return depthStartVersion;
70 public String getAppRootStartVersion() {
71 return appRootStartVersion;
74 public String getRelatedLinkStartVersion() {
75 return relatedLinkStartVersion;
78 public String getNamespaceChangeStartVersion() {
79 return namespaceChangeStartVersion;
83 public void initialize() {
84 versionsValue = apiVersions.stream().map(SchemaVersion::new).collect(Collectors.toList());
85 edgeLabelVersionValue = new SchemaVersion(edgeLabelStartVersion);
86 defaultVersionValue = new SchemaVersion(defaultApiVersion);
87 depthVersionValue = new SchemaVersion(depthStartVersion);
88 appRootVersionValue = new SchemaVersion(appRootStartVersion);
89 relatedLinkVersionValue = new SchemaVersion(relatedLinkStartVersion);
90 namespaceChangeVersionValue = new SchemaVersion(namespaceChangeStartVersion);