Class: EntityManager

EntityManager

new EntityManager(module)

A SnoozeJS Entity Manager
Parameters:
Name Type Description
module object The module the EntityManager will belong to
Source:

Methods

(inner) addController(ctrl)

Adds the Controller to this Entity Manager
Parameters:
Name Type Description
ctrl object The Controller to Add
Source:

(inner) addDAO(dao)

Adds the DAO to this Entity Manager
Parameters:
Name Type Description
dao object The DAO to Add
Source:

(inner) addDTO(dto)

Adds the DTO to this Entity Manager
Parameters:
Name Type Description
dto object The DTO to Add
Source:

(inner) addService(srv)

Adds the Service to this Entity Manager
Parameters:
Name Type Description
srv object The Service to Add
Source:

(inner) addValidator(vd)

Adds the Validator to this Entity Manager
Parameters:
Name Type Description
vd object The Validator to Add
Source:

(inner) associateDAO(dao)

Applies DAO relationships. This occurs after all DAOs have been compiled.
Parameters:
Name Type Description
dao object The DAO
Source:

(inner) associateDAOs()

Associates all DAOs for this EntityManager
Source:

(inner) compile()

Compiles all Entities for this EntityManager
Source:

(inner) compileController(ctrl)

Compiles a Controller by running it's Injection Function and adding the returned object to the Controller
Parameters:
Name Type Description
ctrl object The Controller
Source:

(inner) compileControllers()

Compiles all Controllers for this EntityManager
Source:

(inner) compileDAO(dao)

Compiles a DAO by running it's Injection Function and settings the fields, and options of the DAO from the returned object. Additionally records DAO relationships
Parameters:
Name Type Description
dao object The DAO
Source:

(inner) compileDAOs()

Compiles all DAOs for this EntityManager
Source:

(inner) compileDTO(dto)

Compiles a DTO by running it's Injection Function and defining the DTO from the returned JSON
Parameters:
Name Type Description
dto object The DTO
Source:

(inner) compileDTOs()

Compiles all DTOs for this EntityManager
Source:

(inner) compileService(srv)

Compiles a Service by running it's Injection Function and adding the returned object to the Service
Parameters:
Name Type Description
srv object The Service
Source:

(inner) compileServices()

Compiles all Services for this EntityManager
Source:

(inner) compileUnit(unit)

Compiles a Unit by running it's Injection Function and setting the returned function as the Unit's Test Function
Parameters:
Name Type Description
unit object The Unit Test
Source:

(inner) compileUnits()

Compiles all Units for this EntityManager
Source:

(inner) compileValidator(vd)

Compiles a Validator by running it's Injection Function and adding the returned object to the Validator
Parameters:
Name Type Description
vd object The Validator
Source:

(inner) compileValidators()

Compiles all Validators for this EntityManager
Source:

(inner) controller(nm, func) → {object}

Creates a Controller and returns the Module this Entity Manager belongs to.
Parameters:
Name Type Description
nm string The name of the Controller
func function The Injection Function to build this Controller on
Source:
Returns:
The Module
Type
object

(inner) controllerExists(nm) → {boolean}

Checks if the Controller exists
Parameters:
Name Type Description
nm string The name of the Controller
Source:
Returns:
Type
boolean

(inner) dao(nm, func) → {object}

Creates a DAO and returns the Module this Entity Manager belongs to.
Parameters:
Name Type Description
nm string The name of the DAO
func function The Injection Function to build this DAO on
Source:
Returns:
The Module
Type
object

(inner) daoExists(nm) → {boolean}

Checks if the DAO exists
Parameters:
Name Type Description
nm string The name of the DAO
Source:
Returns:
Type
boolean

(inner) defineDTOFromJSON(dto, json)

Defines a DTO from a DTO Property JSON Object
Parameters:
Name Type Description
dto object The DTO to define
json object The DTO Property JSON
Source:

(inner) dto(nm, json) → {object}

