OBEROn SDK

com.oberon.ooql.sdk
Class Dictionary

java.lang.Object
  extended by com.oberon.ooql.sdk.Dictionary

public class Dictionary
extends java.lang.Object

Stores language translations on the database for application usage. The dictionary is subdivided into sections. Each section contains keyword translations for one or more languages. A dictionary keyword can have its own translation (for example the field label) and sub-keyword translations (for example the field range values)

Version:
5.0

Field Summary
 java.util.BitSet bsOptions
           
static int KEYWORD
          List section keywords
static int LANGUAGE
          List defined languages
static int SECTION
          List Dictionary sections
static int SUBKEY
          List keyword sub-keywords
 
Constructor Summary
Dictionary()
           
Dictionary(java.lang.String language, java.lang.String section, java.lang.String key)
          New dictionary keyword element for the specified language and section
Dictionary(java.lang.String language, java.lang.String section, java.lang.String key, java.lang.String subKey)
          New dictionary sub-keyword element for the specified language and section
 
Method Summary
 void addKeyPattern(java.lang.String keyPattern)
          Add a dictionary keyword pattern for the translation extraction / import / removal.
 void check(boolean update, java.io.DataOutputStream logStream, Framework framework)
          Check if declared keyword / sub-keyword translations are present inside the dictionary
 void get(Framework framework)
          Read a keyword / sub-keyword translation from the database
 java.lang.String getKey()
          Get the settled dictionary keyword name
static java.lang.String getKey(java.lang.String key, Framework framework)
          Get a keyword translation for the default framework language
static java.lang.String getKey(java.lang.String section, java.lang.String key, Framework framework)
          Get a keyword translation for the default framework language from the specified section
static java.lang.String getKey(java.lang.String language, java.lang.String section, java.lang.String key, Framework framework)
          Get a keyword translation for the specified language and section
 java.util.Vector<java.lang.String> getKeyPatterns()
          Get the settled dictionary keyword patterns
 java.lang.String getLanguage()
          Get the settled dictionary language code.
 int getListOption()
          Return the list option
 java.lang.String getSection()
          Get the settled dictionary section name.
 java.lang.String getSeparatorToken()
          Get the settled separator token.
 java.lang.String getSubKey()
          Get the settled dictionary sub-keyword name
static java.lang.String getSubKey(java.lang.String key, java.lang.String subKey, Framework framework)
          Get a sub-keyword translations for the default framework language
static java.lang.String getSubKey(java.lang.String section, java.lang.String key, java.lang.String subKey, Framework framework)
          Get a sub-keyword translations for the default framework language from the specified section
static java.lang.String getSubKey(java.lang.String language, java.lang.String section, java.lang.String key, java.lang.String subKey, Framework framework)
          Get a sub-keyword translations for the specified language and section
static java.util.Hashtable<java.lang.String,java.lang.String> getSubKeys(java.lang.String key, Framework framework)
          Get the sub-keyword translations for the default framework language - search to all sections
static java.util.Hashtable<java.lang.String,java.lang.String> getSubKeys(java.lang.String section, java.lang.String key, Framework framework)
          Get the sub-keyword translations for the default framework language from the specified section
static java.util.Hashtable<java.lang.String,java.lang.String> getSubKeys(java.lang.String language, java.lang.String section, java.lang.String key, Framework framework)
          Get the sub-keyword translations for the specified language and section
static java.util.Hashtable<java.lang.String,java.lang.String> getSubKeys(java.lang.String language, java.lang.String section, java.lang.String key, java.util.Vector<java.lang.String> subKeys, Framework framework)
          Get the sub-keyword translations for the specified language and section
static java.util.Hashtable<java.lang.String,java.lang.String> getSubKeys(java.lang.String section, java.lang.String key, java.util.Vector<java.lang.String> subKeys, Framework framework)
          Get the sub-keyword translations for the default framework language from the specified section
static java.util.Hashtable<java.lang.String,java.lang.String> getSubKeys(java.lang.String key, java.util.Vector<java.lang.String> subKeys, Framework framework)
          Get the sub-keyword translations for the default framework language - search to all sections
static java.util.Vector<java.lang.String> getTranslations(java.lang.String section, java.lang.String key, Framework framework)
          Get the sub-keyword translations for the specified section
