Interface LimsLink<E extends Locatable>

Type Parameters:
E - The type of entity that is at the end of the link.
All Superinterfaces:
Linkable<E>, Locatable
All Known Subinterfaces:
LimsEntityLink<E>
All Known Implementing Classes:
ActionsLink, ArrangementsLink, ArtifactGroupLink, ArtifactGroupLink, ArtifactLink, ArtifactLink, ArtifactLink, ArtifactLink, ArtifactLink, ArtifactLink, AutomaticNextStepLink, AutomationLink, ClarityFile, ContainerLink, ContainerLink, ContainerLink, ContainerTypeLink, ContainerTypeLink, ContainerTypeLink, ControlTypeLink, ControlTypeLink, ControlTypeLink, ControlTypeLink, ControlTypeLink, CreationInput, DemuxArtifact, DemuxArtifactSample, DemuxLink, DemuxSourceArtifact, EscalatedArtifact, FieldLink, FileLink, GlobalTokenLink, Input, Input, InstrumentLink, InstrumentLink, InstrumentLink, InstrumentLink, InstrumentLink, InstrumentTypeLink, InstrumentTypeProcessType, LabLink, LabLink, LimsEntityLinkBase, LimsLinkBase, Location, NextAction, NextStep, Output, OutputArrangement, OutputPlacement, ParentProcessLink, ParentProcessLink, PermissionLink, PermissionLink, Placement, PlacementsLink, PoolsLink, PoolStep, ProcessLink, ProcessTemplateLink, ProcessTypeLink, ProcessTypeLink, ProcessTypeLink, ProcessTypeLink, ProcessTypeLink, ProgramStatusLink, ProjectLink, ProjectLink, ProtocolLink, ProtocolLink, ProtocolLink, ProtocolStepLink, ReagentKitLink, ReagentKitLink, ReagentKitLink, ReagentKitLink, ReagentLotLink, ReagentLotLink, ReagentLotsLink, ReagentsLink, ReagentTypeLink, ResearcherLink, ResearcherLink, ResearcherLink, ResearcherLink, Role, RoleLink, SampleLink, SampleLink, SavedQueryLink, SharedResultFile, StageLink, StepConfiguration, StepDetailsLink, StepSetupLink, Submitter, Technician, Technician, Technician, Technician, TypeDefinition, TypeDefinition, UdfConfigLink, UdtConfigLink, UserLink, WorkflowLink, WorkflowLink, WorkflowStage

public interface LimsLink<E extends Locatable> extends Linkable<E>
Interface for classes that are links to real LIMS objects.

From release 2.34.2 onwards, all concrete implementations of LimsLink should have their hashCode() and equals() methods implemented so links pointing to the same entity class with the same core URI (scheme, host, port and path) are considered equal, even if the concrete classes are not the same or the URI differs only by a query part. To this end, the LimsLinkBase or LimsEntityLinkBase classes provide convenience superclasses whose hashCode() and equals() methods call the hashCode and equals methods given on this interface. Those classes that cannot inherit from these base classes should themselves implement hashCode() and equals() in the same way.

This interface also provides a toString implementation that can give a default string representation for any link.

See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    static boolean
    equals(LimsLink<?> link, Object obj)
    Test a LimsLink against another object for equivalence.
    Get the class of the true, full LIMS entity this object links to.
    default LimsLink<E>
    Since anything implementing this interface is already a link, this default implementation will just return itself.
    Get the URI of the object we are linking to.
    static int
    hashCode(LimsLink<?> link)
    Calculate a hash code for the given link.
    static String
    toString(LimsLink<?> link)
    An implementation of toString() for links.

    Methods inherited from interface com.genologics.ri.Locatable

    setUri
  • Method Details

    • getUri

      URI getUri()
      Get the URI of the object we are linking to.
      Specified by:
      getUri in interface Locatable
      Returns:
      The URI.
    • getEntityClass

      Class<E> getEntityClass()
      Get the class of the true, full LIMS entity this object links to.
      Returns:
      The real object class.
    • getLink

      default LimsLink<E> getLink()
      Since anything implementing this interface is already a link, this default implementation will just return itself.
      Specified by:
      getLink in interface Linkable<E extends Locatable>
      Returns:
      This LimsLink.
    • hashCode

      static int hashCode(LimsLink<?> link)
      Calculate a hash code for the given link.

      The hash is made up of the hash of the entity class this link points to, and if the URI is not null the hash of its user info, scheme, host, port and path.

      Where the URI has no explicit port set, we try get to get the default port for the protocol. This covers HTTP (80), HTTPS (443), SFTP (22).

      Parameters:
      link - The link to calculate the hash code for. Cannot be null.
      Returns:
      A hash code for the link.
      Throws:
      NullPointerException - if link is null.
      Since:
      2.34.2
    • equals

      static boolean equals(LimsLink<?> link, Object obj)
      Test a LimsLink against another object for equivalence.

      To be considered equal, two LimsLink objects must:

      1. Point to entities of the same class (getEntityClass must be the same).
      2. Both links need their URIs to both be null, or both be set.
      3. If the URIs are set, some elements are compared to be equivalent:
        1. The user information (almost certainly null always with Clarity URIs).
        2. The scheme (protocol).
        3. The host.
        4. The port.
        5. The path.

      Note that the query part of the URI is not compared. Thus URIs that point to the same stateful entity that request different states will be considered equivalent.

      Where the URI has no explicit port set, we try get to get the default port for the protocol. This covers HTTP (80), HTTPS (443), SFTP (22).

      Parameters:
      link - The left link for comparison. Cannot be null.
      obj - The right other object for testing. Can be null.
      Returns:
      true if the link and the object it is compared to are equivalent, false if not.
      Throws:
      NullPointerException - if link is null.
      Since:
      2.34.2
    • toString

      static String toString(LimsLink<?> link)
      An implementation of toString() for links. The string form of a link is the name of the entity class and the LIMS id of the instance in the format "LimsLink<entity>[lims id]". If there is no LIMS id set, the value "unset" is given.
      Parameters:
      link - The link to convert to a string. Cannot be null.
      Returns:
      The string form of the link.
      Throws:
      NullPointerException - if link is null.
      Since:
      2.34.2