org.licas.service.link

## Class PermanentLink

- java.lang.Object
- - org.licas.service.link.PermanentLink

-     public class PermanentLink
      extends java.lang.Object

  This class stores information about a service's permanent links list. These are links from one source to another that are specified once and are permanent until they are specifically removed.
  Author:
    Kieran Greer

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected java.util.HashMap<java.lang.String,java.lang.Object>` | `linksFromService` Permanent links from other services to this one.
    `protected java.util.HashMap<java.lang.String,java.lang.Object>` | `linksToService` Permanent links from this service to other ones.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `PermanentLink()` Create a new instance of PermanentLink

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `addLinkFromService(java.lang.String serviceID, java.lang.Object theReference)` Add a link from another service.
    `boolean` | `addLinkToService(java.lang.String serviceID, java.lang.Object theReference)` Add a link to another service.
    `java.util.ArrayList<java.lang.Object>` | `getAllLinkFromService()` Get all source references for all links from another service.
    `java.util.ArrayList<java.lang.String>` | `getAllLinkFromServiceIDs()` Get the ID list for all links from other services.
    `java.util.ArrayList<java.lang.Object>` | `getAllLinkToService()` Get all source references for all links to another service.
    `java.util.ArrayList<java.lang.String>` | `getAllLinkToServiceIDs()` Get the ID list for all links to another service.
    `java.lang.Object` | `getLinkFromService(java.lang.String serviceID)` Get the source reference for a link from another service.
    `java.lang.Object` | `getLinkToService(java.lang.String serviceID)` Get the source reference for a link to another service.
    `void` | `removeLinkFromService(java.lang.String serviceID)` Remove the link from the specified service if it exists.
    `void` | `removeLinkToService(java.lang.String serviceID)` Remove the link to the specified service if it exists.

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

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

- - ### Field Detail

    - #### linksToService

          protected java.util.HashMap<java.lang.String,java.lang.Object> linksToService

      Permanent links from this service to other ones. The keys are the source ids of type String and values are the source references of type Object. Can be a direct reference or a String/Element URI path.

    - #### linksFromService

          protected java.util.HashMap<java.lang.String,java.lang.Object> linksFromService

      Permanent links from other services to this one. The keys are the source ids of type String and values are the source references of type Object. Can be a direct reference or a String/Element URI path.

  - ### Constructor Detail

    - #### PermanentLink

          public PermanentLink()

      Create a new instance of PermanentLink

  - ### Method Detail

    - #### addLinkToService

          public boolean addLinkToService(java.lang.String serviceID,
                                          java.lang.Object theReference)

      Add a link to another service.
      Parameters:
        `serviceID` - a unique id to identify the service.
        `theReference` - the source reference (Object or Element/String URI).
      Returns:
        true if the link is added or false if the id already exists.

    - #### removeLinkToService

          public void removeLinkToService(java.lang.String serviceID)

      Remove the link to the specified service if it exists.
      Parameters:
        `serviceID` - the id of the service being linked to.

    - #### getLinkToService

          public java.lang.Object getLinkToService(java.lang.String serviceID)

      Get the source reference for a link to another service.
      Parameters:
        `serviceID` - the id of the service linked to.
      Returns:
        the value of source or null if no link exists.

    - #### getAllLinkToService

          public java.util.ArrayList<java.lang.Object> getAllLinkToService()

      Get all source references for all links to another service.
      Returns:
        a list of all sources references of links to other services.

    - #### getAllLinkToServiceIDs

          public java.util.ArrayList<java.lang.String> getAllLinkToServiceIDs()

      Get the ID list for all links to another service.
      Returns:
        a list of all ID references of links to other services.

    - #### addLinkFromService

          public boolean addLinkFromService(java.lang.String serviceID,
                                            java.lang.Object theReference)

      Add a link from another service.
      Parameters:
        `serviceID` - a unique id to identify the service.
        `theReference` - the source reference (Object or Element/String URI).
      Returns:
        true if the link is added or false if the id already exists.

    - #### removeLinkFromService

          public void removeLinkFromService(java.lang.String serviceID)

      Remove the link from the specified service if it exists.
      Parameters:
        `serviceID` - the id of the service being linked to.

    - #### getLinkFromService

          public java.lang.Object getLinkFromService(java.lang.String serviceID)

      Get the source reference for a link from another service.
      Parameters:
        `serviceID` - the id of the service linked to.
      Returns:
        the value of source or null if no link exists.

    - #### getAllLinkFromService

          public java.util.ArrayList<java.lang.Object> getAllLinkFromService()

      Get all source references for all links from another service.
      Returns:
        a list of all sources references of links from other services.

    - #### getAllLinkFromServiceIDs

          public java.util.ArrayList<java.lang.String> getAllLinkFromServiceIDs()

      Get the ID list for all links from other services.
      Returns:
        a list of all ID references of links from other services.