001    /**
002     * Copyright (c) 2000-present Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.portal.kernel.search;
016    
017    import com.liferay.portal.security.permission.PermissionChecker;
018    
019    import java.util.List;
020    import java.util.Locale;
021    
022    import javax.portlet.PortletRequest;
023    import javax.portlet.PortletResponse;
024    import javax.portlet.PortletURL;
025    
026    /**
027     * @author Brian Wing Shun Chan
028     */
029    public class IndexerWrapper implements Indexer {
030    
031            public IndexerWrapper(Indexer indexer) {
032                    _indexer = indexer;
033            }
034    
035            @Override
036            public void addRelatedEntryFields(Document document, Object obj)
037                    throws Exception {
038    
039                    _indexer.addRelatedEntryFields(document, obj);
040            }
041    
042            @Override
043            public void delete(long companyId, String uid) throws SearchException {
044                    _indexer.delete(companyId, uid);
045            }
046    
047            @Override
048            public void delete(Object obj) throws SearchException {
049                    _indexer.delete(obj);
050            }
051    
052            @Override
053            public String[] getClassNames() {
054                    return _indexer.getClassNames();
055            }
056    
057            @Override
058            public int getDatabaseCount() throws Exception {
059                    return _indexer.getDatabaseCount();
060            }
061    
062            @Override
063            public Document getDocument(Object obj) throws SearchException {
064                    return _indexer.getDocument(obj);
065            }
066    
067            @Override
068            public BooleanQuery getFacetQuery(
069                            String className, SearchContext searchContext)
070                    throws Exception {
071    
072                    return _indexer.getFacetQuery(className, searchContext);
073            }
074    
075            @Override
076            public BooleanQuery getFullQuery(SearchContext searchContext)
077                    throws SearchException {
078    
079                    return _indexer.getFullQuery(searchContext);
080            }
081    
082            @Override
083            public IndexerPostProcessor[] getIndexerPostProcessors() {
084                    return _indexer.getIndexerPostProcessors();
085            }
086    
087            @Override
088            public String getPortletId() {
089                    return _indexer.getPortletId();
090            }
091    
092            @Override
093            public String getSearchEngineId() {
094                    return _indexer.getSearchEngineId();
095            }
096    
097            @Override
098            public String getSortField(String orderByCol) {
099                    return _indexer.getSortField(orderByCol);
100            }
101    
102            @Override
103            public String getSortField(String orderByCol, int sortType) {
104                    return _indexer.getSortField(orderByCol, sortType);
105            }
106    
107            /**
108             * @deprecated As of 7.0.0, replaced by {@link #getSummary(Document, String,
109             *             PortletURL, PortletRequest, PortletResponse)}
110             */
111            @Deprecated
112            @Override
113            public Summary getSummary(
114                            Document document, Locale locale, String snippet,
115                            PortletURL portletURL)
116                    throws SearchException {
117    
118                    return _indexer.getSummary(document, locale, snippet, portletURL);
119            }
120    
121            @Override
122            public Summary getSummary(
123                            Document document, String snippet, PortletURL portletURL,
124                            PortletRequest portletRequest, PortletResponse portletResponse)
125                    throws SearchException {
126    
127                    return _indexer.getSummary(
128                            document, snippet, portletURL, portletRequest, portletResponse);
129            }
130    
131            @Override
132            public boolean hasPermission(
133                            PermissionChecker permissionChecker, String entryClassName,
134                            long entryClassPK, String actionId)
135                    throws Exception {
136    
137                    return _indexer.hasPermission(
138                            permissionChecker, entryClassName, entryClassPK, actionId);
139            }
140    
141            @Override
142            public boolean isCommitImmediately() {
143                    return _indexer.isCommitImmediately();
144            }
145    
146            @Override
147            public boolean isFilterSearch() {
148                    return _indexer.isFilterSearch();
149            }
150    
151            @Override
152            public boolean isPermissionAware() {
153                    return _indexer.isPermissionAware();
154            }
155    
156            @Override
157            public boolean isStagingAware() {
158                    return _indexer.isStagingAware();
159            }
160    
161            @Override
162            public boolean isVisible(long classPK, int status) throws Exception {
163                    return _indexer.isVisible(classPK, status);
164            }
165    
166            @Override
167            public boolean isVisibleRelatedEntry(long classPK, int status)
168                    throws Exception {
169    
170                    return _indexer.isVisibleRelatedEntry(classPK, status);
171            }
172    
173            @Override
174            public void postProcessContextQuery(
175                            BooleanQuery contextQuery, SearchContext searchContext)
176                    throws Exception {
177    
178                    _indexer.postProcessContextQuery(contextQuery, searchContext);
179            }
180    
181            @Override
182            public void postProcessSearchQuery(
183                            BooleanQuery searchQuery, SearchContext searchContext)
184                    throws Exception {
185    
186                    _indexer.postProcessSearchQuery(searchQuery, searchContext);
187            }
188    
189            @Override
190            public void registerIndexerPostProcessor(
191                    IndexerPostProcessor indexerPostProcessor) {
192    
193                    _indexer.registerIndexerPostProcessor(indexerPostProcessor);
194            }
195    
196            @Override
197            public void reindex(Object obj) throws SearchException {
198                    _indexer.reindex(obj);
199            }
200    
201            @Override
202            public void reindex(String className, long classPK) throws SearchException {
203                    _indexer.reindex(className, classPK);
204            }
205    
206            @Override
207            public void reindex(String[] ids) throws SearchException {
208                    _indexer.reindex(ids);
209            }
210    
211            @Override
212            public void reindexDDMStructures(List<Long> ddmStructureIds)
213                    throws SearchException {
214    
215                    _indexer.reindexDDMStructures(ddmStructureIds);
216            }
217    
218            @Override
219            public Hits search(SearchContext searchContext) throws SearchException {
220                    return _indexer.search(searchContext);
221            }
222    
223            @Override
224            public Hits search(
225                            SearchContext searchContext, String... selectedFieldNames)
226                    throws SearchException {
227    
228                    return _indexer.search(searchContext, selectedFieldNames);
229            }
230    
231            @Override
232            public void unregisterIndexerPostProcessor(
233                    IndexerPostProcessor indexerPostProcessor) {
234    
235                    _indexer.unregisterIndexerPostProcessor(indexerPostProcessor);
236            }
237    
238            @Override
239            public void updateFullQuery(SearchContext searchContext) {
240                    _indexer.updateFullQuery(searchContext);
241            }
242    
243            private final Indexer _indexer;
244    
245    }