org.licas.service.model

## Class KeywordHandler

- java.lang.Object
- - org.licas.service.model.KeywordHandler

-     public class KeywordHandler
      extends java.lang.Object

  This stores and processes keywords for any service metadata structure.
  Author:
    Kieran Greer

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected java.util.HashMap<java.lang.String,java.util.HashMap<java.lang.String,java.util.HashMap<java.lang.String,KeywordInfo>>>` | `keywordLists` The lists of all keywords in all languages.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `KeywordHandler()` Create a new instance of KeywordHandler

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addKeywordList(KeywordInfo keywordInfo)` Add a new list of keywords to the keyword structures.
    `java.util.HashMap<java.lang.String,java.util.HashMap<java.lang.String,java.util.HashMap<java.lang.String,KeywordInfo>>>` | `getKeywordLists()` Get all saved lists of all keywords.
    `java.util.HashMap<java.lang.String,java.util.ArrayList<java.lang.String>>` | `getKeywords(java.lang.String topic, java.lang.String language)` Get any keyword lists for the specified language.
    `java.util.HashMap<java.lang.String,java.util.ArrayList<java.lang.String>>` | `getKeywords(java.lang.String topic, java.lang.String language, java.lang.String source)` Get any keyword lists for the specified topic, language and source.
    `java.util.ArrayList<java.lang.String>` | `justKeywords()` Return a single list of just the keywords only, without any of the context or language details.
    `org.licas_xml.abs.Element` | `keywordsToXml()` Convert the list of keywords into XML format.

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

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

- - ### Field Detail

    - #### keywordLists

          protected java.util.HashMap<java.lang.String,java.util.HashMap<java.lang.String,java.util.HashMap<java.lang.String,KeywordInfo>>> keywordLists

      The lists of all keywords in all languages. Key is the topic name and value is another hashmap, where key is the language name and value is another hashmap where key is the source and value is the keyword info object.

  - ### Constructor Detail

    - #### KeywordHandler

          public KeywordHandler()

      Create a new instance of KeywordHandler

  - ### Method Detail

    - #### addKeywordList

          public void addKeywordList(KeywordInfo keywordInfo)

      Add a new list of keywords to the keyword structures. This either adds a new info structure or appends to an existing keywords list.
      Parameters:
        `keywordInfo` - the keyword info to add.

    - #### getKeywords

          public java.util.HashMap<java.lang.String,java.util.ArrayList<java.lang.String>> getKeywords(java.lang.String topic,
                                                                                                       java.lang.String language)

      Get any keyword lists for the specified language.
      Parameters:
        `topic` - the topic the keywords belong to.
        `language` - the language the keywords were written in. Can be `null` when any matching lists are returned.
      Returns:
        a set of combined keyword lists for each source, one for each language.

    - #### getKeywords

          public java.util.HashMap<java.lang.String,java.util.ArrayList<java.lang.String>> getKeywords(java.lang.String topic,
                                                                                                       java.lang.String language,
                                                                                                       java.lang.String source)

      Get any keyword lists for the specified topic, language and source.
      Parameters:
        `topic` - the topic the keywords belong to.
        `language` - the language the keywords were written in. Can be `null` when any matching lists are returned.
        `source` - the source of the keywords. Can be `null` when any matching lists are returned.
      Returns:
        a set of combined keyword lists for each source, one for each language.

    - #### justKeywords

          public java.util.ArrayList<java.lang.String> justKeywords()

      Return a single list of just the keywords only, without any of the context or language details.
      Returns:
        single list of all keywords.

    - #### getKeywordLists

          public java.util.HashMap<java.lang.String,java.util.HashMap<java.lang.String,java.util.HashMap<java.lang.String,KeywordInfo>>> getKeywordLists()

      Get all saved lists of all keywords.
      Returns:
        the value of keywordLists.

    - #### keywordsToXml

          public org.licas_xml.abs.Element keywordsToXml()
                                                  throws java.lang.Exception

      Convert the list of keywords into XML format.
      Returns:
        the keywords structure converted into XML.
      Throws:
        `java.lang.Exception` - any error.