Class SystemUtil
java.lang.Object
com.ssgllc.fish.service.util.registered.SystemUtil
-
Constructor Summary
ConstructorsConstructorDescriptionSystemUtil(org.springframework.core.env.Environment environment, com.ssgllc.fish.service.cache.EntityConfigCacheService entityConfigCacheService, com.ssgllc.fish.service.cache.CustomCacheService customCacheService, com.ssgllc.fish.config.ApplicationProperties applicationProperties) -
Method Summary
Modifier and TypeMethodDescriptionstatic voidstatic voidstatic <T> TevaluateExpression(Object rootObject, String expression, String returnTypeName, boolean mapContext) Evaluate given expression in context of a root object and return result in given type.
Example:
evaluateExpression(entity, "firstName == null", "java.lang.Boolean", false)
Returns:
Boolean true or false
static ObjectexecuteScript(String templateName, Map<String, Object> config, List<Map<String, Object>> payload, Object body) static StringgetAppConfig(String name) static Stringstatic Stringstatic Objectstatic Stringstatic Stringstatic ObjectgetFromCache(String cacheName, String entryKey) static StringIdentifies the node running this code, as"hostname ipAddress".static Stringstatic StringgetTextTemplate(String name) static voidstatic Objectstatic void
-
Constructor Details
-
SystemUtil
public SystemUtil(org.springframework.core.env.Environment environment, com.ssgllc.fish.service.cache.EntityConfigCacheService entityConfigCacheService, com.ssgllc.fish.service.cache.CustomCacheService customCacheService, com.ssgllc.fish.config.ApplicationProperties applicationProperties)
-
-
Method Details
-
getApplicationProperty
-
getBaseUrl
-
getSystemTimezone
-
getEcPrivateKeyFolder
-
getNodeId
Identifies the node running this code, as"hostname ipAddress". Falls back to a random seven-character string when the local host cannot be resolved, so it is stable for the life of a JVM but not guaranteed to be meaningful across restarts. Useful for attributing a log line or a record to one node of a cluster.- Returns:
- the node identifier
Groovy example:
systemUtil.info("Import ran on " + systemUtil.getNodeId())
Returns:
nothing; the node id appears in the log line
SpEL example:
#getNodeId()
Returns:
"app-node-2 10.4.1.17"
-
getEnvironmentName
-
getAppConfig
-
getTextTemplate
-
getFromCache
-
getCache
-
executeScript
-
evaluateExpression
public static <T> T evaluateExpression(Object rootObject, String expression, String returnTypeName, boolean mapContext) throws ClassNotFoundException Evaluate given expression in context of a root object and return result in given type.
Example:
evaluateExpression(entity, "firstName == null", "java.lang.Boolean", false)
Returns:
Boolean true or false
- Parameters:
rootObject- object in scope where given expression will be evaluatedexpression- expression to be evaluatedreturnTypeName- fully qualified name of return type from expression evaluationmapContext- true if map accessor should be used in evaluation context, false otherwise- Returns:
- result from expression evaluation
- Throws:
ClassNotFoundException
-
debug
-
info
-
warn
-
error
-
inspect
-