com.softwareag.cis.plugin.adapter.util
Class CommonAdapter

java.lang.Object
  extended by com.softwareag.cis.server.Adapter
      extended by com.softwareag.cis.plugin.adapter.util.CommonAdapter
All Implemented Interfaces:
com.softwareag.cis.server.IAdapter, com.softwareag.cis.server.IServerLogConstants, com.softwareag.cis.util.IControlStatusConstants
Direct Known Subclasses:
ButtonPromptAdapter, ExecuteDeferredAdapter, LoginAdapter, MessageBoxAdapter, SystemInfoAdapter

public abstract class CommonAdapter
extends com.softwareag.cis.server.Adapter

An adapter which takes over common tasks needed by all adapters: - exception handling: a popup dialog occurs when an exception is observed


Nested Class Summary
 
Nested classes/interfaces inherited from class com.softwareag.cis.server.Adapter
com.softwareag.cis.server.Adapter.CISAddons, com.softwareag.cis.server.Adapter.FrameMessage, com.softwareag.cis.server.Adapter.ICISStyleAddon, com.softwareag.cis.server.Adapter.LivingPopupFunctions
 
Field Summary
 
Fields inherited from class com.softwareag.cis.server.Adapter
DT_BARS, DT_LINES, DT_POINTS, FIELD_BOTHIDANDTEXT, FIELD_ONLYID, FIELD_ONLYTEXT, MLMSG, MT_ERROR, MT_ERROR_MULTILINE, MT_SUCCESS, MT_SUCCESS_MULTILINE, MT_WARNING, MT_WARNING_MULTILINE, POP_POS_CLICK
 
Fields inherited from interface com.softwareag.cis.server.IServerLogConstants
LOG_DEBUG, LOG_ERROR, LOG_INFO, LOG_WARNING
 
Fields inherited from interface com.softwareag.cis.util.IControlStatusConstants
CS_DISPLAY, CS_EDIT, CS_ERROR, CS_ERROR_DISPLAY, CS_ERROR_NO_FOCUS, CS_FOCUS, CS_INVISIBLE
 
Constructor Summary
CommonAdapter()
           
 
Method Summary
 void activate(java.lang.String sessionId, java.lang.String processId, java.lang.String adapterId)
          Default implementation of the activate method which is called when processing a screen request.
static boolean addRecentlyProcessedAdapter(com.softwareag.cis.server.Adapter adapter)
          Add given adapter to list of recently processed adapters
 void close()
          closePage() if the page is running in pop-up.
 void closePage()
          Close the page.
 void destroy()
          If a session is taken out of the session management then its contents is "destroyed".
 void endProcess()
          Just close the page without prompting.
 void executeDeferred(RunnableDeferred runnable)
          This method allows registration of a Runnable to be executed after the current workplace frame had been closed.
static void executeDeferred(RunnableDeferred runnable, com.softwareag.cis.server.Adapter adapter)
           
 void executeEndProcess()
          Closes the current page via two activities:
(1) The current page is taken out of the workplace administration, if there is one.
 boolean executeIfAllowedToLooseFocus(com.softwareag.cis.server.util.ICommand cmd)
          Execute command if this adapter may loose focus.
static void executeNow(RunnableDeferred runnable, com.softwareag.cis.server.Adapter adapter)
          Execute given RunnableDeferred with its own class loader set as context class loader
static java.util.Collection<com.softwareag.cis.server.Adapter> findKnownAdapters(com.softwareag.cis.server.Adapter contextAdapter, java.lang.Class<?> adapterClass)
          Obtain collection of all known adapter instances which are (a) alive and (b) an instance of the specified class
 java.lang.String findRelatedMenuExtensionId()
          Default implementation.
 CommonAdapter getAdapter()
          Return this adapter - for usage e.g. within inner classes.
static com.softwareag.cis.server.Adapter getAdapterForSubSession(com.softwareag.cis.context.ILookupContext ctx, java.lang.String subSessionId)
          Get the adapter from the known activities and subSessionId
 ApplicationContext getApplicationContext()
           
 com.softwareag.cis.server.Adapter getBaseAdapter()
           
static java.util.Collection<com.softwareag.cis.server.Adapter> getCurrentAdapters(com.softwareag.cis.server.Adapter contextAdapter)
          Get collection of currently known adapters for open windows
 java.util.Locale getLocale()
          Obtain Locale to be used within current session The session context is obtained from this adapter
