@Test public void testGetDrowpDown() { final String factType = "Car"; final String factField = "color"; final SingleFieldConstraint singleFieldConstraint = new SingleFieldConstraint() {{ setFactType(factType); setFieldName(factField); }}; final ConstraintValueEditor editor = spy(createEditor(singleFieldConstraint)); reset(oracle); editor.initDropDownData(); verify(oracle).getEnums(eq(factType), eq(factField), anyMap()); }
void initDropDownData() { this.isDropDownDataEnum = true; final Map<String, String> currentValueMap = new HashMap<String, String>(); if (constraintList != null && constraintList.getConstraints() != null) { for (FieldConstraint con : constraintList.getConstraints()) { if (con instanceof SingleFieldConstraint) { SingleFieldConstraint sfc = (SingleFieldConstraint) con; String fieldName = sfc.getFieldName(); currentValueMap.put(fieldName, sfc.getValue()); } } } this.dropDownData = oracle.getEnums(this.factType, fieldName, currentValueMap); if (DataType.TYPE_BOOLEAN.equals(this.fieldType) && this.dropDownData == null) { this.isDropDownDataEnum = false; this.dropDownData = DropDownData.create(new String[]{"true", "false"}); } }
ConstraintValueEditor extends Composite { void initDropDownData() { this.isDropDownDataEnum = true; final Map<String, String> currentValueMap = new HashMap<String, String>(); if (constraintList != null && constraintList.getConstraints() != null) { for (FieldConstraint con : constraintList.getConstraints()) { if (con instanceof SingleFieldConstraint) { SingleFieldConstraint sfc = (SingleFieldConstraint) con; String fieldName = sfc.getFieldName(); currentValueMap.put(fieldName, sfc.getValue()); } } } this.dropDownData = oracle.getEnums(this.factType, fieldName, currentValueMap); if (DataType.TYPE_BOOLEAN.equals(this.fieldType) && this.dropDownData == null) { this.isDropDownDataEnum = false; this.dropDownData = DropDownData.create(new String[]{"true", "false"}); } } }
ConstraintValueEditor extends Composite { void initDropDownData() { this.isDropDownDataEnum = true; final Map<String, String> currentValueMap = new HashMap<String, String>(); if (constraintList != null && constraintList.getConstraints() != null) { for (FieldConstraint con : constraintList.getConstraints()) { if (con instanceof SingleFieldConstraint) { SingleFieldConstraint sfc = (SingleFieldConstraint) con; String fieldName = sfc.getFieldName(); currentValueMap.put(fieldName, sfc.getValue()); } } } this.dropDownData = oracle.getEnums(this.factType, fieldName, currentValueMap); if (DataType.TYPE_BOOLEAN.equals(this.fieldType) && this.dropDownData == null) { this.isDropDownDataEnum = false; this.dropDownData = DropDownData.create(new String[]{"true", "false"}); } } ConstraintValueEditor(final BaseSingleFieldConstraint con,
                                 final CompositeFieldConstraint constraintList,
                                 final RuleModeller modeller,
                                 final EventBus eventBus,
                                 final boolean readOnly); }
ConstraintValueEditor extends Composite { void initDropDownData() { this.isDropDownDataEnum = true; final Map<String, String> currentValueMap = new HashMap<String, String>(); if (constraintList != null && constraintList.getConstraints() != null) { for (FieldConstraint con : constraintList.getConstraints()) { if (con instanceof SingleFieldConstraint) { SingleFieldConstraint sfc = (SingleFieldConstraint) con; String fieldName = sfc.getFieldName(); currentValueMap.put(fieldName, sfc.getValue()); } } } this.dropDownData = oracle.getEnums(this.factType, fieldName, currentValueMap); if (DataType.TYPE_BOOLEAN.equals(this.fieldType) && this.dropDownData == null) { this.isDropDownDataEnum = false; this.dropDownData = DropDownData.create(new String[]{"true", "false"}); } } ConstraintValueEditor(final BaseSingleFieldConstraint con,
                                 final CompositeFieldConstraint constraintList,
                                 final RuleModeller modeller,
                                 final EventBus eventBus,
                                 final boolean readOnly); void init(); BaseSingleFieldConstraint getConstraint(); void refresh(); void showError(); void hideError(); void setOnValueChangeCommand(Command onValueChangeCommand); void setOnTemplateValueChangeCommand(Command onTemplateValueChangeCommand); }
ConstraintValueEditor extends Composite { void initDropDownData() { this.isDropDownDataEnum = true; final Map<String, String> currentValueMap = new HashMap<String, String>(); if (constraintList != null && constraintList.getConstraints() != null) { for (FieldConstraint con : constraintList.getConstraints()) { if (con instanceof SingleFieldConstraint) { SingleFieldConstraint sfc = (SingleFieldConstraint) con; String fieldName = sfc.getFieldName(); currentValueMap.put(fieldName, sfc.getValue()); } } } this.dropDownData = oracle.getEnums(this.factType, fieldName, currentValueMap); if (DataType.TYPE_BOOLEAN.equals(this.fieldType) && this.dropDownData == null) { this.isDropDownDataEnum = false; this.dropDownData = DropDownData.create(new String[]{"true", "false"}); } } ConstraintValueEditor(final BaseSingleFieldConstraint con,
                                 final CompositeFieldConstraint constraintList,
                                 final RuleModeller modeller,
                                 final EventBus eventBus,
                                 final boolean readOnly); void init(); BaseSingleFieldConstraint getConstraint(); void refresh(); void showError(); void hideError(); void setOnValueChangeCommand(Command onValueChangeCommand); void setOnTemplateValueChangeCommand(Command onTemplateValueChangeCommand);  }