ItEr60S04ValidacionEProbasFuncionaisItEr59S04 : Fixing bug in CostCategory Service.
it adds the checkConstraintNonRepeatedHourCostCodes() method to check if there are repeated codes in the set of hours cost of a same CostCategory.
This commit is contained in:
parent
7c171c8d28
commit
6b1e19c430
1 changed files with 6 additions and 0 deletions
|
|
@ -27,6 +27,7 @@ import java.util.Set;
|
|||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.hibernate.validator.AssertFalse;
|
||||
import org.hibernate.validator.AssertTrue;
|
||||
import org.hibernate.validator.NotEmpty;
|
||||
import org.hibernate.validator.Valid;
|
||||
import org.joda.time.LocalDate;
|
||||
|
|
@ -204,4 +205,9 @@ public class CostCategory extends IntegrationEntity {
|
|||
return Registry.getCostCategoryDAO();
|
||||
}
|
||||
|
||||
@AssertTrue(message = "The hour cost codes must be unique.")
|
||||
public boolean checkConstraintNonRepeatedHourCostCodes() {
|
||||
return getFirstRepeatedCode(this.hourCosts) == null;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue