Example usage for com.vaadin.v7.data.util MethodProperty MethodProperty

List of usage examples for com.vaadin.v7.data.util MethodProperty MethodProperty

Introduction

In this page you can find the example usage for com.vaadin.v7.data.util MethodProperty MethodProperty.

Prototype

@SuppressWarnings("unchecked")
public MethodProperty(Object instance, String beanPropertyName) 

Source Link

Document

Creates a new instance of MethodProperty from a named bean property.

Usage

From source file:org.jpos.qi.EntityContainer.java

License:Open Source License

protected Object getPojoId(Object entity) {
    return new MethodProperty(entity, "id").getValue();
}

From source file:org.jpos.qi.EntityContainer.java

License:Open Source License

public void updateItem(Item item) {
    clearInternalCache();//from   w  w w . ja v  a  2 s .  c o m
    Object id = item.getItemProperty("id").getValue();
    try {
        DB.execWithTransaction((db) -> {
            Object obj = db.session().get(clazz, (Serializable) id);
            for (String propertyId : props.keySet()) {
                MethodProperty<Object> p = new MethodProperty<>(obj, propertyId);
                if (!p.isReadOnly())
                    p.setValue(item.getItemProperty(propertyId).getValue());
            }
            db.session().update(obj);
            ((EntityItem) item).setEntity(obj); // refresh entity
            return null;
        });
    } catch (Exception e) {
        QI.getQI().getLog().error(e);
    }
    fireContentsChange(-1);
}

From source file:org.jpos.qi.EntityItem.java

License:Open Source License

public Property getItemProperty(Object attribute) {
    return new MethodProperty(entity, attribute.toString());
}