|
ColdBox Platform Version 3.7.0 | ||||
FRAMES |
WEB-INF.cftags.componentcoldbox.system.orm.hibernate.BaseORMService
coldbox.system.orm.hibernate.VirtualEntityService
coldbox.system.orm.hibernate.ActiveEntity
public class ActiveEntity
******************************************************************************* Copyright Since 2005 ColdBox Framework by Luis Majano and Ortus Solutions, Corp www.coldbox.org | www.luismajano.com | www.ortussolutions.com ******************************************************************************* Description : This Active Entity object allows you to enhance your ORM entities with virtual service methods and make it follow more of an Active Record pattern, but not really :) It just allows you to operate on entity and related entity objects much much more easily. If you have enabled WireBox entity injection, then you will get an added validation features: boolean function isValid(fields="*",constraints="",locale=""){} coldbox.system.validation.result.IValidationResult function getValidationResults(){} These methods are only active if WireBox entity injection is available.
Constructor Summary | |
---|---|
init([string queryCacheRegion], [boolean useQueryCaching], [boolean eventHandling], [boolean useTransactions], [boolean defaultAsQuery])
Active Entity Constructor, if you override it, make sure you call super |
Method Summary | |
---|---|
any |
GETWIREBOX()
get: WireBox entity injector, only injected if ORM entity injection is available |
void |
SETWIREBOX(any wirebox)
set: WireBox entity injector, only injected if ORM entity injection is available |
any |
delete([any entity], [boolean flush='false'], [boolean transactional='[runtime expression]'])
Delete an entity |
any |
evict([any entity])
Evict entity objects from session, if no arguments, then the entity evicts itself |
IValidationResult |
getValidationResults()
Get the validation results object |
boolean |
isValid([string fields='*'], [any constraints=''], [string locale=''], [string excludeFields=''])
Validate the ActiveEntity with the coded constraints -> this |
any |
merge([any entity])
Merge an entity or array of entities back into the session |
any |
populate([any target='[runtime expression]'], struct memento, [string scope=''], [boolean trustedSetter='false'], [string include=''], [string exclude=''], [boolean ignoreEmpty='false'], [string nullEmptyInclude=''], [string nullEmptyExclude=''], [boolean composeRelationships='true'])
Simple map to property population for entities |
any |
populateFromJSON([any target='[runtime expression]'], string JSONString, [string scope=''], [boolean trustedSetter='false'], [string include=''], [string exclude=''], [boolean ignoreEmpty='false'], [string nullEmptyInclude=''], [string nullEmptyExclude=''], [boolean composeRelationships='true'])
Populate from JSON, for argument definitions look at the populate method |
any |
populateFromQuery([any target='[runtime expression]'], any qry, [numeric rowNumber='1'], [string scope=''], [boolean trustedSetter='false'], [string include=''], [string exclude=''], [boolean ignoreEmpty='false'], [string nullEmptyInclude=''], [string nullEmptyExclude=''], [boolean composeRelationships='true'])
Populate from Query, for argument definitions look at the populate method |
any |
populateFromXML([any target='[runtime expression]'], string xml, [string root=''], [string scope=''], [boolean trustedSetter='false'], [string include=''], [string exclude=''], [boolean ignoreEmpty='false'], [string nullEmptyInclude=''], [string nullEmptyExclude=''], [boolean composeRelationships='true'])
Populate from XML, for argument definitions look at the populate method |
any |
refresh([any entity])
Refresh the state of the entity |
any |
save([any entity], [boolean forceInsert='false'], [boolean flush='false'], [boolean transactional='[runtime expression]'])
Save an entity using hibernate transactions or not |
Methods inherited from class WEB-INF.cftags.component |
---|
|
Constructor Detail |
---|
public init([string queryCacheRegion], [boolean useQueryCaching], [boolean eventHandling], [boolean useTransactions], [boolean defaultAsQuery])
queryCacheRegion
- The query cache region to use if not we will use one for youuseQueryCaching
- Enable query caching for this entity or not, defaults to falseeventHandling
- Enable event handling for new() and save() operations, defaults to trueuseTransactions
- Enable transactions for all major operations, defaults to truedefaultAsQuery
- What should be the default return type query or arrays for list opertions, defaults to trueMethod Detail |
---|
public any GETWIREBOX()
public void SETWIREBOX(any wirebox)
wirebox
public any delete([any entity], [boolean flush='false'], [boolean transactional='[runtime expression]'])
delete
in class
BaseORMService
entity
- You can optionally pass in an entity, else this active entity is savedflush
- Flush the session or not, default is falsetransactional
- Use transactions or not, it defaults to truepublic any evict([any entity])
evict
in class
VirtualEntityService
entity
- The argument can be one persistence entity or an array of entitiespublic IValidationResult getValidationResults()
public boolean isValid([string fields='*'], [any constraints=''], [string locale=''], [string excludeFields=''])
fields
- One or more fields to validate on, by default it validates all fields in the constraints. This can be a simple list or an array.constraints
- An optional shared constraints name or an actual structure of constraints to validate on.locale
- An optional locale to use for i18n messagesexcludeFields
- An optional list of fields to exclude from the validation.public any merge([any entity])
merge
in class
BaseORMService
entity
- The argument can be one persistence entity or an array of entitiespublic any populate([any target='[runtime expression]'], struct memento, [string scope=''], [boolean trustedSetter='false'], [string include=''], [string exclude=''], [boolean ignoreEmpty='false'], [string nullEmptyInclude=''], [string nullEmptyExclude=''], [boolean composeRelationships='true'])
populate
in class
BaseORMService
target
memento
scope
- Use scope injection instead of setter injection, no need of setters, just tell us what scope to inject totrustedSetter
- Do not check if the setter exists, just call it, great for usage with onMissingMethod() and virtual propertiesinclude
- A list of keys to include in the population ONLYexclude
- A list of keys to exclude from the populationignoreEmpty
nullEmptyInclude
nullEmptyExclude
composeRelationships
public any populateFromJSON([any target='[runtime expression]'], string JSONString, [string scope=''], [boolean trustedSetter='false'], [string include=''], [string exclude=''], [boolean ignoreEmpty='false'], [string nullEmptyInclude=''], [string nullEmptyExclude=''], [boolean composeRelationships='true'])
populateFromJSON
in class
BaseORMService
target
JSONString
scope
- Use scope injection instead of setter injection, no need of setters, just tell us what scope to inject totrustedSetter
- Do not check if the setter exists, just call it, great for usage with onMissingMethod() and virtual propertiesinclude
- A list of keys to include in the population ONLYexclude
- A list of keys to exclude from the populationignoreEmpty
nullEmptyInclude
nullEmptyExclude
composeRelationships
public any populateFromQuery([any target='[runtime expression]'], any qry, [numeric rowNumber='1'], [string scope=''], [boolean trustedSetter='false'], [string include=''], [string exclude=''], [boolean ignoreEmpty='false'], [string nullEmptyInclude=''], [string nullEmptyExclude=''], [boolean composeRelationships='true'])
populateFromQuery
in class
BaseORMService
target
qry
- The query to use for populationrowNumber
scope
- Use scope injection instead of setter injection, no need of setters, just tell us what scope to inject totrustedSetter
- Do not check if the setter exists, just call it, great for usage with onMissingMethod() and virtual propertiesinclude
- A list of keys to include in the population ONLYexclude
- A list of keys to exclude from the populationignoreEmpty
nullEmptyInclude
nullEmptyExclude
composeRelationships
public any populateFromXML([any target='[runtime expression]'], string xml, [string root=''], [string scope=''], [boolean trustedSetter='false'], [string include=''], [string exclude=''], [boolean ignoreEmpty='false'], [string nullEmptyInclude=''], [string nullEmptyExclude=''], [boolean composeRelationships='true'])
populateFromXML
in class
BaseORMService
target
xml
root
- The XML root element to start fromscope
- Use scope injection instead of setter injection, no need of setters, just tell us what scope to inject totrustedSetter
- Do not check if the setter exists, just call it, great for usage with onMissingMethod() and virtual propertiesinclude
- A list of keys to include in the population ONLYexclude
- A list of keys to exclude from the populationignoreEmpty
nullEmptyInclude
nullEmptyExclude
composeRelationships
public any refresh([any entity])
refresh
in class
BaseORMService
entity
- The argument can be one persistence entity or an array of entitiespublic any save([any entity], [boolean forceInsert='false'], [boolean flush='false'], [boolean transactional='[runtime expression]'])
save
in class
BaseORMService
entity
- You can optionally pass in an entity, else this active entity is savedforceInsert
- Force insert on the saveflush
- Flush the session or not, default is falsetransactional
- Use transactions or not, it defaults to true
|
ColdBox Platform Version 3.7.0 | ||||
FRAMES |