Options
All
  • Public
  • Public/Protected
  • All
Menu

Class OneToOneLink<EntityT, LinkedEntityT>

Represents a link from one entity to one other linked entity (as opposed to a list of linked entities). In OData v2 a OneToOneLink can be used to filter and order a selection on an entity based on filters and orders on a linked entity.

Type parameters

  • EntityT: Entity

    Type of the entity to be linked from

  • LinkedEntityT: Entity

    Type of the entity to be linked to

Hierarchy

  • Link<EntityT, LinkedEntityT>
    • OneToOneLink

Implements

  • EntityIdentifiable<EntityT>

Index

Constructors

constructor

  • new OneToOneLink(fieldName: string, entityConstructor: Constructable<EntityT>, linkedEntity: Constructable<LinkedEntityT>): OneToOneLink
  • Creates an instance of Link.

    Parameters

    • fieldName: string

      Name of the linking field to be used in the OData request.

    • entityConstructor: Constructable<EntityT>

      Constructor type of the entity the field belongs to

    • linkedEntity: Constructable<LinkedEntityT>

      Constructor type of the linked entity

    Returns OneToOneLink

Properties

entityConstructor

entityConstructor: Constructable<EntityT>

Constructor type of the entity the field belongs to

fieldName

fieldName: string

Name of the linking field to be used in the OData request.

filters

filters: Filterable<LinkedEntityT>

Filterables to apply to the given entity based on the linked entity.

linkedEntity

linkedEntity: Constructable<LinkedEntityT>

Constructor type of the linked entity

orderBys

orderBys: Array<Order<LinkedEntityT>> = []

List of criteria of the linked entity to order the given entity by with descending priority.

selects

selects: Array<Selectable<LinkedEntityT>> = []

List of selectables on the linked entity.

Methods

filter

  • Create filter statements to be applied to the OData request based on the linked entity values.

    Parameters

    • Rest ...filters: Array<Filterable<LinkedEntityT>>

      Filters based on the linked entity

    Returns FilterLink<EntityT, LinkedEntityT>

    Newly created Filterlink

orderBy

  • Create order statements for the OData request based on the linked entity. The given statements have descending priority.

    Example:

    Entity.requestBuilder()
     .getAll()
     .orderBy(Entity.TO_LINKED_ENTITY.orderBy(asc(LinkedEntity.PROPERTY1), desc(LinkedEntity.PROPERTY2)));

    Parameters

    • Rest ...orderBy: Array<Orderable<LinkedEntityT>>

      Criteria to order by

    Returns OrderLink<EntityT, LinkedEntityT>

    Newly created order link

select

  • select(...selects: Array<Selectable<LinkedEntityT>>): Link<EntityT, LinkedEntityT>

Static clone

  • Create a new one to one link based on a given link.

    Type parameters

    • EntityT: Entity

      Type of the entity to be linked from

    • LinkedEntityT: Entity

      Type of the entity to be linked to

    Parameters

    • link: OneToOneLink<EntityT, LinkedEntityT>

      Link to be cloned

    Returns OneToOneLink<EntityT, LinkedEntityT>

    Newly created link