private String convertBooleanValueToString(DTCellValue52 dcv) { final Boolean value = dcv.getBooleanValue(); return (value == null ? "" : value.toString()); }
private String convertBooleanValueToString(DTCellValue52 dcv) { final Boolean value = dcv.getBooleanValue(); return (value == null ? "" : value.toString()); }
private void doCondition(List<BaseColumn> allColumns, LimitedEntryBRLConditionColumn column, List<IPattern> patterns, TemplateDataProvider rowDataProvider, List<DTCellValue52> row, RuleModel rm) { final int index = allColumns.indexOf(column); final DTCellValue52 dcv = row.get(index); if (dcv.getBooleanValue()) { for (IPattern pattern : column.getDefinition()) { patterns.add(pattern); } } }
public Boolean convertToBoolean(final DTCellValue52 cell) { switch (cell.getDataType()) { case BOOLEAN: return cell.getBooleanValue(); case STRING: final String text = cell.getStringValue(); if (Boolean.TRUE.toString().equalsIgnoreCase(text)) { return true; } else if (Boolean.FALSE.toString().equalsIgnoreCase(text)) { return false; } default: return null; } }
public Boolean convertToBoolean(final DTCellValue52 cell) { switch (cell.getDataType()) { case BOOLEAN: return cell.getBooleanValue(); case STRING: final String text = cell.getStringValue(); if (Boolean.TRUE.toString().equalsIgnoreCase(text)) { return true; } else if (Boolean.FALSE.toString().equalsIgnoreCase(text)) { return false; } default: return null; } }
private static void assertBooleanDefaultValue(final DTCellValue52 dcv) { if (dcv.getBooleanValue() == null) { dcv.setBooleanValue(Boolean.valueOf(dcv.getStringValue())); } }
private static void assertBooleanDefaultValue(final DTCellValue52 dcv) { if (dcv.getBooleanValue() == null) { dcv.setBooleanValue(Boolean.valueOf(dcv.getStringValue())); } }
private void doAction(List<BaseColumn> allColumns, LimitedEntryBRLActionColumn column, List<LabelledAction> actions, TemplateDataProvider rowDataProvider, List<DTCellValue52> row, RuleModel rm) { final int index = allColumns.indexOf(column); final DTCellValue52 dcv = row.get(index); if (dcv.getBooleanValue()) { for (IAction action : column.getDefinition()) { addAction(action, actions); } } }
private Values<Boolean> getBooleanValue() throws ValueResolveException { try { final Boolean booleanValue = realCellValue.getBooleanValue(); if (booleanValue != null) { return new Values<>(booleanValue); } else { return new Values<>(); } } catch (final Exception e) { throw new ValueResolveException("Failed to resolve Boolean Value"); } }
private Values<Boolean> getBooleanValue() throws ValueResolveException { try { final Boolean booleanValue = realCellValue.getBooleanValue(); if (booleanValue != null) { return new Values<>(booleanValue); } else { return new Values<>(); } } catch (final Exception e) { throw new ValueResolveException("Failed to resolve Boolean Value"); } }
@Test public void testInitialisationOfBooleanCellsWithoutDefaultValue() throws VetoException { setupBooleanColumn((c) -> {/*Nothing*/ }); modelSynchronizer.appendRow(); assertFalse(model.getData().get(0).get(2).getBooleanValue()); assertFalse((Boolean) uiModel.getCell(0, 2).getValue().getValue()); }
@Test public void conversionToDataType() { final DTCellValue52 dcv = new DTCellValue52(value); dcv.setOtherwise(isOtherwise); cellUtilities.convertDTCellValueType(DataType.DataTypes.BOOLEAN, dcv); assertEquals(expected, dcv.getBooleanValue()); } }
@Test public void checkBooleanDefaultValueNotSet() throws VetoException { final AttributeCol52 column = new AttributeCol52(); column.setAttribute(RuleAttributeWidget.ENABLED_ATTR); modelSynchronizer.appendColumn(column); modelSynchronizer.appendRow(); assertFalse((Boolean) uiModel.getRow(0).getCells().get(2).getValue().getValue()); assertFalse(model.getData().get(0).get(2).getBooleanValue()); } }
@Test public void testGetNumericValue() throws Exception { fieldBoolean.set(dcv, true); fieldDate.set(dcv, now); dcv.setNumericValue(1L); fieldString.set(dcv, "woot"); assertEquals(DataType.DataTypes.NUMERIC_LONG, dcv.getDataType()); assertNull(dcv.getBooleanValue()); assertNull(dcv.getDateValue()); assertEquals(1L, dcv.getNumericValue()); assertNull(dcv.getStringValue()); }
@Test public void testInitialisationOfBooleanCellsWithDefaultValue() throws VetoException { setupBooleanColumn((c) -> c.setDefaultValue(new DTCellValue52(true))); modelSynchronizer.appendRow(); assertTrue(model.getData().get(0).get(2).getBooleanValue()); assertTrue((Boolean) uiModel.getCell(0, 2).getValue().getValue()); }
@Test public void testInitialisationOfBooleanCellsWithNullDefaultValue() throws VetoException { setupBooleanColumn((c) -> c.setDefaultValue(new DTCellValue52((Boolean) null))); modelSynchronizer.appendRow(); assertFalse(model.getData().get(0).get(2).getBooleanValue()); assertFalse((Boolean) uiModel.getCell(0, 2).getValue().getValue()); }
@Test public void checkBooleanDefaultValueTrue() throws VetoException { final AttributeCol52 column = new AttributeCol52(); column.setAttribute(RuleAttributeWidget.ENABLED_ATTR); column.setDefaultValue(new DTCellValue52(true)); modelSynchronizer.appendColumn(column); modelSynchronizer.appendRow(); assertTrue((Boolean) uiModel.getRow(0).getCells().get(2).getValue().getValue()); assertTrue(model.getData().get(0).get(2).getBooleanValue()); }
@Test public void checkBooleanDefaultValueFalse() throws VetoException { final AttributeCol52 column = new AttributeCol52(); column.setAttribute(RuleAttributeWidget.ENABLED_ATTR); column.setDefaultValue(new DTCellValue52(false)); modelSynchronizer.appendColumn(column); modelSynchronizer.appendRow(); assertFalse((Boolean) uiModel.getRow(0).getCells().get(2).getValue().getValue()); assertFalse(model.getData().get(0).get(2).getBooleanValue()); }
@Test public void testDefaultValueNull() throws Exception { final DTCellValue52 defaultValue = null; final DTCellValue52 clone = new DTCellValue52(defaultValue); assertEquals(DataType.DataTypes.STRING, clone.getDataType()); assertNull(clone.getBooleanValue()); assertNull(clone.getDateValue()); assertNull(clone.getNumericValue()); assertNull(clone.getStringValue()); } }
@Test public void testDefaultValue() throws Exception { final DTCellValue52 defaultValue = new DTCellValue52(1); final DTCellValue52 clone = new DTCellValue52(defaultValue); assertEquals(DataType.DataTypes.NUMERIC_INTEGER, clone.getDataType()); assertNull(clone.getBooleanValue()); assertNull(clone.getDateValue()); assertEquals(1, clone.getNumericValue()); assertNull(clone.getStringValue()); }