static java.util.Locale getLocale(com.softwareag.cis.server.Adapter adapter)
          Obtain Locale to be used within current session
static com.softwareag.cis.server.Adapter getPreviousAdapter(com.softwareag.cis.server.Adapter adapter)
           
 com.softwareag.cis.workplace.MFWorkplaceAdapter getWorkplaceAdapter()
          Retrieve the workplace adapter from the current session.
 boolean handleErrorDuringGetPhase(java.lang.Throwable t)
          Handle error during adapter lifecycle GET phase.
 boolean handleErrorDuringInitPhase(java.lang.Throwable t)
          Handle error during adapter lifecycle INIT phase.
 boolean handleErrorDuringInvokePhase(java.lang.Throwable t)
          Handle error during adapter lifecycle INVOKE phase.
 boolean handleErrorDuringSetPhase(java.lang.Throwable t)
          Handle error during adapter lifecycle SET phase.
 void handleRefreshRequest()
          will be called from other frames in case of UI refresh request created by other adapters
 void hasBeenActivated()
          This method will be invoked when switching to an open workplace activity using a CommonAdapter May be overwritten by subclasses when needed.
static boolean isAlive(com.softwareag.cis.server.Adapter adapter)
          Check whether adapter is alive
 boolean isClosed()
          Check whether this adapter has been closed
static boolean isDeadAdapter(com.softwareag.cis.server.Adapter adapter)
          Check whether given adapter is dead (layout has been closed)
 void passivate(java.lang.String sessionId, java.lang.String processId, java.lang.String adapterId)
          Default implementation used for performance logging
 void reactOnDataCollectionEnd()
           
 void reactOnDataCollectionStart()
           
 void reactOnDataTransferEnd()
           
 void reactOnDataTransferStart()
           
static void refreshTargetIfNeeded(com.softwareag.cis.server.Adapter adapter, java.lang.String targetFrame)
          This method can be used to enforce synchronization of the browser client if there are pending changes on the client side.
static void registerActivity(java.lang.String subSessionId, com.softwareag.cis.server.Adapter adapter)
          Register the adapter for the current activity if not already registered
static void removeKnownAdapter(com.softwareag.cis.server.Adapter adapter)
          Remove given Adapter from set of adapters working for the current session
 void switchToPage(java.lang.String page, java.lang.String pageId)
          Extended method to navigate to a page - influencing in detail the way the Application Designer runtime finds an adapter object for a page.
static void unregisterActivity(com.softwareag.cis.server.Adapter adapter)
          Unregister the adapter if it is responsible for any of the known activities
 
