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 CommonPropertiescommonPropertiesprivate static org.slf4j.Loggerloggerprivate SequenceGeneratorServicesequenceGeneratorServiceprivate WebSiteSettingsRepositorysiteSettingsRepositoryprivate MongoStorageServicestorageServiceprivate TemplateLocatorServicetemplateLocatorServiceprivate UserPrincipalDetailsServiceuserDetailsService
-
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.WebSiteSettingsgetCurrentWebSiteSettings()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.StringgetLangCode()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.booleanisBlank(java.lang.String value)This method does return boolean result(true).booleanisFileExists(java.lang.String path)This method check if the file exists.booleanisFileExistsFromSystemRoot(java.lang.String path)This method check if the file exists.booleanisFileExistsFromUploadRoot(java.lang.String path)This method check if the file exists.booleanisLanguageDetection()This method check the state of language detection propertybooleanisNotBlank(java.lang.String value)This method does return boolean result(false).booleanisNotTrue(java.lang.String value)This method does return boolean result(false).booleanisTrue(java.lang.String value)This method does return boolean result(true).booleanisValueEquals(java.lang.String val, java.lang.String equalsToVal)This method does return boolean result(false).java.lang.StringlanguageAwareUrl(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.ObjectrestClientCall(java.lang.String endpoint, java.lang.String method, java.lang.String jsonAsString)This method returns data as map from REST API.private voidsettingsAccumulator(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:FrameworkOperationServiceThis method does return boolean result(false).- Specified by:
isValueEqualsin 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:FrameworkOperationServiceThis method does return boolean result(false).- Specified by:
isNotBlankin interfaceFrameworkOperationService- Parameters:
value- which will be checked- Returns:
- value as boolean
-
isBlank
public boolean isBlank(java.lang.String value)
Description copied from interface:FrameworkOperationServiceThis method does return boolean result(true).- Specified by:
isBlankin interfaceFrameworkOperationService- Parameters:
value- which will be checked- Returns:
- value as boolean
-
isNotTrue
public boolean isNotTrue(java.lang.String value)
Description copied from interface:FrameworkOperationServiceThis method does return boolean result(false).- Specified by:
isNotTruein interfaceFrameworkOperationService- Parameters:
value- which will be checked- Returns:
- value as boolean
-
isTrue
public boolean isTrue(java.lang.String value)
Description copied from interface:FrameworkOperationServiceThis method does return boolean result(true).- Specified by:
isTruein interfaceFrameworkOperationService- Parameters:
value- which will be checked- Returns:
- value as boolean
-
isFileExists
public boolean isFileExists(java.lang.String path)
Description copied from interface:FrameworkOperationServiceThis method check if the file exists.- Specified by:
isFileExistsin interfaceFrameworkOperationService- Parameters:
path- path to the file- Returns:
- value as boolean
-
isFileExistsFromSystemRoot
public boolean isFileExistsFromSystemRoot(java.lang.String path)
Description copied from interface:FrameworkOperationServiceThis method check if the file exists.- Specified by:
isFileExistsFromSystemRootin interfaceFrameworkOperationService- Parameters:
path- path to the file- Returns:
- value as boolean
-
isFileExistsFromUploadRoot
public boolean isFileExistsFromUploadRoot(java.lang.String path)
Description copied from interface:FrameworkOperationServiceThis method check if the file exists.- Specified by:
isFileExistsFromUploadRootin interfaceFrameworkOperationService- Parameters:
path- path to the file- Returns:
- value as boolean
-
isLanguageDetection
public boolean isLanguageDetection()
Description copied from interface:FrameworkOperationServiceThis method check the state of language detection property- Specified by:
isLanguageDetectionin interfaceFrameworkOperationService- Returns:
- value as boolean
-
getActiveLanguages
public java.util.List<java.lang.String> getActiveLanguages()
Description copied from interface:FrameworkOperationServiceThis method returns the list of active languages- Specified by:
getActiveLanguagesin 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:FrameworkOperationServiceThis method does return time.- Specified by:
getTimeFromDatein 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:FrameworkOperationServiceThis method does return date.- Specified by:
getCurrentDatein 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:FrameworkOperationServiceThis method does return time.- Specified by:
getFormattedDatein 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:FrameworkOperationServiceThis method does return time.- Specified by:
getFormattedDateFromTimestampin 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:FrameworkOperationServiceThis method does return time.- Specified by:
getDaysTillEndDatein 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:FrameworkOperationServiceThis method does return time.- Specified by:
getDatePlusYearsin 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:FrameworkOperationServiceThis method does return time.- Specified by:
getDaysTillEndDateFromTimestampin 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:FrameworkOperationServiceThis method returns data as object.- Specified by:
multiplyValueToin 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:FrameworkOperationServiceThis method returns data as object.- Specified by:
divideValueToin 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:FrameworkOperationServiceThis method returns data as object.- Specified by:
plusTwoValuesin 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:FrameworkOperationServiceThis method does return map-structure.- Specified by:
getFileSizein 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:FrameworkOperationServiceThis method does return map-structure.- Specified by:
getFileExtensionin 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:FrameworkOperationServiceThis method does return map-structure.- Specified by:
getFirstLetterin 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:FrameworkOperationServiceThis method does return map-structure.- Specified by:
getCurrentSequencein 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:FrameworkOperationServiceThis method does transform json array to list.- Specified by:
transformJsonArrayToListin 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:FrameworkOperationServiceThis method returns data as text from context.- Specified by:
getLangCodein 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:FrameworkOperationServiceThis method returns data as text from context.- Specified by:
toLowerCasein 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:FrameworkOperationServiceThis method returns data as text from context.- Specified by:
toUpperCasein 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:FrameworkOperationServiceThis method returns data as map from REST API.- Specified by:
restClientCallin 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:FrameworkOperationServiceThis method does recursive rendering for elements with nested relations- Specified by:
parseNestedDatabaseDocsin 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:FrameworkOperationServiceThis 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:
languageAwareUrlin 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:FrameworkOperationServiceRetrieves the current website settings. This method returns an object of type WebSiteSettings, which contains various properties and configurations for the current website.- Specified by:
getCurrentWebSiteSettingsin 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:FrameworkOperationServiceRetrieves the current branding site settings as a LinkedHashMap.- Specified by:
getCurrentBrandingSiteSettingsin 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)
-
-