Title_Documentation

Documentation

Contact Us

Visualizzazione Knowledge Base

PostSave Action

In HyperIoTPostSaveAction, the execute method is executed just before the entity is saved within the database.

post-save-action.png

Pre Save Action Class Hierarchy

To define a custom behavior hooked to a post-save action, simply register a component as follows:

@Component(service = HyperIoTPostSaveAction.class, property = {"type=<entity_package_with_className>"})
public class MyPostAction <T extends HyperIoTBaseEntity> implements HyperIoTPostSaveAction<T> {

    @Override
    public void execute(T entity) {
      ....
    }

}

The “magic” happens all in the OSGi annotation :

@Component(service = HyperIoTPostSaveAction.class, property = {"type=mypackage.MyEntity"})

By implementing the interface and specifying via property OSGi type the entity to which you want to “capture” you can easily perform custom logic in the life cycle of any entity within the HyperIoT Framework.

N.B. “With great power comes great responsibility” cit.

PreUpdate Detailed Action Precedente