Options
All
  • Public
  • Public/Protected
  • All
Menu

Class ResourceDAO

Data access for OnmsResource objects.

Hierarchy

Implements

Index

Constructors

constructor

Accessors

http

Methods

find

  • Get all resources. NOTE: potentially very slow! It is strongly recommended that you retrieve resources by ID or node instead.

    Parameters

    • Optional filter: Filter

      Ignored. The resources API does not support filtering for the resource list query.

    Returns Promise<OnmsResource[]>

findValues

  • findValues(propertyId: string, options?: any): Promise<any>
  • Finds the values for the given propertyId, if it exists.

    Parameters

    • propertyId: string

      The propertyId to find the values for

    • Optional options: any

      Some additional options. May be implementer dependent, such as limit, or value restrictions

    Returns Promise<any>

    A promise containing the values.

get

Protected getApiVersion

  • getApiVersion(): number

Protected getCount

  • getCount(data: any): number
  • A convenience method to make it easy for implementers to extract the count (or totalCount) values from response data.

    Parameters

    • data: any

    Returns number

getFilterProcessor

getNode

  • getNode(nodeId: number | string, depth?: number): Promise<OnmsResource>
  • Retrieve a node resource and its children, given the node's ID.

    Parameters

    • nodeId: number | string

      The node's ID.

    • Optional depth: number

    Returns Promise<OnmsResource>

Protected getOptions

getPropertiesCache

Protected getServerMetadata

Protected parseResultList

  • parseResultList(result: any, dataFieldName: string, path: string, mapCallbackFunction: any): any
  • Fetches the data from the result and verfifes that the dataFieldName exists in the data property. If it does not exist, an exception is thrown.

    Parameters

    • result: any

      The result to fetch the data from

    • dataFieldName: string

      The property name (basically result.data[dataFieldName].

    • path: string

      The path where the result was fetched from. This is for error handling

    • mapCallbackFunction: any

      Callback function to convert each entry from result.data[dataFieldName].

    Returns any

searchProperties

searchProperty

Protected searchPropertyPath

  • searchPropertyPath(): string

Protected toDate

  • toDate(from: any): Moment | undefined
  • Convert the given value to a date, or undefined if it cannot be converted.

    Parameters

    • from: any

    Returns Moment | undefined

Protected toNumber

  • toNumber(from: any): number | undefined
  • Convert the given value to a number, or undefined if it cannot be converted.

    Parameters

    • from: any

    Returns number | undefined

Protected useJson

  • useJson(): boolean

Generated using TypeDoc