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.viewandinspect.entity;
23 import java.util.ArrayList;
24 import java.util.HashMap;
25 import java.util.List;
27 import java.util.Map.Entry;
29 import org.onap.aai.sparky.sync.entity.SearchableEntity;
33 public class SearchableEntityList {
35 private List<SearchableEntity> entities;
37 public SearchableEntityList() {
38 entities = new ArrayList<SearchableEntity>();
41 public List<SearchableEntity> getEntities() {
45 public void setEntities(List<SearchableEntity> entities) {
46 this.entities = entities;
49 public void addEntity(SearchableEntity entity) {
51 if ( !entities.contains(entity)) {
57 protected static SearchableEntity buildEntity(String entityType, String pkeyValue, String link, Map<String,String> searchTags ) {
59 SearchableEntity se = new SearchableEntity();
61 se.setEntityType(entityType);
62 se.setEntityPrimaryKeyValue(pkeyValue);
65 if ( searchTags != null) {
67 Set<Entry<String, String>> entrySet = searchTags.entrySet();
69 for ( Entry<String, String> entry : entrySet ) {
70 se.addSearchTagWithKey(entry.getKey(), entry.getValue());
80 protected static Map<String,String> getSearchTagMap(String... tags) {
82 HashMap<String,String> dataMap = new HashMap<String,String>();
84 if ( tags != null && tags.length >= 2 ) {
86 int numTags = tags.length;
89 while ( index < numTags ) {
91 if ( index + 1 < numTags ) {
92 // we have enough parameters for the current set
93 dataMap.put(tags[index], tags[index+1]);
108 public String toString() {
109 return "SearchableEntityList [" + (entities != null ? "entities=" + entities : "") + "]";