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.search;
25 import java.util.ArrayList;
26 import java.util.List;
28 import org.onap.aai.sparky.search.entity.SearchSuggestion;
31 * The Class SearchResponse.
33 public class SearchResponse {
35 private long processingTimeInMs;
36 private int totalFound;
38 private List<SearchSuggestion> suggestions;
41 * Instantiates a new search response.
43 public SearchResponse() {
44 this.suggestions = new ArrayList<SearchSuggestion>();
45 this.processingTimeInMs = 0;
49 public long getProcessingTimeInMs() {
50 return processingTimeInMs;
53 public void setProcessingTimeInMs(long processingTimeInMs) {
54 this.processingTimeInMs = processingTimeInMs;
57 public int getTotalFound() {
61 public void setTotalFound(int totalFound) {
62 this.totalFound = totalFound;
65 public List<SearchSuggestion> getSuggestions() {
69 public void setSuggestions(List<SearchSuggestion> suggestions) {
70 this.suggestions = suggestions;
74 * Adds the entity entry.
76 * @param suggestionEntry that will be converted to JSON
78 public void addSuggestion(SearchSuggestion suggestionEntity) {
79 suggestions.add(suggestionEntity);
83 * Increments the total number of hits for this SearchResponse by the value passed in.
85 * @param additionalCount - Count to increment the total found
87 public void addToTotalFound(int additionalCount) {
88 totalFound += additionalCount;
92 public String toString() {
93 return "SearchResponse [processingTimeInMs=" + processingTimeInMs + ", totalFound=" + totalFound
94 + ", " + (suggestions != null ? "suggestions=" + suggestions : "") + "]";