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.search;
23 import java.util.ArrayList;
24 import java.util.List;
26 import org.onap.aai.sparky.search.entity.SearchSuggestion;
29 * The Class SearchResponse.
31 public class SearchResponse {
33 private long processingTimeInMs;
34 private int totalFound;
36 private List<SearchSuggestion> suggestions;
39 * Instantiates a new search response.
41 public SearchResponse() {
42 this.suggestions = new ArrayList<SearchSuggestion>();
43 this.processingTimeInMs = 0;
47 public long getProcessingTimeInMs() {
48 return processingTimeInMs;
51 public void setProcessingTimeInMs(long processingTimeInMs) {
52 this.processingTimeInMs = processingTimeInMs;
55 public int getTotalFound() {
59 public void setTotalFound(int totalFound) {
60 this.totalFound = totalFound;
63 public List<SearchSuggestion> getSuggestions() {
67 public void setSuggestions(List<SearchSuggestion> suggestions) {
68 this.suggestions = suggestions;
72 * Adds the entity entry.
74 * @param suggestionEntry that will be converted to JSON
76 public void addSuggestion(SearchSuggestion suggestionEntity){
77 suggestions.add(suggestionEntity);
81 * Increments the total number of hits for this SearchResponse by
82 * the value passed in.
84 * @param additionalCount - Count to increment the total found
86 public void addToTotalFound(int additionalCount) {
87 totalFound += additionalCount;
91 public String toString() {
92 return "SearchResponse [processingTimeInMs=" + processingTimeInMs + ", totalFound=" + totalFound
93 + ", " + (suggestions != null ? "suggestions=" + suggestions : "") + "]";