jet.server.api.nls
Interface ResourceNLSManager


public interface ResourceNLSManager

resource name NLS manager, can use it to get/remove/update NLS entries of resource names.


Method Summary
 boolean containsLocale(java.util.Locale locale, java.lang.String submitter)
          Tests whether has defined NLS entry for specified locale in organization that submitter belongs to..
 java.util.Map<java.lang.String,java.lang.String> exportNLSDisplays(java.util.Locale locale, java.lang.String submitter)
          get NLS displays of whole resource tree for specified locale.
 java.util.List<java.util.Locale> getAvailableLocales(java.lang.String submitter)
          Gets all locales that has defined NLS entry in the organization that submitter belongs to.
 java.util.List<TextNLSEntry> getNLSEntriesInPath(java.util.Locale locale, java.lang.String path, java.lang.String submitter)
          get NLS entries under specified resource path for the locale.
 TextNLSEntry getNLSEntry(java.util.Locale locale, java.lang.String resourcePath, java.lang.String submitter)
          get NLS entry of specified resource for the locale.
 TextNLSEntry getRootNLSEntry(java.util.Locale locale, java.lang.String submitter)
          get NLS entry of root node for the locale.
 int importNLSDisplays(java.util.Locale locale, java.util.Map<java.lang.String,java.lang.String> displays, java.lang.String submitter)
          update NLS displays of whole resource tree for specified locale.
 boolean removeLocale(java.util.Locale locale, java.lang.String submitter)
          Removes a locale and all NLS entries bond with the locale in organization that submitter belongs to.
 boolean removeNLSEntriesInPath(java.util.Locale locale, java.lang.String path, java.lang.String submitter)
          remove NLS entries under specified path for the locale
 boolean removeNLSEntry(java.util.Locale locale, java.lang.String resourcePath, java.lang.String submitter)
          remove NLS entry of specified resource for the locale
 boolean removeRootNLSEntry(java.util.Locale locale, java.lang.String submitter)
          remove NLS entry of root node for the locale
 boolean updateNLSEntriesInPath(java.util.Locale locale, java.lang.String path, java.util.List<TextNLSEntry> entries, java.lang.String submitter)
          update NLS entries under specified path for the locale, this operation will clean all orginal
 boolean updateNLSEntry(java.util.Locale locale, java.lang.String resourcePath, TextNLSEntry entry, java.lang.String submitter)
          update NLS entry of specified resource for the locale.
 boolean updateRootNLSEntry(java.util.Locale locale, TextNLSEntry entry, java.lang.String submitter)
          update NLS entry of root node for the locale.
 

Method Detail

getAvailableLocales

java.util.List<java.util.Locale> getAvailableLocales(java.lang.String submitter)
                                                     throws NoPrivilegeException
Gets all locales that has defined NLS entry in the organization that submitter belongs to.

