use of org.eclipse.scout.rt.platform.classid.ClassIdentifier in project scout.rt by eclipse.
the class FormDataStatementBuilderTest method testTemplate1FieldData_temlateValueDefinition.
@Test
public void testTemplate1FieldData_temlateValueDefinition() {
m_builder.setBasicDefinition(new ClassIdentifier(FormData.Template1GroupBox.class, FormData.Template1GroupBox.TemplateText.class), "TEMPLATE1_TEXT", DataModelConstants.OPERATOR_EQ);
assertEquals(" AND TEMPLATE1_TEXT=:__a1", m_builder.build(m_formData));
assertNotNull(m_builder.getBindMap());
assertEquals(1, m_builder.getBindMap().size());
assertEquals(TEMPLATE1_TEXT, m_builder.getBindMap().get("__a1"));
}
use of org.eclipse.scout.rt.platform.classid.ClassIdentifier in project scout.rt by eclipse.
the class FormDataStatementBuilderTest method testMasterTemplate1FieldData_temlateValueDefinition.
@Test
public void testMasterTemplate1FieldData_temlateValueDefinition() {
m_builder.setBasicDefinition(new ClassIdentifier(FormData.Template1GroupBox.class, AbstractTemplateFieldData.MasterTemplateGroupBox.class, AbstractMasterTemplateFieldData.MasterTemplateText.class), "MASTER_TEMPLATE1_TEXT", DataModelConstants.OPERATOR_EQ);
assertEquals(" AND MASTER_TEMPLATE1_TEXT=:__a1", m_builder.build(m_formData));
assertNotNull(m_builder.getBindMap());
assertEquals(1, m_builder.getBindMap().size());
assertEquals(MASTER_TEMPLATE1_TEXT, m_builder.getBindMap().get("__a1"));
}
use of org.eclipse.scout.rt.platform.classid.ClassIdentifier in project scout.rt by eclipse.
the class FormDataStatementBuilderTest method testTemplate1andTemplate2FieldData_temlateValueDefinition.
@Test
public void testTemplate1andTemplate2FieldData_temlateValueDefinition() {
m_builder.setBasicDefinition(new ClassIdentifier(FormData.Template1GroupBox.class, FormData.Template1GroupBox.TemplateText.class), "TEMPLATE1_TEXT", DataModelConstants.OPERATOR_EQ);
m_builder.setBasicDefinition(new ClassIdentifier(FormData.Template2GroupBox.class, FormData.Template2GroupBox.TemplateText.class), "TEMPLATE2_TEXT", DataModelConstants.OPERATOR_LE);
assertEquals(" AND TEMPLATE1_TEXT=:__a1 AND TEMPLATE2_TEXT<=:__a2", m_builder.build(m_formData));
assertNotNull(m_builder.getBindMap());
assertEquals(2, m_builder.getBindMap().size());
assertEquals(TEMPLATE1_TEXT, m_builder.getBindMap().get("__a1"));
assertEquals(TEMPLATE2_TEXT, m_builder.getBindMap().get("__a2"));
}
use of org.eclipse.scout.rt.platform.classid.ClassIdentifier in project scout.rt by eclipse.
the class FormDataStatementBuilderTest method testMasterTemplate1PropertyData_temlateValueDefinition.
@Test
public void testMasterTemplate1PropertyData_temlateValueDefinition() {
m_builder.setBasicDefinition(new ClassIdentifier(FormData.Template1GroupBox.class, FormData.Template1GroupBox.MasterTemplateGroupBox.class, FormData.Template1GroupBox.MasterTemplateGroupBox.MasterTemplateProp.class), "MASTER_TEMPLATE1_PROP", DataModelConstants.OPERATOR_EQ);
assertEquals(" AND MASTER_TEMPLATE1_PROP=:__a1", m_builder.build(m_formData));
assertNotNull(m_builder.getBindMap());
assertEquals(1, m_builder.getBindMap().size());
assertEquals(MASTER_TEMPLATE1_PROPERTY, m_builder.getBindMap().get("__a1"));
}
use of org.eclipse.scout.rt.platform.classid.ClassIdentifier in project scout.rt by eclipse.
the class BasicPartDefinition method accept.
/**
* Computes whether this {@link BasicPartDefinition} takes part in building the filter criterion.
*
* @param formData
* the form data to be checked.
* @return <code>true</code> if the properties in the form data are sufficient in order to append this part to the
* result statement This will result in a call to
* {@link BasicPartDefinition#createInstanceImpl(FormDataStatementBuilder, List, List, List, Map)} building
* that part.
* <p>
* Default accepts when any of the value of the valueType set is set (isValueSet) and has a non-null value in
* the form data
*/
public boolean accept(AbstractFormData formData) {
Map<Integer, Map<String, AbstractFormFieldData>> fieldsBreathFirstMap = formData.getAllFieldsRec();
Map<Integer, Map<String, AbstractPropertyData<?>>> propertiesBreathFirstMap = formData.getAllPropertiesRec();
if (getValueTypeClassIdentifiers().length > 0) {
for (ClassIdentifier valueType : getValueTypeClassIdentifiers()) {
Object dataObject = formData.findFieldByClass(fieldsBreathFirstMap, valueType);
if (dataObject instanceof AbstractFormFieldData) {
AbstractValueFieldData<?> v = (dataObject instanceof AbstractValueFieldData<?> ? (AbstractValueFieldData<?>) dataObject : null);
AbstractFormFieldData f = (AbstractFormFieldData) dataObject;
if (f.isValueSet() && (v == null || v.getValue() != null)) {
return true;
}
}
dataObject = formData.findPropertyByClass(propertiesBreathFirstMap, valueType);
if (dataObject instanceof AbstractPropertyData<?>) {
AbstractPropertyData<?> p = (AbstractPropertyData<?>) dataObject;
if (p.isValueSet() && p.getValue() != null) {
return true;
}
}
}
}
return false;
}
Aggregations