Package org.codelibs.fess.helper
Class ActivityHelper
java.lang.Object
org.codelibs.fess.helper.ActivityHelper
The helper for user activities.
This class provides methods to log user actions such as login, logout, and access.
It supports both LTSV and ECS log formats.
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected StringThe ECS event dataset.protected StringThe ECS service name.protected StringThe ECS version.The environment map.protected org.apache.logging.log4j.LoggerThe logger.protected StringThe logger name.protected StringThe permission separator.protected booleanThe flag to use ECS format. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaccess(org.dbflute.optional.OptionalThing<org.codelibs.fess.mylasta.action.FessUserBean> user, String path, String execute) Log the access activity.voidaccessDenied(org.dbflute.optional.OptionalThing<org.codelibs.fess.mylasta.action.FessUserBean> user, String path) Log the access denied activity.protected StringGet the client IP.Get the environment map.voidinit()Initialize the helper.protected voidLog the value map.voidlogin(org.dbflute.optional.OptionalThing<org.codelibs.fess.mylasta.action.FessUserBean> user) Log the login activity.voidloginFailure(org.dbflute.optional.OptionalThing<org.lastaflute.web.login.credential.LoginCredential> credential) Log the login failure activity.voidlogout(org.dbflute.optional.OptionalThing<org.codelibs.fess.mylasta.action.FessUserBean> user) Log the logout activity.protected StringnormalizeScript(String script) Normalize script content for logging.voidpermissionChanged(org.dbflute.optional.OptionalThing<org.codelibs.fess.mylasta.action.FessUserBean> user) Log the permission changed activity.voidprint(String action, org.dbflute.optional.OptionalThing<org.codelibs.fess.mylasta.action.FessUserBean> user, Map<String, String> params) Print the log.protected voidprintByEcs(Map<String, String> valueMap) Print the log by ECS.protected voidprintByLtsv(Map<String, String> valueMap) Print the log by LTSV.protected voidPrint the log.voidLog the script execution activity.voidsetEcsEventDataset(String ecsEventDataset) Set the ECS event dataset.voidsetEcsServiceName(String ecsServiceName) Set the ECS service name.voidsetEcsVersion(String ecsVersion) Set the ECS version.voidSet the environment map.voidsetLoggerName(String loggerName) Set the logger name.voidsetPermissionSeparator(String permissionSeparator) Set the permission separator.
-
Field Details
-
logger
protected org.apache.logging.log4j.Logger loggerThe logger. -
loggerName
The logger name. -
permissionSeparator
The permission separator. -
useEcsFormat
protected boolean useEcsFormatThe flag to use ECS format. -
ecsVersion
The ECS version. -
ecsServiceName
The ECS service name. -
ecsEventDataset
The ECS event dataset. -
envMap
The environment map.
-
-
Constructor Details
-
ActivityHelper
public ActivityHelper()Default constructor.
-
-
Method Details
-
init
@PostConstruct public void init()Initialize the helper. -
getEnvMap
Get the environment map.- Returns:
- The environment map.
-
setEnvMap
Set the environment map.- Parameters:
envMap- The environment map.
-
login
public void login(org.dbflute.optional.OptionalThing<org.codelibs.fess.mylasta.action.FessUserBean> user) Log the login activity.- Parameters:
user- The user.
-
loginFailure
public void loginFailure(org.dbflute.optional.OptionalThing<org.lastaflute.web.login.credential.LoginCredential> credential) Log the login failure activity.- Parameters:
credential- The credential.
-
logout
public void logout(org.dbflute.optional.OptionalThing<org.codelibs.fess.mylasta.action.FessUserBean> user) Log the logout activity.- Parameters:
user- The user.
-
access
public void access(org.dbflute.optional.OptionalThing<org.codelibs.fess.mylasta.action.FessUserBean> user, String path, String execute) Log the access activity.- Parameters:
user- The user.path- The path.execute- The execute.
-
permissionChanged
public void permissionChanged(org.dbflute.optional.OptionalThing<org.codelibs.fess.mylasta.action.FessUserBean> user) Log the permission changed activity.- Parameters:
user- The user.
-
scriptExecution
public void scriptExecution(String scriptType, String script, String source, String user, String result) Log the script execution activity.- Parameters:
scriptType- The type of script (e.g., "groovy").script- The script content.source- The source of execution (e.g., "scheduler:JobName").user- The user who triggered the execution.result- The execution result (e.g., "success" or "failure:ExceptionType").
-
normalizeScript
Normalize script content for logging. Replaces control characters and truncates if too long.- Parameters:
script- The script content.- Returns:
- The normalized script content.
-
accessDenied
public void accessDenied(org.dbflute.optional.OptionalThing<org.codelibs.fess.mylasta.action.FessUserBean> user, String path) Log the access denied activity.- Parameters:
user- The user.path- The path.
-
print
public void print(String action, org.dbflute.optional.OptionalThing<org.codelibs.fess.mylasta.action.FessUserBean> user, Map<String, String> params) Print the log.- Parameters:
action- The action.user- The user.params- The parameters.
-
log
Log the value map.- Parameters:
valueMap- The value map.
-
printByLtsv
Print the log by LTSV.- Parameters:
valueMap- The value map.
-
printByEcs
Print the log by ECS.- Parameters:
valueMap- The value map.
-
printLog
Print the log.- Parameters:
message- The message.
-
getClientIp
Get the client IP.- Returns:
- The client IP.
-
setLoggerName
Set the logger name.- Parameters:
loggerName- The logger name.
-
setPermissionSeparator
Set the permission separator.- Parameters:
permissionSeparator- The permission separator.
-
setEcsVersion
Set the ECS version.- Parameters:
ecsVersion- The ECS version.
-
setEcsServiceName
Set the ECS service name.- Parameters:
ecsServiceName- The ECS service name.
-
setEcsEventDataset
Set the ECS event dataset.- Parameters:
ecsEventDataset- The ECS event dataset.
-