[Bug #1121] Fix issue adding @AssertTrue on AdvanceType entity

* Now entity checks that defaultMaxValue is greater than unitPrecision
* Default value for defaultMaxValue was set to 100 (as 0 doesn't have
  too much sense)

FEA: ItEr75S04BugFixing
This commit is contained in:
Manuel Rego Casasnovas 2011-08-04 11:32:11 +02:00
parent ca7e470c18
commit 97390ce668

View file

@ -68,7 +68,7 @@ public class AdvanceType extends BaseEntity implements IHumanIdentifiable{
private String unitName;
@NotNull
private BigDecimal defaultMaxValue = BigDecimal.ZERO;
private BigDecimal defaultMaxValue = new BigDecimal(100);
@NotNull
private boolean updatable = true;
@ -262,4 +262,13 @@ public class AdvanceType extends BaseEntity implements IHumanIdentifiable{
return true;
}
}
@AssertTrue(message = "the default max value must be greater than the precision value")
public boolean checkDefaultMaxValueGreaterThanPrecision() {
if (defaultMaxValue.compareTo(unitPrecision) == -1) {
return false;
}
return true;
}
}