Methods inherited from class com.softwareag.cis.server.Adapter
addAccessPathExtension, addAdapterListener, addPagePopupCommand, appendHTMLToPageName, applyFilterDataCollection, checkIfAdapterExists, checkIfAdapterExists, checkIfAdapterExists, checkIfAdapterExists, checkIfInDevelopmentMode, checkIsPopupClosing, checkIsPopupOpening, closePagePopup, closeTitleBarPopup, closeWindow, deserialize, findAccessPathExtensions, findAdapter, findAdapter, findAdapter, findAdapter, findAdapter, findAdapter, findAdapter, findAdapter, findAdapter, findAdapterForPage, findAdapterForPage, findAdapterId, findAdapterListener, findAdditionalAdaptersInRepsonse, findCISSessionContext, findCurrentlyProcessedAdapter, findCurrentlyProcessedMethod, findCurrentlyRequestedAdapter, findFilterDataCollection, findFunctionsLivingPopup, findHelpId, findHttpServletRequest, findHttpServletResponse, findInitParam, findInitParamMap, findInteractionObjectInfo, findPageApplication, findPageContextRoot, findPageFileName, findPagePixelHeight, findPagePixelWidth, findPageURL, findRepeatIndex, findSAMLArtifact, findServletContext, findSessionContext, findSessionId, findSubSessionContext, findSubsessionId, findValueRequestProperty, forcePageReload, getCISAddons, getCISContextMenuItems, getCISFIELDTextIdMode, getCISObjects1, getCloseWindow, getDateDisplay, getDecimalSeparator, getDisplayType, getFdiw, getForcePageReload, getFrameMessages, getIntPopupsEnabled, getIsDisplayTypeSWT, getLanguage, getMessageLongText, getMessageShortText, getMessageType, getNextPage, getNextPageId, getNextPagePopupCommands, getNextPopup, getNextPopupFeatures, getNextPopupId, getNextPopupMenuFeatures, getNextPopupModal, getNextPopupOnCloseMethod, getNextPopupOnCloseProperty, getNextPopupOnClosePropertyV, getNextPopupSessionId, getNextPopupSubsessionId, getNextPopupTitle, getPageName, getPagePopupCommands, getRefreshParent, getStyle, getTimeDisplay, getTimeZoneOffset, getXMLDataMode, includeAdapterInResponse, includeAdapterInResponse, includeAdapterInResponse, includeAdapterInResponse, init, invokeMethodInTarget, isRunningInPopup, isSubPageRefresh, markSubPageAdapterForDestroy, markThisAdapterForDestroy, openCISPageInNewWindow, openCISPageInTarget, openCISPageInTarget, openCISPageInTarget, openIdValueCombo, openIdValueComboOrPopup, openIdValueHelp, openModelessPopup, openModelessPopup, openModelessPopup, openPageAndRestartSession, openPageInNewWindow, openPageInTarget, openPagePopup, openPagePopup, openPopup, openPopup, openPopupInDiv, openPopupInNewSubSession, outputMessage, outputMessage, outputMessage, processAsDefault, reactOnDataCollectionEndInternal, reactOnHelpRequestForHelpId, reactOnInvokePhaseEnd, reactOnInvokePhaseStart, reactOnMFWorkplaceActivityRestart, reactOnMFWorkplaceActivityStart, reactOnPopupClosedByUser, reactOnPopupMenuClosedByUser, reactOnRequestProcessingStart, reactonStatusBarHelpRequest, refreshParent, refreshScreenOccuranceOfAdapter, refreshScreenOccuranceOfAdapter, refreshScreenOccuranceOfAdapter, refreshTarget, removeAdapterListener, replaceLiteral, replaceLiteral, replaceLiteral, replaceLiteral, replaceLiteralFromProject, replaceLiteralFromProject, replaceLiteralFromProject, replaceLiteralFromProject, repointFocusInScreen, repointFocusInScreen, repointFocusInScreen, serialize, setAdapterName, setApplication, setCISubPageRefresh, setCurrentlyProcessedAdapter, setCurrentlyRequestedAdapter, setDateDisplay, setDecimalSeparator, setDisplayType, setInteractionAdapterId, setInteractionProcess, setIntPopupsEnabled, setIsPopup, setLanguage, setPageFileName, setPageInitParam, setPageInitParamMap, setPageName, setPagePixelHeight, setPagePixelWidth, setPageURL, setParam1, setParam2, setPopupFeatures, setPopupFeatures, setPopupMenuFeatures, setPopupOnCloseMethod, setPopupTitle, setRepeatIndex, setStyle, setTimeDisplay, setTimeZoneOffset, setTraceCheckValue, setXMLDataMode, showPopupMenu, showPopupMenu, sizeTarget, switchScreenOccuranceOfSubsession, switchToPage
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CommonAdapter

public CommonAdapter()
Method Detail

getAdapter

public CommonAdapter getAdapter()
Return this adapter - for usage e.g. within inner classes.

Returns:
this adapter

getWorkplaceAdapter

public com.softwareag.cis.workplace.MFWorkplaceAdapter getWorkplaceAdapter()
Retrieve the workplace adapter from the current session.

Returns:
MFWorkplaceAdapter The workplace adapter.

getLocale

public java.util.Locale getLocale()
Obtain Locale to be used within current session The session context is obtained from this adapter

Returns:
the Locale

getLocale

public static java.util.Locale getLocale(com.softwareag.cis.server.Adapter adapter)
Obtain Locale to be used within current session

Parameters:
adapter - The adapter used to obtain the session context
Returns:
the Locale

handleErrorDuringGetPhase

public boolean handleErrorDuringGetPhase(java.lang.Throwable t)
Handle error during adapter lifecycle GET phase.

Specified by:
handleErrorDuringGetPhase in interface com.softwareag.cis.server.IAdapter
Overrides:
handleErrorDuringGetPhase in class com.softwareag.cis.server.Adapter

handleErrorDuringInitPhase

