removes the validation in the method toDTO because there is already
the annotation @NotEmpty in the ExpenseSheet class. FEA: ItEr76S22ExpenseTrackingSystem
This commit is contained in:
parent
79fe7d3bb4
commit
fbad40f945
1 changed files with 2 additions and 15 deletions
|
|
@ -61,25 +61,12 @@ public final class ExpenseSheetConverter {
|
|||
}
|
||||
|
||||
public final static ExpenseSheetDTO toDTO(ExpenseSheet expenseSheet) {
|
||||
String code = expenseSheet.getCode();
|
||||
if (StringUtils.isBlank(code)) {
|
||||
throw new ValidationException("missing code in the expense sheet");
|
||||
}
|
||||
|
||||
List<ExpenseSheetLineDTO> lineDTOs = new ArrayList<ExpenseSheetLineDTO>();
|
||||
|
||||
if (expenseSheet.getExpenseSheetLines() == null
|
||||
|| expenseSheet.getExpenseSheetLines().isEmpty()) {
|
||||
throw new ValidationException(
|
||||
"the expense sheet must have least a expense sheet line.");
|
||||
}
|
||||
|
||||
for (ExpenseSheetLine line : expenseSheet.getExpenseSheetLines()) {
|
||||
lineDTOs.add(toDTO(line));
|
||||
}
|
||||
|
||||
return new ExpenseSheetDTO(code, expenseSheet.getDescription(),
|
||||
lineDTOs);
|
||||
return new ExpenseSheetDTO(expenseSheet.getCode(),
|
||||
expenseSheet.getDescription(), lineDTOs);
|
||||
}
|
||||
|
||||
private static ExpenseSheetLineDTO toDTO(ExpenseSheetLine line) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue