/** * @return the accountNumberRanges */ public IntRanges getAccountNumberRanges() { return config.getAccountNumberRanges(); }
/** * Priority to display. If a short business assessment is displayed only rows with high priority are shown. * @return */ public Priority getPriority() { return config.getPriority() != null ? config.getPriority() : Priority.MIDDLE; }
/** * The id can be used for referring the row e. g. inside scripts or for calculating values (see {@link #getValue()}). * @see #getValue() */ public String getId() { return config.getId(); }
assertEquals(Priority.HIGH, row.getPriority()); assertEquals(0, row.getAccountNumberRanges().getValues().size()); assertEquals(1, row.getAccountNumberRanges().getRanges().size()); final Range<Integer> range = row.getAccountNumberRanges().getRanges().get(0); assertEquals(5700, (int) range.getMinValue()); assertEquals(5999, (int) range.getMaxValue()); assertEquals(1, row.getAccountNumberRanges().getValues().size()); assertEquals(6300, (int) row.getAccountNumberRanges().getValues().get(0)); assertEquals(1, row.getAccountNumberRanges().getRanges().size()); final Range<Integer> range = row.getAccountNumberRanges().getRanges().get(0); assertEquals(6800, (int) range.getMinValue()); assertEquals(6855, (int) range.getMaxValue()); assertEquals(3, row.getAccountNumberRanges().getValues().size()); assertEquals(6392, (int) row.getAccountNumberRanges().getValues().get(0)); assertEquals(6895, (int) row.getAccountNumberRanges().getValues().get(1)); assertEquals(6960, (int) row.getAccountNumberRanges().getValues().get(2)); assertEquals(0, row.getAccountNumberRanges().getRanges().size()); assertEquals(0, row.getAccountNumberRanges().getValues().size()); assertEquals(0, row.getAccountNumberRanges().getRanges().size());
/** * @param id id or number of the row. * @return The found row or null if not found. */ public BusinessAssessmentRowConfig getRow(final String id) { if (rows == null || id == null) { return null; } for (final BusinessAssessmentRowConfig row : rows) { if (id.equals(row.getId()) == true || id.equals(row.getNo()) == true) { return row; } } return null; }
/** * The title will be displayed. */ public String getTitle() { return config.getTitle(); }
/** * Only for indenting when displaying this row. * @return the indent */ public int getIndent() { return config.getIndent(); }
/** * The number has no other functionality than to be displayed. * @return Number to display (e. g. 1051). */ public String getNo() { return config.getNo(); }
/** * @return the accountNumberRanges */ public IntRanges getAccountNumberRanges() { initialize(); return accountNumberRanges; }
void recalculate() { if (accountRecordsExist == true) { // Nothing to do. return; } final Script groovyScript = config.getValueScript(); if (groovyScript == null) { // Nothing to do. return; } amount = BigDecimal.ZERO; final Map<String, Object> vars = new HashMap<String, Object>(); BusinessAssessment.putBusinessAssessmentRows(vars, businessAssessment); final GroovyResult result = new GroovyExecutor().execute(groovyScript, vars); final Object rval = result.getResult(); if (rval instanceof BigDecimal) { amount = (BigDecimal)rval; } else if (rval instanceof Number) { amount = new BigDecimal(String.valueOf(rval)).setScale(getScale(), RoundingMode.HALF_UP); } }
/** * @param accountNumber * @return true if the given account number matches the account number ranges of this row. */ public boolean doesMatch(final int accountNumber) { return config.getAccountNumberRanges().doesMatch(accountNumber); }