com.microfocus.awm.model.internal

## Class ElementDirectory

- java.lang.Object
- - java.util.Observable
  - - com.microfocus.awm.model.internal.TaurusDirectory
    - - com.microfocus.awm.model.internal.ElementDirectory

- All Implemented Interfaces:
    IElementDirectory

      public class ElementDirectory
      extends TaurusDirectory
      implements IElementDirectory

  Main implementation of `IElementDirectory`.

- - ### Field Summary

    - ### Fields inherited from class com.microfocus.awm.model.internal.TaurusDirectory

      `ATTRIBUTE_CHILD_RESOURCE_ID, ELEMENT_CHILD_RESOURCE`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ElementDirectory()`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `addElement(IElement pElement)` Add an element to the TAURUS element directory.
    `boolean` | `addElementList(IElement pElement, java.lang.String pElementListID)` Add the list id to the list of element lists in which the element is contained.
    `boolean` | `addElementListEntries(IElementListEntry pElementListEntry, IElement pElement)` Add the given element list entry in the element list entries map.
    `void` | `addElementListEntry(IElementListEntry pEntry)` Adds a new `IElementListEntry` to the cache.
    `boolean` | `changeElementType(IElement pElement, ElementType newElementType)` Changes the element type of the given element.
    `void` | `deleteElementListMap()` Remove the eb_elementsinlists.xml-file from the workspace.
    `void` | `deleteElements()` Remove the et_elements.xml-file from the active application's folder.
    `IElement` | `getElement(java.lang.String pElementId)` Get the element with the given ID from the TAURUS element directory.
    `IElement` | `getElementForFile(org.eclipse.core.resources.IFile pFile)` Returns the Taurus element belonging to the given file in the internal Taurus project.
    `IElement` | `getElementForPath(org.eclipse.core.runtime.IPath pFullPath)` Returns the Taurus element belonging to the given path in the internal Taurus project.
    `java.util.Map<java.lang.String,IElementListEntry>` | `getElementListEntries()`
    `java.util.Set<IElementListEntry>` | `getElementListEntries(IElement pElement)` Gets element list entries that belong to the given element.
    `IElementListEntry` | `getElementListEntry(java.lang.String pID)` Returns a cached `IElementListEntry` or `null` if no entry with the given ID was found.
    `java.util.Set<IElement>` | `getElements(ElementType pElementTyp)` get all elements belonging to the specified type
    `static ElementDirectory` | `getInstance()` Returns this singleton's instance.
    `void` | `loadElementListMap()` Load the eb_elementsinlists.xml-file from the workspace which contains the references between elements and element lists in which they are contained.
    `void` | `loadElements()` Load the et_elements.xml file from the workspace.
    `void` | `removeElement(IElement pElement)` Remove the given element from the TAURUS element directory and all element lists in which it is contained.
    `void` | `saveElementListMap()` Save the eb_elementsinlists.xml-file in the workspace which contains the references between elements and element lists in which they are contained.
    `void` | `saveElements()` Save the et_elements.xml file to the workspace.

    - ### Methods inherited from class com.microfocus.awm.model.internal.TaurusDirectory

      `addChild, getResourceID, notifyObservers, saveChildren`

    - ### Methods inherited from class java.util.Observable

      `addObserver, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers`

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

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

    - ### Methods inherited from interface com.microfocus.awm.model.IElementDirectory

      `addObserver, deleteObserver`

- - ### Constructor Detail

    - #### ElementDirectory

          public ElementDirectory()

  - ### Method Detail

    - #### getInstance

          public static ElementDirectory getInstance()

      Returns this singleton's instance.
      Returns:
        the singleton's instance

    - #### addElement

          public boolean addElement(IElement pElement)

      Description copied from interface: `IElementDirectory`
      Add an element to the TAURUS element directory.
      Specified by:
        `addElement` in interface `IElementDirectory`
      Parameters:
        `pElement` - element to be added
      Returns:
        if the element was successfully added to the directory

    - #### changeElementType

          public boolean changeElementType(IElement pElement,
                                           ElementType newElementType)

      Description copied from interface: `IElementDirectory`
      Changes the element type of the given element.
      Specified by:
        `changeElementType` in interface `IElementDirectory`
      Parameters:
        `pElement` - the element
        `newElementType` - the new element type
      Returns:
        `true` if the element type was successfully changed

    - #### removeElement

          public void removeElement(IElement pElement)
                             throws TaurusCoreException

      Description copied from interface: `IElementDirectory`
      Remove the given element from the TAURUS element directory and all element lists in which it is contained.
      Specified by:
        `removeElement` in interface `IElementDirectory`
      Parameters:
        `pElement` - TAURUS element to be removed
      Throws:
        `TaurusCoreException` - if the element could not be removed or the cache could not be updated

    - #### addElementList

          public boolean addElementList(IElement pElement,
                                        java.lang.String pElementListID)

      Description copied from interface: `IElementDirectory`
      Add the list id to the list of element lists in which the element is contained.
      Specified by:
        `addElementList` in interface `IElementDirectory`
      Parameters:
        `pElement` - TAURUS element
        `pElementListID` - element list id
      Returns:
        if the element list was added successfully to the directory

    - #### addElementListEntries

          public boolean addElementListEntries(IElementListEntry pElementListEntry,
                                               IElement pElement)

      Description copied from interface: `IElementDirectory`
      Add the given element list entry in the element list entries map.
      Specified by:
        `addElementListEntries` in interface `IElementDirectory`
      Parameters:
        `pElementListEntry` - element list entry
        `pElement` - corresponding element of the element list entry
      Returns:
        `true` if the given element list entry has been added in the element list map and `false` otherwise

    - #### getElementListEntries

          public java.util.Set<IElementListEntry> getElementListEntries(IElement pElement)

      Description copied from interface: `IElementDirectory`
      Gets element list entries that belong to the given element.

      Note: Modifying the set will not have any effect on the element list cache.

      Specified by:
        `getElementListEntries` in interface `IElementDirectory`
      Parameters:
        `pElement` - the element to get element list entries from
      Returns:
        a set of element list entries belonging to the element

    - #### getElement

          public IElement getElement(java.lang.String pElementId)
                              throws TaurusCoreException

      Description copied from interface: `IElementDirectory`
      Get the element with the given ID from the TAURUS element directory.
      Specified by:
        `getElement` in interface `IElementDirectory`
      Parameters:
        `pElementId` - the element's id
      Returns:
        TAURUS element
      Throws:
        `TaurusCoreException` - if loading the element cache fails

    - #### getElements

          public java.util.Set<IElement> getElements(ElementType pElementTyp)

      get all elements belonging to the specified type
      Specified by:
        `getElements` in interface `IElementDirectory`
      Parameters:
        `pElementTyp` - element type
      Returns:
        all elements for the specified type

    - #### getElementForFile

          public IElement getElementForFile(org.eclipse.core.resources.IFile pFile)
                                     throws TaurusCoreException

      Description copied from interface: `IElementDirectory`
      Returns the Taurus element belonging to the given file in the internal Taurus project.
      Specified by:
        `getElementForFile` in interface `IElementDirectory`
      Parameters:
        `pFile` - file in the internal Taurus project
      Returns:
        Taurus element belonging to the given file in the internal Taurus project
      Throws:
        `TaurusCoreException` - if loading the element cache fails

    - #### getElementForPath

          public IElement getElementForPath(org.eclipse.core.runtime.IPath pFullPath)
                                     throws TaurusCoreException

      Description copied from interface: `IElementDirectory`
      Returns the Taurus element belonging to the given path in the internal Taurus project.
      Specified by:
        `getElementForPath` in interface `IElementDirectory`
      Parameters:
        `pFullPath` - full path in the internal Taurus project
      Returns:
        Taurus element belonging to the given path in the internal Taurus project
      Throws:
        `TaurusCoreException` - if loading the element cache fails

    - #### loadElements

          public void loadElements()
                            throws TaurusCoreException

      Description copied from interface: `IElementDirectory`
      Load the et_elements.xml file from the workspace.
      Specified by:
        `loadElements` in interface `IElementDirectory`
      Throws:
        `TaurusCoreException` - if loading the element cache fails

    - #### saveElements

          public void saveElements()
                            throws TaurusCoreException

      Description copied from interface: `IElementDirectory`
      Save the et_elements.xml file to the workspace.
      Specified by:
        `saveElements` in interface `IElementDirectory`
      Throws:
        `TaurusCoreException` - if saving the element cache fails

    - #### loadElementListMap

          public void loadElementListMap()
                                  throws TaurusCoreException

      Description copied from interface: `IElementDirectory`
      Load the eb_elementsinlists.xml-file from the workspace which contains the references between elements and element lists in which they are contained.
      Specified by:
        `loadElementListMap` in interface `IElementDirectory`
      Throws:
        `TaurusCoreException` - if loading the element list cache fails

    - #### saveElementListMap

          public void saveElementListMap()
                                  throws TaurusCoreException

      Description copied from interface: `IElementDirectory`
      Save the eb_elementsinlists.xml-file in the workspace which contains the references between elements and element lists in which they are contained.
      Specified by:
        `saveElementListMap` in interface `IElementDirectory`
      Throws:
        `TaurusCoreException` - if saving the element list cache fails

    - #### deleteElementListMap

          public void deleteElementListMap()
                                    throws TaurusCoreException

      Description copied from interface: `IElementDirectory`
      Remove the eb_elementsinlists.xml-file from the workspace.
      Specified by:
        `deleteElementListMap` in interface `IElementDirectory`
      Throws:
        `TaurusCoreException` - if updating the element list cache fails

    - #### deleteElements

          public void deleteElements()
                              throws TaurusCoreException

      Description copied from interface: `IElementDirectory`
      Remove the et_elements.xml-file from the active application's folder.
      Specified by:
        `deleteElements` in interface `IElementDirectory`
      Throws:
        `TaurusCoreException` - if updating the cache fails

    - #### getElementListEntry

          public IElementListEntry getElementListEntry(java.lang.String pID)

      Description copied from interface: `IElementDirectory`
      Returns a cached `IElementListEntry` or `null` if no entry with the given ID was found.
      Specified by:
        `getElementListEntry` in interface `IElementDirectory`
      Parameters:
        `pID` - an ID of an element list entry
      Returns:
        the found element list entry or `null`

    - #### getElementListEntries

          public java.util.Map<java.lang.String,IElementListEntry> getElementListEntries()

      Specified by:
        `getElementListEntries` in interface `IElementDirectory`
      Returns:
        the map of all cached element list entries.

    - #### addElementListEntry

          public void addElementListEntry(IElementListEntry pEntry)

      Description copied from interface: `IElementDirectory`
      Adds a new `IElementListEntry` to the cache. This is necessary if any `IElementListEntry` is created (usually done in the constructor).
      Specified by:
        `addElementListEntry` in interface `IElementDirectory`
      Parameters:
        `pEntry` - the entry to be added to the directory

Copyright © 2015 Micro Focus GmbH. All rights reserved.