use of com.developmentontheedge.beans.DynamicPropertySetSupport 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.DynamicPropertySetSupport 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.DynamicPropertySetSupport in project be5 by DevelopmentOnTheEdge.
the class DpsRecordAdapter method createDps.
public static DynamicPropertySet createDps(ResultSet resultSet, MetaProcessor metaProcessor) {
try {
DynamicProperty[] schema = createSchema(resultSet.getMetaData());
DynamicPropertySet row = new DynamicPropertySetSupport();
for (int i = 0; i < schema.length; i++) {
DynamicProperty dp = schema[i];
Object refIdxObj = dp.getAttribute(COLUMN_REF_IDX_PROPERTY);
if (refIdxObj instanceof Integer) {
int refIdx = (int) refIdxObj;
if (refIdx >= 0) {
Map<String, Map<String, String>> tags = new TreeMap<>();
BeTagParser.parseTags(tags, resultSet.getString(i + 1));
DynamicPropertyMeta.add(schema[refIdx], tags);
dp.setAttribute(COLUMN_REF_IDX_PROPERTY, -1);
}
continue;
}
Object val = getSqlValue(dp.getType(), resultSet, i + 1);
// todo test Map<String, Map<String, String>> metaInfo = DynamicPropertyMeta.get(dp);
// metaProcessor.process(val, metaInfo);
DynamicProperty property = DynamicPropertySetSupport.cloneProperty(dp);
property.setValue(val);
row.add(property);
}
return row;
} catch (Exception e) {
throw Be5Exception.internal(e);
}
}
use of com.developmentontheedge.beans.DynamicPropertySetSupport in project be5 by DevelopmentOnTheEdge.
the class FilterOperation method getParameters.
@Override
public Object getParameters(Map<String, Object> presetValues) throws Exception {
DynamicPropertySet dps = new DynamicPropertySetSupport();
dpsHelper.addDpExcludeAutoIncrement(dps, getInfo().getModel());
return filterHelper.processFilterParams(dps, presetValues, context.getOperationParams());
}
use of com.developmentontheedge.beans.DynamicPropertySetSupport in project be5 by DevelopmentOnTheEdge.
the class SilentInsertWithoutCollectionsOperation method getParameters.
@Override
public Object getParameters(Map<String, Object> presetValues) throws Exception {
DynamicPropertySetSupport dps = new DynamicPropertySetSupport();
dps = dpsHelper.addDpExcludeAutoIncrement(dps, getInfo().getModel(), presetValues);
return dpsHelper.setOperationParams(dps, context.getOperationParams());
}
Aggregations