com.microfocus.awm.model.internal

## Class ExecutionContext

- java.lang.Object
- - com.microfocus.awm.model.internal.ExecutionContext

- All Implemented Interfaces:
    IExecutionContext

      public class ExecutionContext
      extends java.lang.Object
      implements IExecutionContext

  Internal implementation of the `IExecutionContext`.

  Author:
    Ralf Pakosch, Christelle Biahmou, Joachim Kaltenbach

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `ExecutionContext(ISystemImage pSys)` Constructor for a context without an action descriptor.
    `ExecutionContext(ISystemImage pSys, ActionDescriptor pActionDescriptor)` Basic constructor.

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addParmForOutputDialog(RToolOutParameter pOutParm)` Parameters added to the ExecutionContext by this Method will be shown in an output dialog at the end of an Action.
    `void` | `addResource(IResource pRes, java.lang.String pName)` Adds an `IResource` with the given name.
    `void` | `addResourceToMemory(IResource pResource)` Adds a resource to the context memory.
    `void` | `addToolExecStatus(ToolExecutionStatus pToolStatus)` Adds a tool execution status to the list of statuses.
    `IExecutionContext` | `duplicate()` Duplicates this execution context, including the following information: Context parameters Memory (previous tool) parameters Context Resource TAURUS System
    `java.util.Map<Property,IPropertyValue>` | `getActionContextMap()` Receives a map with all Properties which have been created based on a resource and/or manually added Properties.
    `ActionDescriptor` | `getActionDescriptor()` Gets the `ActionDescriptor` of the context.
    `java.util.List<IResource>` | `getContextResources()` Returns a list of context resources.
    `FileDescriptor` | `getFileFromContext(FileDescriptor pFileDescr)` Retrieves a FileDescriptor from the context map.
    `FileDescriptor` | `getFileFromMemory(java.lang.String pFileDescrID)` Retrieves a FileDescriptor from the context memory Map.
    `java.util.Map<java.lang.String,FileDescriptor>` | `getFileMemory()` Gets the file memory which contains file descriptors with resolved physical names which were returned by previous tools of an action.
    `java.util.ArrayList<IExecutionContext>` | `getMassProcessingContexts()` Returns a list of execution contexts for every resource that is being processed by a mass processing action.
    `java.util.List<IResource>` | `getMemoryResources()` Gets resources that have been added to the context by tools.
    `java.util.Map<Property,IPropertyValue>` | `getParameterMemoryMap()` Receives a map with all Properties which have been saved in the context.
    `static IPropertyValue` | `getParmeterFromContext(IExecutionContext pContext, Property pProperty)` This method tries to execute an internal method to return the `IPropertyValue` of a `Property` from the context.
    `static IPropertyValue` | `getParmeterFromMemory(IExecutionContext pContext, Property pProperty)` This method tries to execute an internal method to return the `IPropertyValue` of a `Property` from the memory.
    `IPropertyValue` | `getParmFromContext(Property pProperty)` Receives a Property from the ExecutionContext.
    `IPropertyValue` | `getParmFromMemory(Property pKey)` Retrieves a parameter Property from a map where previous tools might have stored their output parameter Properties.
    `java.util.List<RToolOutParameter>` | `getParmsForOutputDialog()` Returns a List of `RToolOutParameter`s, which have the attribute `To_OutputDialog` set to `true`.
    `IResource` | `getResource()` Receives the resource which is assigned to this context.
    `IResource` | `getResource(java.lang.String pName)` Returns the `IResource` with the given name, which has been added to the context by a resource operation (tool defined resource processing).
    `IExecutionContext` | `getResourceContext(java.lang.String pResourceName)` Returns the `IExecutionContext` of a resource with a logical name.
    `ISystemImage` | `getSystemImage()` Gets the `ISystemImage` the context is connected with.
    `java.util.List<ToolExecutionStatus>` | `getToolExecStatusList()` Gets a list of tool execution statuses.
    `IExecutionContext` | `initContext(IResource pRes)` Initializes the IExecutionContext from the given resource.
    `IExecutionContext` | `initContext(java.util.List<IResource> pResources)` Initializes the IExecutionContext from the list of resources.
    `void` | `populateContext(IResource pRes)` Deprecated.
    `void` | `putFileParmIntoMemory(FileDescriptor pFileDescriptor)` Puts a File Descriptor in the execution memory.
    `void` | `putParmIntoContext(Property pProp, IPropertyValue pPropValue)` Manually puts a Property into the context Map.
    `void` | `putParmIntoMemory(Property pProp, IPropertyValue pPropValue)` Puts a parameter Property into a map, providing them to following tools during the execution.
    `void` | `setActionContext(java.util.Map<Property,IPropertyValue> pActionContext)` Set the action context of the execution context.
    `void` | `setContextResources(java.util.List<IResource> pContextResources)` Sets the context resources for mass processing.
    `void` | `setFileMemory(java.util.Map<java.lang.String,FileDescriptor> pFileMemory)` Completely sets the file memory of this context.
    `void` | `setParmMemory(java.util.Map<Property,IPropertyValue> pParmMemory)` Set the parameter memory of the execution context.
    `void` | `setResource(IResource pResource)` Sets the resource of this context.

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

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

- - ### Constructor Detail

    - #### ExecutionContext

          public ExecutionContext(ISystemImage pSys)

      Constructor for a context without an action descriptor.
      Parameters:
        `pSys` - the system image (must not be `null`)

    - #### ExecutionContext

          public ExecutionContext(ISystemImage pSys,
                                  ActionDescriptor pActionDescriptor)

      Basic constructor.
      Parameters:
        `pSys` - the system image (must not be `null`)
        `pActionDescriptor` - the action descriptor

  - ### Method Detail

    - #### getParmeterFromContext

          public static IPropertyValue getParmeterFromContext(IExecutionContext pContext,
                                                              Property pProperty)

      This method tries to execute an internal method to return the `IPropertyValue` of a `Property` from the context.

      If the `IExecutionContext` is an instance of `ExecutionContext`, the internal method is used, which has a better performance (returns `null` if the `IPropertyValue` could not be retrieved). Else `IExecutionContext.getParmFromContext(Property)` is used to retrieve the `IPropertyValue` (throws an `TaurusToolException` if the `IPropertyValue` could not be retrieved (Bad performance)).

      Parameters:
        `pContext` - the context for retrieving the `IPropertyValue`.
        `pProperty` - the desired `Property`
      Returns:
        the `IPropertyValue` or `null`, if none is found.

    - #### getParmeterFromMemory

          public static IPropertyValue getParmeterFromMemory(IExecutionContext pContext,
                                                             Property pProperty)

      This method tries to execute an internal method to return the `IPropertyValue` of a `Property` from the memory.

      If the `IExecutionContext` is an instance of `ExecutionContext`, the internal method is used, which has a better performance (returns `null` if the `IPropertyValue` could not be retrieved). Else `IExecutionContext.getParmFromMemory(Property)` is used to retrieve the `IPropertyValue` (throws an `TaurusToolException` if the `IPropertyValue` could not be retrieved (Bad performance)).

      Parameters:
        `pContext` - the context for retrieving the `IPropertyValue`.
        `pProperty` - the desired `Property`
      Returns:
        the `IPropertyValue` or `null`, if none is found.

    - #### addParmForOutputDialog

          public void addParmForOutputDialog(RToolOutParameter pOutParm)

      Description copied from interface: `IExecutionContext`
      Parameters added to the ExecutionContext by this Method will be shown in an output dialog at the end of an Action.
      Specified by:
        `addParmForOutputDialog` in interface `IExecutionContext`
      Parameters:
        `pOutParm` - The `RToolOutParameter` or `RToolFileOutput` to be shown in an output dialog.

    - #### getActionContextMap

          public java.util.Map<Property,IPropertyValue> getActionContextMap()

      Description copied from interface: `IExecutionContext`
      Receives a map with all Properties which have been created based on a resource and/or manually added Properties.

      Specified by:
        `getActionContextMap` in interface `IExecutionContext`
      Returns:
        a map which contains every Property stored in the ExecutionContext except output parameters from previous tools

    - #### getActionDescriptor

          public ActionDescriptor getActionDescriptor()

      Description copied from interface: `IExecutionContext`
      Gets the `ActionDescriptor` of the context. Note that a context can be created without an action descriptor so this method can return `null`.
      Specified by:
        `getActionDescriptor` in interface `IExecutionContext`
      Returns:
        an action descriptor or `null`.

    - #### getFileFromMemory

          public FileDescriptor getFileFromMemory(java.lang.String pFileDescrID)
                                           throws TaurusToolException

      Description copied from interface: `IExecutionContext`
      Retrieves a FileDescriptor from the context memory Map. FileDescriptors within this Map were set by previous tools during the execution of an Action.

      Usually this will be used when the `NamePhysical` or the `Type` attributes of a FileDescriptor were changed by a previous tool.

      Specified by:
        `getFileFromMemory` in interface `IExecutionContext`
      Parameters:
        `pFileDescrID` - The ID of the desired FileDescriptor
      Returns:
        The desired FileDescriptor
      Throws:
        `TaurusToolException` - if the FileDescriptor does not exist within the parameter memory.

    - #### getParameterMemoryMap

          public java.util.Map<Property,IPropertyValue> getParameterMemoryMap()

      Description copied from interface: `IExecutionContext`
      Receives a map with all Properties which have been saved in the context. In TAURUS every outgoing parameter will be saved in the context, meaning that the ParameterMemoryMap grows during the execution of several tools in a row.
      Specified by:
        `getParameterMemoryMap` in interface `IExecutionContext`
      Returns:
        a map which contains every output parameter which was stored there by previous tools

    - #### getParmFromContext

          public IPropertyValue getParmFromContext(Property pProperty)
                                            throws TaurusToolException

      Description copied from interface: `IExecutionContext`
      Receives a Property from the ExecutionContext. Usually the context was initialized by the `IExecutionContext.initContext(IResource)` method.

      Properties could have also been added by the `IExecutionContext.putParmIntoContext(Property, IPropertyValue)` method.

      Specified by:
        `getParmFromContext` in interface `IExecutionContext`
      Parameters:
        `pProperty` - The desired Property
      Returns:
        the corresponding IPropertyValue
      Throws:
        `TaurusToolException` - if no value for the property was found in the context.

    - #### getParmFromMemory

          public IPropertyValue getParmFromMemory(Property pKey)
                                           throws TaurusToolException

      Description copied from interface: `IExecutionContext`
      Retrieves a parameter Property from a map where previous tools might have stored their output parameter Properties. This map does not contain Properties from the context of the execution.
      Specified by:
        `getParmFromMemory` in interface `IExecutionContext`
      Parameters:
        `pKey` - The Property which should be retrieved
      Returns:
        The corresponding IPropertyValue
      Throws:
        `TaurusToolException` - if no value for the property was found in the memory.

    - #### getParmsForOutputDialog

          public java.util.List<RToolOutParameter> getParmsForOutputDialog()

      Description copied from interface: `IExecutionContext`
      Returns a List of `RToolOutParameter`s, which have the attribute `To_OutputDialog` set to `true`.
      Specified by:
        `getParmsForOutputDialog` in interface `IExecutionContext`
      Returns:
        the List of RToolOutParameters which shall be shown in an output dialog

    - #### getResource

          public IResource getResource()

      Description copied from interface: `IExecutionContext`
      Receives the resource which is assigned to this context.
      Specified by:
        `getResource` in interface `IExecutionContext`
      Returns:
        the resource which is assigned to this context.

    - #### initContext

          public IExecutionContext initContext(IResource pRes)

      Description copied from interface: `IExecutionContext`
      Initializes the IExecutionContext from the given resource. This stores every containing Property with its value in the ExecutionContext.
      Specified by:
        `initContext` in interface `IExecutionContext`
      Parameters:
        `pRes` - The resource which shall be used to initialize the ExecutionContext
      Returns:
        The IExecutionContext containing the resource its Properties

    - #### putFileParmIntoMemory

          public void putFileParmIntoMemory(FileDescriptor pFileDescriptor)

      Description copied from interface: `IExecutionContext`
      Puts a File Descriptor in the execution memory.
      Specified by:
        `putFileParmIntoMemory` in interface `IExecutionContext`
      Parameters:
        `pFileDescriptor` - The FileDescriptor which shall be stored in the parameter memory

    - #### putParmIntoContext

          public void putParmIntoContext(Property pProp,
                                         IPropertyValue pPropValue)

      Description copied from interface: `IExecutionContext`
      Manually puts a Property into the context Map. In most cases, the `IExecutionContext.initContext(IResource)` method should provide all necessary Properties from the given resource.
      Specified by:
        `putParmIntoContext` in interface `IExecutionContext`
      Parameters:
        `pProp` - The Property which shall be stored in the context
        `pPropValue` - The corresponding IPropertyValue

    - #### putParmIntoMemory

          public void putParmIntoMemory(Property pProp,
                                        IPropertyValue pPropValue)

      Description copied from interface: `IExecutionContext`
      Puts a parameter Property into a map, providing them to following tools during the execution.
      Specified by:
        `putParmIntoMemory` in interface `IExecutionContext`
      Parameters:
        `pProp` - The Property which an output parameter was pointing to
        `pPropValue` - The corresponding IPropertyValue

    - #### setActionContext

          public void setActionContext(java.util.Map<Property,IPropertyValue> pActionContext)

      Description copied from interface: `IExecutionContext`
      Set the action context of the execution context.
      Specified by:
        `setActionContext` in interface `IExecutionContext`
      Parameters:
        `pActionContext` - action context to be set in the execution context

    - #### setParmMemory

          public void setParmMemory(java.util.Map<Property,IPropertyValue> pParmMemory)

      Description copied from interface: `IExecutionContext`
      Set the parameter memory of the execution context.
      Specified by:
        `setParmMemory` in interface `IExecutionContext`
      Parameters:
        `pParmMemory` - parameter memory to be set in the execution context

    - #### setResource

          public void setResource(IResource pResource)

      Description copied from interface: `IExecutionContext`
      Sets the resource of this context.
      Specified by:
        `setResource` in interface `IExecutionContext`
      Parameters:
        `pResource` - The IResource which shall be assigned to the context

    - #### setContextResources

          public void setContextResources(java.util.List<IResource> pContextResources)

      Description copied from interface: `IExecutionContext`
      Sets the context resources for mass processing.
      Specified by:
        `setContextResources` in interface `IExecutionContext`
      Parameters:
        `pContextResources` - a list of resources, typically all elements which are selected for a multi selection action. Must not be `null`.
      See Also:
        `ActionDescriptor.isMassProcessing()`

    - #### getContextResources

          public java.util.List<IResource> getContextResources()

      Description copied from interface: `IExecutionContext`
      Returns a list of context resources. If the context was created by a standard AWM action, it always contains all selected resources (e.g. Elements). Does not return `null` unless `IExecutionContext.setContextResources(List)` was called with `null` as parameter.
      Specified by:
        `getContextResources` in interface `IExecutionContext`
      Returns:
        the list of context resources.

    - #### getFileFromContext

          public FileDescriptor getFileFromContext(FileDescriptor pFileDescr)
                                            throws TaurusToolException

      Description copied from interface: `IExecutionContext`
      Retrieves a FileDescriptor from the context map. FileDescriptors within this map were set at the beginning of the Action.

      Specified by:
        `getFileFromContext` in interface `IExecutionContext`
      Parameters:
        `pFileDescr` - The ID of the desired FileDescriptor
      Returns:
        The desired FileDescriptor
      Throws:
        `TaurusToolException` - if the FileDescriptor does not exist within the context.

    - #### getToolExecStatusList

          public java.util.List<ToolExecutionStatus> getToolExecStatusList()

      Description copied from interface: `IExecutionContext`
      Gets a list of tool execution statuses. Tool execution statuses can be created and added to the list by executed tools. The list can be empty but never `null`.
      Specified by:
        `getToolExecStatusList` in interface `IExecutionContext`
      Returns:
        a list of tool execution statuses.

    - #### addToolExecStatus

          public void addToolExecStatus(ToolExecutionStatus pToolStatus)

      Description copied from interface: `IExecutionContext`
      Adds a tool execution status to the list of statuses.
      Specified by:
        `addToolExecStatus` in interface `IExecutionContext`
      Parameters:
        `pToolStatus` - the new tool execution status to be added.

    - #### getResource

          public IResource getResource(java.lang.String pName)

      Description copied from interface: `IExecutionContext`
      Returns the `IResource` with the given name, which has been added to the context by a resource operation (tool defined resource processing).
      Specified by:
        `getResource` in interface `IExecutionContext`
      Parameters:
        `pName` - The logical name of the desired resource
      Returns:
        the IResource with the given name.
      See Also:
        `ToolDescriptor.getResourceProcessing()`

    - #### addResource

          public void addResource(IResource pRes,
                                  java.lang.String pName)

      Description copied from interface: `IExecutionContext`
      Adds an `IResource` with the given name. This should be done if a tool defined resource operation was executed.
      Specified by:
        `addResource` in interface `IExecutionContext`
      Parameters:
        `pRes` - The resource to be added
        `pName` - The logical name of the resource

    - #### getResourceContext

          public IExecutionContext getResourceContext(java.lang.String pResourceName)

      Description copied from interface: `IExecutionContext`
      Returns the `IExecutionContext` of a resource with a logical name. The logical name comes from TOOL-DEFINED resource operations.
      Specified by:
        `getResourceContext` in interface `IExecutionContext`
      Parameters:
        `pResourceName` - the logical name of a resource
      Returns:
        the `IExecutionContext` of the resource or `null` if no resource with that name was found

    - #### populateContext

          @Deprecated
          public void populateContext(IResource pRes)

      Deprecated.
      Description copied from interface: `IExecutionContext`
      Populates the context with the property values of the given resource.
      Specified by:
        `populateContext` in interface `IExecutionContext`
      Parameters:
        `pRes` - the `IResource` which should be use to populate the context.

    - #### getSystemImage

          public ISystemImage getSystemImage()

      Description copied from interface: `IExecutionContext`
      Gets the `ISystemImage` the context is connected with. Note that the context does not need to use the system image, but it is recommended to always add an image for other callers to be used.
      Specified by:
        `getSystemImage` in interface `IExecutionContext`
      Returns:
        an `ISystemImage`. Can be `null`.

    - #### getFileMemory

          public java.util.Map<java.lang.String,FileDescriptor> getFileMemory()

      Description copied from interface: `IExecutionContext`
      Gets the file memory which contains file descriptors with resolved physical names which were returned by previous tools of an action.
      Specified by:
        `getFileMemory` in interface `IExecutionContext`
      Returns:
        the file memory of this context.

    - #### setFileMemory

          public void setFileMemory(java.util.Map<java.lang.String,FileDescriptor> pFileMemory)

      Description copied from interface: `IExecutionContext`
      Completely sets the file memory of this context. Replaces the existing one (if there is one).
      Specified by:
        `setFileMemory` in interface `IExecutionContext`
      Parameters:
        `pFileMemory` - the new file memory map.
      See Also:
        `IExecutionContext.getFileMemory()`, `IExecutionContext.getFileFromMemory(String)`

    - #### duplicate

          public IExecutionContext duplicate()

      Description copied from interface: `IExecutionContext`
      Duplicates this execution context, including the following information:
    - Context parameters
    - Memory (previous tool) parameters
    - Context Resource
    - TAURUS System

Specified by:
  `duplicate` in interface `IExecutionContext`
Returns:
  a duplication of the execution context.

- #### getMemoryResources

      public java.util.List<IResource> getMemoryResources()

  Description copied from interface: `IExecutionContext`
  Gets resources that have been added to the context by tools. E.g. this is done by a table input dialog with multiple selection enabled.
  Specified by:
    `getMemoryResources` in interface `IExecutionContext`
  Returns:
    a list of resources added to the context by tools.
  See Also:
    `IExecutionContext.addResourceToMemory(IResource)`

- #### addResourceToMemory

      public void addResourceToMemory(IResource pResource)

  Description copied from interface: `IExecutionContext`
  Adds a resource to the context memory. Intended to be used by tools within an action.
  Specified by:
    `addResourceToMemory` in interface `IExecutionContext`
  Parameters:
    `pResource` - the resource to be added in the memory
  See Also:
    `IExecutionContext.getMemoryResources()`

- #### getMassProcessingContexts

      public java.util.ArrayList<IExecutionContext> getMassProcessingContexts()

  Description copied from interface: `IExecutionContext`
  Returns a list of execution contexts for every resource that is being processed by a mass processing action. Mass output parameter records are written into individual execution contexts in this list. Calling `IExecutionContext.getMassProcessingContexts()` on any of the contained contexts will always return an empty list.
  Specified by:
    `getMassProcessingContexts` in interface `IExecutionContext`
  Returns:
    a list of mass processing sub contexts. Can be empty.

- #### initContext

      public IExecutionContext initContext(java.util.List<IResource> pResources)

  Description copied from interface: `IExecutionContext`
  Initializes the IExecutionContext from the list of resources. This creates a sub context for every given resource which can then be obtained by `IExecutionContext.getMassProcessingContexts()`. Internally calls `IExecutionContext.initContext(IResource)` for every given resource. The first resource of the given list will be the context's main resource.
  Specified by:
    `initContext` in interface `IExecutionContext`
  Parameters:
    `pResources` - A list of IResources.
  Returns:
    The IExecutionContext containing the resource its Properties

Copyright © 2015 Micro Focus GmbH. All rights reserved.