Registry of KCriteriaBuilder instances, one per persistent entity type, exposed to server-side JS and Velocity as services.criteriaBuilders for building organisation-scoped Hibernate criteria queries. Populated once at construction with a fixed set of entity mappings, each giving the entity class, its required join associations, and the property used to restrict results to the current admin organisation. A caller looks up a builder by registered name (services.criteriaBuilders.get("product")) or by entity class, then uses it to build a KCriteria, instantiate a new entity, or save or delete an existing one, without constructing Hibernate criteria or handling organisation scoping directly. Background on the original design is in issue 5404 of the kademi-dev repository.
Group: Managers
Properties
| Property | Returns | Description |
|---|---|---|
| builders | List<KCriteriaBuilder> | All registered KCriteriaBuilder instances, sorted alphabetically by name. |
| points | KCriteria | Shortcut for get("points") - a freshly built KCriteria for querying Points records within the current organisation. |
| pointsDebit | KCriteria | Shortcut for get("pointsDebit") - a freshly built KCriteria for querying PointsDebit records within the current organisation. |
| profile | KCriteria | Shortcut for get("profile") - a freshly built KCriteria for querying Profile records within the current organisation. |
Methods
getByClass(Class c) · forObject(Object o) · getPoints() · getProfile() · getPointsDebit() · get(String name) · getBuilder(String name) · searchProps(int startPos, int pageSize) · getBuilders()
getByClass(Class c)
Returns: KCriteriaBuilder
Looks up the builder registered for the given entity class.
| Parameter | Description |
|---|---|
c | the entity class to find a builder for |
forObject(Object o)
Returns: KCriteriaBuilder
Looks up the KCriteriaBuilder registered for the given object's entity class, unwrapping any Hibernate proxy first so a subclassed or enhanced instance still resolves to its base entity type.
| Parameter | Description |
|---|---|
o | the entity instance to find a builder for, or null |
getPoints()
Returns: KCriteria
Shortcut for get("points") - a freshly built KCriteria for querying Points records within the current organisation.
getProfile()
Returns: KCriteria
Shortcut for get("profile") - a freshly built KCriteria for querying Profile records within the current organisation.
getPointsDebit()
Returns: KCriteria
Shortcut for get("pointsDebit") - a freshly built KCriteria for querying PointsDebit records within the current organisation.
get(String name)
Returns: KCriteria
Looks up the builder registered under the given name and builds a fresh, organisation-scoped KCriteria from it. Logs and returns null, rather than throwing, when no builder is registered for that name.
| Parameter | Description |
|---|---|
name | the registered builder name, e.g. "product" or "profile" |
getBuilder(String name)
Returns: KCriteriaBuilder
Looks up the raw KCriteriaBuilder registered under the given name, without building a KCriteria from it.
| Parameter | Description |
|---|---|
name | the registered builder name, e.g. "product" or "profile" |
searchProps(int startPos, int pageSize)
Returns: SearchProperties
Creates a SearchProperties describing a page of results, for use with paged criteria searches.
| Parameter | Description |
|---|---|
startPos | the zero-based index of the first record to return |
pageSize | the maximum number of records to return |
getBuilders()
Returns: List<KCriteriaBuilder>
All registered KCriteriaBuilder instances, sorted alphabetically by name.