Skip to main content
summaryrefslogtreecommitdiffstats
blob: 2625d1ee639a0a9611e8b7543195848fca24cb5b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
/*******************************************************************************
 * Copyright (c) 2012 Boeing.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     Boeing - initial API and implementation
 *******************************************************************************/
package org.eclipse.osee.orcs.rest.model.search.artifact;

import java.util.LinkedList;
import java.util.List;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElementWrapper;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 * @author John R. Misinco
 * @author Roberto E. Escobar
 */
@XmlRootElement(name = "SearchResponse")
public class SearchResponse implements SearchResult {

   private int total;
   private long searchTime;
   private String version;
   private SearchRequest searchRequest;

   @XmlTransient
   private List<Integer> ids = new LinkedList<Integer>();

   @XmlTransient
   private List<SearchMatch> searchMatches = new LinkedList<SearchMatch>();

   public void setSearchRequest(SearchRequest searchRequest) {
      this.searchRequest = searchRequest;
   }

   public void setVersion(String version) {
      this.version = version;
   }

   public void setTotal(int total) {
      this.total = total;
   }

   public void setSearchTime(long searchTime) {
      this.searchTime = searchTime;
   }

   @Override
   public int getTotal() {
      return total;
   }

   @Override
   public long getSearchTime() {
      return searchTime;
   }

   @Override
   public String getVersion() {
      return version;
   }

   public SearchRequest getSearchRequest() {
      return searchRequest;
   }

   @Override
   @XmlElementWrapper(name = "ids")
   @XmlElement(name = "id")
   public List<Integer> getIds() {
      if (ids == null) {
         ids = new LinkedList<Integer>();
      }
      return ids;
   }

   public void setIds(List<Integer> ids) {
      this.ids = ids;
   }

   @Override
   public SearchParameters getSearchParameters() {
      return getSearchRequest();
   }

   public void setMatches(List<SearchMatch> searchMatches) {
      this.searchMatches = searchMatches;
   }

   @Override
   @XmlElementWrapper(name = "matches")
   @XmlElement(name = "match")
   public List<SearchMatch> getSearchMatches() {
      return searchMatches;
   }

}

Back to the top