Search in sources :

Example 16 with DynamicPropertySet

use of com.developmentontheedge.beans.DynamicPropertySet in project be5 by DevelopmentOnTheEdge.

the class DynamicPropertySetMetaClass method setProperty.

@Override
@SuppressWarnings("unchecked")
public void setProperty(Object object, String propertyName, Object value) {
    DynamicPropertySet dps = ((T) object);
    if (value instanceof Map) {
        Map map = (Map) value;
        map.put("name", propertyName);
        this.invokeMethod(object, "leftShift", new Object[] { map });
        return;
    }
    if (value == null) {
        DynamicProperty dp = new DynamicProperty(propertyName, String.class);
        dp.setValue(null);
        dps.add(dp);
        return;
    }
    if (dps.getProperty(propertyName) != null) {
        dps.setValue(propertyName, value);
        return;
    }
    DynamicProperty dp = new DynamicProperty(propertyName, value.getClass());
    dp.setValue(value);
    dps.add(dp);
}
Also used : DynamicPropertySet(com.developmentontheedge.beans.DynamicPropertySet) DynamicProperty(com.developmentontheedge.beans.DynamicProperty) Map(java.util.Map) HashMap(java.util.HashMap)

Example 17 with DynamicPropertySet

use of com.developmentontheedge.beans.DynamicPropertySet in project be5 by DevelopmentOnTheEdge.

the class TestOperation method getParameters.

@Override
public Object getParameters(Map<String, Object> presetValues) throws Exception {
    DynamicPropertySet dps = new DynamicPropertySetSupport();
    dps.add(new DynamicProperty("name", "Name", String.class, presetValues.getOrDefault("name", "")));
    dps.add(new DynamicProperty("number", "Number", Long.class, presetValues.getOrDefault("number", "0")));
    return dps;
}
Also used : DynamicPropertySet(com.developmentontheedge.beans.DynamicPropertySet) DynamicProperty(com.developmentontheedge.beans.DynamicProperty) DynamicPropertySetSupport(com.developmentontheedge.beans.DynamicPropertySetSupport)

Aggregations

DynamicPropertySet (com.developmentontheedge.beans.DynamicPropertySet)17 DynamicPropertySetSupport (com.developmentontheedge.beans.DynamicPropertySetSupport)11 DynamicProperty (com.developmentontheedge.beans.DynamicProperty)7 ArrayList (java.util.ArrayList)3 List (java.util.List)3 Map (java.util.Map)3 Be5Exception (com.developmentontheedge.be5.api.exceptions.Be5Exception)2 HashMap (java.util.HashMap)2 SEARCH_PARAM (com.developmentontheedge.be5.api.FrontendConstants.SEARCH_PARAM)1 SEARCH_PRESETS_PARAM (com.developmentontheedge.be5.api.FrontendConstants.SEARCH_PRESETS_PARAM)1 Entity (com.developmentontheedge.be5.metadata.model.Entity)1 Query (com.developmentontheedge.be5.metadata.model.Query)1 JsonApiModel (com.developmentontheedge.be5.model.jsonapi.JsonApiModel)1 DocumentGenerator (com.developmentontheedge.be5.query.DocumentGenerator)1 SqlMockOperationTest (com.developmentontheedge.be5.test.SqlMockOperationTest)1 BeanInfoConstants (com.developmentontheedge.beans.BeanInfoConstants)1 DynamicPropertyBuilder (com.developmentontheedge.beans.DynamicPropertyBuilder)1 ColumnRef (com.developmentontheedge.sql.format.ColumnRef)1 FilterApplier (com.developmentontheedge.sql.format.FilterApplier)1 Formatter (com.developmentontheedge.sql.format.Formatter)1