use of com.developmentontheedge.beans.DynamicPropertySet in project be5 by DevelopmentOnTheEdge.
the class StandardOperationsTest method editOperationGenerateStringPrimaryKey.
@Test
public void editOperationGenerateStringPrimaryKey() {
DynamicPropertySet dps = new DynamicPropertySetSupport();
dpsHelper.addDpExcludeAutoIncrement(dps, meta.getEntity("propertyTypes"));
dps.setValue("name", "TestName");
dps.setValue("CODE", "02");
when(SqlServiceMock.mock.select(any(), any(), any())).thenReturn(dps);
Object first = generateOperation("propertyTypes", "All records", "Edit", "01", "{}").getFirst();
verify(SqlServiceMock.mock).select(eq("SELECT * FROM propertyTypes WHERE CODE =?"), any(), eq("01"));
assertEquals("{'CODE':'02','name':'TestName'}", oneQuotes(JsonFactory.bean(first).getJsonObject("values").toString()));
}
use of com.developmentontheedge.beans.DynamicPropertySet in project be5 by DevelopmentOnTheEdge.
the class TestOperation method invoke.
@Override
public void invoke(Object parameters) throws Exception {
DynamicPropertySet dps = (DynamicPropertySet) parameters;
db.insert(dpsHelper.generateInsertSql(getInfo().getEntity(), dps), dpsHelper.getValues(dps));
setResultRedirectThisOperation();
}
use of com.developmentontheedge.beans.DynamicPropertySet in project be5 by DevelopmentOnTheEdge.
the class TestOperationProperty method getParameters.
@Override
public Object getParameters(Map<String, Object> presetValues) throws Exception {
DynamicPropertySet dps = new DynamicPropertySetSupport();
dps.add(new DynamicProperty("simple", "Name", String.class));
dps.add(new DynamicProperty("simpleNumber", "Number", Long.class));
dps.add(new DynamicProperty("getOrDefault", "Name", String.class, presetValues.getOrDefault("getOrDefault", "defaultValue")));
dps.add(new DynamicProperty("getOrDefaultNumber", "Name", Long.class, presetValues.getOrDefault("getOrDefaultNumber", "3")));
return dpsHelper.setValues(dps, presetValues);
}
use of com.developmentontheedge.beans.DynamicPropertySet in project be5 by DevelopmentOnTheEdge.
the class TestOperationProperty method invoke.
@Override
public void invoke(Object parameters) throws Exception {
DynamicPropertySet dps = (DynamicPropertySet) parameters;
db.insert(dpsHelper.generateInsertSql(getInfo().getEntity(), dps), dpsHelper.getValues(dps));
}
use of com.developmentontheedge.beans.DynamicPropertySet in project be5 by DevelopmentOnTheEdge.
the class OperationHelper method readAsList.
public List<List<Object>> readAsList(String sql, Object... params) {
List<List<Object>> vals = new ArrayList<>();
List<DynamicPropertySet> list = readAsRecords(sql, params);
for (int i = 0; i < list.size(); i++) {
List<Object> propertyList = new ArrayList<>();
for (DynamicProperty property : list.get(i)) {
propertyList.add(property.getValue());
}
vals.add(propertyList);
}
return vals;
}
Aggregations