-
Notifications
You must be signed in to change notification settings - Fork 35
Expand file tree
/
Copy pathHoldInformation.java
More file actions
39 lines (33 loc) · 1.24 KB
/
HoldInformation.java
File metadata and controls
39 lines (33 loc) · 1.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package example.borrow.application;
import java.time.LocalDate;
import example.borrow.domain.Hold;
import lombok.Getter;
@Getter
public class HoldInformation {
private final String id;
private final String bookBarcode;
private final String patronId;
private final LocalDate dateOfHold;
private final LocalDate dateOfCheckout;
private final LocalDate dateOfCheckin;
private final Hold.HoldStatus holdStatus;
private HoldInformation(String id, String bookBarcode, String patronId, LocalDate dateOfHold, LocalDate dateOfCheckout, LocalDate dateOfCheckin, Hold.HoldStatus holdStatus) {
this.id = id;
this.bookBarcode = bookBarcode;
this.patronId = patronId;
this.dateOfHold = dateOfHold;
this.dateOfCheckout = dateOfCheckout;
this.dateOfCheckin = dateOfCheckin;
this.holdStatus = holdStatus;
}
public static HoldInformation from(Hold hold) {
return new HoldInformation(
hold.getId().id().toString(),
hold.getOnBook().barcode(),
hold.getHeldBy().email(),
hold.getDateOfHold(),
hold.getDateOfCheckout(),
hold.getDateOfCheckin(),
hold.getStatus());
}
}