CustomerResult.java
6.39 KB
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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
/*
* Decompiled with CFR 0_118.
*
* Could not load the following classes:
* org.slf4j.Logger
* org.slf4j.LoggerFactory
*/
package com.day.cq.searchpromote.xml.result;
import com.day.cq.searchpromote.xml.result.BannerList;
import com.day.cq.searchpromote.xml.result.BreadCrumbList;
import com.day.cq.searchpromote.xml.result.CustomFieldList;
import com.day.cq.searchpromote.xml.result.FacetList;
import com.day.cq.searchpromote.xml.result.MenuList;
import com.day.cq.searchpromote.xml.result.Pagination;
import com.day.cq.searchpromote.xml.result.Query;
import com.day.cq.searchpromote.xml.result.Redirect;
import com.day.cq.searchpromote.xml.result.ResultEntity;
import com.day.cq.searchpromote.xml.result.ResultList;
import com.day.cq.searchpromote.xml.result.ResultParser;
import com.day.cq.searchpromote.xml.result.SearchForm;
import com.day.cq.searchpromote.xml.result.Suggestions;
import com.day.cq.searchpromote.xml.result.Template;
import com.day.cq.searchpromote.xml.result.ZoneList;
import javax.xml.namespace.QName;
import javax.xml.stream.XMLEventReader;
import javax.xml.stream.events.StartElement;
import javax.xml.stream.events.XMLEvent;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class CustomerResult
implements ResultEntity {
private static final Logger LOG = LoggerFactory.getLogger(CustomerResult.class);
private static final String QUERY_NODE = "query";
private static final String CUSTOM_FIELDS_NODE = "custom-fields";
private static final String MENUS_NODE = "menus";
private static final String BREADCRUMBS_NODE = "breadcrumbs";
private static final String SUGGESTIONS_NODE = "suggestions";
private static final String PAGINATION_NODE = "pagination";
private static final String FACETS_NODE = "facets";
private static final String RESULTS_NODE = "results";
private static final String BANERS_NODE = "banners";
private static final String ZONES_NODE = "zones";
private static final String TEMPLATE_NODE = "template";
private static final String SEARCH_FORM_NODE = "search-form";
private static final String REDIRECT_NODE = "redirect";
private Query query;
private CustomFieldList customFieldList;
private MenuList menuList;
private BreadCrumbList breadCrumbList;
private Suggestions suggestionList;
private Pagination pagination;
private FacetList facetList;
private ResultList resultList;
private BannerList bannerList;
private ZoneList zoneList;
private SearchForm searchForm;
private Template template;
private Redirect redirect;
@Override
public void parse(XMLEventReader reader) throws Exception {
XMLEvent subElement;
LOG.debug("Parsing results...");
while (reader.hasNext() && (subElement = ResultParser.getNextEvent(reader)) != null && !subElement.isEndElement()) {
StartElement element = subElement.asStartElement();
String localPart = element.getName().getLocalPart();
LOG.debug("Found node {}", (Object)localPart);
if (localPart.equals("query")) {
this.query = new Query();
this.query.parse(reader);
continue;
}
if (localPart.equals("custom-fields")) {
this.customFieldList = new CustomFieldList();
this.customFieldList.parse(reader);
continue;
}
if (localPart.equals("menus")) {
this.menuList = new MenuList();
this.menuList.parse(reader);
continue;
}
if (localPart.equals("breadcrumbs")) {
this.breadCrumbList = new BreadCrumbList();
this.breadCrumbList.parse(reader);
continue;
}
if (localPart.equals("suggestions")) {
this.suggestionList = new Suggestions();
this.suggestionList.parse(reader);
continue;
}
if (localPart.equals("pagination")) {
this.pagination = new Pagination();
this.pagination.parse(reader);
continue;
}
if (localPart.equals("facets")) {
this.facetList = new FacetList();
this.facetList.parse(reader);
continue;
}
if (localPart.equals("results")) {
this.resultList = new ResultList();
this.resultList.parse(reader);
continue;
}
if (localPart.equals("banners")) {
this.bannerList = new BannerList();
this.bannerList.parse(reader);
continue;
}
if (localPart.equals("zones")) {
this.zoneList = new ZoneList();
this.zoneList.parse(reader);
continue;
}
if (localPart.equals("search-form")) {
this.searchForm = new SearchForm();
this.searchForm.parse(reader);
continue;
}
if (localPart.equals("template")) {
this.template = new Template();
this.template.parse(reader);
continue;
}
if (localPart.equals("redirect")) {
this.redirect = new Redirect();
this.redirect.parse(reader);
continue;
}
ResultParser.parseUnknownTag(reader);
}
LOG.debug("Done parsing results.");
}
public Query getQuery() {
return this.query;
}
public CustomFieldList getCustomFieldList() {
return this.customFieldList;
}
public MenuList getMenuList() {
return this.menuList;
}
public BreadCrumbList getBreadCrumbList() {
return this.breadCrumbList;
}
public Suggestions getSuggestions() {
return this.suggestionList;
}
public Pagination getPagination() {
return this.pagination;
}
public FacetList getFacetList() {
return this.facetList;
}
public ResultList getResultList() {
return this.resultList;
}
public BannerList getBannerList() {
return this.bannerList;
}
public ZoneList getZoneList() {
return this.zoneList;
}
public SearchForm getSearchForm() {
return this.searchForm;
}
public Redirect getRedirect() {
return this.redirect;
}
}