Interface UDFHolder

All Known Implementing Classes:
Artifact, ClarityProcess, Container, ExecutableProcess, Lab, ProcessTemplate, Project, Researcher, Sample, SampleBase, SampleCreation, StepDetails, UDT

public interface UDFHolder
Interface for any entity or other object that holds user defined fields (UDFs).
Since:
2.31
  • Method Summary

    Modifier and Type
    Method
    Description
    default UDF
    getUDF(String name)
    Finds a UDF by name.
    default UDF
    getUDF(String name, boolean fail)
    Finds a UDF by name.
    default UDF
    getUDF(String name, boolean fail, String failMessage)
    Finds a UDF by name.
    default List<UDF>
    Another alternative for getUserDefinedFields that is more pleasant on the eye when used in Groovy or other scripting systems where the property is accessed as if it were a field.
    default List<UDF>
    Alternative method used as a shorthand for getUserDefinedFields.
    default String
    Finds a UDF by name and, if found, returns its value.
    default String
    getUDFValue(String name, boolean fail)
    Finds a UDF by name and returns its value.
    default String
    getUDFValue(String name, boolean fail, String failMessage)
    Finds a UDF by name and return its value.
    default String
    getUDFValue(String name, String defaultValue)
    Finds a UDF by name and, if found, returns its value.
    Get a list of user defined fields held by the entity.
    default UDF
    setUDF(String name, Object value)
    Adds, sets or removes a UDF.
  • Method Details

    • getUserDefinedFields

      List<UDF> getUserDefinedFields()
      Get a list of user defined fields held by the entity.
      Returns:
      A list of UDF objects. This should never return null.
    • getUDFs

      default List<UDF> getUDFs()
      Alternative method used as a shorthand for getUserDefinedFields.
      Returns:
      A list of UDF objects.
    • getUdfs

      default List<UDF> getUdfs()
      Another alternative for getUserDefinedFields that is more pleasant on the eye when used in Groovy or other scripting systems where the property is accessed as if it were a field.
      Returns:
      A list of UDF objects.
    • getUDF

      default UDF getUDF(String name)
      Finds a UDF by name.
      Parameters:
      name - The name of the UDF to find.
      Returns:
      The UDF object with the same name, or null if there is no matching UDF.
      Throws:
      IllegalArgumentException - if name is null.
      Since:
      2.31.5
    • getUDFValue

      default String getUDFValue(String name)
      Finds a UDF by name and, if found, returns its value.
      Parameters:
      name - The name of the UDF to find.
      Returns:
      The value of the UDF, or null if there is no matching UDF.
      Throws:
      IllegalArgumentException - if name is null.
      Since:
      2.31.5
    • getUDFValue

      default String getUDFValue(String name, String defaultValue)
      Finds a UDF by name and, if found, returns its value.
      Parameters:
      name - The name of the UDF to find.
      defaultValue - The value to return if there is no matching UDF.
      Returns:
      The value of the UDF, or defaultValue if there is no matching UDF.
      Throws:
      IllegalArgumentException - if name is null.
      Since:
      2.31.5
    • getUDF

      default UDF getUDF(String name, boolean fail)
      Finds a UDF by name.
      Parameters:
      name - The name of the UDF to find.
      fail - Whether to fail with a MissingUDFException if the field is not found.
      Returns:
      The UDF object with the same name, or null if there is no matching UDF and fail is false.
      Throws:
      IllegalArgumentException - if name is null.
      MissingUDFException - if fail is true and there is no matching UDF.
      Since:
      2.31.5
    • getUDFValue

      default String getUDFValue(String name, boolean fail)
      Finds a UDF by name and returns its value.
      Parameters:
      name - The name of the UDF to find.
      fail - Whether to fail with a MissingUDFException if the field is not found.
      Returns:
      The value of the UDF, or null if there is no matching UDF and fail is false.
      Throws:
      IllegalArgumentException - if name is null.
      MissingUDFException - if fail is true and there is no matching UDF.
      Since:
      2.31.5
    • getUDF

      default UDF getUDF(String name, boolean fail, String failMessage)
      Finds a UDF by name.
      Parameters:
      name - The name of the UDF to find.
      fail - Whether to fail with a MissingUDFException if the field is not found.
      failMessage - The message to put in the MissingUDFException when such an exception is raised.
      Returns:
      The UDF object with the same name, or null if there is no matching UDF and fail is false.
      Throws:
      IllegalArgumentException - if name is null.
      MissingUDFException - if fail is true and there is no matching UDF.
    • getUDFValue

      default String getUDFValue(String name, boolean fail, String failMessage)
      Finds a UDF by name and return its value.
      Parameters:
      name - The name of the UDF to find.
      fail - Whether to fail with a MissingUDFException if the field is not found.
      failMessage - The message to put in the MissingUDFException when such an exception is raised.
      Returns:
      The value of the UDF, or null if there is no matching UDF and fail is false.
      Throws:
      IllegalArgumentException - if name is null.
      MissingUDFException - if fail is true and there is no matching UDF.
      Since:
      2.31.5
    • setUDF

      default UDF setUDF(String name, Object value)
      Adds, sets or removes a UDF. If the named UDF exists, it either has its value set (if "value" is not null) or is removed (if "value" is null). If it doesn't exist, a new UDF object is created for the field and is added.
      Parameters:
      name - The name of the field to change.
      value - The value to set the field to.
      Returns:
      The UDF object found or created, or null if it is removed or not found.
      Throws:
      IllegalArgumentException - if name is null.
      Since:
      2.31.5