001/*
002 * This library is part of OpenCms -
003 * the Open Source Content Management System
004 *
005 * Copyright (c) Alkacon Software GmbH & Co. KG (http://www.alkacon.com)
006 *
007 * This library is free software; you can redistribute it and/or
008 * modify it under the terms of the GNU Lesser General Public
009 * License as published by the Free Software Foundation; either
010 * version 2.1 of the License, or (at your option) any later version.
011 *
012 * This library is distributed in the hope that it will be useful,
013 * but WITHOUT ANY WARRANTY; without even the implied warranty of
014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
015 * Lesser General Public License for more details.
016 *
017 * For further information about Alkacon Software, please see the
018 * company website: http://www.alkacon.com
019 *
020 * For further information about OpenCms, please see the
021 * project website: http://www.opencms.org
022 *
023 * You should have received a copy of the GNU Lesser General Public
024 * License along with this library; if not, write to the Free Software
025 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
026 */
027
028package org.opencms.ade.galleries.shared;
029
030import org.opencms.ade.galleries.shared.I_CmsGalleryProviderConstants.GalleryMode;
031import org.opencms.ade.galleries.shared.I_CmsGalleryProviderConstants.GalleryTabId;
032import org.opencms.ade.galleries.shared.I_CmsGalleryProviderConstants.SortParams;
033import org.opencms.gwt.shared.CmsGalleryContainerInfo;
034import org.opencms.gwt.shared.CmsTemplateContextInfo;
035import org.opencms.util.CmsStringUtil;
036
037import java.util.ArrayList;
038import java.util.Arrays;
039import java.util.HashSet;
040import java.util.List;
041import java.util.Set;
042
043import com.google.gwt.user.client.rpc.IsSerializable;
044
045/**
046 * This bean represents the current search object.<p>
047 *
048 * The search object collects the current parameters which are used for the search and
049 * contains the search results for the current search parameters.
050 *
051 * @since 8.0.0
052 */
053public class CmsGallerySearchBean implements IsSerializable {
054
055    /** The default matches per page. */
056    public static final int DEFAULT_MATCHES_PER_PAGE = 40;
057
058    /** The default tab id to use when the gallery is opened. */
059    public static final int DEFAULT_TAB_ID = 0;
060
061    /** Name of the used JS variable. */
062    public static final String DICT_NAME = "cms_gallery_search_bean";
063
064    /** The list of selected categories ids (path). */
065    private List<String> m_categories = new ArrayList<String>();
066
067    /** The container information (used for the container page Add menu case of the gallery dialog). */
068    private CmsGalleryContainerInfo m_containerInfo;
069
070    /** The end creation date criteria as long. */
071    private long m_dateCreatedEnd = -1L;
072
073    /** The start creation date criteria as long. */
074    private long m_dateCreatedStart = -1L;
075
076    /** The end modification date criteria as long. */
077    private long m_dateModifiedEnd = -1L;
078
079    /** The start modification date criteria as long. */
080    private long m_dateModifiedStart = -1L;
081
082    /** Flag to disable the preview. */
083    private boolean m_disablePreview;
084
085    /** The list of selected vfs folders. */
086    private Set<String> m_folders = new HashSet<String>();
087
088    /** The list of selected galleries ids (path). */
089    private List<String> m_galleries = new ArrayList<String>();
090
091    /** Flag to indicate whether the user changed the gallery selection. */
092    private boolean m_galleriesChanged;
093
094    /** The gallery mode. */
095    private GalleryMode m_galleryMode;
096
097    /** The prefix for the key used to store the last selected gallery. */
098    private String m_galleryStoragePrefix;
099
100    /** Indicates the search exclude property should be ignored. */
101    private boolean m_ignoreSearchExclude;
102
103    /** Flag indicating if the search should include expired or unreleased resources. */
104    private boolean m_includeExpired;
105
106    /** The id of a tab which will be set after an initial (CmsGalleryDataBean) search. */
107    private GalleryTabId m_initialTabId;
108
109    /** The index of the last search results page. */
110    private int m_lastPage;
111
112    /** The selected locale for search. */
113    private String m_locale;
114
115    /** The number of search results to be display pro page. */
116    private int m_matchesPerPage;
117
118    /** The reason why an upload to the current target folder is not allowed. */
119    private String m_noUploadReason;
120
121    /** The original gallery data for which this search bean was created. */
122    private CmsGalleryDataBean m_originalGalleryData;
123
124    /** The current search result page. */
125    private int m_page;
126
127    /** The search query string. */
128    private String m_query;
129
130    /** The gallery reference path. */
131    private String m_referencePath;
132
133    /** True if the search results were replaced. */
134    private boolean m_replacedResults;
135
136    /** The path to the selected resource. */
137    private String m_resourcePath;
138
139    /** The type of the selected resource. */
140    private String m_resourceType;
141
142    /** The number of all search results. */
143    private int m_resultCount;
144
145    /** The results to display in the list of search results. */
146    private List<CmsResultItemBean> m_results;
147
148    /** The search scope. */
149    private CmsGallerySearchScope m_scope;
150
151    /** The real list of types to be used for the search on the server. */
152    private List<String> m_serverSearchTypes = new ArrayList<String>();
153
154    /** The sitemap preload data. */
155    private CmsSitemapEntryBean m_sitemapPreloadData;
156
157    /** The sort order of the search result. */
158    private String m_sortOrder;
159
160    /** The tab id to be selected by opening the gallery dialog. */
161    private String m_tabId = I_CmsGalleryProviderConstants.GalleryTabId.cms_tab_types.name();
162
163    /** The template context information. */
164    private CmsTemplateContextInfo m_templateContextInfo;
165
166    /** The list of the resource types ids (resource type name). */
167    private List<String> m_types = new ArrayList<String>();
168
169    /** The VFS tree preload data. */
170    private CmsVfsEntryBean m_vfsPreloadData;
171
172    /**
173     * Empty default constructor. <p>
174     */
175    public CmsGallerySearchBean() {
176
177        m_matchesPerPage = DEFAULT_MATCHES_PER_PAGE;
178        m_page = 1;
179        // default sorting by date last modified
180        m_sortOrder = SortParams.dateLastModified_desc.name();
181    }
182
183    /**
184     * Constructor of the search object.<p>
185     *
186     * The constructor copies the content of the provided parameter to the current bean.
187     *
188     * @param searchObj a search object with content
189     */
190    public CmsGallerySearchBean(CmsGallerySearchBean searchObj) {
191
192        setTypes(searchObj.getTypes());
193        setGalleries(searchObj.getGalleries());
194        setFolders(searchObj.getFolders());
195        setCategories(searchObj.getCategories());
196        setQuery(searchObj.getQuery());
197        setLocale(searchObj.getLocale());
198        setMatchesPerPage(searchObj.getMatchesPerPage());
199        setSortOrder(searchObj.getSortOrder());
200        setTabId(searchObj.getTabId());
201        setPage(searchObj.getPage());
202        setLastPage(searchObj.getLastPage());
203        setDateCreatedEnd(searchObj.getDateCreatedEnd());
204        setDateCreatedStart(searchObj.getDateCreatedStart());
205        setDateModifiedEnd(searchObj.getDateModifiedEnd());
206        setDateModifiedStart(searchObj.getDateModifiedStart());
207        setScope(searchObj.getScope());
208        setIncludeExpired(searchObj.isIncludeExpired());
209        setIgnoreSearchExclude(searchObj.isIgnoreSearchExclude());
210        setGalleryMode(searchObj.getGalleryMode());
211        setGalleryStoragePrefix(searchObj.getGalleryStoragePrefix());
212        setServerSearchTypes(searchObj.getServerSearchTypes());
213        setOriginalGalleryData(searchObj.getOriginalGalleryData());
214        setReplacedResults(searchObj.hasReplacedResults());
215        setContainerInfo(searchObj.getContainerInfo());
216    }
217
218    /**
219     * Creates the key used to store the last selected gallery.<p>
220     *
221     * @param prefix the prefix for the key
222     * @param referenceType the type name of the reference resource
223     *
224     * @return the key to store the last selected gallery
225     */
226    public static String getGalleryStorageKey(String prefix, String referenceType) {
227
228        return prefix + "#" + referenceType;
229    }
230
231    /**
232     * Adds a category to the categories list.<p>
233     *
234     * @param category the category
235     */
236    public void addCategory(String category) {
237
238        if (!m_categories.contains(category)) {
239            m_categories.add(category);
240        }
241    }
242
243    /**
244     * Adds a new VFS folder to search in.<p>
245     *
246     * @param folder the folder to add
247     */
248    public void addFolder(String folder) {
249
250        m_folders.add(folder);
251    }
252
253    /**
254     * Adds a gallery folder to the galleries list.<p>
255     *
256     * @param gallery the gallery
257     */
258    public void addGallery(String gallery) {
259
260        if (!m_galleries.contains(gallery)) {
261            m_galleries.add(gallery);
262        }
263    }
264
265    /**
266     * Adds a type to the types list.<p>
267     *
268     * @param type the type
269     */
270    public void addType(String type) {
271
272        if (!m_types.contains(type)) {
273            m_types.add(type);
274        }
275    }
276
277    /**
278     * Clears the categories list.<p>
279     */
280    public void clearCategories() {
281
282        m_categories.clear();
283    }
284
285    /**
286     * Clears the list of VFS folders.<p>
287     */
288    public void clearFolders() {
289
290        m_folders.clear();
291    }
292
293    /**
294     * Clears the full text search.<p>
295     */
296    public void clearFullTextSearch() {
297
298        m_query = null;
299        m_dateCreatedEnd = -1L;
300        m_dateCreatedStart = -1L;
301        m_dateModifiedEnd = -1L;
302        m_dateModifiedStart = -1L;
303    }
304
305    /**
306     * Clears the galleries list.<p>
307     */
308    public void clearGalleries() {
309
310        m_galleries.clear();
311    }
312
313    /**
314     * Clears the types list.<p>
315     */
316    public void clearTypes() {
317
318        m_types.clear();
319    }
320
321    /**
322     * Returns the list of the available categories.<p>
323     *
324     * @return the categories
325     */
326    public List<String> getCategories() {
327
328        return m_categories;
329    }
330
331    /**
332     * Gets the container information.<p>
333     *
334     * This is used for filtering of dynamic function search results in the 'Add menu' case of the gallery dialog.
335     *
336     * @return the container information
337     */
338    public CmsGalleryContainerInfo getContainerInfo() {
339
340        return m_containerInfo;
341    }
342
343    /**
344     * Returns the dateCreatedEnd.<p>
345     *
346     * @return the dateCreatedEnd
347     */
348    public long getDateCreatedEnd() {
349
350        return m_dateCreatedEnd;
351    }
352
353    /**
354     * Returns the dateCreatedStart.<p>
355     *
356     * @return the dateCreatedStart
357     */
358    public long getDateCreatedStart() {
359
360        return m_dateCreatedStart;
361    }
362
363    /**
364     * Returns the dateModifiedEnd.<p>
365     *
366     * @return the dateModifiedEnd
367     */
368    public long getDateModifiedEnd() {
369
370        return m_dateModifiedEnd;
371    }
372
373    /**
374     * Returns the dateModifiedStart.<p>
375     *
376     * @return the dateModifiedStart
377     */
378    public long getDateModifiedStart() {
379
380        return m_dateModifiedStart;
381    }
382
383    /**
384     * Returns the list of selected VFS folders.<p>
385     *
386     * @return the list of selected VFS folders
387     */
388    public Set<String> getFolders() {
389
390        return m_folders;
391    }
392
393    /**
394     * Returns the list of the available galleries.<p>
395     *
396     * @return the galleries
397     */
398    public List<String> getGalleries() {
399
400        return m_galleries;
401    }
402
403    /**
404     * Gets the gallery mode.<p>
405     *
406     * @return the gallery mode
407     */
408    public GalleryMode getGalleryMode() {
409
410        return m_galleryMode;
411    }
412
413    /**
414     * Gets the key used to store the last selected gallery.<p>
415     *
416     * @return the key used to store the last selected gallery
417     */
418    public String getGalleryStoragePrefix() {
419
420        return m_galleryStoragePrefix;
421    }
422
423    /**
424     * Gets the initial tab id.<p>
425     *
426     * @return the initial tab id
427     */
428    public GalleryTabId getInitialTabId() {
429
430        return m_initialTabId;
431    }
432
433    /**
434     * Gets the index of the last search results page.<p>
435     *
436     * @return the index of the last search results page
437     */
438    public int getLastPage() {
439
440        return m_lastPage;
441    }
442
443    /**
444     * Returns the search locale.<p>
445     *
446     * @return the locale
447     */
448    public String getLocale() {
449
450        return m_locale;
451    }
452
453    /**
454     * Returns the number of matches per search page.<p>
455     *
456     * @return the matchesPerPage
457     */
458    public int getMatchesPerPage() {
459
460        return m_matchesPerPage;
461    }
462
463    /**
464     * Returns the reason why an upload to the current target folder is not allowed.<p>
465     *
466     * @return the reason why an upload to the current target folder is not allowed
467     */
468    public String getNoUploadReason() {
469
470        return m_noUploadReason;
471    }
472
473    /**
474     * Returns the original gallery data.<p>
475     *
476     * @return the original gallery data
477     */
478    public CmsGalleryDataBean getOriginalGalleryData() {
479
480        return m_originalGalleryData;
481    }
482
483    /**
484     * Returns the page.<p>
485     *
486     * @return the page
487     */
488    public int getPage() {
489
490        if (m_page < 1) {
491            return 1;
492        }
493        return m_page;
494    }
495
496    /**
497     * Returns the search query string.<p>
498     *
499     * @return the query
500     */
501    public String getQuery() {
502
503        return m_query;
504    }
505
506    /**
507     * Gets the gallery reference path.<p>
508     *
509     * @return the gallery reference path
510     */
511    public String getReferencePath() {
512
513        return m_referencePath;
514    }
515
516    /**
517     * Returns the path to the selected resource in the current search.<p>
518     *
519     * @return the path to the selected resource
520     */
521    public String getResourcePath() {
522
523        return m_resourcePath;
524    }
525
526    /**
527     * Returns the resource type of the selected resource.<p>
528     *
529     * @return the resource type
530     */
531    public String getResourceType() {
532
533        return m_resourceType;
534    }
535
536    /**
537     * Returns the resultCount.<p>
538     *
539     * @return the resultCount
540     */
541    public int getResultCount() {
542
543        return m_resultCount;
544    }
545
546    /**
547     * Returns the results.<p>
548     *
549     * @return the results
550     */
551    public List<CmsResultItemBean> getResults() {
552
553        return m_results;
554    }
555
556    /**
557     * Gets the search scope.<p>
558     *
559     * @return the search scope
560     */
561    public CmsGallerySearchScope getScope() {
562
563        return m_scope;
564    }
565
566    /**
567     * Gets the server search types.<p>
568     *
569     * These are the types which are actually used for the search on the server, rather than the types
570     * which are checked in the types tab. The lists are different, for example, if the user hasn't selected any
571     * types.
572     *
573     * @return the server search types
574     */
575    public List<String> getServerSearchTypes() {
576
577        return m_serverSearchTypes;
578    }
579
580    /**
581     * Gets the sitemap preload data.<p>
582     *
583     * @return the sitemap preload data
584     */
585    public CmsSitemapEntryBean getSitemapPreloadData() {
586
587        return m_sitemapPreloadData;
588    }
589
590    /**
591     * Returns the sort order of the search results.<p>
592     *
593     * @return the sortOrder
594     */
595    public String getSortOrder() {
596
597        return m_sortOrder;
598    }
599
600    /**
601     * Returns the tabId.<p>
602     *
603     * @return the tabId
604     */
605    public String getTabId() {
606
607        return m_tabId;
608    }
609
610    /**
611     * Gets the template context information.
612     * 
613     * @return the template context information
614     */
615    public CmsTemplateContextInfo getTemplateContextInfo() {
616
617        return m_templateContextInfo;
618    }
619
620    /**
621     * Returns the list of the available type.<p>
622     *
623     * @return the typeNames
624     */
625    public List<String> getTypes() {
626
627        return m_types;
628    }
629
630    /**
631     * Gets the VFS preload data.<p>
632     *
633     * @return the VFS preload data
634     */
635    public CmsVfsEntryBean getVfsPreloadData() {
636
637        return m_vfsPreloadData;
638    }
639
640    /**
641     * Checks if there are more search items available on the next page.<p>
642     *
643     * @return <code>true</code> if there are more search results available <code>false</code> otherwise
644     */
645    public boolean hasMore() {
646
647        return ((m_results.size() >= m_matchesPerPage)
648            && (m_resultCount > (m_page * m_matchesPerPage))
649            && !hasReplacedResults());
650    }
651
652    /**
653     * Returns true if the search results were replaced with something else.
654     *
655     * @return true if the search results were replaced with something else
656     */
657    public boolean hasReplacedResults() {
658
659        return m_replacedResults;
660    }
661
662    /**
663     * Checks if the gallery selection was changed by the user.<p>
664     *
665     * @return true if the gallery selection was changed
666     */
667    public boolean haveGalleriesChanged() {
668
669        return m_galleriesChanged;
670    }
671
672    /**
673     * Returns true if no preview should be shown for the search result.<p>
674     *
675     * @return true if no preview should be shown
676     */
677    public boolean isDisablePreview() {
678
679        return m_disablePreview;
680    }
681
682    /**
683     * Checks if any search parameter are selected.<p>
684     *
685     * @return false if any search parameter is selected, true if there are no search parameter selected
686     */
687    @SuppressWarnings("unchecked")
688    public boolean isEmpty() {
689
690        List<String>[] params = new List[] {m_types, m_galleries, m_categories, new ArrayList<String>(m_folders)};
691        for (List<String> paramList : params) {
692            if ((paramList != null) && !paramList.isEmpty()) {
693                return false;
694            }
695        }
696        if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(m_query)) {
697            return false;
698        }
699        List<Long> dates = Arrays.asList(
700            new Long[] {
701                Long.valueOf(m_dateCreatedEnd),
702                Long.valueOf(m_dateCreatedStart),
703                Long.valueOf(m_dateModifiedEnd),
704                Long.valueOf(m_dateModifiedStart)});
705        for (Long date : dates) {
706            if ((date != null) && (!date.equals(Long.valueOf(-1L)))) {
707                return false;
708            }
709        }
710        return true;
711    }
712
713    /**
714     * Returns the search exclude property ignore flag.<p>
715     *
716     * @return the search exclude property ignore flag
717     */
718    public boolean isIgnoreSearchExclude() {
719
720        return m_ignoreSearchExclude;
721    }
722
723    /**
724     * Returns if the search should include expired or unreleased resources.<p>
725     *
726     * @return <code>true</code> if the search should include expired or unreleased resources
727     */
728    public boolean isIncludeExpired() {
729
730        return m_includeExpired;
731    }
732
733    /**
734     * Removes a category from the categories list.<p>
735     *
736     * @param category the category
737     */
738    public void removeCategory(String category) {
739
740        m_categories.remove(category);
741    }
742
743    /**
744     * Removes a folder from the folder list.<p>
745     *
746     * @param folder the folder to remove
747     */
748    public void removeFolder(String folder) {
749
750        m_folders.remove(folder);
751    }
752
753    /**
754     * Removes a gallery folder from the galleries list.<p>
755     *
756     * @param gallery the gallery
757     */
758    public void removeGallery(String gallery) {
759
760        m_galleries.remove(gallery);
761    }
762
763    /**
764     * Removes a type from the types list.<p>
765     *
766     * @param type the type
767     */
768    public void removeType(String type) {
769
770        m_types.remove(type);
771    }
772
773    /**
774     * Sets the categories.<p>
775     *
776     * @param categories the categories to set
777     */
778    public void setCategories(List<String> categories) {
779
780        m_categories = categories;
781    }
782
783    /**
784     * Sets the container information.
785     *
786     * @param containerInfo the container information
787     */
788    public void setContainerInfo(CmsGalleryContainerInfo containerInfo) {
789
790        m_containerInfo = containerInfo;
791    }
792
793    /**
794     * Sets the dateCreatedEnd.<p>
795     *
796     * @param dateCreatedEnd the dateCreatedEnd to set
797     */
798    public void setDateCreatedEnd(long dateCreatedEnd) {
799
800        m_dateCreatedEnd = dateCreatedEnd;
801    }
802
803    /**
804     * Sets the dateCreatedStart.<p>
805     *
806     * @param dateCreatedStart the dateCreatedStart to set
807     */
808    public void setDateCreatedStart(long dateCreatedStart) {
809
810        m_dateCreatedStart = dateCreatedStart;
811    }
812
813    /**
814     * Sets the dateModifiedEnd.<p>
815     *
816     * @param dateModifiedEnd the dateModifiedEnd to set
817     */
818    public void setDateModifiedEnd(long dateModifiedEnd) {
819
820        m_dateModifiedEnd = dateModifiedEnd;
821    }
822
823    /**
824     * Sets the dateModifiedStart.<p>
825     *
826     * @param dateModifiedStart the dateModifiedStart to set
827     */
828    public void setDateModifiedStart(long dateModifiedStart) {
829
830        m_dateModifiedStart = dateModifiedStart;
831    }
832
833    /**
834     * Sets the 'disable preview' flag.<p>
835     *
836     * @param disablePreview true if the preview for the search result should not be shown
837     */
838    public void setDisablePreview(boolean disablePreview) {
839
840        m_disablePreview = disablePreview;
841    }
842
843    /**
844     * Sets the folders to search in.<p>
845     *
846     * @param folders the folders
847     */
848    public void setFolders(Set<String> folders) {
849
850        m_folders = folders;
851    }
852
853    /**
854     * Sets the galleries.<p>
855     *
856     * @param galleries the galleries to set
857     */
858    public void setGalleries(List<String> galleries) {
859
860        m_galleries = galleries;
861    }
862
863    /**
864     * Sets the "galleries changed" flag.<p>
865     *
866     * @param changed the new flag value
867     */
868    public void setGalleriesChanged(boolean changed) {
869
870        m_galleriesChanged = changed;
871    }
872
873    /**
874     * Sets the gallery mode.<p>
875     *
876     * @param galleryMode the gallery mode to set
877     */
878    public void setGalleryMode(GalleryMode galleryMode) {
879
880        m_galleryMode = galleryMode;
881    }
882
883    /**
884     * Sets the prefix of the key used to store the last selected gallery.<p>
885     *
886     * @param prefix the prefix of the key used to store the last selected gallery
887     */
888    public void setGalleryStoragePrefix(String prefix) {
889
890        m_galleryStoragePrefix = prefix;
891    }
892
893    /**
894     * Sets the search exclude property ignore flag.<p>
895     *
896     * @param excludeForPageEditor the search exclude property ignore flag
897     */
898    public void setIgnoreSearchExclude(boolean excludeForPageEditor) {
899
900        m_ignoreSearchExclude = excludeForPageEditor;
901    }
902
903    /**
904     * Sets if the search should include expired or unreleased resources.<p>
905     *
906     * @param includeExpired if the search should include expired or unreleased resources
907     */
908    public void setIncludeExpired(boolean includeExpired) {
909
910        m_includeExpired = includeExpired;
911    }
912
913    /**
914     * Sets the initial tab id.<p>
915     *
916     * @param initialTabId the initial tab id
917     */
918    public void setInitialTabId(GalleryTabId initialTabId) {
919
920        m_initialTabId = initialTabId;
921    }
922
923    /**
924     * Sets the index of the last search result page.<p>
925     *
926     * @param lastPage the index of the last search result page
927     */
928    public void setLastPage(int lastPage) {
929
930        m_lastPage = lastPage;
931    }
932
933    /**
934     * Sets the locale.<p>
935     *
936     * @param locale the locale to set
937     */
938    public void setLocale(String locale) {
939
940        m_locale = locale;
941    }
942
943    /**
944     * Sets the matchesPerPage.<p>
945     *
946     * @param matchesPerPage the matchesPerPage to set
947     */
948    public void setMatchesPerPage(int matchesPerPage) {
949
950        m_matchesPerPage = matchesPerPage;
951    }
952
953    /**
954     * Sets the reason why an upload to the current target folder is not allowed.<p>
955     *
956     * @param noUploadReason the reason why an upload to the current target folder is not allowed to set
957     */
958    public void setNoUploadReason(String noUploadReason) {
959
960        m_noUploadReason = noUploadReason;
961    }
962
963    /**
964     * Sets the original gallery data.<p>
965     *
966     * @param originalGalleryData the original gallery data to set
967     */
968    public void setOriginalGalleryData(CmsGalleryDataBean originalGalleryData) {
969
970        m_originalGalleryData = originalGalleryData;
971    }
972
973    /**
974     * Sets the page.<p>
975     *
976     * @param page the page to set
977     */
978    public void setPage(int page) {
979
980        m_page = page;
981    }
982
983    /**
984     * Sets the query.<p>
985     *
986     * @param query the query to set
987     */
988    public void setQuery(String query) {
989
990        m_query = query;
991    }
992
993    /**
994     * Sets the gallery reference path.<p>
995     *
996     * @param referencePath the gallery reference path
997     */
998    public void setReferencePath(String referencePath) {
999
1000        m_referencePath = referencePath;
1001    }
1002
1003    /**
1004     * Sets the 'results were replaced' status.
1005     *
1006     * @param replacedResults the new value for the 'results were replaced' status
1007     */
1008    public void setReplacedResults(boolean replacedResults) {
1009
1010        m_replacedResults = replacedResults;
1011
1012    }
1013
1014    /**
1015     * Sets the resourcePath.<p>
1016     *
1017     * @param resourcePath the resourcePath to set
1018     */
1019    public void setResourcePath(String resourcePath) {
1020
1021        m_resourcePath = resourcePath;
1022    }
1023
1024    /**
1025     * Sets the resource type of the selected resource.<p>
1026     *
1027     * @param resourceType the resource type to set
1028     */
1029    public void setResourceType(String resourceType) {
1030
1031        m_resourceType = resourceType;
1032    }
1033
1034    /**
1035     * Sets the resultCount.<p>
1036     *
1037     * @param resultCount the resultCount to set
1038     */
1039    public void setResultCount(int resultCount) {
1040
1041        m_resultCount = resultCount;
1042    }
1043
1044    /**
1045     * Sets the results.<p>
1046     *
1047     * @param results the results to set
1048     */
1049    public void setResults(List<CmsResultItemBean> results) {
1050
1051        m_results = results;
1052    }
1053
1054    /**
1055     * Sets the search scope.<p>
1056     *
1057     * @param scope the search scope
1058     */
1059    public void setScope(CmsGallerySearchScope scope) {
1060
1061        m_scope = scope;
1062    }
1063
1064    /**
1065     * Sets the server search types.<p>
1066     *
1067     * @param types the server search types
1068     */
1069    public void setServerSearchTypes(List<String> types) {
1070
1071        m_serverSearchTypes = types;
1072    }
1073
1074    /**
1075     * Sets the sitemap preload data.<p>
1076     *
1077     * @param preloadData the sitemap preload data
1078     */
1079    public void setSitemapPreloadData(CmsSitemapEntryBean preloadData) {
1080
1081        m_sitemapPreloadData = preloadData;
1082    }
1083
1084    /**
1085     * Sets the sortOrder.<p>
1086     *
1087     * @param sortOrder the sortOrder to set
1088     */
1089    public void setSortOrder(String sortOrder) {
1090
1091        m_sortOrder = sortOrder;
1092    }
1093
1094    /**
1095     * Sets the tabId.<p>
1096     *
1097     * @param tabId the tabId to set
1098     */
1099    public void setTabId(String tabId) {
1100
1101        m_tabId = tabId;
1102    }
1103
1104    public void setTemplateContextInfo(CmsTemplateContextInfo cmsTemplateContextInfo) {
1105
1106        m_templateContextInfo = cmsTemplateContextInfo;
1107    }
1108
1109    /**
1110     * Sets the type names.<p>
1111     *
1112     * @param types the type names to set
1113     */
1114    public void setTypes(List<String> types) {
1115
1116        if (types == null) {
1117            m_types = new ArrayList<String>();
1118        } else {
1119            m_types = types;
1120        }
1121    }
1122
1123    /**
1124     * Sets the VFS tree preload data.<p>
1125     *
1126     * @param preloadData the VFS tree preload data
1127     */
1128    public void setVfsPreloadData(CmsVfsEntryBean preloadData) {
1129
1130        m_vfsPreloadData = preloadData;
1131    }
1132}