imcode.server
Class LanguageMapper

java.lang.Object
  extended by imcode.server.LanguageMapper

public class LanguageMapper
extends java.lang.Object

Author:
kreiger

Nested Class Summary
static class LanguageMapper.LanguageNotSupportedException
           
 
Field Summary
static java.lang.String ISO639_2
          http://www.loc.gov/standards/iso639-2/langhome.html
 
Constructor Summary
LanguageMapper(com.imcode.db.Database database, java.lang.String defaultLanguage)
           
 
Method Summary
static java.lang.String convert639_1to639_2(java.lang.String language)
           
static java.lang.String convert639_2to639_1(java.lang.String language)
           
 java.lang.String createLanguagesOptionList(UserDomainObject user, java.lang.String documentLanguage)
           
static boolean existsIsoCode639_2(java.lang.String isoCode639_2)
           
static java.lang.String getAsIso639_2OrDefaultLanguage(java.lang.String langStr, java.lang.String defaultLanguage)
           
 java.lang.String getCurrentLanguageNameInUsersLanguage(UserDomainObject user, java.lang.String documentLanguage)
           
 java.lang.String getDefaultLanguage()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ISO639_2

public static final java.lang.String ISO639_2
http://www.loc.gov/standards/iso639-2/langhome.html

See Also:
Constant Field Values
Constructor Detail

LanguageMapper

public LanguageMapper(com.imcode.db.Database database,
                      java.lang.String defaultLanguage)
Method Detail

getCurrentLanguageNameInUsersLanguage

public java.lang.String getCurrentLanguageNameInUsersLanguage(UserDomainObject user,
                                                              java.lang.String documentLanguage)

createLanguagesOptionList

public java.lang.String createLanguagesOptionList(UserDomainObject user,
                                                  java.lang.String documentLanguage)

getAsIso639_2OrDefaultLanguage

public static java.lang.String getAsIso639_2OrDefaultLanguage(java.lang.String langStr,
                                                              java.lang.String defaultLanguage)

convert639_1to639_2

public static java.lang.String convert639_1to639_2(java.lang.String language)
                                            throws LanguageMapper.LanguageNotSupportedException
Parameters:
language - The iso-639-1 representation of the language, i.e. 'sv'.
Returns:
the iso-639-2 representation of the language, i.e. 'swe'.
Throws:
java.lang.IllegalArgumentException - If an unsupported language is requested.
LanguageMapper.LanguageNotSupportedException

convert639_2to639_1

public static java.lang.String convert639_2to639_1(java.lang.String language)
                                            throws LanguageMapper.LanguageNotSupportedException
Parameters:
language - The iso-639-2 representation of the language, i.e. 'swe'.
Returns:
the iso-639-1 representation of the language, i.e. 'sv'.
Throws:
java.lang.IllegalArgumentException - If an unsupported language is requested.
LanguageMapper.LanguageNotSupportedException

existsIsoCode639_2

public static boolean existsIsoCode639_2(java.lang.String isoCode639_2)

getDefaultLanguage

public java.lang.String getDefaultLanguage()