Package org.pentaho.reporting.libraries.repository.dummy

## Class DummyContentLocation

- java.lang.Object
- - org.pentaho.reporting.libraries.repository.dummy.DummyContentLocation

- All Implemented Interfaces:
    `java.io.Serializable`, `ContentEntity`, `ContentLocation`

      public class DummyContentLocation
      extends java.lang.Object
      implements ContentLocation, java.io.Serializable

  A dummy content location holds references to all dummy items. It does allow to create any items, but always reports itself as empty location. This implementation only serves as data-sink in case the generated content is not needed anywhere.
  Author:
    Thomas Morgner
  See Also:
    Serialized Form

- - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `DummyContentLocation​(ContentLocation parent, java.lang.String name)` | Creates a new DummyContentLocation with the given parent and name.
    `DummyContentLocation​(Repository repository, java.lang.String name)` | Creates a new root DummyContentLocation with the given repository and name.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `ContentItem` | `createItem​(java.lang.String name)` | Creates a new data item in the current location.
    `ContentLocation` | `createLocation​(java.lang.String name)` | Creates a new content location in the current location.
    `boolean` | `delete()` | A dummy location does not have content and therefore does not support the delete command.
    `boolean` | `exists​(java.lang.String name)` | A dummy location does not have children, therefore this method always returns false.
    `java.lang.Object` | `getAttribute​(java.lang.String domain, java.lang.String key)` | Dummy locations do not have attributes, therefore this method always returns null.
    `java.lang.Object` | `getContentId()` | Returns the full pathname of the location.
    `ContentEntity` | `getEntry​(java.lang.String name)` | Returns the content entity with the given name.
    `java.lang.String` | `getName()` | Returns the name of the entry.
    `ContentLocation` | `getParent()` | Returns the parent, if there is any.
    `Repository` | `getRepository()` | Returns the parent repository for this location.
    `ContentEntity[]` | `listContents()` | Returns all content entities stored in this content-location.
    `boolean` | `setAttribute​(java.lang.String domain, java.lang.String key, java.lang.Object value)` | Dummy locations do not allow to set attributes, therefore this method always returns false.

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

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

- - ### Constructor Detail

    - #### DummyContentLocation

          public DummyContentLocation​(ContentLocation parent,
                                      java.lang.String name)

      Creates a new DummyContentLocation with the given parent and name. The location will inherit the repository from its parent.
      Parameters:
        `parent` - the parent location.
        `name` - the name of this location.

    - #### DummyContentLocation

          public DummyContentLocation​(Repository repository,
                                      java.lang.String name)

      Creates a new root DummyContentLocation with the given repository and name.
      Parameters:
        `repository` - the repository.
        `name` - the name of this location.

  - ### Method Detail

    - #### listContents

          public ContentEntity[] listContents()
                                       throws ContentIOException

      Returns all content entities stored in this content-location. This always returns an empty array.
      Specified by:
        `listContents` in interface `ContentLocation`
      Returns:
        the content entities for this location, an empty array.
      Throws:
        `ContentIOException` - if an repository error occured.

    - #### getEntry

          public ContentEntity getEntry​(java.lang.String name)
                                 throws ContentIOException

      Returns the content entity with the given name. This always throws the ContentIOException, as this implementation claims to not know any of its childs.
      Specified by:
        `getEntry` in interface `ContentLocation`
      Parameters:
        `name` - the name of the entity to be retrieved.
      Returns:
        the content entity for this name, never null.
      Throws:
        `ContentIOException` - if an repository error occured.

    - #### createItem

          public ContentItem createItem​(java.lang.String name)
                                 throws ContentCreationException

      Creates a new data item in the current location. This method must never return null. This method will fail if an entity with the same name exists in this location.
      Specified by:
        `createItem` in interface `ContentLocation`
      Parameters:
        `name` - the name of the new entity.
      Returns:
        the newly created entity, never null.
      Throws:
        `ContentCreationException` - if the item could not be created.

    - #### createLocation

          public ContentLocation createLocation​(java.lang.String name)
                                         throws ContentCreationException

      Creates a new content location in the current location. This method must never return null. This method will fail if an entity with the same name exists in this location.
      Specified by:
        `createLocation` in interface `ContentLocation`
      Parameters:
        `name` - the name of the new entity.
      Returns:
        the newly created entity, never null.
      Throws:
        `ContentCreationException` - if the item could not be created.

    - #### exists

          public boolean exists​(java.lang.String name)

      A dummy location does not have children, therefore this method always returns false.
      Specified by:
        `exists` in interface `ContentLocation`
      Parameters:
        `name` - the name of the item.
      Returns:
        false.

    - #### getName

          public java.lang.String getName()

      Returns the name of the entry.
      Specified by:
        `getName` in interface `ContentEntity`
      Returns:
        the name, never null.

    - #### getContentId

          public java.lang.Object getContentId()

      Returns the full pathname of the location.
      Specified by:
        `getContentId` in interface `ContentEntity`
      Returns:
        the full pathname.

    - #### getAttribute

          public java.lang.Object getAttribute​(java.lang.String domain,
                                               java.lang.String key)

      Dummy locations do not have attributes, therefore this method always returns null.
      Specified by:
        `getAttribute` in interface `ContentEntity`
      Parameters:
        `domain` - the attribute domain.
        `key` - the name of the attribute.
      Returns:
        the value or null, if the content-entity does not have a value for this attribute.

    - #### setAttribute

          public boolean setAttribute​(java.lang.String domain,
                                      java.lang.String key,
                                      java.lang.Object value)

      Dummy locations do not allow to set attributes, therefore this method always returns false.
      Specified by:
        `setAttribute` in interface `ContentEntity`
      Parameters:
        `domain` - the attribute domain.
        `key` - the attribute name
        `value` - the new attribute value.
      Returns:
        false.

    - #### getParent

          public ContentLocation getParent()

      Returns the parent, if there is any.
      Specified by:
        `getParent` in interface `ContentEntity`
      Returns:
        the parent.

    - #### getRepository

          public Repository getRepository()

      Returns the parent repository for this location.
      Specified by:
        `getRepository` in interface `ContentEntity`
      Returns:
        the repository.

    - #### delete

          public boolean delete()

      A dummy location does not have content and therefore does not support the delete command.
      Specified by:
        `delete` in interface `ContentEntity`
      Returns:
        always false.