static java.util.Vector<java.lang.String> getTranslations(java.lang.String language, java.lang.String section, java.lang.String key, Framework framework)
          Get the sub-keyword translations for the specified language and section
 java.lang.String getValue()
          Get the dictionary keyword / sub-keyword translation.
 void importKeys(java.io.DataInputStream inStream, Framework framework)
          Import translations from a file to the database
 boolean isExcel()
          Check if translation import/export is in Excel mode
 boolean isJSON()
          Get the json flag
 boolean isXML()
          Check if translation import/export is in XML mode
 void list(Framework framework)
          List the dictionary keywords/sub-keywords using the settled filters (language,section..)
static java.util.Vector<java.lang.String> listSubKeys(java.lang.String key, Framework framework)
          List the sub-keyword names for a given keyword
static java.util.Vector<java.lang.String> listSubKeys(java.lang.String section, java.lang.String key, Framework framework)
          List the sub-keyword names for a given keyword and section
 void put(Framework framework)
          Save a keyword / sub-keyword translation to the database
 void removeKeys(Framework framework)
          Delete one or more keyword / sub-keyword translations from the dictionary
static void resetCache(Framework framework)
          Clean the dictionary cache
 void selectKeys(java.io.DataOutputStream outStream, Framework framework)
          Extract dictionary translations to a file, using the settled filters (language,section..)
static java.lang.String selectKeys(java.lang.String language, java.lang.String section, java.lang.String key, java.lang.String subKey, java.lang.String value, boolean xml, Framework framework)
          Extract the sub-keyword translations using language,section,key and subkey patterns
 void setExcel(boolean excel)
          Set the Excel flag for export/import translations in Excel format
 void setJSON(boolean json)
          Set the import / export file format in JSON format
 void setKey(java.lang.String key)
          Set the dictionary keyword name.
static void setKey(java.lang.String language, java.lang.String section, java.lang.String key, java.lang.String value, Framework framework)
          Add a keyword translation for the specified language and section
 void setLanguage(java.lang.String language)
          Set the dictionary language code.
 void setListOption(int listType)
          Set keyword extraction type; Must be used with the list method.
 void setSection(java.lang.String section)
          Set the dictionary section name.
 void setSeparatorToken(java.lang.String token)
          Set the separator token for the translation extraction.
 void setSubKey(java.lang.String subKey)
          Set the dictionary sub-keyword name.
static void setSubKey(java.lang.String language, java.lang.String section, java.lang.String key, java.lang.String subKey, java.lang.String value, Framework framework)
          Add a sun-keyword translation for the specified language and section
 void setValue(java.lang.String translation)
          Set the dictionary keyword / sub-keyword translation.
 void setXML(boolean xml)
          Set the xml flag for export/import translations in XML format
 java.lang.String toString()
          Return the settled parameters and values as a single String
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

LANGUAGE

public static final int LANGUAGE
List defined languages

See Also:
Constant Field Values

SECTION

public static final int SECTION
List Dictionary sections

See Also:
Constant Field Values

KEYWORD

public static final int KEYWORD
List section keywords

See Also:
Constant Field Values

SUBKEY

public static final int SUBKEY
List keyword sub-keywords

See Also:
Constant Field Values

bsOptions

public java.util.BitSet bsOptions
Constructor Detail

Dictionary

public Dictionary()

Dictionary

public Dictionary(java.lang.String language,
                  java.lang.String section,
                  java.lang.String key)
New dictionary keyword element for the specified language and section

Parameters:
language - the translation language
section - the dictionary section
key - the keyword name
Since:
4.0

Dictionary

public Dictionary(java.lang.String language,
                  java.lang.String section,
                  java.lang.String key,
                  java.lang.String subKey)
New dictionary sub-keyword element for the specified language and section

Parameters:
language - the translation language
section - the dictionary section
key - the keyword name
subKey - the sub-keyword name
Since:
4.0
Method Detail

put

public void put(Framework framework)
         throws OberonException
Save a keyword / sub-keyword translation to the database

Parameters:
framework - the current framework
Throws:
OberonException - usually due to DB SQL exceptions or to limited user access rights

importKeys

public void importKeys(java.io.DataInputStream inStream,
                       Framework framework)
                throws java.io.IOException,
                       OberonException
Import translations from a file to the database

Parameters:
inStream - the input data stream containing the translations
framework - the current framework
Throws:
OberonException - usually due to DB SQL exceptions or to limited user access rights
java.io.IOException

get

public void get(Framework framework)
         throws OberonException
Read a keyword / sub-keyword translation from the database

Parameters:
framework - the current framework
Throws:
OberonException - usually due to DB SQL exceptions

list

public void list(Framework framework)
          throws OberonException
List the dictionary keywords/sub-keywords using the settled filters (language,section..)

