java.lang.Object
net.commuty.parking.model.AccessLog
public class AccessLog
extends java.lang.Object
This corresponds to a user that entered or exited a parking site at a point in time.
You can construct this entity using the createInAccessLog(UserId, LocalDateTime) or
createOutAccessLog(UserId, LocalDateTime) methods, depending on the type of access log you want to report.
-
Method Summary
Modifier and Type Method Description static AccessLogcreateInAccessLog(UserId userId, java.time.LocalDateTime at)Create a report for a user that entered the parking site at the specified time.static AccessLogcreateInAccessLog(UserId userId, java.time.LocalDateTime at, boolean granted, java.lang.String reason)Create a report for a user that entered the parking site at the specified time.static AccessLogcreateOutAccessLog(UserId userId, java.time.LocalDateTime at)Create a report for a user that exited the parking site at the specified time.static AccessLogcreateOutAccessLog(UserId userId, java.time.LocalDateTime at, boolean granted, java.lang.String reason)Create a report for a user that exited the parking site at the specified time.java.time.LocalDateTimegetAt()The moment when the user entered/exited the parking site.java.lang.StringgetReason()An optional reason to specify why the user has been authorized (or not) to enter.java.lang.StringgetUserId()The identifier of the user.UserIdTypegetUserIdType()TheUserIdTypeof the identifier of the user.AccessDirectiongetWay()The direction (eitherAccessDirection.INorAccessDirection.OUT) of the user entering/exiting the parking site.booleanisGranted()Whether or not the user has been granted to enter/exit the parking.
-
Method Details
-
createInAccessLog
Create a report for a user that entered the parking site at the specified time. -
createOutAccessLog
Create a report for a user that exited the parking site at the specified time. -
createInAccessLog
public static AccessLog createInAccessLog(UserId userId, java.time.LocalDateTime at, boolean granted, java.lang.String reason)Create a report for a user that entered the parking site at the specified time.- Parameters:
userId- TheUserIdconcerned by the access log. Cannot be null.at- The moment when the user entered the parking site, in UTC. Cannot be null.granted- Whether or not the user was allowed to enter the parking or not;reason- reason to specify why the user has been authorized (or not) to enter. This also can be used as a free-text field for ad-hoc comments.- Returns:
- the
AccessLogentity.
-
createOutAccessLog
public static AccessLog createOutAccessLog(UserId userId, java.time.LocalDateTime at, boolean granted, java.lang.String reason)Create a report for a user that exited the parking site at the specified time.- Parameters:
userId- TheUserIdconcerned by the access log. Cannot be null.at- The moment when the user exited the parking site, in UTC. Cannot be null.granted- Whether or not the user was allowed to enter the parking or not;reason- reason to specify why the user has been authorized (or not) to exit. This also can be used as a free-text field for ad-hoc comments.- Returns:
- the
AccessLogentity.
-
getUserId
public java.lang.String getUserId()The identifier of the user. This is linked with thegetUserIdType()property. -
getUserIdType
TheUserIdTypeof the identifier of the user. This is linked with thegetUserId()property. -
getWay
The direction (eitherAccessDirection.INorAccessDirection.OUT) of the user entering/exiting the parking site. -
getAt
public java.time.LocalDateTime getAt()The moment when the user entered/exited the parking site. -
isGranted
public boolean isGranted()Whether or not the user has been granted to enter/exit the parking. -
getReason
public java.lang.String getReason()An optional reason to specify why the user has been authorized (or not) to enter. This also can be used as a free-text field for ad-hoc comments.
-