Class FrameworkOperationServiceImpl
- java.lang.Object
-
- co.mastermindcms.framework.services.FrameworkOperationServiceImpl
-
- All Implemented Interfaces:
FrameworkOperationService
@Service public class FrameworkOperationServiceImpl extends java.lang.Object implements FrameworkOperationService
-
-
Field Summary
Fields Modifier and Type Field Description private CommonProperties
commonProperties
private static org.slf4j.Logger
logger
private SequenceGeneratorService
sequenceGeneratorService
private WebSiteSettingsRepository
siteSettingsRepository
private MongoStorageService
storageService
private TemplateLocatorService
templateLocatorService
private UserPrincipalDetailsService
userDetailsService
-
Constructor Summary
Constructors Constructor Description FrameworkOperationServiceImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.Map<java.lang.String,java.lang.Object>
divideValueTo(java.lang.String val, java.lang.String to)
This method returns data as object.java.util.List<java.lang.String>
getActiveLanguages()
This method returns the list of active languagesjava.util.LinkedHashMap<java.lang.String,java.lang.Object>
getCurrentBrandingSiteSettings()
Retrieves the current branding site settings as a LinkedHashMap.java.util.Map<java.lang.String,java.lang.String>
getCurrentDate(java.lang.String pattern)
This method does return date.java.util.Map<java.lang.String,java.lang.String>
getCurrentSequence(java.lang.String seqName)
This method does return map-structure.WebSiteSettings
getCurrentWebSiteSettings()
Retrieves the current website settings.java.util.Map<java.lang.String,java.lang.Object>
getDatePlusYears(java.lang.String years, java.lang.String pattern)
This method does return time.java.util.Map<java.lang.String,java.lang.Object>
getDaysTillEndDate(java.lang.String date)
This method does return time.java.util.Map<java.lang.String,java.lang.Object>
getDaysTillEndDateFromTimestamp(java.lang.String timestamp)
This method does return time.java.util.Map<java.lang.String,java.lang.String>
getFileExtension(java.lang.String filePath)
This method does return map-structure.java.util.Map<java.lang.String,java.lang.String>
getFileSize(java.lang.String url, java.lang.String dim)
This method does return map-structure.java.util.Map<java.lang.String,java.lang.String>
getFirstLetter(java.lang.String text)
This method does return map-structure.java.util.Map<java.lang.String,java.lang.String>
getFormattedDate(java.lang.String date, java.lang.String pattern)
This method does return time.java.util.Map<java.lang.String,java.lang.String>
getFormattedDateFromTimestamp(java.lang.String timestamp, java.lang.String pattern)
This method does return time.java.lang.String
getLangCode()
This method returns data as text from context.java.util.Map<java.lang.String,java.lang.String>
getTimeFromDate(java.lang.String date)
This method does return time.boolean
isBlank(java.lang.String value)
This method does return boolean result(true).boolean
isFileExists(java.lang.String path)
This method check if the file exists.boolean
isFileExistsFromSystemRoot(java.lang.String path)
This method check if the file exists.boolean
isFileExistsFromUploadRoot(java.lang.String path)
This method check if the file exists.boolean
isLanguageDetection()
This method check the state of language detection propertyboolean
isNotBlank(java.lang.String value)
This method does return boolean result(false).boolean
isNotTrue(java.lang.String value)
This method does return boolean result(false).boolean
isTrue(java.lang.String value)
This method does return boolean result(true).boolean
isValueEquals(java.lang.String val, java.lang.String equalsToVal)
This method does return boolean result(false).java.lang.String
languageAwareUrl(java.lang.String url)
This method adds the language code to the given URL based on the browser's preferred language.java.util.Map<java.lang.String,java.lang.Object>
multiplyValueTo(java.lang.String val, java.lang.String to)
This method returns data as object.java.util.HashMap<java.lang.Object,java.lang.Object>
parseNestedDatabaseDocs(java.lang.String itemName, java.lang.String nestedKey, java.lang.String database, java.lang.String jsonObjString)
This method does recursive rendering for elements with nested relationsjava.util.Map<java.lang.String,java.lang.Object>
plusTwoValues(java.lang.String val1, java.lang.String val2)
This method returns data as object.java.lang.Object
restClientCall(java.lang.String endpoint, java.lang.String method, java.lang.String jsonAsString)
This method returns data as map from REST API.private void
settingsAccumulator(java.util.LinkedHashMap<java.lang.String,java.lang.Object> m, java.util.Map.Entry<java.lang.String,java.lang.Object> v)
java.util.Map<java.lang.String,java.lang.String>
toLowerCase(java.lang.String str)
This method returns data as text from context.java.util.Map<java.lang.String,java.lang.String>
toUpperCase(java.lang.String str)
This method returns data as text from context.java.util.List<java.util.Map<java.lang.String,java.lang.Object>>
transformJsonArrayToList(java.lang.String jsonArray)
This method does transform json array to list.
-
-
-
Field Detail
-
commonProperties
@Autowired private CommonProperties commonProperties
-
sequenceGeneratorService
@Autowired private SequenceGeneratorService sequenceGeneratorService
-
storageService
@Autowired private MongoStorageService storageService
-
userDetailsService
@Qualifier("userPrincipalDetailsService") @Autowired private UserPrincipalDetailsService userDetailsService
-
siteSettingsRepository
@Autowired private WebSiteSettingsRepository siteSettingsRepository
-
templateLocatorService
@Autowired private TemplateLocatorService templateLocatorService
-
logger
private static final org.slf4j.Logger logger
-
-
Method Detail
-
isValueEquals
public boolean isValueEquals(java.lang.String val, java.lang.String equalsToVal)
Description copied from interface:FrameworkOperationService
This method does return boolean result(false).- Specified by:
isValueEquals
in interfaceFrameworkOperationService
- Parameters:
val
- which will be checkedequalsToVal
- which will be compared- Returns:
- value as boolean
-
isNotBlank
public boolean isNotBlank(java.lang.String value)
Description copied from interface:FrameworkOperationService
This method does return boolean result(false).- Specified by:
isNotBlank
in interfaceFrameworkOperationService
- Parameters:
value
- which will be checked- Returns:
- value as boolean
-
isBlank
public boolean isBlank(java.lang.String value)
Description copied from interface:FrameworkOperationService
This method does return boolean result(true).- Specified by:
isBlank
in interfaceFrameworkOperationService
- Parameters:
value
- which will be checked- Returns:
- value as boolean
-
isNotTrue
public boolean isNotTrue(java.lang.String value)
Description copied from interface:FrameworkOperationService
This method does return boolean result(false).- Specified by:
isNotTrue
in interfaceFrameworkOperationService
- Parameters:
value
- which will be checked- Returns:
- value as boolean
-
isTrue
public boolean isTrue(java.lang.String value)
Description copied from interface:FrameworkOperationService
This method does return boolean result(true).- Specified by:
isTrue
in interfaceFrameworkOperationService
- Parameters:
value
- which will be checked- Returns:
- value as boolean
-
isFileExists
public boolean isFileExists(java.lang.String path)
Description copied from interface:FrameworkOperationService
This method check if the file exists.- Specified by:
isFileExists
in interfaceFrameworkOperationService
- Parameters:
path
- path to the file- Returns:
- value as boolean
-
isFileExistsFromSystemRoot
public boolean isFileExistsFromSystemRoot(java.lang.String path)
Description copied from interface:FrameworkOperationService
This method check if the file exists.- Specified by:
isFileExistsFromSystemRoot
in interfaceFrameworkOperationService
- Parameters:
path
- path to the file- Returns:
- value as boolean
-
isFileExistsFromUploadRoot
public boolean isFileExistsFromUploadRoot(java.lang.String path)
Description copied from interface:FrameworkOperationService
This method check if the file exists.- Specified by:
isFileExistsFromUploadRoot
in interfaceFrameworkOperationService
- Parameters:
path
- path to the file- Returns:
- value as boolean
-
isLanguageDetection
public boolean isLanguageDetection()
Description copied from interface:FrameworkOperationService
This method check the state of language detection property- Specified by:
isLanguageDetection
in interfaceFrameworkOperationService
- Returns:
- value as boolean
-
getActiveLanguages
public java.util.List<java.lang.String> getActiveLanguages()
Description copied from interface:FrameworkOperationService
This method returns the list of active languages- Specified by:
getActiveLanguages
in interfaceFrameworkOperationService
- Returns:
- value as list
-
getTimeFromDate
public java.util.Map<java.lang.String,java.lang.String> getTimeFromDate(java.lang.String date)
Description copied from interface:FrameworkOperationService
This method does return time.- Specified by:
getTimeFromDate
in interfaceFrameworkOperationService
- Parameters:
date
- from which can extracted time- Returns:
- data as map
-
getCurrentDate
public java.util.Map<java.lang.String,java.lang.String> getCurrentDate(java.lang.String pattern)
Description copied from interface:FrameworkOperationService
This method does return date.- Specified by:
getCurrentDate
in interfaceFrameworkOperationService
- Parameters:
pattern
- pattern to format- Returns:
- data as map
-
getFormattedDate
public java.util.Map<java.lang.String,java.lang.String> getFormattedDate(java.lang.String date, java.lang.String pattern)
Description copied from interface:FrameworkOperationService
This method does return time.- Specified by:
getFormattedDate
in interfaceFrameworkOperationService
- Parameters:
date
- from which can extracted timepattern
- pattern to format- Returns:
- data as map
-
getFormattedDateFromTimestamp
public java.util.Map<java.lang.String,java.lang.String> getFormattedDateFromTimestamp(java.lang.String timestamp, java.lang.String pattern)
Description copied from interface:FrameworkOperationService
This method does return time.- Specified by:
getFormattedDateFromTimestamp
in interfaceFrameworkOperationService
- Parameters:
timestamp
- from which can extracted timepattern
- pattern to format- Returns:
- data as map
-
getDaysTillEndDate
public java.util.Map<java.lang.String,java.lang.Object> getDaysTillEndDate(java.lang.String date)
Description copied from interface:FrameworkOperationService
This method does return time.- Specified by:
getDaysTillEndDate
in interfaceFrameworkOperationService
- Parameters:
date
- from which can extracted time- Returns:
- data as map
-
getDatePlusYears
public java.util.Map<java.lang.String,java.lang.Object> getDatePlusYears(java.lang.String years, java.lang.String pattern)
Description copied from interface:FrameworkOperationService
This method does return time.- Specified by:
getDatePlusYears
in interfaceFrameworkOperationService
- Parameters:
years
- from which can extracted timepattern
- pattern to format- Returns:
- data as map
-
getDaysTillEndDateFromTimestamp
public java.util.Map<java.lang.String,java.lang.Object> getDaysTillEndDateFromTimestamp(java.lang.String timestamp)
Description copied from interface:FrameworkOperationService
This method does return time.- Specified by:
getDaysTillEndDateFromTimestamp
in interfaceFrameworkOperationService
- Parameters:
timestamp
- from which can extracted time- Returns:
- data as map
-
multiplyValueTo
public java.util.Map<java.lang.String,java.lang.Object> multiplyValueTo(java.lang.String val, java.lang.String to)
Description copied from interface:FrameworkOperationService
This method returns data as object.- Specified by:
multiplyValueTo
in interfaceFrameworkOperationService
- Parameters:
val
- the value which will be dividedto
- the value on which will be divided- Returns:
- data as map
-
divideValueTo
public java.util.Map<java.lang.String,java.lang.Object> divideValueTo(java.lang.String val, java.lang.String to)
Description copied from interface:FrameworkOperationService
This method returns data as object.- Specified by:
divideValueTo
in interfaceFrameworkOperationService
- Parameters:
val
- the value which will be dividedto
- the value on which will be divided- Returns:
- data as map
-
plusTwoValues
public java.util.Map<java.lang.String,java.lang.Object> plusTwoValues(java.lang.String val1, java.lang.String val2)
Description copied from interface:FrameworkOperationService
This method returns data as object.- Specified by:
plusTwoValues
in interfaceFrameworkOperationService
- Parameters:
val1
- the first integer valueval2
- the second integer value- Returns:
- data as map
-
getFileSize
public java.util.Map<java.lang.String,java.lang.String> getFileSize(java.lang.String url, java.lang.String dim)
Description copied from interface:FrameworkOperationService
This method does return map-structure.- Specified by:
getFileSize
in interfaceFrameworkOperationService
- Parameters:
url
- of file, which will be measureddim
- value for measure file size- Returns:
- data as map
-
getFileExtension
public java.util.Map<java.lang.String,java.lang.String> getFileExtension(java.lang.String filePath)
Description copied from interface:FrameworkOperationService
This method does return map-structure.- Specified by:
getFileExtension
in interfaceFrameworkOperationService
- Parameters:
filePath
- of file, which will be measured- Returns:
- data as map
-
getFirstLetter
public java.util.Map<java.lang.String,java.lang.String> getFirstLetter(java.lang.String text)
Description copied from interface:FrameworkOperationService
This method does return map-structure.- Specified by:
getFirstLetter
in interfaceFrameworkOperationService
- Parameters:
text
- from which can extracted letter- Returns:
- data as map
-
getCurrentSequence
public java.util.Map<java.lang.String,java.lang.String> getCurrentSequence(java.lang.String seqName)
Description copied from interface:FrameworkOperationService
This method does return map-structure.- Specified by:
getCurrentSequence
in interfaceFrameworkOperationService
- Parameters:
seqName
- name as sequence which is at the moment- Returns:
- data as map
-
transformJsonArrayToList
public java.util.List<java.util.Map<java.lang.String,java.lang.Object>> transformJsonArrayToList(java.lang.String jsonArray)
Description copied from interface:FrameworkOperationService
This method does transform json array to list.- Specified by:
transformJsonArrayToList
in interfaceFrameworkOperationService
- Parameters:
jsonArray
- JSON-array of array contains an instructions for transform data- Returns:
- map-representation of data
-
getLangCode
public java.lang.String getLangCode()
Description copied from interface:FrameworkOperationService
This method returns data as text from context.- Specified by:
getLangCode
in interfaceFrameworkOperationService
- Returns:
- data as text
-
toLowerCase
public java.util.Map<java.lang.String,java.lang.String> toLowerCase(java.lang.String str)
Description copied from interface:FrameworkOperationService
This method returns data as text from context.- Specified by:
toLowerCase
in interfaceFrameworkOperationService
- Parameters:
str
- string value to transform to lowercase- Returns:
- map-representation of data
-
toUpperCase
public java.util.Map<java.lang.String,java.lang.String> toUpperCase(java.lang.String str)
Description copied from interface:FrameworkOperationService
This method returns data as text from context.- Specified by:
toUpperCase
in interfaceFrameworkOperationService
- Parameters:
str
- string value to transform to uppercase- Returns:
- map-representation of data
-
restClientCall
public java.lang.Object restClientCall(java.lang.String endpoint, java.lang.String method, java.lang.String jsonAsString)
Description copied from interface:FrameworkOperationService
This method returns data as map from REST API.- Specified by:
restClientCall
in interfaceFrameworkOperationService
- Parameters:
endpoint
- endpoint to REST APImethod
- http method definition GET/POSTjsonAsString
- json as string- Returns:
- data as object
-
parseNestedDatabaseDocs
public java.util.HashMap<java.lang.Object,java.lang.Object> parseNestedDatabaseDocs(java.lang.String itemName, java.lang.String nestedKey, java.lang.String database, java.lang.String jsonObjString)
Description copied from interface:FrameworkOperationService
This method does recursive rendering for elements with nested relations- Specified by:
parseNestedDatabaseDocs
in interfaceFrameworkOperationService
- Parameters:
itemName
- item prefix name which will be compilednestedKey
- the name of the property which contains nested relationsdatabase
- name of the database for relationsjsonObjString
- this an object which will be checked for 'children' property- Returns:
- data as map
-
languageAwareUrl
public java.lang.String languageAwareUrl(java.lang.String url)
Description copied from interface:FrameworkOperationService
This method adds the language code to the given URL based on the browser's preferred language. It returns the modified URL with the language code.- Specified by:
languageAwareUrl
in interfaceFrameworkOperationService
- Parameters:
url
- The original URL to be modified.- Returns:
- The modified URL with the language code.
-
getCurrentWebSiteSettings
public WebSiteSettings getCurrentWebSiteSettings()
Description copied from interface:FrameworkOperationService
Retrieves the current website settings. This method returns an object of type WebSiteSettings, which contains various properties and configurations for the current website.- Specified by:
getCurrentWebSiteSettings
in interfaceFrameworkOperationService
- Returns:
- The current website settings represented by an instance of WebSiteSettings.
-
getCurrentBrandingSiteSettings
public java.util.LinkedHashMap<java.lang.String,java.lang.Object> getCurrentBrandingSiteSettings()
Description copied from interface:FrameworkOperationService
Retrieves the current branding site settings as a LinkedHashMap.- Specified by:
getCurrentBrandingSiteSettings
in interfaceFrameworkOperationService
- Returns:
- the current branding site settings represented as a HashMap, where the keys and values are of type String
-
settingsAccumulator
private void settingsAccumulator(java.util.LinkedHashMap<java.lang.String,java.lang.Object> m, java.util.Map.Entry<java.lang.String,java.lang.Object> v)
-
-