Parameters:
framework - the current framework
Throws:
OberonException - usually due to DB SQL exceptions

selectKeys

public void selectKeys(java.io.DataOutputStream outStream,
                       Framework framework)
                throws java.io.IOException,
                       OberonException
Extract dictionary translations to a file, using the settled filters (language,section..)

Parameters:
outStream - the destination stream (if null extract to the framework result buffer)
framework - the current framework
Throws:
OberonException - usually due to DB SQL exceptions or IO exceptions
java.io.IOException

removeKeys

public void removeKeys(Framework framework)
                throws OberonException
Delete one or more keyword / sub-keyword translations from the dictionary

Parameters:
framework - the current framework
Throws:
OberonException - usually due to DB SQL exceptions or to limited user access rights

check

public void check(boolean update,
                  java.io.DataOutputStream logStream,
                  Framework framework)
           throws java.io.IOException,
                  OberonException
Check if declared keyword / sub-keyword translations are present inside the dictionary

Parameters:
update - if true add missed keywords to dictionary section
logStream - the log file stream
framework - the current framework
Throws:
OberonException - usually due to DB SQL exceptions or to limited user access rights
java.io.IOException

setLanguage

public void setLanguage(java.lang.String language)
Set the dictionary language code. Must be used for the put/get methods. Can be used with the importKeys / selectKeys and removeKeys methods to filter the translations. Use '*' to ignore the language filter. The code length is 3 chars maximum (ex. UK , AUS, DE , ESP , IT ...)

Parameters:
language - the dictionary language code

getLanguage

public java.lang.String getLanguage()
Get the settled dictionary language code.

Returns:
the language code

setSection

public void setSection(java.lang.String section)
Set the dictionary section name. Must be used for the put/get methods. Can be used with the importKeys / selectKeys and removeKeys methods to filter the translations. Use '*' to ignore the section filter.

Parameters:
section - the dictionary section name

getSection

public java.lang.String getSection()
Get the settled dictionary section name.

Returns:
the section name

setKey

public void setKey(java.lang.String key)
Set the dictionary keyword name. Must be used for the put/get methods. Can be used with the list method to extract the sub-keyword names.

Parameters:
key - the dictionary keyword

getKey

public java.lang.String getKey()
Get the settled dictionary keyword name

Returns:
the dictionary keyword

setSubKey

public void setSubKey(java.lang.String subKey)
Set the dictionary sub-keyword name. Can be used for the put/get methods to specify keyword range translation.

Parameters:
subKey - the dictionary sub-keyword name

getSubKey

public java.lang.String getSubKey()
Get the settled dictionary sub-keyword name

Returns:
the dictionary sub-keyword

setValue

public void setValue(java.lang.String translation)
Set the dictionary keyword / sub-keyword translation. Must be used for the put method.

Parameters:
translation - the dictionary translation

getValue

public java.lang.String getValue()
Get the dictionary keyword / sub-keyword translation.

Returns:
the dictionary translation

addKeyPattern

public void addKeyPattern(java.lang.String keyPattern)
Add a dictionary keyword pattern for the translation extraction / import / removal. Can be used with the importKeys / selectKeys and removeKeys methods

Parameters:
keyPattern - the dictionary keyword pattern

getKeyPatterns

public java.util.Vector<java.lang.String> getKeyPatterns()
Get the settled dictionary keyword patterns

Returns:
a vector of dictionary keyword patterns

setSeparatorToken

public void setSeparatorToken(java.lang.String token)
Set the separator token for the translation extraction. Can be used with the list and selectKeys methods

Parameters:
token - the separator token

getSeparatorToken

public java.lang.String getSeparatorToken()
Get the settled separator token.

Returns:
the separator token
See Also:
setSeparatorToken(String)

setXML

public void setXML(boolean xml)
Set the xml flag for export/import translations in XML format


isXML

public boolean isXML()
Check if translation import/export is in XML mode


setJSON

public void setJSON(boolean json)
Set the import / export file format in JSON format

Parameters:
json - true to set the JSON format
Since:
4.2.3

isJSON

public boolean isJSON()
Get the json flag

Since:
4.2.3
See Also:
setJSON(boolean)

setExcel

public void setExcel(boolean excel)
Set the Excel flag for export/import translations in Excel format


isExcel

public boolean isExcel()
Check if translation import/export is in Excel mode


setListOption

public void setListOption(int listType)
Set keyword extraction type; Must be used with the list method.

Parameters:
listType - LANGUAGE (default) SECTION KEYWORD SUBKEY

getListOption

public int getListOption()
Return the list option