Creates a DTO and returns the Module this Entity Manager belongs to.
Parameters:
Name Type Description
nm string The name of the DTO
json object The DTO Properties
Source:
Returns:
The Module
Type
object

(inner) dtoExists(nm) → {boolean}

Checks if the DTO exists
Parameters:
Name Type Description
nm string The name of the DTO
Source:
Returns:
Type
boolean

(inner) getController(nm) → {object}

Gets the Controller with the supplied name
Parameters:
Name Type Description
nm string The name of the Controller
Source:
Returns:
Controller
Type
object

(inner) getControllers() → {array}

Gets the Controllers managed by this EntityManager
Source:
Returns:
Array of Controllers
Type
array

(inner) getDAO(nm) → {object}

Gets the DAO with the supplied name
Parameters:
Name Type Description
nm string The name of the DAO
Source:
Returns:
DAO
Type
object

(inner) getDAOs() → {array}

Gets the DAOs managed by this EntityManager
Source:
Returns:
Array of DAOs
Type
array

(inner) getDTO(nm) → {object}

Gets the DTO with the supplied name
Parameters:
Name Type Description
nm string The name of the DTO
Source:
Returns:
DTO
Type
object

(inner) getDTOs() → {array}

Gets the DTOs managed by this EntityManager
Source:
Returns:
Array of DTOs
Type
array

(inner) getService(nm) → {object}

Gets the Service with the supplied name
Parameters:
Name Type Description
nm string The name of the Service
Source:
Returns:
Service
Type
object

(inner) getServices() → {array}

Gets the Services managed by this EntityManager
Source:
Returns:
Array of Services
Type
array

(inner) getUnits() → {array}

Gets the Unit Tests managed by this EntityManager
Source:
Returns:
Array of Unit Tests
Type
array

(inner) getValidator(nm) → {object}

Gets the Validator with the supplied name
Parameters:
Name Type Description
nm string The name of the Validator
Source:
Returns:
Validator
Type
object

(inner) getValidators() → {array}

Gets the Validators managed by this EntityManager
Source:
Returns:
Array of Validators
Type
array

(inner) removeController(nm)

Removes the Controller from this Entity Manager
Parameters:
Name Type Description
nm string The name of the Controller
Source:

(inner) removeDAO(nm)

Removes the DAO from this Entity Manager
Parameters:
Name Type Description
nm string The name of the DAO
Source:

(inner) removeDTO(nm)

Removes the DTO from this Entity Manager
Parameters:
Name Type Description
nm string The name of the DTO
Source:

(inner) removeService(nm)

Removes the Service from this Entity Manager
Parameters:
Name Type Description
nm string The name of the Service
Source:

(inner) removeValidator(nm)

Removes the Validator from this Entity Manager
Parameters:
Name Type Description
nm string The name of the Validator
Source:

(inner) run(_func) → {mixed}

Runs an Injection Function and returns it's output
Parameters:
Name Type Description
_func function The Injection Function
Source:
Returns:
Type
mixed

(inner) service(nm, func) → {object}

Creates a Service and returns the Module this Entity Manager belongs to.
Parameters:
Name Type Description
nm string The name of the Service
func function The Injection Function to build this Service on
Source:
Returns:
The Module
Type
object

(inner) serviceExists(nm) → {boolean}

Checks if the Service exists
Parameters:
Name Type Description
nm string The name of the Service
Source:
Returns:
Type
boolean

(inner) unit(fn) → {object}

Creates a Unit Test and returns the Module this Entity Manager belongs to.
Parameters:
Name Type Description
fn function The Injection Function to build this Unit Test on
Source:
Returns:
The Module
Type
object

(inner) validator(nm, func) → {object}

Creates a Validator and returns the Module this Entity Manager belongs to.
Parameters:
Name Type Description
nm string The name of the DAO
func function The Injection Function to build this Validator on
Source:
Returns:
The Module
Type
object

(inner) validatorExists(nm) → {boolean}

Checks if the Validator exists
Parameters:
Name Type Description
nm string The name of the Validator
Source:
Returns:
Type
boolean