Domain object model (metadata) - in-memory representation of all *.meta files included in the application config. Developer should never create UBDomain class directly, but instead use a:
- App.domainInfo property inside server-side methods
- SyncConnection.getDomainInfo method inside CLI scripts
UBConnection.domain
property inside a browser
// server-side example
const UB = require('@unitybase/ub')
const App = UB.App
let ubaAuditPresent = App.domainInfo.has('uba_audit')
# new UBDomain (domainInfo: object)
Members
# dialectsPriority static
Priority to apply a mapping of a attributes/entities to the physical tables depending on connection dialect
Name | Type | Description |
---|---|---|
MSSQL2012 | ||
MSSQL2008 | ||
MSSQL | ||
Oracle11 | ||
Oracle10 | ||
Oracle9 | ||
Oracle | ||
PostgreSQL | ||
AnsiSQL | ||
Firebird | ||
SQLite3 |
# EntityCacheTypes static
Name | Type | Description |
---|---|---|
None | ||
Entity | ||
Session | ||
SessionEntity |
# EntityDataSourceType : string static
Entity dataSource types
Name | Type | Description |
---|---|---|
Normal | string | |
External | string | |
System | string | |
Virtual | string |
# ExpressionType static
Types of expressions in attribute mapping
Name | Type | Description |
---|---|---|
Field | ||
Expression |
# ubDataTypes static
Possible types of the attributes
Name | Type | Description |
---|---|---|
String | Small string. MSSQL: NVARCHAR, ORACLE: NVARCHAR2, POSTGRE: VARCHAR | |
Int | 32-bite Integer. MSSQL: INT, ORACLE: INTEGER, POSTGRE: INTEGER | |
BigInt | 64-bite Integer. MSSQL: BIGINT, ORACLE: NUMBER(19), POSTGRE: BIGINT | |
Float | Double. MSSQL: FLOAT, ORACLE: NUMBER(19, 4), POSTGRE: NUMERIC(19, 4) | |
Currency | Currency. MSSQL: FLOAT, ORACLE: NUMBER(19, 2), POSTGRE: NUMERIC(19, 2) | |
Boolean | Boolean. MSSQL: TINYINT, ORACLE: NUMBER(1), POSTGRE: SMALLINT | |
DateTime | Date + Time in UTC (GMT+0) timezone. MSSQL: DATETIME, OARCLE: DATE, POSTGRE: TIMESTAMP WITH TIME ZONE | |
Text | Long strint. MSSQL: NVARCHAR(MAX), ORACLE: CLOB, POSTGRE: TEXT | |
ID | Alias for BigInt | |
Entity | Reference to enother entity. BigInt | |
Document | Store a JSON with information about Document place in blob store | |
Many | ||
TimeLog | Seconds since UNIX epoch, Int64. MSSQL: BIGINT, ORACLE: NUMBER(19), POSTGRE: BIGINT | |
Enum | Enumertion (see ubm_enum) | |
BLOB | Bynary data. MSSQL: VARBINARY(MAX), ORACLE: BLOB, POSTGRE: BYTEA | |
Date | Date (without time) in UTC (GMT+0) | |
Json | Json stored in database. Postgres: JSONB, _MSSQL: NVARCHAR(4000), ORACLE: NVARCHAR2(2000) | |
Geometry | SPATIAL geometry. Postgres: geometry | |
Geography | SPATIAL geography. Postgres: geography |
# ubServiceFields static
Service attribute names
Name | Type | Description |
---|---|---|
dateFrom | ||
dateTo |
# connections : Array.<DBConnectionConfig> instance
Connection collection (extended domain only)
# customerModels : Array.<string> instance
Array of customer models names
# defaultConnection : DBConnectionConfig instance
Default connection (extended domain only)
# entities : Object.<string, UBEntity> instance
Map with keys is entity name, value is UBEntity
# models : Object.<string, UBModel> instance
Models collection
# orderedModels : Array.<UBModel> instance
Array of models, sorted by the order of loading
# vendorModels : Array.<string> instance
Array of vendor models names
Methods
# getPhysicalDataType (dataType: string) → string static
Return physical type by UBDataType
Arguments:
dataType
: string
# eachEntity (cb: domainEntitiesIteratorCallback) → object instance
Iterates over domain entities and invokes callBack
for each entity.
The iteratee is invoked with three arguments: (UBEntity, entityName, UBDomain.entities)
Arguments:
# filterEntities (predicate: object) → Array.<UBEntity> instance
Filter entities by properties
// sessionCachedEntities contains all entities with property cacheType === Session
var sessionCachedEntities = domain.filterEntities({cacheType: 'Session'});
# get (entityCode: string, raiseErrorIfNotExistsopt: boolean) → UBEntity instance
Get entity by code
# has (entityCode: string) → boolean instance
Check entity present in domain & user has access right for at least one entity method
Arguments:
entityCode
: string
# isEntityMethodsAccessible (entityCode: string, methodNames: string) → boolean instance
Check all provided entity methods are accessible via ELS.
If entity does not exist in domain or at last one of provided methods is not accessible - return false