See Also:
setListOption(int)

setKey

public static void setKey(java.lang.String language,
                          java.lang.String section,
                          java.lang.String key,
                          java.lang.String value,
                          Framework framework)
                   throws OberonException
Add a keyword translation for the specified language and section

Parameters:
language - the translation language
section - the dictionary section
key - the keyword name
value - the dictionary translation value
framework - the current framework
Throws:
OberonException - usually due to DB SQL exceptions

getKey

public static java.lang.String getKey(java.lang.String key,
                                      Framework framework)
                               throws OberonException
Get a keyword translation for the default framework language

Parameters:
key - the keyword name
framework - the current framework
Throws:
OberonException - usually due to DB SQL exceptions

getKey

public static java.lang.String getKey(java.lang.String section,
                                      java.lang.String key,
                                      Framework framework)
                               throws OberonException
Get a keyword translation for the default framework language from the specified section

Parameters:
section - the dictionary section
key - the keyword name
framework - the current framework
Throws:
OberonException - usually due to DB SQL exceptions

getKey

public static java.lang.String getKey(java.lang.String language,
                                      java.lang.String section,
                                      java.lang.String key,
                                      Framework framework)
                               throws OberonException
Get a keyword translation for the specified language and section

Parameters:
language - the translation language
section - the dictionary section
key - the keyword name
framework - the current framework
Throws:
OberonException - usually due to DB SQL exceptions

setSubKey

public static void setSubKey(java.lang.String language,
                             java.lang.String section,
                             java.lang.String key,
                             java.lang.String subKey,
                             java.lang.String value,
                             Framework framework)
                      throws OberonException
Add a sun-keyword translation for the specified language and section

Parameters:
language - the translation language
section - the dictionary section
key - the keyword name
subKey - the sub-keyword name
value - the dictionary translation value
framework - the current framework
Throws:
OberonException - usually due to DB SQL exceptions

getSubKey

public static java.lang.String getSubKey(java.lang.String key,
                                         java.lang.String subKey,
                                         Framework framework)
                                  throws OberonException
Get a sub-keyword translations for the default framework language

Parameters:
key - the keyword name
subKey - the sub-keywords (separated by comma)
framework - the current framework
Throws:
OberonException - usually due to DB SQL exceptions

getSubKey

public static java.lang.String getSubKey(java.lang.String section,
                                         java.lang.String key,
                                         java.lang.String subKey,
                                         Framework framework)
                                  throws OberonException
Get a sub-keyword translations for the default framework language from the specified section

Parameters:
section - the dictionary section
key - the keyword name
subKey - the sub-keywords (separated by comma)
framework - the current framework
Throws:
OberonException - usually due to DB SQL exceptions

getSubKey

public static java.lang.String getSubKey(java.lang.String language,
                                         java.lang.String section,
                                         java.lang.String key,
                                         java.lang.String subKey,
                                         Framework framework)
                                  throws OberonException
Get a sub-keyword translations for the specified language and section

Parameters:
language - the translation language
section - the dictionary section
key - the keyword name
subKey - the sub-keywords (separated by comma)
framework - the current framework
Throws:
OberonException - usually due to DB SQL exceptions

getSubKeys

public static java.util.Hashtable<java.lang.String,java.lang.String> getSubKeys(java.lang.String key,
                                                                                Framework framework)
                                                                         throws java.lang.Exception
Get the sub-keyword translations for the default framework language - search to all sections

Parameters:
key - the keyword name
framework - the current framework
Returns:
hashtable with mapped sub-keyword translations
Throws:
java.lang.Exception - usually due to DB SQL exceptions

getSubKeys

public static java.util.Hashtable<java.lang.String,java.lang.String> getSubKeys(java.lang.String key,
                                                                                java.util.Vector<java.lang.String> subKeys,
                                                                                Framework framework)
                                                                         throws OberonException
Get the sub-keyword translations for the default framework language - search to all sections

Parameters:
key - the keyword name
subKeys - a vector of sub-keyword names
framework - the current framework
Returns:
hashtable with mapped sub-keyword translations
Throws:
OberonException - usually due to DB SQL exceptions

getSubKeys

public static java.util.Hashtable<java.lang.String,java.lang.String> getSubKeys(java.lang.String section,
                                                                                java.lang.String key,
                                                                                Framework framework)
                                                                         throws java.lang.Exception
Get the sub-keyword translations for the default framework language from the specified section

Parameters:
section - the dictionary section
key - the keyword name
framework - the current framework
Returns:
hashtable with mapped sub-keyword translations
Throws:
java.lang.Exception - usually due to DB SQL exceptions

