de.esprit.netsuite.client

## Class ClientContext

- java.lang.Object
- - de.esprit.common.util.DumpableObject
  - - de.esprit.common.log.LogSupportAdapter
    - - de.esprit.appsuite.launch.ApplicationContext
      - - de.esprit.netsuite.client.ClientContext

- All Implemented Interfaces:
    ErrorHandler, Initializable, Exitable, LogSupport, Dumpable, java.io.Closeable, java.lang.AutoCloseable
  Direct Known Subclasses:
    CoClientContext, GuiClientContext, RawClientContext

      public abstract class ClientContext
      extends ApplicationContext

  This class is the main access point for the runtime environment of the client.
  Author:
    Rainer Buesch

- - ### Field Summary

    - ### Fields inherited from class de.esprit.appsuite.launch.ApplicationContext

      `isExitOnClose`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ClientContext(ClientConfig cfg)`
    `ClientContext(ClientConfig cfg, boolean isConnectOnInit)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `cancelTask(RemoteTaskId taskId, SessionId sessId)` Sends a `RemoteTaskCancelAgent` in order to cancel the remote task on the server.
    `boolean` | `cancelTask(TaskId taskId)` Cancels the async task.
    `protected EspritClientConnector` | `createClientConnector(ServerHost serverHost)` Creates the network connector for the given `ServerHost`
    `protected ClientInfo` | `createClientInfo()` Creates the client specific `ClientInfo` sub-type which contains client details info.
    `protected abstract ServerNotificationHandler` | `createServerNotificationHandler()` Creates the `ServerNotificationHandler` instance used to handle received `ServerNotificationMessage`s
    `protected ClientTaskManager` | `createTaskManager()`
    `ABOManager` | `getABOManager()`
    `AdminActionValidator` | `getAdminActionValidator()`
    `java.util.Map<AgentId,PropertyMap>` | `getAgentParamsCache()` Returns a general purpose HashMap that can be used by agents for caching parameters
    `PowerMap` | `getClientCache()` Returns a general purpose Map for caching client data
    `ClientConfig` | `getClientConfig()` Returns the command line configuration parameters of the client
    `ClientConnector` | `getClientConnector()`
    `ClientMainFrame` | `getMainFrame()` Returns the MainFrame of the client application as the central access point to it's GUI.
    `ClientActionValidator` | `getNetActionValidator()`
    `ServerNotificationHandler` | `getServerMessageHandler()` Gets the clients handler for received ServerMessages
    `ClientTaskManager` | `getTaskManager()`
    `UserActionValidator` | `getUserActionValidator()`
    `UserCache` | `getUserCache()` Returns the clients `UserCache`, which keeps ever up-to-date session data of all connected clients.
    `void` | `init()` Performs the initialization of this class.
    `boolean` | `isCoClient()` Convenience method that tells whether this is an instance of `CoClientContext`
    `void` | `loadTranslations(Language language)` Loads the translation tables for this context.
    `ClientInfo` | `readClientInfo()` Creates and fills the client specific `ClientInfo` object.
    `void` | `setMainFrame(ApplicationMainFrame mainFrame)` Sets the MainFrame for this application.
    `DumpString` | `toDumpString(DumpString s)` This method allows subclasses to add values to the existing DumpString of the superclass.
    `ToString` | `toString(ToString s)` This method allows subclasses to add values to the existing ToString of the superclass.

    - ### Methods inherited from class de.esprit.appsuite.launch.ApplicationContext

      `checkInitialized, close, confirmCancelAllAsyncActivity, createErrorHandler, createLicense, createUncaughtExceptionHandler, exit, getApplicationConfig, getApplicationName, getCustomVersion, getDatabase, getErrorHandler, getEspritVersion, getJavaVersionManager, getLicense, getSupportedLanguages, getTextEditor, hasMainFrame, isClosed, isDefaultContext, isGuiClient, isInitialized, registerForClose, setDatabase, setExitOnClose, showError, showError, showError, showInfo, showInfo, showWarning, showWarning`

    - ### Methods inherited from class de.esprit.common.log.LogSupportAdapter

      `getLogChannel, getLogLevel, isLogDebug, isLogVerbose, logDebug, logDump, logError, logError, logFatal, logInfo, logVerbose, logWarning, setLogChannel, setLogLevel`

    - ### Methods inherited from class de.esprit.common.util.DumpableObject

      `configureDumpHeadlineLength, configureDumpMaxElementsPrinted, copyDumpStringValues, copyToStringValues, createDumpHeader, toDumpString, toString`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### ClientContext

          public ClientContext(ClientConfig cfg)

    - #### ClientContext

          public ClientContext(ClientConfig cfg,
                       boolean isConnectOnInit)

  - ### Method Detail

    - #### createClientConnector

          protected EspritClientConnector createClientConnector(ServerHost serverHost)

      Creates the network connector for the given `ServerHost`

    - #### getClientConnector

          public ClientConnector getClientConnector()

    - #### getABOManager

          public ABOManager getABOManager()

    - #### init

          public void init()
                    throws java.lang.Exception

      Description copied from interface: `Initializable`
      Performs the initialization of this class. Note that the implementation should maintain an isInitialized flag which must be set when initialization has completed.
      Specified by:
        `init` in interface `Initializable`
      Overrides:
        `init` in class `ApplicationContext`
      Throws:
        `java.lang.Exception`

    - #### loadTranslations

          public void loadTranslations(Language language)

      Description copied from class: `ApplicationContext`
      Loads the translation tables for this context.
      Overrides:
        `loadTranslations` in class `ApplicationContext`

    - #### getUserCache

          public UserCache getUserCache()

      Returns the clients `UserCache`, which keeps ever up-to-date session data of all connected clients.

    - #### getUserActionValidator

          public UserActionValidator getUserActionValidator()

    - #### getNetActionValidator

          public ClientActionValidator getNetActionValidator()

    - #### getAdminActionValidator

          public AdminActionValidator getAdminActionValidator()

    - #### getTaskManager

          public ClientTaskManager getTaskManager()

      Overrides:
        `getTaskManager` in class `ApplicationContext`

    - #### cancelTask

          public final boolean cancelTask(RemoteTaskId taskId,
                           SessionId sessId)

      Sends a `RemoteTaskCancelAgent` in order to cancel the remote task on the server. The local counterpart task remains untouched but will react on the remote cancel. Note that the `SessionId` is not necessarily the one of this client. The cancel request may have been received via `ClientCommand` i.e. from the servers administrator.

    - #### cancelTask

          public final boolean cancelTask(TaskId taskId)

      Description copied from class: `ApplicationContext`
      Cancels the async task.
      Overrides:
        `cancelTask` in class `ApplicationContext`
      Returns:
        true if the task was actually hit for cancellation

    - #### getMainFrame

          public ClientMainFrame getMainFrame()

      Returns the MainFrame of the client application as the central access point to it's GUI. Note that if the client is a co-client this method will throw an IllegalStateException because a co-client cannot have a GUI.
      Overrides:
        `getMainFrame` in class `ApplicationContext`

    - #### setMainFrame

          public void setMainFrame(ApplicationMainFrame mainFrame)

      Sets the MainFrame for this application.
      Overrides:
        `setMainFrame` in class `ApplicationContext`

    - #### isCoClient

          public final boolean isCoClient()

      Convenience method that tells whether this is an instance of `CoClientContext`

    - #### getServerMessageHandler

          public ServerNotificationHandler getServerMessageHandler()

      Gets the clients handler for received ServerMessages

    - #### getAgentParamsCache

          public java.util.Map<AgentId,PropertyMap> getAgentParamsCache()

      Returns a general purpose HashMap that can be used by agents for caching parameters

    - #### getClientCache

          public PowerMap getClientCache()

      Returns a general purpose Map for caching client data

    - #### getClientConfig

          public ClientConfig getClientConfig()

      Returns the command line configuration parameters of the client

    - #### readClientInfo

          public final ClientInfo readClientInfo()

      Creates and fills the client specific `ClientInfo` object. Calls `createClientInfo()` for creating the eventual specific subclass of `ClientInfo`.

    - #### createTaskManager

          protected ClientTaskManager createTaskManager()

      Overrides:
        `createTaskManager` in class `ApplicationContext`

    - #### createServerNotificationHandler

          protected abstract ServerNotificationHandler createServerNotificationHandler()

      Creates the `ServerNotificationHandler` instance used to handle received `ServerNotificationMessage`s

    - #### createClientInfo

          protected ClientInfo createClientInfo()

      Creates the client specific `ClientInfo` sub-type which contains client details info. This method is called each time a `ClientInfo` object is requested from the server. It is NOT called when the `ClientContext` is initialized.

    - #### toString

          public ToString toString(ToString s)

      Description copied from interface: `Dumpable`
      This method allows subclasses to add values to the existing ToString of the superclass. Usually subclasses only need to override this method.
      Specified by:
        `toString` in interface `Dumpable`
      Overrides:
        `toString` in class `ApplicationContext`

    - #### toDumpString

          public DumpString toDumpString(DumpString s)

      Description copied from interface: `Dumpable`
      This method allows subclasses to add values to the existing DumpString of the superclass. Usually subclasses only need to override this method.
      Specified by:
        `toDumpString` in interface `Dumpable`
      Overrides:
        `toDumpString` in class `ApplicationContext`

Copyright © 2014 EsprIT-Systems. All Rights Reserved.