com.microfocus.awm.model.internal

## Class Resource

- java.lang.Object
- - org.eclipse.core.runtime.PlatformObject
  - - com.microfocus.awm.model.internal.Resource

- All Implemented Interfaces:
    IResource, org.eclipse.core.runtime.IAdaptable
  Direct Known Subclasses:
    AbstractElementListEntry, AbstractTaurusApplication, AbstractTaurusSystem, ActiveTaurusApplication, Element, ElementList, FileResource, Filter, TableResource

      public class Resource
      extends org.eclipse.core.runtime.PlatformObject
      implements IResource

  Should be handled as abstract class. The class was not declared as abstract for compatibility reasons.

  Copyright (C) Micro Focus

  Author:
    Ralf Pakosch

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `java.lang.String` | `_ID` The resource identifier.
    `java.lang.String` | `_name` The name of the resource.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `Resource()` Creates a new resource with a UUID.
    `Resource(java.lang.String pID)` Do not use this constructor for new instances (only in sub class constructors).
    `Resource(java.lang.String pID, IResource pParent)` Do not use this constructor for new instances (only in sub class constructors).

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addChildResource(IResource pRes)` Adds a resource to the list of children resources.
    `void` | `addPropertyValue(IPropertyValue pPropertyValue)` Set the value of the property associated with the given property value in this resource to the given property value.
    `boolean` | `addResourceChild(IResource pRes)` Adds a resource to the list of children resources.
    `void` | `delete()` Removes this resource and all its children resources from cache.
    `boolean` | `equals(java.lang.Object obj)`
    `java.util.Map<Property,IPropertyValue>` | `getAllPropertyValues()` Get all property values of this resource.
    `java.util.List<IResource>` | `getChildrenResources()` Returns a list of child resources.
    `java.lang.String` | `getID()` Gets the unique ID of the resource.
    `java.lang.String` | `getName()` Gets the name of the resource.
    `IResource` | `getParentResource()` Returns the parent of this resource or `null` if there is none.
    `IPropertyValue` | `getPropertyValue(Property pProperty)` Get the value of the given property in this resource.
    `IPropertyValue` | `getPropertyValueFromHierarchy(Property pProperty)` Returns a property value of this resource and (if existent) parent resources.
    `java.util.Collection<? super IResource>` | `getResourceChildren()` Returns an unmodifiable `Collection` of child resources.
    `static IPropertyValue` | `getValueOfLinkedProperty(IResource pRes, LinkedProperty pProp)` Gets the value of a linked property, where `IResource.getPropertyValue(Property)` would return `null`.
    `int` | `hashCode()`
    `void` | `removeProperty(Property pProperty)` Removes the given property with its value from the resource.
    `boolean` | `removeResourceChild(IResource pRes)` Removes a resource of the list of children resources.
    `void` | `setName(java.lang.String pName)` Sets the name of the resource.
    `void` | `setPropertyValues(java.util.Collection<IPropertyValue> pPropertyValues)` Sets the property values of this resource.

    - ### Methods inherited from class org.eclipse.core.runtime.PlatformObject

      `getAdapter`

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

      `getClass, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface org.eclipse.core.runtime.IAdaptable

      `getAdapter`

