2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
6 * Copyright © 2017 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 * ECOMP is a trademark and service mark of AT&T Intellectual Property.
23 package org.onap.aai.sparky.viewandinspect.entity;
25 import java.util.ArrayList;
26 import java.util.HashMap;
27 import java.util.List;
29 import java.util.Map.Entry;
31 import org.onap.aai.sparky.sync.entity.SearchableEntity;
35 public class SearchableEntityList {
37 private List<SearchableEntity> entities;
39 public SearchableEntityList() {
40 entities = new ArrayList<SearchableEntity>();
43 public List<SearchableEntity> getEntities() {
47 public void setEntities(List<SearchableEntity> entities) {
48 this.entities = entities;
51 public void addEntity(SearchableEntity entity) {
53 if ( !entities.contains(entity)) {
59 protected static SearchableEntity buildEntity(String entityType, String pkeyValue, String link, Map<String,String> searchTags ) {
61 SearchableEntity se = new SearchableEntity();
63 se.setEntityType(entityType);
64 se.setEntityPrimaryKeyValue(pkeyValue);
67 if ( searchTags != null) {
69 Set<Entry<String, String>> entrySet = searchTags.entrySet();
71 for ( Entry<String, String> entry : entrySet ) {
72 se.addSearchTagWithKey(entry.getKey(), entry.getValue());
82 protected static Map<String,String> getSearchTagMap(String... tags) {
84 HashMap<String,String> dataMap = new HashMap<String,String>();
86 if ( tags != null && tags.length >= 2 ) {
88 int numTags = tags.length;
91 while ( index < numTags ) {
93 if ( index + 1 < numTags ) {
94 // we have enough parameters for the current set
95 dataMap.put(tags[index], tags[index+1]);
110 public String toString() {
111 return "SearchableEntityList [" + (entities != null ? "entities=" + entities : "") + "]";