public boolean handleErrorDuringInitPhase(java.lang.Throwable t)
Handle error during adapter lifecycle INIT phase.

Specified by:
handleErrorDuringInitPhase in interface com.softwareag.cis.server.IAdapter
Overrides:
handleErrorDuringInitPhase in class com.softwareag.cis.server.Adapter

handleErrorDuringInvokePhase

public boolean handleErrorDuringInvokePhase(java.lang.Throwable t)
Handle error during adapter lifecycle INVOKE phase.

Specified by:
handleErrorDuringInvokePhase in interface com.softwareag.cis.server.IAdapter
Overrides:
handleErrorDuringInvokePhase in class com.softwareag.cis.server.Adapter

handleErrorDuringSetPhase

public boolean handleErrorDuringSetPhase(java.lang.Throwable t)
Handle error during adapter lifecycle SET phase.

Specified by:
handleErrorDuringSetPhase in interface com.softwareag.cis.server.IAdapter
Overrides:
handleErrorDuringSetPhase in class com.softwareag.cis.server.Adapter

executeIfAllowedToLooseFocus

public boolean executeIfAllowedToLooseFocus(com.softwareag.cis.server.util.ICommand cmd)
Execute command if this adapter may loose focus. This method may be superseeeded by subclasses

Parameters:
cmd - The command to be executed
Returns:
false e.g. if editing for current item is pending.

switchToPage

public void switchToPage(java.lang.String page,
                         java.lang.String pageId)
Extended method to navigate to a page - influencing in detail the way the Application Designer runtime finds an adapter object for a page. Normally inside one sub-session there is one adapter per adapter class. You may have multiple by separating them from one another via an id. This is passed as additional parameter inside this method.

Overrides:
switchToPage in class com.softwareag.cis.server.Adapter
Parameters:
page - Path to the html file of the page to be displayed.
pageId - ID of the page.

findRelatedMenuExtensionId

public java.lang.String findRelatedMenuExtensionId()
Default implementation. Returning null.


executeEndProcess

public void executeEndProcess()
Closes the current page via two activities:
(1) The current page is taken out of the workplace administration, if there is one.
(2) The sub session which the current page belongs to is taken out of the session management.
You normally have to override this method if you work in a different workplace environment than the CIS workplace.


endProcess

public void endProcess()
Just close the page without prompting.

Overrides:
endProcess in class com.softwareag.cis.server.Adapter

closePage

public void closePage()
Close the page.

Overrides:
closePage in class com.softwareag.cis.server.Adapter

close

public void close()
closePage() if the page is running in pop-up. endProcess() otherwise.


destroy

public void destroy()
If a session is taken out of the session management then its contents is "destroyed".

Specified by:
destroy in interface com.softwareag.cis.server.IAdapter
Overrides:
destroy in class com.softwareag.cis.server.Adapter

handleRefreshRequest

public void handleRefreshRequest()
will be called from other frames in case of UI refresh request created by other adapters


executeDeferred

public static void executeDeferred(RunnableDeferred runnable,
                                   com.softwareag.cis.server.Adapter adapter)

executeDeferred

public void executeDeferred(RunnableDeferred runnable)
This method allows registration of a Runnable to be executed after the current workplace frame had been closed. Special use case: "Export" dialog closes but the download dialog shall popup in front.


executeNow

public static void executeNow(RunnableDeferred runnable,
                              com.softwareag.cis.server.Adapter adapter)
Execute given RunnableDeferred with its own class loader set as context class loader

Parameters:
runnable - The RunnableDeferred to be executed now
adapter - Adapter provided for context information

reactOnDataTransferStart

public void reactOnDataTransferStart()
Specified by:
reactOnDataTransferStart in interface com.softwareag.cis.server.IAdapter
Overrides:
reactOnDataTransferStart in class com.softwareag.cis.server.Adapter

reactOnDataTransferEnd

public void reactOnDataTransferEnd()
Specified by:
reactOnDataTransferEnd in interface com.softwareag.cis.server.IAdapter
Overrides:
reactOnDataTransferEnd in class com.softwareag.cis.server.Adapter

reactOnDataCollectionStart

public void reactOnDataCollectionStart()
Specified by:
reactOnDataCollectionStart in interface com.softwareag.cis.server.IAdapter
Overrides:
reactOnDataCollectionStart in class com.softwareag.cis.server.Adapter

