Interface TranslationService
-
- All Known Implementing Classes:
TranslationServiceImpl
public interface TranslationService
-
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description void
addTranslation(java.lang.String lang, java.util.HashSet<LocalizedText> translations, java.util.Optional<Language> languageOptional)
This method creates all relationships between database entities.Language
createLanguage(Language language)
This method creates a database entity.java.util.Optional<Language>
createLanguage(java.util.LinkedHashMap<java.lang.String,java.lang.Object> langAsMap)
This method creates a database entity.LocalizedText
createTranslation(LocalizedText translation)
This method creates a database entity.java.util.Optional<LocalizedText>
createTranslation(java.util.LinkedHashMap<java.lang.String,java.lang.Object> translationAsMap)
This method creates a database entity.java.util.List<TranslationExport>
exportTranslations(co.mastermindcms.modules.beans.SearchRequest request)
Exports translations based on the given search request.java.util.List<Language>
findLanguages()
This method returns database entities as list.LocalizedText
findOrCreateTranslation(LocalizedText tr)
Finds or creates a translation for the given localized text object.java.util.List<LocalizedText>
findTranslations()
This method returns database entities as list.java.util.List<LocalizedText>
findTranslationsByLangCode(java.lang.String lang)
This method returns database entity.java.util.List<java.util.Map<java.lang.String,java.lang.Object>>
getAlphabetForActiveLanguage(java.lang.String isUpp)
Return alphabets of active language codejava.util.List<java.util.Map<java.lang.String,java.lang.Object>>
getAlphabetForLanguage(java.lang.String isUpp, java.lang.String language)
Return alphabets of active language codejava.lang.String
getDefaultLanguage()
This method returns the default language.java.lang.String
getLangFromContext()
This method returns data as text from context.LanguageRepository
getLanguageRepository()
java.util.Deque<java.util.Map<java.lang.String,java.lang.Object>>
getPaginationFilter(java.lang.String requestJson)
This method does calculation for a pages based on the request.TranslationsRepository
getRepository()
java.util.Map<java.lang.String,java.lang.String>
getTranslatedTimeDuration(java.lang.String date)
This method returns data as map.java.util.Map<java.lang.String,java.lang.String>
getTranslation(java.lang.String id, java.lang.String repositoryName)
This method returns data as map.java.util.Map<java.lang.String,java.lang.String>
getTranslation(java.lang.String id, java.lang.String lang, java.lang.String repositoryName)
This method returns data as map.LocalizedText
getTranslationById(java.lang.String id)
This method returns data as map.java.util.HashSet<LocalizedText>
getTranslations(java.lang.String langEn, java.lang.String langDe)
This method returns data as set.java.util.Map<java.lang.String,java.lang.String>
getTranslationsByLangCode(java.lang.String lang)
This method returns data as map.java.lang.String
getTranslationValue(java.lang.String id, java.lang.String repositoryName)
This method returns translation for entity.java.lang.String
getTranslationValue(java.lang.String id, java.lang.String lang, java.lang.String repositoryName)
This method returns translation for entity.void
removeLanguageAndClean(java.lang.String langId)
This method removes a database entity and clean all relationships from another entities.void
removeLanguagesByIds(java.util.ArrayList<java.lang.String> languageIds)
This method removes a list of database entities.void
removeTranslationAndClean(java.lang.String translationId)
This method removes a database entity and clean all relationships from another entities.void
removeTranslationsByIds(java.util.ArrayList<java.lang.String> translationIds)
This method removes a list of database entities.void
removeTranslationsByLanguage(java.lang.String langId)
This method removes a list of database entities.java.util.Optional<LocalizedText>
saveArticle(java.lang.String text, java.lang.String articleId)
This method saves a database entity.java.util.Optional<Language>
saveLanguage(Language language)
This method saves a database entity.java.util.Optional<Language>
saveLanguage(java.util.LinkedHashMap<java.lang.String,java.lang.Object> langAsMap)
This method save an updates of database entity.java.util.Optional<LocalizedText>
saveTranslation(LocalizedText translation)
This method saves a database entity.java.util.Optional<LocalizedText>
saveTranslation(java.util.LinkedHashMap<java.lang.String,java.lang.Object> translationAsMap)
This method save an updates of database entity.java.util.List<Language>
searchLanguages(java.lang.String query, java.lang.String offset, java.lang.String limit)
This method does search requests and returns data as list.java.util.LinkedHashSet<LocalizedText>
searchTranslations(java.lang.String requestJson)
This method does search requests and returns data as list.java.util.List<LocalizedText>
searchTranslations(java.lang.String query, java.lang.String offset, java.lang.String limit)
Deprecated.java.util.List<LocalizedText>
searchTranslationsById(java.lang.String regex)
Deprecated.org.springframework.data.domain.Page<LocalizedText>
searchTranslationsPaged(java.lang.String requestJson)
This method does search requests and returns data as pages.void
uploadTranslations(java.io.File file, java.lang.String username)
Uploads translations to the server for the given user.
-
-
-
Method Detail
-
getRepository
TranslationsRepository getRepository()
-
getLanguageRepository
LanguageRepository getLanguageRepository()
-
getPaginationFilter
java.util.Deque<java.util.Map<java.lang.String,java.lang.Object>> getPaginationFilter(java.lang.String requestJson)
This method does calculation for a pages based on the request.- Parameters:
requestJson
- JSON-object of request contains an instructions for search queries- Returns:
- map-representation of data
-
searchTranslations
java.util.LinkedHashSet<LocalizedText> searchTranslations(java.lang.String requestJson)
This method does search requests and returns data as list.- Parameters:
requestJson
- search request- Returns:
- data transport entities as list
-
searchTranslationsPaged
org.springframework.data.domain.Page<LocalizedText> searchTranslationsPaged(java.lang.String requestJson)
This method does search requests and returns data as pages.- Parameters:
requestJson
- JSON-object of request contains an instructions for search queries- Returns:
- database entities separated to pages
-
searchTranslations
@Deprecated java.util.List<LocalizedText> searchTranslations(java.lang.String query, java.lang.String offset, java.lang.String limit)
Deprecated.This method does search requests and returns data as list.- Parameters:
query
- search queryoffset
- offset for returned itemslimit
- limit for returned items- Returns:
- database entities as list
-
searchTranslationsById
@Deprecated java.util.List<LocalizedText> searchTranslationsById(java.lang.String regex)
Deprecated.This method does search requests and returns data as list.- Parameters:
regex
- regexp for identifier definition- Returns:
- database entities as list
-
findTranslations
java.util.List<LocalizedText> findTranslations()
This method returns database entities as list.- Returns:
- database entities as list
-
findTranslationsByLangCode
java.util.List<LocalizedText> findTranslationsByLangCode(java.lang.String lang)
This method returns database entity.- Parameters:
lang
- for filter and return database entity- Returns:
- database entity
-
getTranslationsByLangCode
java.util.Map<java.lang.String,java.lang.String> getTranslationsByLangCode(java.lang.String lang)
This method returns data as map.- Parameters:
lang
- field for filter and return data- Returns:
- data as map
-
getLangFromContext
java.lang.String getLangFromContext()
This method returns data as text from context.- Returns:
- data as text
-
getTranslatedTimeDuration
java.util.Map<java.lang.String,java.lang.String> getTranslatedTimeDuration(java.lang.String date)
This method returns data as map.- Parameters:
date
- field for translated- Returns:
- data as map
-
getTranslationById
LocalizedText getTranslationById(java.lang.String id)
This method returns data as map.- Parameters:
id
- identification for database entity, which will be revers on map- Returns:
- data as entity
-
getTranslation
java.util.Map<java.lang.String,java.lang.String> getTranslation(java.lang.String id, java.lang.String repositoryName)
This method returns data as map.- Parameters:
id
- identification for database entity, which will be revers on maprepositoryName
- repository name from where will be returned data- Returns:
- data as map
-
getTranslation
java.util.Map<java.lang.String,java.lang.String> getTranslation(java.lang.String id, java.lang.String lang, java.lang.String repositoryName)
This method returns data as map.- Parameters:
id
- identification for database entity, which will be revers on maplang
- the language iso-code for translationrepositoryName
- repository name from where will be returned data- Returns:
- data as map
-
getTranslationValue
java.lang.String getTranslationValue(java.lang.String id, java.lang.String repositoryName)
This method returns translation for entity.- Parameters:
id
- identification for database entity, which will be revers on maprepositoryName
- repository name from where will be returned data- Returns:
- translation
-
getTranslationValue
java.lang.String getTranslationValue(java.lang.String id, java.lang.String lang, java.lang.String repositoryName)
This method returns translation for entity.- Parameters:
id
- identification for database entity, which will be revers on maplang
- the language iso-code for translationrepositoryName
- repository name from where will be returned data- Returns:
- translation value
-
searchLanguages
java.util.List<Language> searchLanguages(java.lang.String query, java.lang.String offset, java.lang.String limit)
This method does search requests and returns data as list.- Parameters:
query
- search queryoffset
- offset for returned itemslimit
- limit for returned items- Returns:
- database entities as list
-
findLanguages
java.util.List<Language> findLanguages()
This method returns database entities as list.- Returns:
- database entities as list
-
createTranslation
java.util.Optional<LocalizedText> createTranslation(java.util.LinkedHashMap<java.lang.String,java.lang.Object> translationAsMap)
This method creates a database entity.- Parameters:
translationAsMap
- map-representation of database entity- Returns:
- optional value to externally interaction
-
createTranslation
LocalizedText createTranslation(LocalizedText translation)
This method creates a database entity.- Parameters:
translation
- database entity- Returns:
- database entity
-
createLanguage
java.util.Optional<Language> createLanguage(java.util.LinkedHashMap<java.lang.String,java.lang.Object> langAsMap)
This method creates a database entity.- Parameters:
langAsMap
- map-representation of database entity- Returns:
- optional value to externally interaction
-
createLanguage
Language createLanguage(Language language)
This method creates a database entity.- Parameters:
language
- database entity- Returns:
- created entity
-
saveTranslation
java.util.Optional<LocalizedText> saveTranslation(java.util.LinkedHashMap<java.lang.String,java.lang.Object> translationAsMap)
This method save an updates of database entity.- Parameters:
translationAsMap
- map-representation of database entity- Returns:
- optional value to externally interaction
-
saveArticle
java.util.Optional<LocalizedText> saveArticle(java.lang.String text, java.lang.String articleId)
This method saves a database entity.- Parameters:
text
- data which will be added in database entityarticleId
- identification for database entity which will be saved or updated- Returns:
- optional value to externally interaction
-
saveTranslation
java.util.Optional<LocalizedText> saveTranslation(LocalizedText translation)
This method saves a database entity.- Parameters:
translation
- database entity- Returns:
- optional value to externally interaction
-
saveLanguage
java.util.Optional<Language> saveLanguage(java.util.LinkedHashMap<java.lang.String,java.lang.Object> langAsMap)
This method save an updates of database entity.- Parameters:
langAsMap
- map-representation of database entity- Returns:
- optional value to externally interaction
-
saveLanguage
java.util.Optional<Language> saveLanguage(Language language)
This method saves a database entity.- Parameters:
language
- database entity- Returns:
- optional value to externally interaction
-
removeTranslationAndClean
void removeTranslationAndClean(java.lang.String translationId)
This method removes a database entity and clean all relationships from another entities.- Parameters:
translationId
- identification for database entity which will be removed
-
removeTranslationsByIds
void removeTranslationsByIds(java.util.ArrayList<java.lang.String> translationIds)
This method removes a list of database entities.- Parameters:
translationIds
- the list of database entities which will be removed
-
removeTranslationsByLanguage
void removeTranslationsByLanguage(java.lang.String langId)
This method removes a list of database entities.- Parameters:
langId
- language identification
-
removeLanguageAndClean
void removeLanguageAndClean(java.lang.String langId)
This method removes a database entity and clean all relationships from another entities.- Parameters:
langId
- identification for database entity which will be removed
-
removeLanguagesByIds
void removeLanguagesByIds(java.util.ArrayList<java.lang.String> languageIds)
This method removes a list of database entities.- Parameters:
languageIds
- the list of database entities which will be removed
-
getTranslations
java.util.HashSet<LocalizedText> getTranslations(java.lang.String langEn, java.lang.String langDe)
This method returns data as set.- Parameters:
langEn
- the lang of database entities which will be retrievedlangDe
- the lang of database entities which will be retrieved- Returns:
- database entities as list
-
addTranslation
void addTranslation(java.lang.String lang, java.util.HashSet<LocalizedText> translations, java.util.Optional<Language> languageOptional)
This method creates all relationships between database entities.- Parameters:
lang
- the lang of database entities which will be updatedtranslations
- the list of database entities where will be added other database entitylanguageOptional
- the lang of database entities which will be added in list of other database entities
-
getAlphabetForActiveLanguage
java.util.List<java.util.Map<java.lang.String,java.lang.Object>> getAlphabetForActiveLanguage(java.lang.String isUpp)
Return alphabets of active language code- Parameters:
isUpp
- flag to convert alphabet to uppercase- Returns:
- list with characters
-
getAlphabetForLanguage
java.util.List<java.util.Map<java.lang.String,java.lang.Object>> getAlphabetForLanguage(java.lang.String isUpp, java.lang.String language)
Return alphabets of active language code- Parameters:
isUpp
- flag to convert alphabet to uppercaselanguage
- language code- Returns:
- list with characters
-
getDefaultLanguage
java.lang.String getDefaultLanguage()
This method returns the default language.- Returns:
- A String representing the default language.
-
findOrCreateTranslation
LocalizedText findOrCreateTranslation(LocalizedText tr)
Finds or creates a translation for the given localized text object. This method takes a localized text object as input and searches for an existing translation in the system. If a translation is found, it is returned. If not, a new translation is created and returned.- Parameters:
tr
- - The localized text object for which the translation needs to be found or created- Returns:
- The found or created translation
-
exportTranslations
java.util.List<TranslationExport> exportTranslations(co.mastermindcms.modules.beans.SearchRequest request)
Exports translations based on the given search request.- Parameters:
request
- the search request containing the necessary criteria for exporting translations- Returns:
- a list of TranslationExport objects representing the exported translations
-
uploadTranslations
void uploadTranslations(java.io.File file, java.lang.String username)
Uploads translations to the server for the given user.- Parameters:
file
- the file containing the translations to be uploadedusername
- the username of the user uploading the translations
-
-