Class TranslationKeyService
java.lang.Object
sk.iway.iwcm.components.translation_keys.rest.TranslationKeyService
TranslationKeyService
Trieda sluzi na CRUD operacie pre prekladove kluce. Pracuje s dvoma zdrojmi, properties subor a tabulka webjet_properties. DefaultKeys su nemenne prekladove kluce, ktore sluzia iba na READ funkcionalitu. ChangedKeys su prekladove kluce pre ktore funguju CREATE, READ, UPDATE a aj DELETE funkcionality.
-
Method Summary
Modifier and TypeMethodDescriptioncreateOrEditTranslationKey
(Identity user, TranslationKeyEntity entity, boolean isImport, String importMode, Set<String> importedColumns) Method will handle create/edit process of TranslationKeyEntities for every supported language.createOrEditTranslationKeySingleLanguage
(Identity user, TranslationKeyEntity entity, boolean reloadPropDB) Method will handle create/edit process of TranslationKeyEntities for SINGLE language defined in entity.Method will check is user have rights to delete entered entity.Returns map of language-field combination based on languages conf.Method will return TranslationKeyRepository set in gloval variable of this Service.org.springframework.data.domain.Page<TranslationKeyEntity>
getTranslationKeys
(javax.servlet.http.HttpServletRequest request, org.springframework.data.domain.Pageable pageable) Return prepared PAGE for Datatable TranslationKey's.saveTranslation
(String key, String translation, String lng) Simple method to save translation
-
Method Details
-
getLanguageFieldCombination
Returns map of language-field combination based on languages conf. property. Eg.: sk->A (as fieldA) en->B (as fieldB)- Returns:
-
getTranslationKeys
public org.springframework.data.domain.Page<TranslationKeyEntity> getTranslationKeys(javax.servlet.http.HttpServletRequest request, org.springframework.data.domain.Pageable pageable) Return prepared PAGE for Datatable TranslationKey's. As input data use method "getSortedTranslationKeys". Prepage page with this data and allso set pagination.- Parameters:
pageable
- pagination param for page.- Returns:
- page for Datatable TranslationKey's with sorted translation key's and set pagination.
-
createOrEditTranslationKeySingleLanguage
public TranslationKeyEntity createOrEditTranslationKeySingleLanguage(Identity user, TranslationKeyEntity entity, boolean reloadPropDB) Method will handle create/edit process of TranslationKeyEntities for SINGLE language defined in entity.- Parameters:
user
-entity
-reloadPropDB
- - if true the properties cache will be reloaded after save- Returns:
-
createOrEditTranslationKey
public TranslationKeyEntity createOrEditTranslationKey(Identity user, TranslationKeyEntity entity, boolean isImport, String importMode, Set<String> importedColumns) Method will handle create/edit process of TranslationKeyEntities for every supported language. CASE 1, if translation key is not in file or DB, then new DB record will by set (representing new translation key). CASE 2, if translation key is only in file, then new DB record will by set (representing new value of translation key), even if old value in file and value from EDITOR are same. CASE 3, if translation key have DB value, this value will be updated. !! Every translation key value in specific language is saved in DB or file like stand alone record.- Parameters:
user
- actually logged userentity
- entity representing translation key and his values in all supported languages- Returns:
- same entity that was entered
-
delete
Method will check is user have rights to delete entered entity. If yes, entity will be deleted. If no, throw IllegalArgumentException.- Parameters:
user
- actualy logged userkey
- translation key entity we want to deletelng
- language variant of translation key we want delete- Returns:
- number of deleted entities
-
getTranslationKeyRepository
Method will return TranslationKeyRepository set in gloval variable of this Service.- Returns:
- TranslationKeyRepository
-
saveTranslation
Simple method to save translation- Parameters:
key
-translation
-lng
-
-