@Artefact(value: Controller) @ReadOnly @groovy.transform.CompileStatic class RestfulServiceController<T extends GormEntity<T>> extends RestfulController<T>
Restful controller that delegates all operations to a scaffold service.
This controller is datastore-agnostic and works with any ScaffoldService implementation (GORM, JPA, JDBC, REST, custom, etc.). It uses the service interface rather than concrete implementations, allowing different backends to be swapped.
Read-only protection is handled by the service layer - services with readOnly=true
will silently ignore mutation operations (no-op behavior).
@Scaffold(RestfulServiceController<Car>)
class CarController {
}
The controller will automatically locate and inject the corresponding service
(e.g., CarService) using DomainServiceLocator.
T - The domain/entity type| Constructor and description |
|---|
RestfulServiceController(java.lang.Class<T> resource, boolean readOnly) |
| Type Params | Return Type | Name and description |
|---|---|---|
|
protected java.lang.Integer |
countResources() |
|
protected void |
deleteResource(T resource) |
|
protected ScaffoldService<T, java.io.Serializable> |
getService()Get the scaffold service for this controller. |
|
protected java.util.List<T> |
listAllResources(java.util.Map params) |
|
protected T |
queryForResource(java.io.Serializable id) |
|
protected T |
saveResource(T resource) |
|
protected T |
updateResource(T resource) |
Get the scaffold service for this controller.