Interface TranslationService
public interface TranslationService
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionvoidaddPlugin(TranslationPlugin translationPlugin) Add a newTranslationPluginfor a given Object TypevoiddeleteTranslationLabel(String objectType, long objectId, String fieldName, Locale locale) Deletes a translation label for a given object's fieldvoiddeleteTranslationLabels(String objectType, long objectId) Deletes the list of translations for a given objectvoiddeleteTranslationLabels(String objectType, long objectId, String username) Deletes the list of translations for a given objectgetAllTranslationFields(String objectType, long objectId) Retrieves the list of TranslationFields Labels for all fields of an Object (identified by its type and id).getAllTranslationFields(String objectType, long objectId, String username) Retrieves the list of TranslationFields Labels for all fields of an Object (identified by its type and id).getTranslationField(String objectType, long objectId, String fieldName) Retrieves the list of Translation Labels for a given field of an Object (identified by its type and id).getTranslationField(String objectType, long objectId, String fieldName, String username) Retrieves the list of Translation Labels for a given field of an Object (identified by its type and id).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 designatedLocale.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 designatedLocale.voidremovePlugin(String objectType) Removes aTranslationPluginidentified by its objectTypevoidsaveTranslationLabel(String objectType, long objectId, String fieldName, Locale locale, String label) Saves a single Translation Label with a givenLocalefor a given Object's field.voidsaveTranslationLabels(String objectType, long objectId, String fieldName, Map<Locale, String> labels) Saves Translation Labels for a given Object's field.voidsaveTranslationLabels(String objectType, long objectId, String fieldName, Map<Locale, String> labels, String username) Saves Translation Labels for a given Object's field.
-
Field Details
-
TRANSLATION_SAVED_EVENT_NAME
- See Also:
-
TRANSLATION_DELETED_EVENT_NAME
- See Also:
-
-
Method Details
-
getAllTranslationFields
Map<String,TranslationField> getAllTranslationFields(String objectType, long objectId, String username) throws IllegalAccessException, org.exoplatform.commons.exception.ObjectNotFoundException Retrieves the list of TranslationFields Labels for all fields 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 attachedobjectId- Object unique identifierusername- user name accessing the list, used for ACL check- Returns:
TranslationFieldof Translations with a corresponding label for each savedLocale- Throws:
IllegalAccessException- When user doesn't have access permission to objectorg.exoplatform.commons.exception.ObjectNotFoundException- When object wasn't found
-
getAllTranslationFields
Map<String,TranslationField> getAllTranslationFields(String objectType, long objectId) throws org.exoplatform.commons.exception.ObjectNotFoundException Retrieves the list of TranslationFields Labels for all fields of an Object (identified by its type and id).- Parameters:
objectType- Object type for which the Translation Metadata will be attachedobjectId- Object unique identifier- Returns:
TranslationFieldof Translations with a corresponding label for each savedLocale- Throws:
org.exoplatform.commons.exception.ObjectNotFoundException- When object wasn't found
-
getTranslationField
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 attachedobjectId- Object unique identifierfieldName- Object fieldusername- user name accessing the list, used for ACL check- Returns:
TranslationFieldof Translations with a corresponding label for each savedLocale- Throws:
IllegalAccessException- When user doesn't have access permission to objectorg.exoplatform.commons.exception.ObjectNotFoundException- When object wasn't found
-
getTranslationField
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 attachedobjectId- Object unique identifierfieldName- Object field- Returns:
TranslationFieldof Translations with a corresponding label for each savedLocale- Throws:
org.exoplatform.commons.exception.ObjectNotFoundException- When object wasn't found
-
getTranslationLabel
Retrieves the Translation Label for a given field of an Object (identified by its type and id) with a designatedLocale. not. -
getTranslationLabelOrDefault
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 designatedLocale. not. -
saveTranslationLabels
void saveTranslationLabels(String objectType, long objectId, String fieldName, Map<Locale, String> labels, String username) throws IllegalAccessException, org.exoplatform.commons.exception.ObjectNotFoundExceptionSaves 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 attachedobjectId- Object unique identifierfieldName- Object fieldlabels-Mapof Translations with a corresponding label for eachLocaleusername- user name updating the list, used for ACL check- Throws:
IllegalAccessException- When user doesn't have write permission to objectorg.exoplatform.commons.exception.ObjectNotFoundException- When object wasn't found
-
saveTranslationLabels
void saveTranslationLabels(String objectType, long objectId, String fieldName, Map<Locale, String> labels) throws org.exoplatform.commons.exception.ObjectNotFoundExceptionSaves 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 attachedobjectId- Object unique identifierfieldName- Object fieldlabels-Mapof Translations with a corresponding label for eachLocale- Throws:
org.exoplatform.commons.exception.ObjectNotFoundException- When object wasn't found
-
saveTranslationLabel
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 givenLocalefor 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 attachedobjectId- Object unique identifierfieldName- Object fieldlocale-Localelabel- Translation label value- Throws:
org.exoplatform.commons.exception.ObjectNotFoundException- When object wasn't found
-
deleteTranslationLabels
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 attachedobjectId- Object unique identifierusername- user name deleting the list, used for ACL check- Throws:
IllegalAccessException- When user doesn't have write permission to objectorg.exoplatform.commons.exception.ObjectNotFoundException- When object wasn't found
-
deleteTranslationLabels
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 attachedobjectId- Object unique identifier- Throws:
org.exoplatform.commons.exception.ObjectNotFoundException- When object wasn't found
-
deleteTranslationLabel
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 attachedobjectId- Object unique identifierfieldName- Object fieldlocale-Locale- Throws:
org.exoplatform.commons.exception.ObjectNotFoundException- When object wasn't found
-
addPlugin
Add a newTranslationPluginfor a given Object Type- Parameters:
translationPlugin-TranslationPlugin
-
removePlugin
Removes aTranslationPluginidentified by its objectType- Parameters:
objectType- Object type
-