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.sparky.sync.entity;
23 import java.util.ArrayList;
24 import java.util.Arrays;
26 import org.onap.aai.sparky.util.NodeUtils;
28 import com.fasterxml.jackson.annotation.JsonIgnore;
29 import com.fasterxml.jackson.core.JsonProcessingException;
30 import com.fasterxml.jackson.databind.ser.impl.SimpleBeanPropertyFilter;
31 import com.fasterxml.jackson.databind.ser.impl.SimpleFilterProvider;
32 import com.fasterxml.jackson.annotation.JsonInclude;
33 import com.fasterxml.jackson.annotation.JsonInclude.Include;
36 * The Class IndexableCrossEntityReference.
38 @JsonInclude(Include.NON_NULL)
39 public class IndexableCrossEntityReference extends IndexableEntity implements IndexDocument {
41 protected String crossReferenceEntityValues;
42 protected ArrayList<String> crossEntityReferenceCollection = new ArrayList<String>();
45 * Instantiates a new indexable cross entity reference.
47 public IndexableCrossEntityReference() {
52 * Adds the cross entity reference value.
54 * @param crossEntityReferenceValue the cross entity reference value
56 public void addCrossEntityReferenceValue(String crossEntityReferenceValue) {
57 if (!crossEntityReferenceCollection.contains(crossEntityReferenceValue)) {
58 crossEntityReferenceCollection.add(crossEntityReferenceValue);
62 public String getCrossReferenceEntityValues() {
63 return crossReferenceEntityValues;
66 public void setCrossReferenceEntityValues(String crossReferenceEntityValues) {
67 this.crossReferenceEntityValues = crossReferenceEntityValues;
73 * @see org.openecomp.sparky.synchronizer.entity.IndexDocument#deriveFields()
76 public void deriveFields() {
77 this.id = NodeUtils.generateUniqueShaDigest(link);
78 this.crossReferenceEntityValues = NodeUtils.concatArray(crossEntityReferenceCollection, ";");
81 @JsonIgnore // Since this is a "get" we need to JSON ignore otherwise it will be called when converting to JSON
83 public String getAsJson() throws JsonProcessingException {
85 return NodeUtils.convertObjectToJson(this, false);
90 public String toString() {
91 return "IndexableCrossEntityReference ["
92 + (crossReferenceEntityValues != null
93 ? "crossReferenceEntityValues=" + crossReferenceEntityValues + ", " : "")
94 + (crossEntityReferenceCollection != null
95 ? "crossEntityReferenceCollection=" + crossEntityReferenceCollection + ", " : "");