getSubKeys

public static java.util.Hashtable<java.lang.String,java.lang.String> getSubKeys(java.lang.String section,
                                                                                java.lang.String key,
                                                                                java.util.Vector<java.lang.String> subKeys,
                                                                                Framework framework)
                                                                         throws OberonException
Get the sub-keyword translations for the default framework language from the specified section

Parameters:
section - the dictionary section
key - the keyword name
subKeys - a vector of sub-keyword names
framework - the current framework
Returns:
hashtable with mapped sub-keyword translations
Throws:
OberonException - usually due to DB SQL exceptions

getSubKeys

public static java.util.Hashtable<java.lang.String,java.lang.String> getSubKeys(java.lang.String language,
                                                                                java.lang.String section,
                                                                                java.lang.String key,
                                                                                Framework framework)
                                                                         throws java.lang.Exception
Get the sub-keyword translations for the specified language and section

Parameters:
language - the translation language
section - the dictionary section
key - the keyword name
framework - the current framework
Returns:
hashtable with mapped sub-keyword translations
Throws:
java.lang.Exception - usually due to DB SQL exceptions

getSubKeys

public static java.util.Hashtable<java.lang.String,java.lang.String> getSubKeys(java.lang.String language,
                                                                                java.lang.String section,
                                                                                java.lang.String key,
                                                                                java.util.Vector<java.lang.String> subKeys,
                                                                                Framework framework)
                                                                         throws OberonException
Get the sub-keyword translations for the specified language and section

Parameters:
language - the translation language
section - the dictionary section
key - the keyword name
subKeys - a vector of sub-keyword names
framework - the current framework
Returns:
hashtable with mapped sub-keyword translations
Throws:
OberonException - usually due to DB SQL exceptions

listSubKeys

public static java.util.Vector<java.lang.String> listSubKeys(java.lang.String key,
                                                             Framework framework)
                                                      throws OberonException
List the sub-keyword names for a given keyword

Parameters:
key - the keyword name
framework - the current framework
Returns:
a vector of sub-keyword names
Throws:
OberonException - usually due to DB SQL exceptions

listSubKeys

public static java.util.Vector<java.lang.String> listSubKeys(java.lang.String section,
                                                             java.lang.String key,
                                                             Framework framework)
                                                      throws OberonException
List the sub-keyword names for a given keyword and section

Parameters:
section - the dictionary section
key - the keyword name
framework - the current framework
Returns:
a vector of sub-keyword names
Throws:
OberonException - usually due to DB SQL exceptions

selectKeys

public static java.lang.String selectKeys(java.lang.String language,
                                          java.lang.String section,
                                          java.lang.String key,
                                          java.lang.String subKey,
                                          java.lang.String value,
                                          boolean xml,
                                          Framework framework)
                                   throws OberonException
Extract the sub-keyword translations using language,section,key and subkey patterns

Parameters:
language - the dictionary language pattern
section - the dictionary section pattern
key - the keyword pattern
subKey - the sub-key pattern
value - the translation pattern
xml - if true the result will be in xml format
framework - the current framework
Returns:
a structured text or xml data list (String)
Throws:
OberonException - usually due to DB SQL exceptions

getTranslations

public static java.util.Vector<java.lang.String> getTranslations(java.lang.String section,
                                                                 java.lang.String key,
                                                                 Framework framework)
                                                          throws OberonException
Get the sub-keyword translations for the specified section

Parameters:
section - the dictionary section
key - the keyword name
framework - the current framework
Returns:
a vector of sub-keyword names and relative translations (separated by "|")
Throws:
OberonException - usually due to DB SQL exceptions

getTranslations

public static java.util.Vector<java.lang.String> getTranslations(java.lang.String language,
                                                                 java.lang.String section,
                                                                 java.lang.String key,
                                                                 Framework framework)
                                                          throws OberonException
Get the sub-keyword translations for the specified language and section

Parameters:
language - the translation language
section - the dictionary section
key - the keyword name
framework - the current framework
Returns:
a vector of sub-keyword names and relative translations (separated by "|")
Throws:
OberonException - usually due to DB SQL exceptions

resetCache

public static void resetCache(Framework framework)
                       throws OberonException
Clean the dictionary cache

Throws:
OberonException

toString

public java.lang.String toString()
Return the settled parameters and values as a single String

Overrides:
toString in class java.lang.Object

OBEROn SDK

Copyright © 2008-2014 Mirko Solazzi. All Rights Reserved.