Revize b7979e83
Přidáno uživatelem Dominik Poch před téměř 6 roky(ů)
server/src/main/java/cz/zcu/yamanager/domain/User.java | ||
---|---|---|
210 | 210 |
this.vacationCount = vacationCount; |
211 | 211 |
} |
212 | 212 |
|
213 |
/** |
|
214 |
* Adds the given amount to the number of user's available vacations. If the given parameter is null |
|
215 |
* or a result of the addition is negative the method throws an exception. |
|
216 |
* |
|
217 |
* @param value the given amount that is going to be added |
|
218 |
* @throws IllegalArgumentException when he given parameter is null or a result of the addition is negative |
|
219 |
*/ |
|
220 |
public void addVacationCount(final Float value) { |
|
221 |
User.log.debug("Adding the given number of hours {} to the vacation", value); |
|
222 |
|
|
223 |
if(value == null) { |
|
224 |
User.log.warn("The given value must not be null"); |
|
225 |
throw new IllegalArgumentException("vacation.null.error"); |
|
226 |
} else if (this.vacationCount + value < 0) { |
|
227 |
User.log.warn("The number of remaining overtime must not be negative"); |
|
228 |
throw new IllegalArgumentException("negative.vacation.error"); |
|
229 |
} |
|
230 |
|
|
231 |
this.vacationCount += value; |
|
232 |
} |
|
233 |
|
|
213 | 234 |
/** |
214 | 235 |
* Adds a difference of the given starting and the ending time of a vacation |
215 | 236 |
* to the number of user's available vacations. If some of the given parameters are null |
... | ... | |
433 | 454 |
public void setCreationDate(final LocalDateTime creationDate) { |
434 | 455 |
User.log.debug("Setting a new user's creation date: {}", creationDate); |
435 | 456 |
|
436 |
if (creationDate == null) { |
|
437 |
User.log.warn("The given creation date must not be null"); |
|
438 |
throw new IllegalArgumentException("creation.null.error"); |
|
439 |
} |
|
440 |
|
|
441 | 457 |
this.creationDate = creationDate; |
442 | 458 |
} |
443 | 459 |
|
Také k dispozici: Unified diff
Edit User class