public class BizController.SaveHelper extends Object
Modifier and Type | Method and Description |
---|---|
BizController.SaveHelper |
disableAutoload()
Disables the automatically loading process of all entity properties annotated with
Autoloaded . |
BizController.SaveHelper |
disableSafePOST()
Disables the CSRF-token checks when
saveEntity(BaseEntity) is called. |
boolean |
saveEntity(sirius.db.mixing.BaseEntity<?> entity)
Applies the configured save login on the given entity.
|
BizController.SaveHelper |
withAfterCreateURI(String createdURI)
Used to supply a URL to which the user is redirected if a new entity was created.
|
BizController.SaveHelper |
withAfterSaveURI(String afterSaveURI)
Used to supply a URL to which the user is redirected if an entity was successfully saved.
|
BizController.SaveHelper |
withMappings(sirius.db.mixing.Mapping... columns)
Specifies what mappings should be loaded from the request context
if not set all marked as
Autoloaded properties of the entity are loaded |
BizController.SaveHelper |
withPostSaveHandler(Consumer<Boolean> postSaveHandler)
Installs a post save handler which is invoked just after the entity was persisted into the database.
|
BizController.SaveHelper |
withPreSaveHandler(Consumer<Boolean> preSaveHandler)
Installs a pre save handler which is invoked just before the entity is persisted into the database.
|
public BizController.SaveHelper withPreSaveHandler(Consumer<Boolean> preSaveHandler)
preSaveHandler
- a consumer which is supplied with a boolean flag, indicating if the entity was new.
The handler can be used to modify the entity before it is saved.public BizController.SaveHelper withPostSaveHandler(Consumer<Boolean> postSaveHandler)
postSaveHandler
- a consumer which is supplied with a boolean flag, indicating if the entiy was new.
The
handler can be used to modify the entity or related entities after it was created in
the database.public BizController.SaveHelper withMappings(sirius.db.mixing.Mapping... columns)
if not set all marked as Autoloaded
properties of the entity are loaded
columns
- array of Mapping
objectspublic BizController.SaveHelper withAfterCreateURI(String createdURI)
As new entities are often created using a placeholder URL like /entity/new, we must redirect to the canonical URL like /entity/128 if a new entity was created.
Note that the redirect is only performed if the newly created entity has validation warnings or the Entity is new.
createdURI
- the URI to redirect to where ${id} is replaced with the actual id of the entitypublic BizController.SaveHelper withAfterSaveURI(String afterSaveURI)
Once an entity was successfully saved is not new and has no validation warnings, the user will be redirected to the given URL.
afterSaveURI
- the list or base URL to return to, after an entity was successfully edited.public BizController.SaveHelper disableAutoload()
Autoloaded
.public BizController.SaveHelper disableSafePOST()
saveEntity(BaseEntity)
is called.public boolean saveEntity(sirius.db.mixing.BaseEntity<?> entity)
entity
- the entity to update and saveCopyright © 2018. All rights reserved.