@OnLoad public void onLoad(Result<Boolean> result) { Objects.requireNonNull(db); db.load( User.EMPTY, result.from( u -> { this.user = u; return true; })); }
@OnLoad public void onLoad(Result<Boolean> result) { LOG.fine("@Onload - synchronizing count value from Store"); _countStore.load( 0L, result.from( loadedValue -> { if (loadedValue != null) this._count = loadedValue; return true; })); }
@Override @Modify public void create(User user, Result<String> result) throws AppException { validateStatePreCreate(user); getValidator() .validate( user, result.from( u -> { this.user = u; return user.identity().getKey(); })); }
@Override public void get(Result<User> result) { result.complete(user); }
@Override public void currVal(Result<Long> result) { result.complete(_count); }
@OnSave public void onSave() { LOG.fine("onSave called!"); _countStore.save(_count, x -> Result.ignore()); }
@Modify @Override public void nextVal(Result<Long> result) { LOG.fine("nextVal called!"); result.complete(++_count); }
@OnActive public void onActive(Result<Void> result) { System.out.println(getClass().getSimpleName() + " service is now active"); result.complete(null); }