2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.
6 * Copyright © 2017-2018 Amdocs
7 * ================================================================================
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
19 * ============LICENSE_END=========================================================
21 package org.onap.aai.datarouter.util;
23 import java.util.ArrayList;
24 import java.util.List;
27 * Processing and entity wrapper for property transposition logic and UEB processing
31 public class CrossEntityReference {
33 private String targetEntityType;
35 private List<String> attributeNames;
37 public CrossEntityReference() {
38 this.targetEntityType = null;
39 this.attributeNames = new ArrayList<>();
42 public String getTargetEntityType() {
43 return targetEntityType;
46 public void setTargetEntityType(String targetEntityType) {
47 this.targetEntityType = targetEntityType;
50 public List<String> getAttributeNames() {
51 return attributeNames;
54 public void setAttributeNames(List<String> attributeNames) {
55 this.attributeNames = attributeNames;
58 public void addAttributeName(String attributeName) {
59 if (!this.attributeNames.contains(attributeName)) {
60 this.attributeNames.add(attributeName);
64 public void initialize(String crossEntityReferenceValueFromModel) {
66 if (crossEntityReferenceValueFromModel == null
67 || crossEntityReferenceValueFromModel.length() == 0) {
68 // or throw an exception due to failure to initialize
72 String[] tokens = crossEntityReferenceValueFromModel.split(",");
74 if (tokens.length >= 2) {
75 this.targetEntityType = tokens[0];
77 for (int x = 1; x < tokens.length; x++) {
78 this.attributeNames.add(tokens[x]);
81 // throw a CrossEntityReferenceInitializationException??
87 public String toString() {
88 return "CrossEntityReference ["
89 + (targetEntityType != null ? "entityType=" + targetEntityType + ", " : "")
90 + (attributeNames != null ? "attributeNames=" + attributeNames : "") + "]";