com.microfocus.awm.core

## Class TaurusModelUtilities

- java.lang.Object
- - com.microfocus.awm.core.TaurusModelUtilities

-     public class TaurusModelUtilities
      extends java.lang.Object

  Utility class covering model based functions.

  Copyright Micro Focus GmbH.

  Author:
    Micro Focus

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `TaurusModelUtilities.EParameterFrom` Enumeration for sources of resolved parameter values.

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static java.lang.String` | `DYN_ATTRIBUTE_JOB_AFTER_ACTION` Job After Action.
    `static java.lang.Object` | `MODEL_ENCODING_DEFAULT` Default encoding for AWM models.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `TaurusModelUtilities()`

  - ### Method Summary

    All Methods Static Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method and Description
    --- | ---
    `static boolean` | `containsFunctionPackage(TAURUSConfiguration pModel, java.lang.String pFunctionPackageID)` Gets whether a function package with the given ID exists in the model.
    `static void` | `createModel(org.eclipse.core.resources.IFile pModelFile, TemplateModelExtension pTemplate, org.eclipse.core.runtime.IProgressMonitor pMon)` Creates an AWM model file.
    `static ToolDescriptor` | `findDialogTool(ToolDescriptor pTool, java.lang.String pPanelName)` Searches for a ISPF panel tool descriptor with the given panel name.
    `static IElement` | `findLinkedElement(ITaurusApplication pApplication, java.lang.String pResourceIdentifier, java.lang.String pLinkedElementTypeID)` Finds a linked element from the given resource identifier.
    `static IElement` | `findLinkedElement(ITaurusApplication pApplication, java.lang.String pResourceIdentifier, java.lang.String[] pLinkedElementTypeIDs)` Finds a linked element from the given resource identifier and an array of linked element type IDs.
    `static IElement` | `findLinkedElement(java.lang.String pResourceIdentifier, LinkedElementType pLinkedElementType, java.lang.String pIDPrefix)` Deprecated. Use `findLinkedElement(String, List)` instead, which is much more time efficient.
    `static IElement` | `findLinkedElement(java.lang.String pResourceID, java.util.List<LinkedElementType> pAffectedElementTypes)` Calls `findLinkedElement(String, LinkedElementType, String)` for every given linked element type.
    `static IElement` | `findLinkedElement(java.lang.String pResourceIdentifier, java.lang.String pIDPrefix)` Finds a linked element from the given resource identifier.
    `static ActionDescriptor` | `getActionDescriptorByID(java.lang.String pID, TAURUSConfiguration pTauConf)` Returns the Action Descriptor with the given ID in the given Taurus model configuration.
    `static ActionDescriptor` | `getAfterJobAction(ToolDescriptor pTool)` Gets "job after action" of the tool descriptor supporting both old tool types (old extension points) and new ones (function packages).
    `static java.lang.String` | `getApplicationAttributeValue(java.lang.String pAttributeName, TAURUSConfiguration pModel)` Gets the value of a custom `ApplicationOptions` attribute.
    `static IApplicationProperty` | `getApplicationProperty(ITaurusApplication pApplication, Property pProperty)` Tries to get the application property for a specific `ITaurusApplication` based on the given model `Property`.
    `static ActionDescriptor` | `getDefaultFilterAction(IFilter pFilter)` Get the default filter action for the given filter.
    `static org.eclipse.core.resources.IResource` | `getEclipseResource(IExecutionContext pContext, ToolDescriptor pToolDescriptor, int pIDInparmInxed, boolean pResourceNotFoundException)` Deprecated. Parameters should no longer be accessed through indexes. Tool executors should implement `IToolExecutor2` and obtain the parameter via corresponding methods of `IToolContext` or `ToolUtility`.
    `static java.lang.String` | `getElementID(ISystemImage pImg, ElementType pEleType, java.util.Collection<IPropertyValue> pTargetPropVals)` Generates an element ID.
    `static java.lang.String` | `getElementID(ISystemImage pImg, ElementType pEleType, java.util.Map<Property,IPropertyValue> pTargetPropVals)` Generates an element ID.
    `static java.lang.String` | `getElementID(ISystemImage pImg, java.util.List<RToolInParameter> pParameters, IExecutionContext pContext)` Creates an element ID from the given list of input parameters.
    `static java.lang.StringBuilder` | `getElementIDPrefix(ISystemImage pImg, org.eclipse.emf.ecore.EObject pModelObject)` Gets the prefix of an element ID, which is:
    `static java.util.List<RElementlistColumn>` | `getElementListStructureProperties(TAURUSConfiguration pTauConf, java.lang.String elementListStructureID)` Returns the modelled column relationships of an element list structure.
    `static IPropertyValue` | `getElementName(ElementType pEleType, java.util.Map<Property,IPropertyValue> pPropVals)` Gets the property value of the `RElementProperty` relationship which has the flag "Element Name" set to `true`.
    `static IPropertyValue` | `getElementName(IElement pElement)` Gets the property value of the `RElementProperty` relationship which has the flag "Element Name" set to `true`.
    `static Property` | `getElementNameProperty(ElementType pEleType)` Gets the property of the `RElementProperty` relationship which has the flag "Element Name" set to `true`.
    `static ElementType` | `getElementType(java.util.Collection<IPropertyValue> pPropertyValues)` Looks for an element type property in the given list of property values and returns the corresponding element type or `null` if no element type could be resolved.
    `static ElementType` | `getElementType(java.util.Map<Property,IPropertyValue> pPropertyValues)` Looks for an element type property in the given map of property values and returns the corresponding element type or `null` if no element type could be resolved.
    `static ElementType` | `getElementTypeByID(java.lang.String pID, TAURUSConfiguration pTauConf)` Returns for the Element Type with the given ID in the given Taurus model configuration.
    `static java.util.Map<java.lang.String,ElementType>` | `getElementTypMachnameMap(TAURUSConfiguration pTauConf)` Get a map which maps an elements match name to the corresponding element type.
    `static java.util.List<ElementType>` | `getElemTypList(TAURUSConfiguration pTauConf)` Get a list of defined element types in a specific model.
    `static java.lang.String` | `getExitParameter(org.eclipse.emf.ecore.EObject pEObject)` Gets the 'Exitparm' attribute from the `TAURUSConfiguration` of the given EObject.
    `static FileDescriptor` | `getFileDescriptorByID(java.lang.String pID, TAURUSConfiguration pTauConf)` Returns the File Descriptor with the given ID in the given Taurus model configuration.
    `static FileDescriptor` | `getFileDescriptorByInputParam(RToolInParameter pIp, IExecutionContext pContext)` Deprecated. Does not resolve property references from the main context, if the given `IExecutionContext` is a mass processing sub context. Use `getFileDescriptorFromParameter(RToolParameter, IToolContext)` instead.
    `static FileDescriptor` | `getFileDescriptorFromParameter(RToolParameter pParm, IExecutionContext pContext)` Deprecated. Does not resolve property references from the main context, if the given `IExecutionContext` is a mass processing sub context. Use `getFileDescriptorFromParameter(RToolParameter, IToolContext)` instead.
    `static FileDescriptor` | `getFileDescriptorFromParameter(RToolParameter pParm, IToolContext pToolContext)` Resolves and returns a file descriptor referenced by a tool parameter.
    `static java.util.List<FunctionPackage>` | `getFunctionPackages(TAURUSConfiguration taurusConfiguration)` Gets a list of all defined function packages in the given model.
    `static ActionDescriptor` | `getGetRootContainersAction(ITaurusApplication appl)` Safely tries to get the "get root containers" action for the given application.
    `static java.util.List<Property>` | `getLabelProperties(ElementType pElementType)` Returns a list of label Properties of the given Element Type or an empty list.
    `static java.util.List<LinkedElementType>` | `getLinkedElementTypesByID(java.lang.String[] pLinkedElementTypeIDs, TAURUSConfiguration pTauConf)` Returns a list of linked element types with the given linked element type ID.
    `static java.util.List<LinkedElementType>` | `getLinkedElementTypesByID(java.lang.String pLinkedElementTypeID, TAURUSConfiguration pTauConf)` Returns a list of linked element types with the given linked element type ID.
    `static int` | `getMaxRC(ITaurusApplication pApplication)` Gets the maximum return code of the given application (from the `ApplicationOptions`) or the default value, if application options are missing.
    `static int` | `getMaxRC(TAURUSConfiguration pModel)` Gets the maximum return code of the given model (from the `ApplicationOptions`) or the default value, if no model is provided.
    `static org.eclipse.emf.ecore.EObject` | `getObjectByModelExtensionID(TAURUSConfiguration pModel, java.lang.String pModelExtensionID)` Searches in the given model for an `EObject` where the `TaurusPackage.getIFunctionPackageDefinable_ExtensionID()` equals the given model extension id.
    `static IPropertyValue` | `getParameterPropertyValue(RToolInParameter pStringInparm, IExecutionContext pContext)` Returns a property value for the given parameter.
    `static java.lang.String` | `getParameterValue(RToolInParameter pInparm, IExecutionContext pContext)` Returns the value of the given parameter or `null`.
    `static Property` | `getPropertyByID(java.lang.String pID, TAURUSConfiguration pTauConf)` Returns for the Property with the given ID in the given Taurus model configuration.
    `static java.util.List<Property>` | `getPropertyListOfElementTyp(ElementType elmtyp)` Returns the Key Properties of the given Element Type, sorted after their sequence number.
    `static IPropertyValue` | `getPropertyValueFromHierarchy(Property pProperty, IExecutionContext pContext)` Obtain property value from the execution hierarchy for a given `Property`.
    `static RElementProperty` | `getSortProperty(ElementType pEleType)` Get the sort property of the given element type.
    `static java.lang.String` | `getStringBooleanValue(Property pProperty, boolean pBoolean)` Gets a string representation of a boolean value for a property.
    `static Property` | `getSuffixProperty(ElementType pElementType)` Returns the first property of the given element type which has the "Special Property" attribute set to `ESpecialProperties.ELEMENT_SUFFIX`.
    `static TAURUSConfiguration` | `getTaurusConfiguration(org.eclipse.emf.ecore.EObject pObj)` Returns the corresponding `TAURUSConfiguration` of the given `EObject`.
    `static ToolDescriptor` | `getToolDescriptorByID(java.lang.String pID, TAURUSConfiguration pTauConf)` Returns the Tool Descriptor with the given ID in the given Taurus model configuration.
    `static boolean` | `isPropertyOfElementType(Property pProp, IElement pElement)` Checks whether the property is modelled as a property of the given element type.

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

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

- - ### Field Detail

    - #### DYN_ATTRIBUTE_JOB_AFTER_ACTION

          public static final java.lang.String DYN_ATTRIBUTE_JOB_AFTER_ACTION

      Job After Action.
      See Also:
        Constant Field Values

    - #### MODEL_ENCODING_DEFAULT

          public static final java.lang.Object MODEL_ENCODING_DEFAULT

      Default encoding for AWM models.

  - ### Constructor Detail

    - #### TaurusModelUtilities

          public TaurusModelUtilities()

  - ### Method Detail

    - #### getElemTypList

          public static java.util.List<ElementType> getElemTypList(TAURUSConfiguration pTauConf)

      Get a list of defined element types in a specific model.
      Parameters:
        `pTauConf` - the model.
      Returns:
        list of defined element types

    - #### getElementTypMachnameMap

          public static java.util.Map<java.lang.String,ElementType> getElementTypMachnameMap(TAURUSConfiguration pTauConf)

      Get a map which maps an elements match name to the corresponding element type.
      Parameters:
        `pTauConf` - the model.
      Returns:
        map which maps an elements match name to the corresponding element type

    - #### getPropertyListOfElementTyp

          public static java.util.List<Property> getPropertyListOfElementTyp(ElementType elmtyp)

      Returns the Key Properties of the given Element Type, sorted after their sequence number.
      Parameters:
        `elmtyp` - The Element Type
      Returns:
        an ArrayList, which contains the Key Properties of the given Element Type
      See Also:
        `IDDefinition`, `RIDProperty`

    - #### getDefaultFilterAction

          public static ActionDescriptor getDefaultFilterAction(IFilter pFilter)

      Get the default filter action for the given filter.
      Parameters:
        `pFilter` - TAURUS filter
      Returns:
        default filter action for the given filter

    - #### getElementListStructureProperties

          public static java.util.List<RElementlistColumn> getElementListStructureProperties(TAURUSConfiguration pTauConf,
                                                                                             java.lang.String elementListStructureID)

      Returns the modelled column relationships of an element list structure.
      Parameters:
        `pTauConf` - the model.
        `elementListStructureID` - the ID of the element list structure.
      Returns:
        the properties of a given ElementListStructuresID

    - #### getElementType

          public static ElementType getElementType(java.util.Map<Property,IPropertyValue> pPropertyValues)

      Looks for an element type property in the given map of property values and returns the corresponding element type or `null` if no element type could be resolved.
      Parameters:
        `pPropertyValues` - a map of property values.
      Returns:
        the resolved element type or `null`.

    - #### getElementType

          public static ElementType getElementType(java.util.Collection<IPropertyValue> pPropertyValues)

      Looks for an element type property in the given list of property values and returns the corresponding element type or `null` if no element type could be resolved.
      Parameters:
        `pPropertyValues` - a list of property values.
      Returns:
        the resolved element type or `null`.

    - #### getElementID

          public static java.lang.String getElementID(ISystemImage pImg,
                                                      java.util.List<RToolInParameter> pParameters,
                                                      IExecutionContext pContext)
                                               throws TaurusCoreException

      Creates an element ID from the given list of input parameters.
      Parameters:
        `pImg` - the system image
        `pParameters` - a list of input parameters
        `pContext` - the execution context
      Returns:
        an element ID or `null`
      Throws:
        `TaurusCoreException` - if a property value of a parameter could not be found in the execution context and neither a static- nor a default value was set

    - #### getElementID

          public static java.lang.String getElementID(ISystemImage pImg,
                                                      ElementType pEleType,
                                                      java.util.Collection<IPropertyValue> pTargetPropVals)
                                               throws TaurusCoreException

      Generates an element ID.
      Parameters:
        `pImg` - the system image.
        `pEleType` - the element type.
        `pTargetPropVals` - the property values containing all ID properties of the element type.
      Returns:
        an element ID.
      Throws:
        `TaurusCoreException` - if the element ID cannot be generated, usually because key properties are missing.

    - #### getElementID

          public static java.lang.String getElementID(ISystemImage pImg,
                                                      ElementType pEleType,
                                                      java.util.Map<Property,IPropertyValue> pTargetPropVals)
                                               throws TaurusCoreException

      Generates an element ID.
      Parameters:
        `pImg` - the system image.
        `pEleType` - the element type.
        `pTargetPropVals` - the property values containing all ID properties of the element type.
      Returns:
        an element ID.
      Throws:
        `TaurusCoreException` - if the element ID cannot be generated, usually because key properties are missing.
      See Also:
        `getElementID(ISystemImage, ElementType, Collection)`

    - #### getElementIDPrefix

          public static java.lang.StringBuilder getElementIDPrefix(ISystemImage pImg,
                                                                   org.eclipse.emf.ecore.EObject pModelObject)

      Gets the prefix of an element ID, which is:

      `[model name]_[system name]:[system port]`

      .
      Parameters:
        `pImg` - the system image
        `pModelObject` - any object from the model (e.g. the `ElementType`)
      Returns:
        the element ID prefix

    - #### getElementName

          public static IPropertyValue getElementName(IElement pElement)

      Gets the property value of the `RElementProperty` relationship which has the flag "Element Name" set to `true`. Returns `null` if no property relationship with that flag exists.
      Parameters:
        `pElement` - the element.
      Returns:
        the property value containing the element name or `null`.

    - #### getGetRootContainersAction

          public static ActionDescriptor getGetRootContainersAction(ITaurusApplication appl)

      Safely tries to get the "get root containers" action for the given application. Returns `null` if the root containers action cannot be get for any of the following reasons:
      - The application is `null`.
      - The application's model is `null` (e.g. because the application is not loaded).
      - The model does not contain application options.
      - No root containers action was set in the application options.
      Parameters:
        `appl` - the application to get the "get root containers" action from
      Returns:
        the "get root containers" action or `null`

    - #### getElementName

          public static IPropertyValue getElementName(ElementType pEleType,
                                                      java.util.Map<Property,IPropertyValue> pPropVals)

      Gets the property value of the `RElementProperty` relationship which has the flag "Element Name" set to `true`. Returns `null` if no property relationship with that flag exists.
      Parameters:
        `pEleType` - the element type.
        `pPropVals` - the property values.
      Returns:
        the property value containing the element name or `null`.

    - #### getElementNameProperty

          public static Property getElementNameProperty(ElementType pEleType)

      Gets the property of the `RElementProperty` relationship which has the flag "Element Name" set to `true`. Returns `null` if no property relationship with that flag exists.
      Parameters:
        `pEleType` - the element type.
      Returns:
        the property value containing the element name or `null`.

    - #### getLabelProperties

          public static java.util.List<Property> getLabelProperties(ElementType pElementType)

      Returns a list of label Properties of the given Element Type or an empty list. If no tree view label Property has been defined, the name-Property will be returned. If no name Property has been defined, the last Element Property will be returned.
      Parameters:
        `pElementType` - the `ElementType`
      Returns:
        a list of Properties (can be empty)
      See Also:
        `RElementProperty.isTreeViewLabel()`

    - #### getSuffixProperty

          public static Property getSuffixProperty(ElementType pElementType)

      Returns the first property of the given element type which has the "Special Property" attribute set to `ESpecialProperties.ELEMENT_SUFFIX`.
      Parameters:
        `pElementType` - the element type.
      Returns:
        the suffix property or `null`.

    - #### getTaurusConfiguration

          public static TAURUSConfiguration getTaurusConfiguration(org.eclipse.emf.ecore.EObject pObj)

      Returns the corresponding `TAURUSConfiguration` of the given `EObject`.
      Parameters:
        `pObj` - an EObject that belongs to the TAURUS Configuration
      Returns:
        the TAURUSConfiguration of the given EObject or `null`

    - #### getParameterValue

          public static java.lang.String getParameterValue(RToolInParameter pInparm,
                                                           IExecutionContext pContext)
                                                    throws TaurusToolException

      Returns the value of the given parameter or `null`.
      Parameters:
        `pInparm` - the `RToolInParameter`
        `pContext` - the `IExecutionContext`
      Returns:
        the parameter value or `null` if the "Parameter from" attribute of the input parameter is "UserInput".
      Throws:
        `TaurusToolException` - if the property value could not be found in the execution context and neither a static- nor a default value is set.

    - #### getApplicationProperty

          public static IApplicationProperty getApplicationProperty(ITaurusApplication pApplication,
                                                                    Property pProperty)

      Tries to get the application property for a specific `ITaurusApplication` based on the given model `Property`.
      Parameters:
        `pApplication` - the `ITaurusApplication`
        `pProperty` - the model `Property`
      Returns:
        the application property based on the `ITaurusApplication` and `Property`. If no `IApplicationProperty` could be retrieved, `null` is returned.

        `IApplicationProperty` could only be retrieved if the `ITaurusApplication` was loaded at least once during the current runtime of AWM.

    - #### getParameterPropertyValue

          public static IPropertyValue getParameterPropertyValue(RToolInParameter pStringInparm,
                                                                 IExecutionContext pContext)
                                                          throws TaurusToolException

      Returns a property value for the given parameter. The value of the returned `IPropertyValue` can be `null` if it cannot be resolved. Throws an exception if the given input parameter does not have a property ("Target ID Parm") associated.

      Calls `getParameterValue(RToolInParameter, IExecutionContext)`.

      Parameters:
        `pStringInparm` - a string input parameter (`RToolInParameter`)
        `pContext` - the `IExecutionContext`
      Returns:
        a property value which contains the resolved value of the parameter
      Throws:
        `TaurusToolException` -
    - If no property (target ID) was associated to the given input parameter.
    - if the property value could not be found in the execution context and neither a static- nor a default value is set.
    See Also:
      `getParameterValue(RToolInParameter, IExecutionContext)`

  - #### getPropertyValueFromHierarchy

        public static IPropertyValue getPropertyValueFromHierarchy(Property pProperty,
                                                                   IExecutionContext pContext)

    Obtain property value from the execution hierarchy for a given `Property`. The returned `IPropertyValue` can be `null` if it cannot be resolved.

    The search order of `IPropertyValue` follows

    1. Search for `IPropertyValue` of the `Property` in the memory
    2. Search for `IPropertyValue` of the `Property` in the context
    3. In case the `Property` have default value then it will be used as `IPropertyValue`
    Parameters:
      `pProperty` - the `Property` which value is searched for.
      `pContext` - the `IExecutionContext`
    Returns:
      the property value if it has been found in the hierarchy, otherwise `null`

  - #### findDialogTool

        public static ToolDescriptor findDialogTool(ToolDescriptor pTool,
                                                    java.lang.String pPanelName)

    Searches for a ISPF panel tool descriptor with the given panel name.
    Parameters:
      `pTool` - the tool descriptor to search in
      `pPanelName` - the desired panel name
    Returns:
      the ISPF panel tool descriptor or `null` if it was not found

  - #### isPropertyOfElementType

        public static boolean isPropertyOfElementType(Property pProp,
                                                      IElement pElement)

    Checks whether the property is modelled as a property of the given element type.
    Parameters:
      `pProp` - the property.
      `pElement` - the element type.
    Returns:
      `true` if the given Property is a Property of the given Element Type.
    See Also:
      `RElementProperty`

  - #### getApplicationAttributeValue

        public static java.lang.String getApplicationAttributeValue(java.lang.String pAttributeName,
                                                                    TAURUSConfiguration pModel)

    Gets the value of a custom `ApplicationOptions` attribute.
    Parameters:
      `pAttributeName` - the attribute name (not case sensitive)
      `pModel` - the model to search in
    Returns:
      the value of the attribute or `null` if no attribute with the given name is defined in the model or any parameter is `null`.
    See Also:
      `TAURUSConfiguration.getApplicationOptions()`, `ApplicationOptions.getCustomOption()`

  - #### getActionDescriptorByID

        public static ActionDescriptor getActionDescriptorByID(java.lang.String pID,
                                                               TAURUSConfiguration pTauConf)

    Returns the Action Descriptor with the given ID in the given Taurus model configuration.
    Parameters:
      `pID` - the ID of the desired Action Descriptor.
      `pTauConf` - the model.
    Returns:
      the `ActionDescriptor` with the given ID or `null` if the Action Descriptor is not defined or the model is not loaded.

  - #### getElementTypeByID

        public static ElementType getElementTypeByID(java.lang.String pID,
                                                     TAURUSConfiguration pTauConf)

    Returns for the Element Type with the given ID in the given Taurus model configuration.
    Parameters:
      `pID` - the ID of the desired Element Type
      `pTauConf` - the model.
    Returns:
      the `ElementType` with the given ID or `null` if the Element Type is not defined or the model is not loaded.

  - #### getLinkedElementTypesByID

        public static java.util.List<LinkedElementType> getLinkedElementTypesByID(java.lang.String pLinkedElementTypeID,
                                                                                  TAURUSConfiguration pTauConf)

    Returns a list of linked element types with the given linked element type ID.
    Parameters:
      `pLinkedElementTypeID` - the desired linked element type ID
      `pTauConf` - the model.
    Returns:
      a list of linked element types. Can be empty but never `null`.
    See Also:
      `LinkedElementType.getLinkedElementTypeID()`, `getLinkedElementTypesByID(String[], TAURUSConfiguration)`

  - #### getLinkedElementTypesByID

        public static java.util.List<LinkedElementType> getLinkedElementTypesByID(java.lang.String[] pLinkedElementTypeIDs,
                                                                                  TAURUSConfiguration pTauConf)

    Returns a list of linked element types with the given linked element type ID.
    Parameters:
      `pLinkedElementTypeIDs` - array of desired linked element type IDs. Must not be `null`.
      `pTauConf` - the model.
    Returns:
      a list of linked element types. Can be empty but never `null`.
    See Also:
      `LinkedElementType.getLinkedElementTypeID()`, `getLinkedElementTypesByID(String, TAURUSConfiguration)`

  - #### getPropertyByID

        public static Property getPropertyByID(java.lang.String pID,
                                               TAURUSConfiguration pTauConf)

    Returns for the Property with the given ID in the given Taurus model configuration.
    Parameters:
      `pID` - the ID of the desired property.
      `pTauConf` - the model.
    Returns:
      the `Property` with the given ID or `null` if the Property is not defined or the model is not loaded.

  - #### getToolDescriptorByID

        public static ToolDescriptor getToolDescriptorByID(java.lang.String pID,
                                                           TAURUSConfiguration pTauConf)

    Returns the Tool Descriptor with the given ID in the given Taurus model configuration.
    Parameters:
      `pID` - the ID of the desired Tool Descriptor.
      `pTauConf` - the model.
    Returns:
      the `ToolDescriptor` with the given ID or `null` if the Tool Descriptor is not defined or the model is not loaded.

  - #### getFileDescriptorByID

        public static FileDescriptor getFileDescriptorByID(java.lang.String pID,
                                                           TAURUSConfiguration pTauConf)

    Returns the File Descriptor with the given ID in the given Taurus model configuration.
    Parameters:
      `pID` - the ID of the desired File Descriptor.
      `pTauConf` - the model.
    Returns:
      the `ToolDescriptor` with the given ID or `null` if the File Descriptor is not defined or the model is not loaded.

  - #### getFileDescriptorFromParameter

        public static FileDescriptor getFileDescriptorFromParameter(RToolParameter pParm,
                                                                    IToolContext pToolContext)
                                                             throws TaurusToolException

    Resolves and returns a file descriptor referenced by a tool parameter. The returned instance will be a clone of the referenced `FileDescriptor` instance with its `name physical` attribute resolved (since it can contain variables).

    If the given context is an `IMassProcessingSubContext`, properties referenced by `name physical` will also be searched in the parent mass processing context.

    Parameters:
      `pParm` - a tool parameter
      `pToolContext` - the tool context
    Returns:
      a resolved file descriptor instance
    Throws:
      `TaurusToolException` - if any parameter is `null` or no file descriptor is referenced by the parameter
    See Also:
      `getFileDescriptorByInputParam(RToolInParameter, IExecutionContext)`

  - #### getFileDescriptorFromParameter

        @Deprecated
        public static FileDescriptor getFileDescriptorFromParameter(RToolParameter pParm,
                                                                                 IExecutionContext pContext)
                                                                          throws TaurusToolException

    Deprecated. Does not resolve property references from the main context, if the given `IExecutionContext` is a mass processing sub context. Use `getFileDescriptorFromParameter(RToolParameter, IToolContext)` instead.
    Resolves and returns a file descriptor referenced by a tool parameter. The returned instance will be a clone of the referenced `FileDescriptor` instance with its `name physical` attribute resolved (since it can contain variables).
    Parameters:
      `pParm` - a tool parameter
      `pContext` - the execution context
    Returns:
      a resolved file descriptor instance
    Throws:
      `TaurusToolException` - if any parameter is `null` or no file descriptor is referenced by the parameter
    See Also:
      `getFileDescriptorByInputParam(RToolInParameter, IExecutionContext)`

  - #### getFileDescriptorByInputParam

        @Deprecated
        public static FileDescriptor getFileDescriptorByInputParam(RToolInParameter pIp,
                                                                                IExecutionContext pContext)
                                                                         throws TaurusToolException

    Deprecated. Does not resolve property references from the main context, if the given `IExecutionContext` is a mass processing sub context. Use `getFileDescriptorFromParameter(RToolParameter, IToolContext)` instead.
    Gets the resolved file descriptor from the given input parameter and context. References in the physical file name will be resolved.
    Parameters:
      `pIp` - An input parameter. Must not be `null`.
      `pContext` - The context in which file memory the FileDescriptor will be searched. Must not be `null`
    Returns:
      The FileDescriptor of the given Input Parameter
    Throws:
      `TaurusToolException` - if "parameter from" was set to "previous tool" but the file descriptor could not be found in the parameter memory.

  - #### getMaxRC

        public static int getMaxRC(ITaurusApplication pApplication)

    Gets the maximum return code of the given application (from the `ApplicationOptions`) or the default value, if application options are missing.
    Parameters:
      `pApplication` - an AWM application.
    Returns:
      the configured maximum return code of the given model or the default value if the application options are missing
    See Also:
      `ApplicationOptions.getMaxRC()`

  - #### getMaxRC

        public static int getMaxRC(TAURUSConfiguration pModel)

    Gets the maximum return code of the given model (from the `ApplicationOptions`) or the default value, if no model is provided.
    Parameters:
      `pModel` - the model. Can be `null` but then the default maximum RC will be returned
    Returns:
      the maximum return code
    See Also:
      `ApplicationOptions.getMaxRC()`

  - #### getExitParameter

        public static java.lang.String getExitParameter(org.eclipse.emf.ecore.EObject pEObject)

    Gets the 'Exitparm' attribute from the `TAURUSConfiguration` of the given EObject. If no EXITPARM was specified or the attribute cannot be found, the default 'Exitparm' value will be returned.
    Parameters:
      `pEObject` - an EObject
    Returns:
      the 'Exitparm' attribute value

  - #### getSortProperty

        public static RElementProperty getSortProperty(ElementType pEleType)

    Get the sort property of the given element type.
    Parameters:
      `pEleType` - The element type
    Returns:
      the first sort property of the element type or `null` if there is none

  - #### getAfterJobAction

        public static ActionDescriptor getAfterJobAction(ToolDescriptor pTool)

    Gets "job after action" of the tool descriptor supporting both old tool types (old extension points) and new ones (function packages).
    Parameters:
      `pTool` - the tool descriptor
    Returns:
      the "job after action" or `null` if none was defined in the model
    See Also:
      `ToolDescriptor.getAfterJobAction()`

  - #### getFunctionPackages

        public static java.util.List<FunctionPackage> getFunctionPackages(TAURUSConfiguration taurusConfiguration)

    Gets a list of all defined function packages in the given model.
    Parameters:
      `taurusConfiguration` - the model
    Returns:
      a list of function packages (can be empty)

  - #### containsFunctionPackage

        public static boolean containsFunctionPackage(TAURUSConfiguration pModel,
                                                      java.lang.String pFunctionPackageID)

    Gets whether a function package with the given ID exists in the model.
    Parameters:
      `pModel` - the model
      `pFunctionPackageID` - the function package ID
    Returns:
      `true` if the function package exists

  - #### findLinkedElement

        public static IElement findLinkedElement(java.lang.String pResourceIdentifier,
                                                 java.lang.String pIDPrefix)
                                          throws TaurusCoreException

    Finds a linked element from the given resource identifier.
    Parameters:
      `pResourceIdentifier` - the identifier
      `pIDPrefix` - the element ID prefix. The prefix can be accessed through `getElementIDPrefix(ISystemImage, EObject)`
    Returns:
      the found element or `null`
    Throws:
      `TaurusCoreException` - if an error occurs while loading the cached elements

  - #### findLinkedElement

        @Deprecated
        public static IElement findLinkedElement(java.lang.String pResourceIdentifier,
                                                              LinkedElementType pLinkedElementType,
                                                              java.lang.String pIDPrefix)

    Deprecated. Use `findLinkedElement(String, List)` instead, which is much more time efficient.
    Finds a linked element from the given resource identifier.
    Parameters:
      `pResourceIdentifier` - the identifier
      `pLinkedElementType` - the linked element type
      `pIDPrefix` - the element ID prefix
    Returns:
      the found element or `null`

  - #### getObjectByModelExtensionID

        public static org.eclipse.emf.ecore.EObject getObjectByModelExtensionID(TAURUSConfiguration pModel,
                                                                                java.lang.String pModelExtensionID)

    Searches in the given model for an `EObject` where the `TaurusPackage.getIFunctionPackageDefinable_ExtensionID()` equals the given model extension id.
    Parameters:
      `pModel` - the model which will be checked for an object with give model extension id
      `pModelExtensionID` - the model extension id of the desired `EObject`
    Returns:
      the first `EObject` found in the model where `TaurusPackage.getIFunctionPackageDefinable_ExtensionID()` equals the given model extension id.

  - #### findLinkedElement

        public static IElement findLinkedElement(ITaurusApplication pApplication,
                                                 java.lang.String pResourceIdentifier,
                                                 java.lang.String pLinkedElementTypeID)

    Finds a linked element from the given resource identifier.
    Parameters:
      `pApplication` - the currently loaded application
      `pResourceIdentifier` - the identifier. Must not be `null`.
      `pLinkedElementTypeID` - the ID of a linked element type. Must not be `null` .
    Returns:
      the found element or `null` if the element has not been found or no linked element type with the given element type ID exists in the model

  - #### findLinkedElement

        public static IElement findLinkedElement(ITaurusApplication pApplication,
                                                 java.lang.String pResourceIdentifier,
                                                 java.lang.String[] pLinkedElementTypeIDs)

    Finds a linked element from the given resource identifier and an array of linked element type IDs. Searches through all linked elements matching the linked element ID and returns the first found element.
    Parameters:
      `pApplication` - the currently loaded application
      `pResourceIdentifier` - the identifier. Must not be `null`.
      `pLinkedElementTypeIDs` - an array of linked element type IDs. Must not be `null` .
    Returns:
      the found element or `null` if the element has not been found or no linked element type with the given element type ID exists in the model

  - #### findLinkedElement

        public static IElement findLinkedElement(java.lang.String pResourceID,
                                                 java.util.List<LinkedElementType> pAffectedElementTypes)

    Calls `findLinkedElement(String, LinkedElementType, String)` for every given linked element type.
    Parameters:
      `pResourceID` - the identifier
      `pAffectedElementTypes` - the list of linked element types
    Returns:
      the found element or `null`

  - #### getEclipseResource

        @Deprecated
        public static org.eclipse.core.resources.IResource getEclipseResource(IExecutionContext pContext,
                                                                                           ToolDescriptor pToolDescriptor,
                                                                                           int pIDInparmInxed,
                                                                                           boolean pResourceNotFoundException)
                                                                                    throws TaurusToolException

    Deprecated. Parameters should no longer be accessed through indexes. Tool executors should implement `IToolExecutor2` and obtain the parameter via corresponding methods of `IToolContext` or `ToolUtility`.
    Resolves the Eclipse resource path from an input parameter of the given tool and calls `TaurusUtility.getEclipseResource(String)` to get the corresponding `IResource`.
    Parameters:
      `pContext` - the execution context
      `pToolDescriptor` - the tool descriptor
      `pIDInparmInxed` - the index from the tool's input parameters which should contain the Eclipse resource identifier (resource path)
      `pResourceNotFoundException` - whether to throw an exception if the resource path could not be resolved to an existing Eclipse resource
    Returns:
      the resolved resource or `null` if it doesn't exist and `pResourceNotFoundException` is `false`
    Throws:
      `TaurusToolException` -
      - If the given index is higher than the number of the tools input parameters.
      - If the parameter value cannot be resolved due to modelling issues (e.g. "Parameter From" was set to context, but the context does not contain the property).
      - If `pResourceNotFoundException` is `true` and the resource path could not be resolved to an existing Eclipse resource. The resolved path will be part of the exception message.

  - #### createModel

        public static void createModel(org.eclipse.core.resources.IFile pModelFile,
                                       TemplateModelExtension pTemplate,
                                       org.eclipse.core.runtime.IProgressMonitor pMon)
                                throws TaurusCoreException

    Creates an AWM model file.
    Parameters:
      `pModelFile` - the target file. Must not be `null` but does not need to exist. If it exists, its contents will be overwritten.
      `pTemplate` - a model template. Can be `null` to create a default model only containing application options and base categories.
      `pMon` - a progress monitor
    Throws:
      `TaurusCoreException` - if problems occur during model initialization or creating/writing the target file

  - #### getStringBooleanValue

        public static java.lang.String getStringBooleanValue(Property pProperty,
                                                             boolean pBoolean)

    Gets a string representation of a boolean value for a property.

    Property Type | Boolean Value | Returned String
    Boolean | `true` | `Property.getTrueValue()`
    Boolean | `false` | `Property.getFalseValue()`
    Not Boolean | `true` | `true`
    Not Boolean | `false` | `false`

    If the given property is `null` the result is equal to a non-boolean property.

    Parameters:
      `pProperty` - a property (can be `null`)
      `pBoolean` - the boolean value to convert into a string
    Returns:
      a string representation of the boolean value

Copyright © 2015 Micro Focus GmbH. All rights reserved.