CustomerResult.java 6.39 KB
/*
 * 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;
    }
}