2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright © 2017 AT&T Intellectual Property.
6 * Copyright © 2017 Amdocs
8 * ================================================================================
9 * Licensed under the Apache License, Version 2.0 (the "License");
10 * you may not use this file except in compliance with the License.
11 * You may obtain a copy of the License at
13 * http://www.apache.org/licenses/LICENSE-2.0
15 * Unless required by applicable law or agreed to in writing, software
16 * distributed under the License is distributed on an "AS IS" BASIS,
17 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 * See the License for the specific language governing permissions and
19 * limitations under the License.
20 * ============LICENSE_END=========================================================
22 * ECOMP and OpenECOMP are trademarks
23 * and service marks of AT&T Intellectual Property.
25 package org.openecomp.datarouter.util;
27 import java.util.ArrayList;
28 import java.util.List;
31 * Processing and entity wrapper for property transposition logic and UEB processing
35 public class CrossEntityReference {
37 private String targetEntityType;
39 private List<String> attributeNames;
41 public CrossEntityReference() {
42 this.targetEntityType = null;
43 this.attributeNames = new ArrayList<String>();
46 public String getTargetEntityType() {
47 return targetEntityType;
50 public void setTargetEntityType(String targetEntityType) {
51 this.targetEntityType = targetEntityType;
54 public List<String> getAttributeNames() {
55 return attributeNames;
58 public void setAttributeNames(List<String> attributeNames) {
59 this.attributeNames = attributeNames;
62 public void addAttributeName(String attributeName) {
63 if (!this.attributeNames.contains(attributeName)) {
64 this.attributeNames.add(attributeName);
68 public void initialize(String crossEntityReferenceValueFromModel) {
70 if (crossEntityReferenceValueFromModel == null
71 || crossEntityReferenceValueFromModel.length() == 0) {
72 // or throw an exception due to failure to initialize
76 String[] tokens = crossEntityReferenceValueFromModel.split(",");
78 if (tokens.length >= 2) {
79 this.targetEntityType = tokens[0];
81 for (int x = 1; x < tokens.length; x++) {
82 this.attributeNames.add(tokens[x]);
85 // throw a CrossEntityReferenceInitializationException??
91 public String toString() {
92 return "CrossEntityReference ["
93 + (targetEntityType != null ? "entityType=" + targetEntityType + ", " : "")
94 + (attributeNames != null ? "attributeNames=" + attributeNames : "") + "]";