Update the dependencies to use project version
[aai/sparky-be.git] / src / main / java / org / onap / aai / sparky / search / SearchResponse.java
1 /**
2  * ============LICENSE_START=======================================================
3  * org.onap.aai
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
11  *
12  *       http://www.apache.org/licenses/LICENSE-2.0
13  *
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=========================================================
20  *
21  * ECOMP is a trademark and service mark of AT&T Intellectual Property.
22  */
23 package org.onap.aai.sparky.search;
24
25 import java.util.ArrayList;
26 import java.util.List;
27
28 import org.onap.aai.sparky.search.entity.SearchSuggestion;
29
30 /**
31  * The Class SearchResponse.
32  */
33 public class SearchResponse {
34
35   private long processingTimeInMs;
36   private int totalFound;
37
38   private List<SearchSuggestion> suggestions;
39
40   /**
41    * Instantiates a new search response.
42    */
43   public SearchResponse() {
44     this.suggestions = new ArrayList<SearchSuggestion>();
45     this.processingTimeInMs = 0;
46     this.totalFound = 0;
47   }
48
49   public long getProcessingTimeInMs() {
50     return processingTimeInMs;
51   }
52
53   public void setProcessingTimeInMs(long processingTimeInMs) {
54     this.processingTimeInMs = processingTimeInMs;
55   }
56
57   public int getTotalFound() {
58     return totalFound;
59   }
60
61   public void setTotalFound(int totalFound) {
62     this.totalFound = totalFound;
63   }
64
65   public List<SearchSuggestion> getSuggestions() {
66     return suggestions;
67   }
68
69   public void setSuggestions(List<SearchSuggestion> suggestions) {
70     this.suggestions = suggestions;
71   }
72
73   /**
74    * Adds the entity entry.
75    *
76    * @param suggestionEntry that will be converted to JSON
77    */
78   public void addSuggestion(SearchSuggestion suggestionEntity) {
79     suggestions.add(suggestionEntity);
80   }
81
82   /**
83    * Increments the total number of hits for this SearchResponse by the value passed in.
84    * 
85    * @param additionalCount - Count to increment the total found
86    */
87   public void addToTotalFound(int additionalCount) {
88     totalFound += additionalCount;
89   }
90
91   @Override
92   public String toString() {
93     return "SearchResponse [processingTimeInMs=" + processingTimeInMs + ", totalFound=" + totalFound
94         + ", " + (suggestions != null ? "suggestions=" + suggestions : "") + "]";
95   }
96
97
98
99 }