oracle.adf.view.rich.model

## Class RemoteRegionModel

- java.lang.Object
- - oracle.adf.view.rich.model.RegionModel
  - - oracle.adf.view.rich.model.RemoteRegionModel

- All Implemented Interfaces:
    RemoteRegionListener

      public abstract class RemoteRegionModel
      extends RegionModel
      implements RemoteRegionListener

  Model for a remote Region Component. This model provides extensions that are needed to allow the Region to make a connection to another server. This version of the RegionModel also implements the contract for the RemoteRegionListener. The contract for this listener is the same as for the standard RemoteRegionListener except that the models beforeRequest is guarenteed to be executed before any other listener and it's endRequest is guarenteed to be executed after any other listener and no registration of the listener is necessary.
  Since:
    12.1.4.0
  See Also:
    `RemoteRegionListener`

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class oracle.adf.view.rich.model.RegionModel

      `RegionModel.RegionAction`

  - ### Field Summary

    - ### Fields inherited from class oracle.adf.view.rich.model.RegionModel

      `REMOTE_REGION_ATTRIB`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `RemoteRegionModel()`

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected void` | `addRegionClientId(String clientId, boolean isNew)` Called whenever a clientId is added to the RegionComponentClientId set.
    `abstract void` | `afterRequest(RemoteApplicationResponse resp, Map<String,Object> stateMap)` Executed after the request to the remote region.
    `abstract void` | `beforeRequest(RemoteApplicationRequest req, Map<String,Object> stateMap)` Executed before the request to the remote region.
    `void` | `clearRemoteApplicationInstance()` Removes the stored `RemoteApplicationInstance` from the model.
    `String` | `getBootstrap()` Return bootstrap
    `RemoteApplicationInstance` | `getRemoteApplicationInstance()` Returns the current RemoteApplicationInstance.
    `abstract ConcurrentHashMap<String,Serializable>` | `getRemoteAttributeMap()` Returns a map that may be used for persisted storage.
    `abstract URI` | `getURI()` Returns the URI for the remote application context.
    `boolean` | `isActive()` Allows the model to prevent a remote application call from being made.
    `boolean` | `isAuthorizationRequired()` Returns whether or not an authorization token should be provided on the first request.
    `boolean` | `isRemoteApplicationInstancePresent()` Tells whether there is a RemoteApplicationInstance stored in this model
    `protected void` | `queueRefreshEvent()` Queues a RegionRefreshEvent on all of the components which are represented by this RemoteRegionModel instance.
    `protected void` | `removeRegionClientId(String clientId)` Called whenever a clientId is removed from the RegionComponentClientId set.
    `void` | `setRemoteApplicationInstance(RemoteApplicationInstance instance)` Sets the current RemoteApplicationInstance.

    - ### Methods inherited from class oracle.adf.view.rich.model.RegionModel

      `getActions, getCapabilities, getRegionComponentClientIds, getRegionModelListener, getUncommittedDataWarning, getViewHandle, getViewId, isComponentPresent, isDataDirty, isRemoteConsumerModel, isRemoteProducerModel, markRegionDirty, processBeginRegion, processBeginRegion, processEndRegion, processEndRegion, refresh, release, setRegionModelListener`

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

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

- - ### Constructor Detail

    - #### RemoteRegionModel

          public RemoteRegionModel()

  - ### Method Detail

    - #### beforeRequest

          public abstract void beforeRequest(RemoteApplicationRequest req,
                                             Map<String,Object> stateMap)

      Executed before the request to the remote region. This allows the listener to add tasks to it's task handler. This listener is always guarenteed to be executed while the region is in context, meaning that the processBeginRegion will have run.
      Specified by:
        `beforeRequest` in interface `RemoteRegionListener`
      Parameters:
        `req` - the Response from the remote server
        `stateMap` - a of string keys and object values that provides temporary storage between the begin and the beforeRequest and afterRequest methods.
      See Also:
        `RemoteRegionListener`

    - #### afterRequest

          public abstract void afterRequest(RemoteApplicationResponse resp,
                                            Map<String,Object> stateMap)

      Executed after the request to the remote region. This allows the listener to receive input from its task handlers.
      Specified by:
        `afterRequest` in interface `RemoteRegionListener`
      Parameters:
        `resp` - the Response from the remote server
        `stateMap` - a of string keys and object values that provides temporary storage between the begin and the beforeRequest and afterRequest methods.
      See Also:
        `RemoteRegionListener`

    - #### getURI

          public abstract URI getURI()

      Returns the URI for the remote application context. This includes the any server prefix needed for the remote application on the remote server (like ws-faces/) but DOES NOT include the location of the bootstrap.. This should be able to change from request to request.
      Returns:
        the URI for the remote application.

    - #### isAuthorizationRequired

          public boolean isAuthorizationRequired()

      Returns whether or not an authorization token should be provided on the first request. If this is false and authorization is needed, the server will still go though a standard challenge/response negotiation with the producer, but if this is true the authorization will still be provided on the first request to a server in order to save the additional round trip.
      Returns:
        a boolean containing `true` if authorization should be sent on the first call to the producer and `false` if the normal challenge/response should be used.

    - #### isActive

          public boolean isActive()

      Allows the model to prevent a remote application call from being made. If this is false, any requests to the producer will be skipped.
      Returns:
        a boolean containing `false` if the remote connection is not needed or `true` if it is.

    - #### getRemoteAttributeMap

          public abstract ConcurrentHashMap<String,Serializable> getRemoteAttributeMap()

      Returns a map that may be used for persisted storage. The remote region is stateful and this map allows the RemoteRegion to store attributes which will help allow it to persist data needed to manage the remote connection.

      It is important to not that this map has two requirements. First is must be thread-safe and second is it must be serializable. As such, the ConcurrentHashMap is returned from this method rather then a more generic type.

      Returns:
        a `ConcurrentHashMap` containing the modules state

    - #### setRemoteApplicationInstance

          public void setRemoteApplicationInstance(RemoteApplicationInstance instance)

      Sets the current RemoteApplicationInstance. The remote region is stateful and this is one of the properties that needs to be maintained from request to request. If the RemoteApplicationInstance is `null` then it should be the same as unsetting the instance value such that calls to `getRemoteApplicationInstance()` return `null`. This method will change both the persisted RemoteApplicationInstance as well as the locally stored instance.
      Parameters:
        `instance` - the RemoteApplicationInstance for this region or `null`

    - #### clearRemoteApplicationInstance

          public void clearRemoteApplicationInstance()

      Removes the stored `RemoteApplicationInstance` from the model.

    - #### getRemoteApplicationInstance

          public RemoteApplicationInstance getRemoteApplicationInstance()

      Returns the current RemoteApplicationInstance. The first time this method is run for a particular RemoteRegionModel instance, it will pull the persisted value of the RemoteApplicationInstance from the persisted state. From there on, it will use a "cached" copy of the object to prevent the RemoteApplicationInstance from changing durring the processing of the remote region. Only `setRemoteApplicationInstance(RemoteApplicationInstance)` will change the locally stored copy.
      Returns:
        the current `RemoteApplicationInstance` or `null` if one has not been stored.

    - #### isRemoteApplicationInstancePresent

          public boolean isRemoteApplicationInstancePresent()

      Tells whether there is a RemoteApplicationInstance stored in this model
      Returns:
        true if the model is stored in the remote application instance.

    - #### getBootstrap

          public String getBootstrap()

      Return bootstrap
      Returns:
        RemoteRegionBootstrap jsf or jspx

    - #### queueRefreshEvent

          protected void queueRefreshEvent()

      Queues a RegionRefreshEvent on all of the components which are represented by this RemoteRegionModel instance. Please note that while queueing the RefreshEvent is expected to function properly under all circumstances, marking the region as dirty AFTER queueing the event may result in a secondary request in some circumstances. For performance reasons, IF the region needs to be marked dirty, it should be done BEFORE queuing the event.

    - #### addRegionClientId

          protected void addRegionClientId(String clientId,
                                           boolean isNew)

      Description copied from class: `RegionModel`
      Called whenever a clientId is added to the RegionComponentClientId set. This method is called regardless of whether the item is new or not. This is because sometimes the cache on the model may be out of date, and "add" logic might need to be performed regardless of whether the cache is up to date or not. The isNew parameter will allow the implementation to decide which logic to run and when.

      By default this method ensures that the client ID does NOT appear in the list of RemoteRegions. For RemoteRegion functionality, ADFFaces needs to maintain a set of clientId's that are remote. This version of the method ensures the region DOES NOT appear in this list.

      Overrides:
        `addRegionClientId` in class `RegionModel`
      Parameters:
        `clientId` - the Client Id
        `isNew` - if this is a new component. This is not used.

    - #### removeRegionClientId

          protected void removeRegionClientId(String clientId)

      Description copied from class: `RegionModel`
      Called whenever a clientId is removed from the RegionComponentClientId set. This method will only be run if a clientId was actually removed .
      Overrides:
        `removeRegionClientId` in class `RegionModel`
      Parameters:
        `clientId` - the client id.

Copyright (c) 1998, 2018, Oracle and/or its affiliates. All rights reserved.