Start page / Plug-In Development / Examples / Module: Editorial Search and Replace / Module Structure / Search

<< Chapter “Report”

Package: Search

The Search package contains all functionality to execute search and replace processes on store elements, forms and content fields (editors and other text information) as well as data structures that manage information such as search configuration and search results.

Important The classes of this package and its sub-packages do not implement FirstSpirit API.
Package Overview: Client ServiceClass Description: Search ConfigurationPackage Overview: Store Element Search AdaptersPackage Overview: Search ResultsClass Description: Form Data Search ResultClass Description: Search Adapter UtilityPackage Overview: GOM Element Search AdaptersPackage Overview: ReportPackage Overview: Search AdaptersPackage Overview: Form Data Search AdapterClass Description: Media Search ResultClass Description: Template Search Result

Search Configuration

de.espirit.firstspirit.opt.example.editorialsar.search.SearchConfiguration

This class serves as a store for the current search and replace run's filter configuration, allowing search string, replacement string, store type, language, and case sensitivity settings to be passed between objects as one.

The class also contains methods to determine if its fields

  • allow for a search run (the search string contains at least three characters) and
  • allow for a replacement run (search string and replacement string are defined and contain at least three characters each).

Package: Search Adapters

The Search Adapters package contains classes that allow store elements, form data and individual editors to be processed during search and replace runs.

Search Adapter Utility

de.espirit.firstspirit.opt.example.editorialsar.search.adapter.SearchAdapterUtility

This utility class includes functionality commonly used in search adapter classes:

  • processing text, searching for and counting the number of occurrences of a search string, and optionally replacing those occurrences with a replacement string, and
  • processing a DOM structure recursively to identify and process text-only values in leaf nodes.

Additionally, the class defines a sub-class ProcessingResult which is used by search adapters to keep track of result count for final tally.

Store Element Adapters

de.espirit.firstspirit.opt.example.editorialsar.search.adapter.storeelement.DataProviderStoreElementSearchAdapter
de.espirit.firstspirit.opt.example.editorialsar.search.adapter.storeelement.MediaStoreElementSearchAdapter
de.espirit.firstspirit.opt.example.editorialsar.search.adapter.storeelement.TemplateStoreElementSearchAdapter

These search adapters specialize on processing store elements of different types. Depending on the element type, processing includes iterating through project languages which should be processed, identifying fields and forms to process, and calling other search adapters as required (e.g. a FormDataSearchAdapter for an element providing FormData).

These search adapter classes extend the abstract class StoreElementSearchAdapter in the same package, which in turn extends SearchAdapter in the package de.espirit.firstspirit.opt.example.editorialsar.search.adapter.

Form Data Adapter

de.espirit.firstspirit.opt.example.editorialsar.search.adapter.formdata.FormDataSearchAdapter

This search adapter is specialized on processing FormData objects, iterating through individual GOM elements (i.e., single editors inside an element's form) and calling further search adapters as appropriate.

This search adapter class extends the abstract class SearchAdapter in the package de.espirit.firstspirit.opt.example.editorialsar.search.adapter.

GOM Element Adapters

de.espirit.firstspirit.opt.example.editorialsar.search.adapter.gomelement.DomGomElementSearchAdapter
de.espirit.firstspirit.opt.example.editorialsar.search.adapter.gomelement.DomTableGomElementSearchAdapter
de.espirit.firstspirit.opt.example.editorialsar.search.adapter.gomelement.FsListGomElementSearchAdapter
de.espirit.firstspirit.opt.example.editorialsar.search.adapter.gomelement.TextGomElementSearchAdapter

These specialized search adapters process individual GOM form elements (i.e., single editors inside a form) based on GOM element type, allowing for different treatment of each type.

The DomGomElementSearchAdapter and the DomTableGomElementSearchAdapter are designed to process DOM data of the input components DOM Editor (CMS_INPUT_DOM) and DOM Table (CMS_INPUT_DOMTABLE), respectively.

The TextGomElementSearchAdapter is designed to process input components with text values: Text (CMS_INPUT_TEXT) and Textarea (CMS_INPUT_TEXTAREA).

These search adapter classes extend the abstract class GomElementSearchAdapter in the same package, which in turn extends SearchAdapter in the package de.espirit.firstspirit.opt.example.editorialsar.search.adapter.

Package: Search Results

The Search Results package includes classes that store information about the location of one or more occurrences of the search word within a store element. Depending on the store element's type, the Search Adapters instantiate and return a different implementation of the interface SearchResult, also located within this package.

These search result classes listed below implement the interface SearchResult located in the same package.

Form Data Search Result

de.espirit.firstspirit.opt.example.editorialsar.search.result.FormDataSearchResult

This search result class is geared towards use in conjunction with form-based results. It stores a combination of project language and editor name to locate a set of search string occurrences stored within this editor for the given language. It also stores the occurrence count of the search string within that editor's value for the language.

This class may also be used to indicate search results within an element's metadata form, for which the Language constant SOLE_LANGUAGE, specified within the interface EditorValue, will be used.

Media Search Result

de.espirit.firstspirit.opt.example.editorialsar.search.result.MediaSearchResult

The media search result class stores location information for occurrences of the search string within one field of a given project language within a Media element, e.g. file name or description.

Template Search Result

de.espirit.firstspirit.opt.example.editorialsar.search.result.TemplateSearchResult

This search result class is used to indicate search string occurrences within template elements. The location data stored indicates the template tab (as shown in the SiteArchitect user interface, e.g. Properties, Form, Rules, etc.) in which a number of search string occurrences were identified.

This class provides two constructors:

  • TemplateSearchResult(TemplateSearchResult#Tab, int)
    allows configuration of a search result object to indicate a template tab, but does not support the Tab value CHANNEL directly.
  • TemplateSearchResult(TemplateSet, int)
    allows configuration of a search result object to indicate an output channel (identified by the TemplateSet object provided as a parameter). The private Tab field will automatically be set to the value CHANNEL.

<< Chapter “Report”

© 2005 - 2024 Crownpeak Technology GmbH | All rights reserved. | FirstSpirit 2024.12 | Data privacy