import BidEntityRelationsHelper from 'pvbid-sdk/src/domain/services/BidEntityRelationsHelper.js'
BidEntityRelationsHelper
Helper class to manage all bid entities in a bid.
Constructor Summary
Public Constructor | ||
public |
constructor(bid: Bid) Creates an instance of BidEntityRelationsHelper. |
Method Summary
Public Methods | ||
public |
Gets an assembly entity by id. |
|
public |
assemblyMaps(id: number): AssemblyMap | Object<string, AssemblyMap> Gets a assembly map entity by id. |
|
public |
bidEntityExists(type: string, id: number | string): boolean Determines if bid entity exists based on type and id. |
|
public |
Gets a component group entity by id. |
|
public |
Gets a component entity by id. |
|
public |
Gets a datatable entity by id. |
|
public |
dependencyExists(dependencyContract: object): boolean Determines if dependency exists basd on the dependency contract. |
|
public |
dynamicGroups(id: string): DynamicGroup | Object<string, DynamicGroup> Gets a dynamic group entity by id. |
|
public |
fieldGroups(id: number): FieldGroup | Object<string, FieldGroup> Gets a field group entity by id. |
|
public |
Gets a field entity by id. |
|
public |
getBidEntitiesByDefId(type: string, defId: number): BidEntity[] Get bid entities by a definition id |
|
public |
getBidEntity(type: string, id: number | string): BidEntity Gets a bid entity by type and id. |
|
public |
getCollection(type: string): object Returns the full collection of bid entites by type. |
|
public |
getComponentByDefId(defId: number): Component Gets a component by their core definition id. |
|
public |
getDatatableByDefId(defId: number): Datatable Gets a datatable by definition id |
|
public |
getDependants(type: string, id: int): * Gets all the dependants for a bid bid entity. |
|
public |
getDependency(dependencyContract: object): BidEntity Gets a bid entity by a dependency contract. |
|
public |
getDependencyValue(dependencyContract: object): string | number | boolean Gets the value of a bid entity by a dependency contract. |
|
public |
getFieldValue(field: *, dataColumnId: *): * |
|
public |
isDependencyFullyDefined(dependencyContract: object): boolean Checks if the dependency used an undefined dependency value when evaluating (dependencies may evaluate to a number even if they rely on an undefined value somewhere in the calc) |
|
public |
Gets a line item entity by id. |
|
public |
Gets a metric entity by id. |
|
public |
parseBoolean(value: *): * |
|
public |
searchByTitle(type: string, query: string, exactMatch: boolean): BidEntity[] Searches and returns an array of bid entities by their title. |
|
public |
Gets a bid variable entity by id. |
Public Constructors
Public Methods
public assemblies(id: number): Assembly | Object<string, Assembly> source
Gets an assembly entity by id. If no id is passed, will return an of object of keyed assemblies by their id..
Params:
Name | Type | Attribute | Description |
id | number |
Example:
{
"92" : <Assembly>,
"103" : <Assembly>
}
public assemblyMaps(id: number): AssemblyMap | Object<string, AssemblyMap> source
Gets a assembly map entity by id. If no id is passed, will return an object of keyed assembly maps by their id.
Params:
Name | Type | Attribute | Description |
id | number |
|
The id of the assembly map to retrieve. |
Example:
{
"92" : <AssemblyMap>,
"103" : <AssemblyMap>
}
public bidEntityExists(type: string, id: number | string): boolean source
Determines if bid entity exists based on type and id.
public componentGroups(id: number): ComponentGroup | Object<string, ComponentGroup> source
Gets a component group entity by id. If no id is passed, will return an of object of keyed component groups by their id..
Params:
Name | Type | Attribute | Description |
id | number |
Example:
{
"92" : <ComponentGroup>,
"103" : <ComponentGroup>
}
public components(id: number): Component | Object<string, Component> source
Gets a component entity by id. If no id is passed, will return an object of keyed components by their id.
Params:
Name | Type | Attribute | Description |
id | number |
|
The id of the component to retrieve. |
Example:
{
"92" : <Component>,
"103" : <Component>
}
public datatables(id: number): Datatable | Object<string, Datatable> source
Gets a datatable entity by id. If no id is passed, will return an of object of keyed datatables by their id..
Params:
Name | Type | Attribute | Description |
id | number |
Example:
{
"92" : <Datatable>,
"103" : <Datatable>
}
public dependencyExists(dependencyContract: object): boolean source
Determines if dependency exists basd on the dependency contract.
public dynamicGroups(id: string): DynamicGroup | Object<string, DynamicGroup> source
Gets a dynamic group entity by id. If no id is passed, will return an of object of keyed dynamic groups by their id.
Params:
Name | Type | Attribute | Description |
id | string |
Example:
{
"92" : <DynamicGroup>,
"103" : <DynamicGroup>
}
public fieldGroups(id: number): FieldGroup | Object<string, FieldGroup> source
Gets a field group entity by id. If no id is passed, will return an of object of keyed field groups by their id..
Params:
Name | Type | Attribute | Description |
id | number |
Example:
{
"92" : <FieldGroup>,
"103" : <FieldGroup>
}
public fields(id: number): Field | Object<string, Field> source
Gets a field entity by id. If no id is passed, will return an of object of keyed fields by their id..
Params:
Name | Type | Attribute | Description |
id | number |
Example:
{
"92" : <Field>,
"103" : <Field>
}
public getBidEntitiesByDefId(type: string, defId: number): BidEntity[] source
Get bid entities by a definition id
public getBidEntity(type: string, id: number | string): BidEntity source
Gets a bid entity by type and id.
public getCollection(type: string): object source
Returns the full collection of bid entites by type. Returned is a keyed object by the bid entity id.
Params:
Name | Type | Attribute | Description |
type | string |
public getComponentByDefId(defId: number): Component source
Gets a component by their core definition id. Note, this function will be removed once
Params:
Name | Type | Attribute | Description |
defId | number |
public getDatatableByDefId(defId: number): Datatable source
Gets a datatable by definition id
Params:
Name | Type | Attribute | Description |
defId | number |
public getDependants(type: string, id: int): * source
Gets all the dependants for a bid bid entity.
Params:
Name | Type | Attribute | Description |
type | string | The type of bid enity. IE. line_item, field, metric, component, etc. |
|
id | int | The id of the bid entity. |
Return:
* | [BidEntity[]] |
public getDependency(dependencyContract: object): BidEntity source
Gets a bid entity by a dependency contract.
Params:
Name | Type | Attribute | Description |
dependencyContract | object | ||
dependencyContract.type | string | The type of bid entity, ie: line_item, metric, field, component, component_group, assembly, etc |
|
dependencyContract.bid_entity_id | string | The id of the bid entity. Note, this will eventual be converted to simply "id". |
|
dependencyContract.field | string | The bid entity property that holds the needed value. |
Return:
BidEntity (nullable: true) | Returns the bid entity requested determined by the dependency contract. |
Example:
{
"type" : <string>,
"bid_entity_id" : <string>,
"field" : <string>
}
public getDependencyValue(dependencyContract: object): string | number | boolean source
Gets the value of a bid entity by a dependency contract.
Params:
Name | Type | Attribute | Description |
dependencyContract | object | ||
dependencyContract.type | string | The type of bid entity, ie: line_item, metric, field, component, compnent_group, assembly, etc |
|
dependencyContract.bid_entity_id | string | The id of the bid entity. Note, this will eventual be converted to simply "id". |
|
dependencyContract.field | string | The bid entity property that holds the needed value. |
public getFieldValue(field: *, dataColumnId: *): * source
Params:
Name | Type | Attribute | Description |
field | * | ||
dataColumnId | * |
Return:
* |
public isDependencyFullyDefined(dependencyContract: object): boolean source
Checks if the dependency used an undefined dependency value when evaluating (dependencies may evaluate to a number even if they rely on an undefined value somewhere in the calc)
Params:
Name | Type | Attribute | Description |
dependencyContract | object |
public lineItems(id: number): LineItem | Object<string, LineItem> source
Gets a line item entity by id. If no id is passed, will return an of object of keyed line items by their id..
Params:
Name | Type | Attribute | Description |
id | number |
|
Example:
{
"92" : <LineItem>,
"103" : <LineItem>
}
public metrics(id: number): Metric | Object<string, Metric> source
Gets a metric entity by id. If no id is passed, will return an of object of keyed metrics by their id..
Params:
Name | Type | Attribute | Description |
id | number |
Example:
{
"92" : <Metric>,
"103" : <Metric>
}
public searchByTitle(type: string, query: string, exactMatch: boolean): BidEntity[] source
Searches and returns an array of bid entities by their title. Results are case-insensitive.
Params:
Name | Type | Attribute | Description |
type | string | The type of bid entity to search for: line_item, field, metric, component, assembly, etc. |
|
query | string | ||
exactMatch | boolean |
|
By default, the search will match any title that contains the search term. If this flag is set to true, the title search will perform a case-insensitive exact match |
public variables(id: string): Component | Object<string, Component> source
Gets a bid variable entity by id. If no id is passed, will return an object of keyed bid variables by their id.
Params:
Name | Type | Attribute | Description |
id | string |
|
The id of the component to retrieve. |
Example:
{
"xyg4" : <BidVariable>,
"burden" : <BidVariable>
}