Class ActivityHelper

java.lang.Object
org.codelibs.fess.helper.ActivityHelper

public class ActivityHelper extends Object
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.
  • Field Details

    • logger

      protected org.apache.logging.log4j.Logger logger
      The logger.
    • loggerName

      protected String loggerName
      The logger name.
    • permissionSeparator

      protected String permissionSeparator
      The permission separator.
    • useEcsFormat

      protected boolean useEcsFormat
      The flag to use ECS format.
    • ecsVersion

      protected String ecsVersion
      The ECS version.
    • ecsServiceName

      protected String ecsServiceName
      The ECS service name.
    • ecsEventDataset

      protected String ecsEventDataset
      The ECS event dataset.
    • envMap

      protected Map<String,String> envMap
      The environment map.
  • Constructor Details

    • ActivityHelper

      public ActivityHelper()
      Default constructor.
  • Method Details

    • init

      @PostConstruct public void init()
      Initialize the helper.
    • getEnvMap

      protected Map<String,String> getEnvMap()
      Get the environment map.
      Returns:
      The environment map.
    • setEnvMap

      public void setEnvMap(Map<String,String> envMap)
      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

      protected String normalizeScript(String script)
      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

      protected void log(Map<String,String> valueMap)
      Log the value map.
      Parameters:
      valueMap - The value map.
    • printByLtsv

      protected void printByLtsv(Map<String,String> valueMap)
      Print the log by LTSV.
      Parameters:
      valueMap - The value map.
    • printByEcs

      protected void printByEcs(Map<String,String> valueMap)
      Print the log by ECS.
      Parameters:
      valueMap - The value map.
    • printLog

      protected void printLog(String message)
      Print the log.
      Parameters:
      message - The message.
    • getClientIp

      protected String getClientIp()
      Get the client IP.
      Returns:
      The client IP.
    • setLoggerName

      public void setLoggerName(String loggerName)
      Set the logger name.
      Parameters:
      loggerName - The logger name.
    • setPermissionSeparator

      public void setPermissionSeparator(String permissionSeparator)
      Set the permission separator.
      Parameters:
      permissionSeparator - The permission separator.
    • setEcsVersion

      public void setEcsVersion(String ecsVersion)
      Set the ECS version.
      Parameters:
      ecsVersion - The ECS version.
    • setEcsServiceName

      public void setEcsServiceName(String ecsServiceName)
      Set the ECS service name.
      Parameters:
      ecsServiceName - The ECS service name.
    • setEcsEventDataset

      public void setEcsEventDataset(String ecsEventDataset)
      Set the ECS event dataset.
      Parameters:
      ecsEventDataset - The ECS event dataset.