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