Class: EntityFactory

binding.EntityFactory(propertiesopt, …arguments) → {T}

new EntityFactory(propertiesopt, …arguments) → {T}

Parameters:
Name Type Attributes Description
properties Object <optional>

initial properties to set on the instance

arguments * <repeatable>

Additional constructor params passed through the type constructor

Source:
Returns:

The new managed instance

Type
T

Extends

Members

(protected, readonly) db :EntityManager

The owning EntityManager where this factory belongs to

Type:
Inherited From:
Source:

(protected, readonly) managedType :metamodel.ManagedType

The managed type of this factory

Type:
Inherited From:
Source:

methods :Object.<string, function()>

Methods that are added to object instances
This property is an alias for this factory type prototype

Type:
  • Object.<string, function()>
Inherited From:
Source:

Methods

addMethod(name, fn) → {void}

Add a method to instances of this factories type

Parameters:
Name Type Description
name string

The method name to add

fn function

The Method to add

Inherited From:
Source:
Returns:
Type
void

addMethods(methods) → {void}

Adds methods to instances of this factories type

Parameters:
Name Type Description
methods Object.<string, function()>

The methods to add

Inherited From:
Source:
Returns:
Type
void

find() → {query.Builder.<T>}

Creates a new query for this class

Source:
Returns:

The query builder

Type
query.Builder.<T>

fromJSON(json) → {T}

Creates a new instance and sets the DatabaseObject to the given json

Parameters:
Name Type Description
json json
Overrides:
Source:
Returns:

instance

Type
T

load(id, optionsopt, doneCallbackopt, failCallbackopt) → {Promise.<T>}

Loads the instance for the given id, or null if the id does not exists.

Parameters:
Name Type Attributes Description
id string

The id to query

options Object <optional>

The load options

Properties
Name Type Attributes Default Description
depth number | boolean <optional>
0

The object depth which will be loaded. Depth 0 loads only this object,
true loads the objects by reachability.

refresh boolean <optional>
false

Indicates whether the object should be revalidated (cache bypass).

local boolean <optional>
false

Indicates whether the local copy (from the entity manager)
of an object should be returned if it exists. This value might be stale.

doneCallback binding.EntityFactory~doneCallback <optional>

Called when the operation succeed.

failCallback binding.EntityFactory~failCallback <optional>

Called when the operation failed.

Source:
Returns:

A Promise that will be fulfilled when the asynchronous operation completes.

Type
Promise.<T>

new(properties) → {T}

Creates a new instance of the of this type

Parameters:
Name Type Description
properties Object.<string, *>

Additional properties which will be applied to the created instance

Inherited From:
Source:
Returns:

A new created instance of this class

Type
T

newInstance(argsopt) → {T}

Creates a new instance of the factory type

Parameters:
Name Type Attributes Description
args Array.<*> <optional>

Constructor arguments used for instantiation, the constructor will not be called
when no arguments are passed

Inherited From:
Source:
Returns:

A new created instance of T

Type
T

partialUpdate(id, partialUpdateopt) → {partialupdate.EntityPartialUpdateBuilder.<T>}

Creates a new partial update for this class

Parameters:
Name Type Attributes Description
id string

The id to partial update

partialUpdate json <optional>

An initial partial update to execute

Source:
Returns:
Type
partialupdate.EntityPartialUpdateBuilder.<T>

ref(id) → {T}

Gets an unloaded reference for the given id.

Parameters:
Name Type Description
id string

The id of an object to get a reference for.

Source:
Returns:

An unloaded reference to the object with the given id.

Type
T