Interface TranslationService


public interface TranslationService
  • Field Details

  • Method Details

    • getTranslationField

      default TranslationField getTranslationField(String objectType, long objectId, String fieldName, String username) throws IllegalAccessException, org.exoplatform.commons.exception.ObjectNotFoundException
      Retrieves the list of Translation Labels for a given field of an Object (identified by its type and id). This will ensure at the same time to check the User ACL to know whether it can access object or not.
      Parameters:
      objectType - Object type for which the Translation Metadata will be attached
      objectId - Object unique identifier
      fieldName - Object field
      username - user name accessing the list, used for ACL check
      Returns:
      TranslationField of Translations with a corresponding label for each saved Locale
      Throws:
      IllegalAccessException - When user doesn't have access permission to object
      org.exoplatform.commons.exception.ObjectNotFoundException - When object wasn't found
    • getTranslationField

      TranslationField getTranslationField(String objectType, String objectId, String fieldName, String username) throws IllegalAccessException, org.exoplatform.commons.exception.ObjectNotFoundException
      Retrieves the list of Translation Labels for a given field of an Object (identified by its type and id). This will ensure at the same time to check the User ACL to know whether it can access object or not.
      Parameters:
      objectType - Object type for which the Translation Metadata will be attached
      objectId - Object unique identifier
      fieldName - Object field
      username - user name accessing the list, used for ACL check
      Returns:
      TranslationField of Translations with a corresponding label for each saved Locale
      Throws:
      IllegalAccessException - When user doesn't have access permission to object
      org.exoplatform.commons.exception.ObjectNotFoundException - When object wasn't found
    • getTranslationField

      default TranslationField getTranslationField(String objectType, long objectId, String fieldName) throws org.exoplatform.commons.exception.ObjectNotFoundException
      Retrieves the list of Translation Labels for a given field of an Object (identified by its type and id).
      Parameters:
      objectType - Object type for which the Translation Metadata will be attached
      objectId - Object unique identifier
      fieldName - Object field
      Returns:
      TranslationField of Translations with a corresponding label for each saved Locale
      Throws:
      org.exoplatform.commons.exception.ObjectNotFoundException - When object wasn't found
    • getTranslationField

      TranslationField getTranslationField(String objectType, String objectId, String fieldName) throws org.exoplatform.commons.exception.ObjectNotFoundException
      Retrieves the list of Translation Labels for a given field of an Object (identified by its type and id).
      Parameters:
      objectType - Object type for which the Translation Metadata will be attached
      objectId - Object unique identifier
      fieldName - Object field
      Returns:
      TranslationField of Translations with a corresponding label for each saved Locale
      Throws:
      org.exoplatform.commons.exception.ObjectNotFoundException - When object wasn't found
    • getTranslationLabel

      default String getTranslationLabel(String objectType, long objectId, String fieldName, Locale locale)
      Retrieves the Translation Label for a given field of an Object (identified by its type and id) with a designated Locale. not.
      Parameters:
      objectType - Object type for which the Translation Metadata will be attached
      objectId - Object unique identifier
      fieldName - Object field
      locale - Locale
      Returns:
      the translated label for a given Locale
    • getTranslationLabel

      String getTranslationLabel(String objectType, String objectId, String fieldName, Locale locale)
      Retrieves the Translation Label for a given field of an Object (identified by its type and id) with a designated Locale. not.
      Parameters:
      objectType - Object type for which the Translation Metadata will be attached
      objectId - Object unique identifier
      fieldName - Object field
      locale - Locale
      Returns:
      the translated label for a given Locale
    • getTranslationLabelOrDefault

      default String getTranslationLabelOrDefault(String objectType, long objectId, String fieldName, Locale locale)
      Retrieves the Translation Label for a given field of an Object (identified by its type and id) with a designated Locale. not.
      Parameters:
      objectType - Object type for which the Translation Metadata will be attached
      objectId - Object unique identifier
      fieldName - Object field
      locale - Locale
      Returns:
      the translated label for a given Locale
    • getTranslationLabelOrDefault

      String getTranslationLabelOrDefault(String objectType, String objectId, String fieldName, Locale locale)
      Retrieves the Translation Label for a given field of an Object (identified by its type and id) with a designated Locale. not.
      Parameters:
      objectType - Object type for which the Translation Metadata will be attached
      objectId - Object unique identifier
      fieldName - Object field
      locale - Locale
      Returns:
      the translated label for a given Locale
    • saveTranslationLabels

      default void saveTranslationLabels(String objectType, long objectId, String fieldName, Map<Locale,String> labels, String username) throws IllegalAccessException, org.exoplatform.commons.exception.ObjectNotFoundException
      Saves Translation Labels for a given Object's field. This will replace any existing list of translations
      Parameters:
      objectType - Object type for which the Translation Metadata will be attached
      objectId - Object unique identifier
      fieldName - Object field
      labels - Map of Translations with a corresponding label for each Locale
      username - user name updating the list, used for ACL check
      Throws:
      IllegalAccessException - When user doesn't have write permission to object
      org.exoplatform.commons.exception.ObjectNotFoundException - When object wasn't found
    • saveTranslationLabels

      void saveTranslationLabels(String objectType, String objectId, String fieldName, Map<Locale,String> labels, String username) throws IllegalAccessException, org.exoplatform.commons.exception.ObjectNotFoundException
      Saves Translation Labels for a given Object's field. This will replace any existing list of translations
      Parameters:
      objectType - Object type for which the Translation Metadata will be attached
      objectId - Object unique identifier
      fieldName - Object field
      labels - Map of Translations with a corresponding label for each Locale
      username - user name updating the list, used for ACL check
      Throws:
      IllegalAccessException - When user doesn't have write permission to object
      org.exoplatform.commons.exception.ObjectNotFoundException - When object wasn't found
    • saveTranslationLabels

      default void saveTranslationLabels(String objectType, long objectId, String fieldName, Map<Locale,String> labels) throws org.exoplatform.commons.exception.ObjectNotFoundException
      Saves Translation Labels for a given Object's field. This will replace any existing list of translations
      Parameters:
      objectType - Object type for which the Translation Metadata will be attached
      objectId - Object unique identifier
      fieldName - Object field
      labels - Map of Translations with a corresponding label for each Locale
      Throws:
      org.exoplatform.commons.exception.ObjectNotFoundException - When object wasn't found
    • saveTranslationLabels

      void saveTranslationLabels(String objectType, String objectId, String fieldName, Map<Locale,String> labels) throws org.exoplatform.commons.exception.ObjectNotFoundException
      Saves Translation Labels for a given Object's field. This will replace any existing list of translations
      Parameters:
      objectType - Object type for which the Translation Metadata will be attached
      objectId - Object unique identifier
      fieldName - Object field
      labels - Map of Translations with a corresponding label for each Locale
      Throws:
      org.exoplatform.commons.exception.ObjectNotFoundException - When object wasn't found
    • saveTranslationLabel

      default void saveTranslationLabel(String objectType, long objectId, String fieldName, Locale locale, String label) throws org.exoplatform.commons.exception.ObjectNotFoundException
      Saves a single Translation Label with a given Locale for a given Object's field. This will not replace other existing translation for other languages
      Parameters:
      objectType - Object type for which the Translation Metadata will be attached
      objectId - Object unique identifier
      fieldName - Object field
      locale - Locale
      label - Translation label value
      Throws:
      org.exoplatform.commons.exception.ObjectNotFoundException - When object wasn't found
    • saveTranslationLabel

      void saveTranslationLabel(String objectType, String objectId, String fieldName, Locale locale, String label) throws org.exoplatform.commons.exception.ObjectNotFoundException
      Saves a single Translation Label with a given Locale for a given Object's field. This will not replace other existing translation for other languages
      Parameters:
      objectType - Object type for which the Translation Metadata will be attached
      objectId - Object unique identifier
      fieldName - Object field
      locale - Locale
      label - Translation label value
      Throws:
      org.exoplatform.commons.exception.ObjectNotFoundException - When object wasn't found
    • deleteTranslationLabels

      default void deleteTranslationLabels(String objectType, long objectId, String username) throws IllegalAccessException, org.exoplatform.commons.exception.ObjectNotFoundException
      Deletes the list of translations for a given object
      Parameters:
      objectType - Object type for which the Translation Metadata will be attached
      objectId - Object unique identifier
      username - user name deleting the list, used for ACL check
      Throws:
      IllegalAccessException - When user doesn't have write permission to object
      org.exoplatform.commons.exception.ObjectNotFoundException - When object wasn't found
    • deleteTranslationLabels

      void deleteTranslationLabels(String objectType, String objectId, String username) throws IllegalAccessException, org.exoplatform.commons.exception.ObjectNotFoundException
      Deletes the list of translations for a given object
      Parameters:
      objectType - Object type for which the Translation Metadata will be attached
      objectId - Object unique identifier
      username - user name deleting the list, used for ACL check
      Throws:
      IllegalAccessException - When user doesn't have write permission to object
      org.exoplatform.commons.exception.ObjectNotFoundException - When object wasn't found
    • deleteTranslationLabels

      default void deleteTranslationLabels(String objectType, long objectId) throws org.exoplatform.commons.exception.ObjectNotFoundException
      Deletes the list of translations for a given object
      Parameters:
      objectType - Object type for which the Translation Metadata will be attached
      objectId - Object unique identifier
      Throws:
      org.exoplatform.commons.exception.ObjectNotFoundException - When object wasn't found
    • deleteTranslationLabels

      void deleteTranslationLabels(String objectType, String objectId) throws org.exoplatform.commons.exception.ObjectNotFoundException
      Deletes the list of translations for a given object
      Parameters:
      objectType - Object type for which the Translation Metadata will be attached
      objectId - Object unique identifier
      Throws:
      org.exoplatform.commons.exception.ObjectNotFoundException - When object wasn't found
    • deleteTranslationLabel

      default void deleteTranslationLabel(String objectType, long objectId, String fieldName, Locale locale) throws org.exoplatform.commons.exception.ObjectNotFoundException
      Deletes a translation label for a given object's field
      Parameters:
      objectType - Object type for which the Translation Metadata will be attached
      objectId - Object unique identifier
      fieldName - Object field
      locale - Locale
      Throws:
      org.exoplatform.commons.exception.ObjectNotFoundException - When object wasn't found
    • deleteTranslationLabel

      void deleteTranslationLabel(String objectType, String objectId, String fieldName, Locale locale) throws org.exoplatform.commons.exception.ObjectNotFoundException
      Deletes a translation label for a given object's field
      Parameters:
      objectType - Object type for which the Translation Metadata will be attached
      objectId - Object unique identifier
      fieldName - Object field
      locale - Locale
      Throws:
      org.exoplatform.commons.exception.ObjectNotFoundException - When object wasn't found
    • addPlugin

      void addPlugin(TranslationPlugin translationPlugin)
      Add a new TranslationPlugin for a given Object Type
      Parameters:
      translationPlugin - TranslationPlugin
    • removePlugin

      void removePlugin(String objectType)
      Removes a TranslationPlugin identified by its objectType
      Parameters:
      objectType - Object type