reactOnDataCollectionEnd

public void reactOnDataCollectionEnd()
Specified by:
reactOnDataCollectionEnd in interface com.softwareag.cis.server.IAdapter
Overrides:
reactOnDataCollectionEnd in class com.softwareag.cis.server.Adapter

isAlive

public static boolean isAlive(com.softwareag.cis.server.Adapter adapter)
Check whether adapter is alive

Parameters:
adapter - The adapter to be checked
Returns:
true if alive

addRecentlyProcessedAdapter

public static boolean addRecentlyProcessedAdapter(com.softwareag.cis.server.Adapter adapter)
Add given adapter to list of recently processed adapters

Returns:
true if adapter has been appended to list

getPreviousAdapter

public static com.softwareag.cis.server.Adapter getPreviousAdapter(com.softwareag.cis.server.Adapter adapter)

getBaseAdapter

public com.softwareag.cis.server.Adapter getBaseAdapter()

removeKnownAdapter

public static void removeKnownAdapter(com.softwareag.cis.server.Adapter adapter)
Remove given Adapter from set of adapters working for the current session


registerActivity

public static void registerActivity(java.lang.String subSessionId,
                                    com.softwareag.cis.server.Adapter adapter)
Register the adapter for the current activity if not already registered

Parameters:
subSessionId - The current sub-session id
adapter - The adapter to be registered

unregisterActivity

public static void unregisterActivity(com.softwareag.cis.server.Adapter adapter)
Unregister the adapter if it is responsible for any of the known activities

Parameters:
adapter - The adapter to be unregistered

getAdapterForSubSession

public static com.softwareag.cis.server.Adapter getAdapterForSubSession(com.softwareag.cis.context.ILookupContext ctx,
                                                                        java.lang.String subSessionId)
Get the adapter from the known activities and subSessionId

Returns:
the adapter from the known activities and subSessionId

findKnownAdapters

public static java.util.Collection<com.softwareag.cis.server.Adapter> findKnownAdapters(com.softwareag.cis.server.Adapter contextAdapter,
                                                                                        java.lang.Class<?> adapterClass)
Obtain collection of all known adapter instances which are (a) alive and (b) an instance of the specified class

Parameters:
contextAdapter - The context adapter used to obtain the list of known adapters in this session
adapterClass - The class whose instances are being searched - if null, this parameter is ignored
Returns:
a collection of all matching adapters belonging to the current session

getCurrentAdapters

public static java.util.Collection<com.softwareag.cis.server.Adapter> getCurrentAdapters(com.softwareag.cis.server.Adapter contextAdapter)
Get collection of currently known adapters for open windows


isDeadAdapter

public static boolean isDeadAdapter(com.softwareag.cis.server.Adapter adapter)
Check whether given adapter is dead (layout has been closed)

Returns:
true if adapter is dead, false otherwise

isClosed

public boolean isClosed()
Check whether this adapter has been closed

Returns:
true if closed

hasBeenActivated

public void hasBeenActivated()
This method will be invoked when switching to an open workplace activity using a CommonAdapter May be overwritten by subclasses when needed.


refreshTargetIfNeeded

public static void refreshTargetIfNeeded(com.softwareag.cis.server.Adapter adapter,
                                         java.lang.String targetFrame)
This method can be used to enforce synchronization of the browser client if there are pending changes on the client side. It will not enforce a retrieval of data from the server. Hence it is cheaper that a call to Adapter.refreshTarget()

Parameters:
adapter - The currently processed adapter used to enqueue the refresh request. In general, this is not the adapter for the layout to be refreshed.
targetFrame - The frame to be refreshed

getApplicationContext

public ApplicationContext getApplicationContext()

activate

public void activate(java.lang.String sessionId,
                     java.lang.String processId,
                     java.lang.String adapterId)
Default implementation of the activate method which is called when processing a screen request. Used for performance logging

Specified by:
activate in interface com.softwareag.cis.server.IAdapter
Overrides:
activate in class com.softwareag.cis.server.Adapter

passivate

public void passivate(java.lang.String sessionId,
                      java.lang.String processId,
                      java.lang.String adapterId)
Default implementation used for performance logging

Specified by:
passivate in interface com.softwareag.cis.server.IAdapter
Overrides:
passivate in class com.softwareag.cis.server.Adapter