org.appng.search.searcher

## Class SearchFormatter

- java.lang.Object
- - org.appng.search.searcher.SearchFormatter

-     public class SearchFormatter
      extends Object

  A `SearchFormatter` is responsible for formatting the `Result`s of a search, which are grouped into several `Part`s. It supports XML and JSON as output formats, optionally applying pagination.
  Author:
    Matthias Müller
  See Also:
    `Part`, `Result`

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static String` | `DEFAULT_DATE_PATTERN`
    `static int` | `DEFAULT_PAGE`
    `static String` | `DEFAULT_PAGE_PARAM`
    `static String` | `DEFAULT_PAGE_SIZE_PARAM`
    `static int` | `DEFAULT_PAGESIZE`
    `static String` | `DEFAULT_QUERY_PARAM`
    `static String` | `FORMAT_JSON`
    `static String` | `FORMAT_XML`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `SearchFormatter(DocumentBuilderFactory documentBuilderFactory, TransformerFactory transformerFactory)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `String` | `getDateFormat()`
    `String` | `getFormat()`
    `int` | `getPage()`
    `String` | `getPageParamName()`
    `int` | `getPageSize()`
    `String` | `getPageSizeParamName()`
    `List<Part>` | `getParts()`
    `String` | `getQueryParam()`
    `String` | `getQueryParamName()`
    `protected List<Result>` | `getSortedDocs()`
    `long` | `getTime()`
    `File` | `getXslStylesheet()`
    `boolean` | `isDoXsl()`
    `boolean` | `isPretty()`
    `boolean` | `isUseParts()`
    `protected Search<SearchFilter>` | `paginate(List<Result> sortedDocs)`
    `protected void` | `processXML(Writer writer, List<Result> sortedDocs, DateFormat dateFormat)`
    `void` | `setDateFormat(String dateFormat)`
    `void` | `setDoXsl(boolean doXsl)`
    `void` | `setFormat(String format)`
    `void` | `setPage(int page)`
    `void` | `setPageParamName(String pageParamName)`
    `void` | `setPageSize(int pageSize)`
    `void` | `setPageSizeParamName(String pageSizeParamName)`
    `void` | `setParts(List<Part> parts)`
    `void` | `setPretty(boolean pretty)`
    `void` | `setQueryParam(String queryParam)`
    `void` | `setQueryParamName(String queryParamName)`
    `void` | `setTime(long time)`
    `void` | `setUseParts(boolean useParts)`
    `void` | `setXslStylesheet(File xslStylesheet)`
    `void` | `write(OutputStream out)`
    `void` | `write(Writer writer)`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### DEFAULT_PAGE

          public static final int DEFAULT_PAGE

      See Also:
        Constant Field Values

    - #### DEFAULT_PAGE_PARAM

          public static final String DEFAULT_PAGE_PARAM

      See Also:
        Constant Field Values

    - #### DEFAULT_PAGESIZE

          public static final int DEFAULT_PAGESIZE

      See Also:
        Constant Field Values

    - #### DEFAULT_PAGE_SIZE_PARAM

          public static final String DEFAULT_PAGE_SIZE_PARAM

      See Also:
        Constant Field Values

    - #### DEFAULT_QUERY_PARAM

          public static final String DEFAULT_QUERY_PARAM

      See Also:
        Constant Field Values

    - #### DEFAULT_DATE_PATTERN

          public static final String DEFAULT_DATE_PATTERN

      See Also:
        Constant Field Values

    - #### FORMAT_JSON

          public static final String FORMAT_JSON

      See Also:
        Constant Field Values

    - #### FORMAT_XML

          public static final String FORMAT_XML

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### SearchFormatter

          public SearchFormatter(DocumentBuilderFactory documentBuilderFactory,
                                 TransformerFactory transformerFactory)

  - ### Method Detail

    - #### write

          public void write(OutputStream out)
                     throws IOException

      Throws:
        `IOException`

    - #### write

          public void write(Writer writer)
                     throws IOException

      Throws:
        `IOException`

    - #### getSortedDocs

          protected List<Result> getSortedDocs()

    - #### processXML

          protected void processXML(Writer writer,
                                    List<Result> sortedDocs,
                                    DateFormat dateFormat)
                             throws IOException

      Throws:
        `IOException`

    - #### paginate

          protected Search<SearchFilter> paginate(List<Result> sortedDocs)

    - #### getPage

          public int getPage()

    - #### setPage

          public void setPage(int page)

    - #### getPageParamName

          public String getPageParamName()

    - #### setPageParamName

          public void setPageParamName(String pageParamName)

    - #### getPageSize

          public int getPageSize()

    - #### setPageSize

          public void setPageSize(int pageSize)

    - #### getPageSizeParamName

          public String getPageSizeParamName()

    - #### setPageSizeParamName

          public void setPageSizeParamName(String pageSizeParamName)

    - #### getQueryParamName

          public String getQueryParamName()

    - #### setQueryParamName

          public void setQueryParamName(String queryParamName)

    - #### isPretty

          public boolean isPretty()

    - #### setPretty

          public void setPretty(boolean pretty)

    - #### getFormat

          public String getFormat()

    - #### setFormat

          public void setFormat(String format)

    - #### isUseParts

          public boolean isUseParts()

    - #### setUseParts

          public void setUseParts(boolean useParts)

    - #### getDateFormat

          public String getDateFormat()

    - #### setDateFormat

          public void setDateFormat(String dateFormat)

    - #### getParts

          public List<Part> getParts()

    - #### setParts

          public void setParts(List<Part> parts)

    - #### getQueryParam

          public String getQueryParam()

    - #### setQueryParam

          public void setQueryParam(String queryParam)

    - #### getXslStylesheet

          public File getXslStylesheet()

    - #### setXslStylesheet

          public void setXslStylesheet(File xslStylesheet)

    - #### getTime

          public long getTime()

    - #### setTime

          public void setTime(long time)

    - #### isDoXsl

          public boolean isDoXsl()

    - #### setDoXsl

          public void setDoXsl(boolean doXsl)

Copyright © 2011–2023 aiticon GmbH. All rights reserved.