Parameters:
submitter - the submitter user id, should be an administrator or organization administrator (if specified organization, otherwise will throw NoPrivilegeException.
Returns:
A List which contain all locales.
Throws:
NoPrivilegeException - throws this exception if submitter is not an administrator or organization administrator.

containsLocale

boolean containsLocale(java.util.Locale locale,
                       java.lang.String submitter)
                       throws NoPrivilegeException
Tests whether has defined NLS entry for specified locale in organization that submitter belongs to..

Parameters:
locale - The locale to test.
submitter - the submitter user id, should be an administrator or organization administrator.
Returns:
Return True if defined NLS entry for the specified locale, otherwise false.
Throws:
NoPrivilegeException - throws this exception if submitter is not an administrator or organization administrator.

getNLSEntriesInPath

java.util.List<TextNLSEntry> getNLSEntriesInPath(java.util.Locale locale,
                                                 java.lang.String path,
                                                 java.lang.String submitter)
                                                 throws NoPrivilegeException,
                                                        UnknownResource
get NLS entries under specified resource path for the locale.

Parameters:
locale - the locale
path - the resource path.
submitter - the submitter user id, should be an administrator or organization administrator.
Returns:
the NLS entries list, if return value of getAvailableLocales(String) does not contain specified locale or path does not indicate a folder, return null.
Throws:
NoPrivilegeException - throw this exception if submitter is not an administrator or organization administrator (if the path indicates a organization resource).
UnknownResource - throw this exception if path does not exist.
See Also:
TextNLSEntry

getNLSEntry

TextNLSEntry getNLSEntry(java.util.Locale locale,
                         java.lang.String resourcePath,
                         java.lang.String submitter)
                         throws NoPrivilegeException,
                                UnknownResource
get NLS entry of specified resource for the locale.

Parameters:
locale - the locale
resourcePath - resource path that defined NLS entry
submitter - the submitter user id, should be an administrator or organization administrator.
Returns:
the NLS entry of the specified resourcePath, if return value of getAvailableLocales(String) does not contain specified locale or no NLS entry defined on this resource, return null.
Throws:
NoPrivilegeException - throw this exception if submitter is not an administrator or organization administrator (if the resourcePath indicates a organization resource).
UnknownResource - throw this exception if path does not exist.
See Also:
TextNLSEntry

getRootNLSEntry

TextNLSEntry getRootNLSEntry(java.util.Locale locale,
                             java.lang.String submitter)
                             throws NoPrivilegeException
get NLS entry of root node for the locale.

Parameters:
locale - the locale
submitter - the submitter user id, should be an administrator or organization administrator.
Returns:
the NLS entry of the root node, if return value of getAvailableLocales(String) does not contain specified locale or no NLS entry defined on it, return null.
Throws:
NoPrivilegeException - throw this exception if submitter is not an administrator.
See Also:
TextNLSEntry

removeLocale

boolean removeLocale(java.util.Locale locale,
                     java.lang.String submitter)
                     throws NoPrivilegeException
Removes a locale and all NLS entries bond with the locale in organization that submitter belongs to.

Parameters:
locale - The locale which you want to remove.
submitter - the submitter user id, should be an administrator or organization administrator.
Returns:
Return true if removed NLS entries bond with specified locale successfully. false if no NLS entry defined for this locale.
Throws:
NoPrivilegeException - throws this exception if submitter is not an administrator or organization administrator.

removeNLSEntriesInPath

boolean removeNLSEntriesInPath(java.util.Locale locale,
                               java.lang.String path,
                               java.lang.String submitter)
                               throws NoPrivilegeException,
                                      UnknownResource
remove NLS entries under specified path for the locale

Parameters:
locale - the locale
path - the path, should be a folder.
submitter - the submitter user id, should be an administrator or organization administrator.
Returns:
true if remove NLS entries under the path successfully, false if no NLS entry for the locale under the path, or the path does not indicate a folder.
Throws:
NoPrivilegeException - throw this exception if submitter is not an administrator or organization administrator (if the path indicates a organization resource).
UnknownResource - throw this exception if path does not exist.

removeNLSEntry

boolean removeNLSEntry(java.util.Locale locale,
                       java.lang.String resourcePath,
                       java.lang.String submitter)
                       throws NoPrivilegeException,
                              UnknownResource
remove NLS entry of specified resource for the locale

Parameters:
locale - the locale
resourcePath - resource path that defined NLS entry.
submitter - the submitter user id, should be an administrator or organization administrator.
Returns:
true if remove NLS entry of the resource successfully, false if no NLS entry for the locale defined on the resource.
Throws:
NoPrivilegeException - throw this exception if submitter is not an administrator or organization administrator (if the resourcePath indicates a organization resource).
UnknownResource - throw this exception if resourcePath does not exist.

removeRootNLSEntry

boolean removeRootNLSEntry(java.util.Locale locale,
                           java.lang.String submitter)
                           throws NoPrivilegeException
remove NLS entry of root node for the locale

Parameters:
locale - the locale
submitter - the submitter user id, should be an administrator.
Returns:
true if remove NLS entry of root node successfully, false if no NLS entry for the locale defined on it.
Throws:
NoPrivilegeException - throw this exception if submitter is not an administrator.

updateNLSEntriesInPath

boolean updateNLSEntriesInPath(java.util.Locale locale,
                               java.lang.String path,
                               java.util.List<TextNLSEntry> entries,
                               java.lang.String submitter)
                               throws NoPrivilegeException,
                                      UnknownResource
update NLS entries under specified path for the locale, this operation will clean all orginal

Parameters:
locale - the locale
path - the patch, should be a folder
entries - NLS entries that will update to.
submitter - the submitter user id, should be an administrator or organization administrator.
Returns:
true if update NLS entries under the path successfully, false if the path does not indicate a folder.
Throws:
NoPrivilegeException - throw this exception if submitter is not an administrator or organization administrator (if the path indicates a organization resource).
UnknownResource - throw this exception if path does not exist.

updateNLSEntry

boolean updateNLSEntry(java.util.Locale locale,
                       java.lang.String resourcePath,
                       TextNLSEntry entry,
                       java.lang.String submitter)
                       throws NoPrivilegeException,
                              UnknownResource
update NLS entry of specified resource for the locale.

Parameters:
locale - the locale
resourcePath - resource path that defined NLS entry
entry - NLS entry that will update to
submitter - the submitter user id, should be an administrator or organization administrator.
Returns:
true if update NLS entry successfully.
Throws:
NoPrivilegeException - throw this exception if submitter is not an administrator or organization administrator (if the resourcePath indicates a organization resource).
UnknownResource - throw this exception if resourcePath does not exist.

updateRootNLSEntry

boolean updateRootNLSEntry(java.util.Locale locale,
                           TextNLSEntry entry,
                           java.lang.String submitter)
                           throws NoPrivilegeException
update NLS entry of root node for the locale.

Parameters:
locale - the locale
entry - NLS entry that will update to
submitter - the submitter user id, should be an administrator.
Returns:
true if update NLS entry successfully.
Throws:
NoPrivilegeException - throw this exception if submitter is not an administrator.
UnknownResource - throw this exception if resourcePath does not exist.

exportNLSDisplays

java.util.Map<java.lang.String,java.lang.String> exportNLSDisplays(java.util.Locale locale,
                                                                   java.lang.String submitter)
                                                                   throws NoPrivilegeException
get NLS displays of whole resource tree for specified locale. return a Map object that represents displays of resource tree belong to the same organization of submitter, key is resource path, value is display text.

Parameters:
locale - the locale
submitter - the submitter user id, should be an administrator or organization administrator.
Returns:
a Map object which represents displays of resource tree, key is resource path, value is display text. if not define display text of a resource path for the locale, value is empty string.
Throws:
NoPrivilegeException - throw this exception if submitter is not an administrator or organization administrator.

importNLSDisplays

int importNLSDisplays(java.util.Locale locale,
                      java.util.Map<java.lang.String,java.lang.String> displays,
                      java.lang.String submitter)
                      throws NoPrivilegeException
update NLS displays of whole resource tree for specified locale. displays is a Map object that represents displays of resource tree, key is resource path, value is display text. if a resource path does not exist or the resource path and submitter do not belong to same organization, the item will be ignore. Existing display text will be overwritten.

Parameters:
locale - the locale
displays - a Map object which represents displays of resource tree, key is resource path, value is display text. if no display text of a resource path for the locale, value should be empty string.
submitter - the submitter user id, should be an administrator or organization administrator.
Returns:
the display text number that import successfully .
Throws:
NoPrivilegeException - throw this exception if submitter is not an administrator or organization administrator.