Search in sources :

Example 1 with SessionAttribute

use of com.haulmont.cuba.security.entity.SessionAttribute in project cuba by cuba-platform.

the class SessionAttributeEditor method commitAndClose.

@Override
public void commitAndClose() {
    SessionAttribute item = datasource.getItem();
    if (item.getStringValue() != null) {
        Datatype dt = Datatypes.get(item.getDatatype());
        try {
            Object object = dt.parse(item.getStringValue());
            item.setStringValue(object == null ? "" : object.toString());
        } catch (IllegalArgumentException | ParseException e) {
            showNotification(getMessage("unableToParseValue"), NotificationType.ERROR);
            return;
        }
    }
    super.commitAndClose();
}
Also used : ParseException(java.text.ParseException) SessionAttribute(com.haulmont.cuba.security.entity.SessionAttribute) Datatype(com.haulmont.chile.core.datatypes.Datatype)

Aggregations

Datatype (com.haulmont.chile.core.datatypes.Datatype)1 SessionAttribute (com.haulmont.cuba.security.entity.SessionAttribute)1 ParseException (java.text.ParseException)1