- - ### Field Detail

    - #### _ID

          public java.lang.String _ID

      The resource identifier.

    - #### _name

          public java.lang.String _name

      The name of the resource.

  - ### Constructor Detail

    - #### Resource

          public Resource()

      Creates a new resource with a UUID.

      Do not use this constructor for new instances (only in sub class constructors). Class is not declared as abstract for compatibility reasons.

      See Also:
        `Resource(String)`

    - #### Resource

          public Resource(java.lang.String pID)

      Do not use this constructor for new instances (only in sub class constructors). Class is not declared as abstract for compatibility reasons.
      Parameters:
        `pID` - the identifier for this resource.

    - #### Resource

          public Resource(java.lang.String pID,
                          IResource pParent)

      Do not use this constructor for new instances (only in sub class constructors). Class is not declared as abstract for compatibility reasons.
      Parameters:
        `pID` - the identifier for this resource.
        `pParent` - the parent resource. Can be `null`.
      See Also:
        `getParentResource()`

  - ### Method Detail

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `java.lang.Object`

    - #### equals

          public boolean equals(java.lang.Object obj)

      Overrides:
        `equals` in class `java.lang.Object`

    - #### getPropertyValue

          public IPropertyValue getPropertyValue(Property pProperty)

      Description copied from interface: `IResource`
      Get the value of the given property in this resource.
      Specified by:
        `getPropertyValue` in interface `IResource`
      Parameters:
        `pProperty` - TAURUS property
      Returns:
        value of the given property in this resource

    - #### addPropertyValue

          public void addPropertyValue(IPropertyValue pPropertyValue)

      Description copied from interface: `IResource`
      Set the value of the property associated with the given property value in this resource to the given property value.
      Specified by:
        `addPropertyValue` in interface `IResource`
      Parameters:
        `pPropertyValue` - the new property value

    - #### setPropertyValues

          public void setPropertyValues(java.util.Collection<IPropertyValue> pPropertyValues)

      Description copied from interface: `IResource`
      Sets the property values of this resource.
      Specified by:
        `setPropertyValues` in interface `IResource`
      Parameters:
        `pPropertyValues` - the new property values

    - #### getAllPropertyValues

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

      Description copied from interface: `IResource`
      Get all property values of this resource.

      Modifying the returned map will have no effect on the resource.

      Specified by:
        `getAllPropertyValues` in interface `IResource`
      Returns:
        all property values of this resource

    - #### getID

          public java.lang.String getID()

      Description copied from interface: `IResource`
      Gets the unique ID of the resource.
      Specified by:
        `getID` in interface `IResource`
      Returns:
        the resource ID.

    - #### setName

          public void setName(java.lang.String pName)

      Description copied from interface: `IResource`
      Sets the name of the resource.
      Specified by:
        `setName` in interface `IResource`
      Parameters:
        `pName` - the new resource name

    - #### getName

          public java.lang.String getName()

      Description copied from interface: `IResource`
      Gets the name of the resource.
      Specified by:
        `getName` in interface `IResource`
      Returns:
        the resource name

    - #### getParentResource

          public IResource getParentResource()

      Description copied from interface: `IResource`
      Returns the parent of this resource or `null` if there is none.

      Note: Parent/Child relationships will only be maintained if the "Linked Element List" attribute ( `ActionDescriptor.isLinkElementList()`) is set to `true`.

      Specified by:
        `getParentResource` in interface `IResource`
      Returns:
        the parent resource or `null`.

    - #### getChildrenResources

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

      Description copied from interface: `IResource`
      Returns a list of child resources. Can be an empty list if there are no child resources.

      Note: Parent/Child relationships will only be maintained if the "Linked Element List" attribute ( `ActionDescriptor.isLinkElementList()`) is set to `true`.

      Specified by:
        `getChildrenResources` in interface `IResource`
      Returns:
        a list of children resources. Can be empty.

    - #### delete

          public void delete()
                      throws TaurusCoreException

      Description copied from interface: `IResource`
      Removes this resource and all its children resources from cache.
      Will not delete the physical resource on the target system.
      Specified by:
        `delete` in interface `IResource`
      Throws:
        `TaurusCoreException` - if the deletion of the resource fails
      See Also:
        `IResource.getChildrenResources()`

    - #### getPropertyValueFromHierarchy

          public IPropertyValue getPropertyValueFromHierarchy(Property pProperty)

      Description copied from interface: `IResource`
      Returns a property value of this resource and (if existent) parent resources. If this resource already contains the desired property value, this method does nothing but calling `IResource.getPropertyValue(Property)`. Otherwise `IResource.getParentResource()` will be called recursively until `IResource.getPropertyValue(Property)` returns a value or the root parent is reached.
      Specified by:
        `getPropertyValueFromHierarchy` in interface `IResource`
      Parameters:
        `pProperty` - the desired property
      Returns:
        an `IPropertyValue` or `null` if the value cannot be found in the hierarchy.

    - #### addResourceChild

          public boolean addResourceChild(IResource pRes)

      Description copied from interface: `IResource`
      Adds a resource to the list of children resources. Does nothing if the given resource is already a child of this resource.
      Specified by:
        `addResourceChild` in interface `IResource`
      Parameters:
        `pRes` - the `IResource` to be added as child of this resource.
      Returns:
        `true` if an element was added as a result of this call
      See Also:
        `IResource.getResourceChildren()`

    - #### addChildResource

          public void addChildResource(IResource pRes)

      Description copied from interface: `IResource`
      Adds a resource to the list of children resources. Does nothing if the given resource is already a child of this resource.
      Specified by:
        `addChildResource` in interface `IResource`
      Parameters:
        `pRes` - the `IResource` to be added as child of this resource.
      See Also:
        `IResource.getResourceChildren()`

    - #### getValueOfLinkedProperty

          public static IPropertyValue getValueOfLinkedProperty(IResource pRes,
                                                                LinkedProperty pProp)

      Gets the value of a linked property, where `IResource.getPropertyValue(Property)` would return `null`. The reason is that we don't add linked properties to resources directly, since they don't have a value that needs to be persisted (more precisely, the value must not be persisted).
      Parameters:
        `pRes` - the resource to get the linked property value from
        `pProp` - the linked property
      Returns:
        the linked property value

    - #### removeProperty

          public void removeProperty(Property pProperty)

      Removes the given property with its value from the resource.
      Parameters:
        `pProperty` - the property which should be removed from the resource

    - #### getResourceChildren

          public java.util.Collection<? super IResource> getResourceChildren()

      Description copied from interface: `IResource`
      Returns an unmodifiable `Collection` of child resources. Can be an empty `Collection` if there are no child resources.

      Note: Parent/Child relationships will only be maintained if the "Linked Element List" attribute ( `ActionDescriptor.isLinkElementList()`) is set to `true`.

      Specified by:
        `getResourceChildren` in interface `IResource`
      Returns:
        an unmodifiable `Collection` of children resources. Can be empty.

    - #### removeResourceChild

          public boolean removeResourceChild(IResource pRes)

      Description copied from interface: `IResource`
      Removes a resource of the list of children resources. Does nothing if the given resource is not a child of this resource.
      Specified by:
        `removeResourceChild` in interface `IResource`
      Parameters:
        `pRes` - the `IResource` to be added as child of this resource.
      Returns:
        `true` if an element was removed as a result of this call
      See Also:
        `IResource.getResourceChildren()`

Copyright © 2015 Micro Focus GmbH. All rights reserved.