2 * ============LICENSE_START===================================================
3 * SPARKY (AAI UI service)
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.onap.aai.sparky.viewandinspect.entity;
27 import java.util.ArrayList;
28 import java.util.HashMap;
29 import java.util.List;
31 import java.util.Map.Entry;
33 import org.onap.aai.sparky.sync.entity.SearchableEntity;
37 public class SearchableEntityList {
39 private List<SearchableEntity> entities;
41 public SearchableEntityList() {
42 entities = new ArrayList<SearchableEntity>();
45 public List<SearchableEntity> getEntities() {
49 public void setEntities(List<SearchableEntity> entities) {
50 this.entities = entities;
53 public void addEntity(SearchableEntity entity) {
55 if ( !entities.contains(entity)) {
61 protected static SearchableEntity buildEntity(String entityType, String pkeyValue, String link, Map<String,String> searchTags ) {
63 SearchableEntity se = new SearchableEntity();
65 se.setEntityType(entityType);
66 se.setEntityPrimaryKeyValue(pkeyValue);
69 if ( searchTags != null) {
71 Set<Entry<String, String>> entrySet = searchTags.entrySet();
73 for ( Entry<String, String> entry : entrySet ) {
74 se.addSearchTagWithKey(entry.getKey(), entry.getValue());
84 protected static Map<String,String> getSearchTagMap(String... tags) {
86 HashMap<String,String> dataMap = new HashMap<String,String>();
88 if ( tags != null && tags.length >= 2 ) {
90 int numTags = tags.length;
93 while ( index < numTags ) {
95 if ( index + 1 < numTags ) {
96 // we have enough parameters for the current set
97 dataMap.put(tags[index], tags[index+1]);
112 public String toString() {
113 return "SearchableEntityList [" + (entities != null ? "entities=" + entities : "") + "]";