Example usage for com.vaadin.data Result ok

List of usage examples for com.vaadin.data Result ok

Introduction

In this page you can find the example usage for com.vaadin.data Result ok.

Prototype

public static <R> Result<R> ok(R value) 

Source Link

Document

Returns a successful result wrapping the given value.

Usage

From source file:com.haulmont.cuba.web.widgets.CubaDateField.java

License:Apache License

@Override
protected Result<LocalDate> handleUnparsableDateString(String dateString) {
    if (Objects.equals(dateString, StringUtils.replaceChars(getState(false).dateMask, "#U", "__"))) {
        return Result.ok(null);
    }/*from  ww  w.ja v  a  2  s . co m*/

    return Result.error(getParseErrorMessage());
}

From source file:org.jpos.qi.minigl.AccountConverter.java

License:Open Source License

@Override
public Result<Account> convertToModel(String value, ValueContext valueContext) {
    if (value != null && !value.isEmpty()) {
        try {/*from w w  w .  ja v a 2 s. co  m*/
            Account acct = (Account) DB.exec(db -> {
                GLSession session = new GLSession(db);
                Account res = session.getAccount("jcard", value);
                if (res == null && createNew) {
                    if (createFinal)
                        res = new FinalAccount();
                    else
                        res = new CompositeAccount();
                    res.setCode(value);
                } else if (res == null) {
                    throw new BLException("Invalid Account Code");
                }
                return res;
            });
            return Result.ok(acct);
        } catch (Exception e) {
            return Result.error(e.getMessage());
        }
    }
    if (required)
        return Result.error(QI.getQI().getMessage("errorMessage.req", QI.getQI().getMessage("account")));
    else
        return Result.ok(null);
}

From source file:org.jpos.qi.minigl.ShortToLayerConverter.java

License:Open Source License

@Override
public Result<Short> convertToModel(Layer value, ValueContext context) {
    if (value != null)
        return Result.ok(value.getId());
    return Result.ok(null);
}

From source file:org.jpos.qi.minigl.StringToTagConverter.java

License:Open Source License

@Override
public Result<Tags> convertToModel(String value, ValueContext context) {
    if (value != null && !value.isEmpty())
        return Result.ok(new Tags(value));
    return Result.ok(null);
}