Class AccessLog

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 AccessLog createInAccessLog​(UserId userId, java.time.LocalDateTime at)
    Create a report for a user that entered the parking site at the specified time.
    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.
    static AccessLog createOutAccessLog​(UserId userId, java.time.LocalDateTime at)
    Create a report for a user that exited the parking site at the specified time.
    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.
    java.time.LocalDateTime getAt()
    The moment when the user entered/exited the parking site.
    java.lang.String getReason()
    An optional reason to specify why the user has been authorized (or not) to enter.
    java.lang.String getUserId()
    The identifier of the user.
    UserIdType getUserIdType()
    The UserIdType of the identifier of the user.
    AccessDirection getWay()
    The direction (either AccessDirection.IN or AccessDirection.OUT) of the user entering/exiting the parking site.
    boolean isGranted()
    Whether or not the user has been granted to enter/exit the parking.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • createInAccessLog

      public static AccessLog createInAccessLog​(UserId userId, java.time.LocalDateTime at)
      Create a report for a user that entered the parking site at the specified time.
      Parameters:
      userId - The UserId concerned by the access log. Cannot be null.
      at - The moment when the user entered the parking site, in UTC. Cannot be null.
      Returns:
      the AccessLog entity.
    • createOutAccessLog

      public static AccessLog createOutAccessLog​(UserId userId, java.time.LocalDateTime at)
      Create a report for a user that exited the parking site at the specified time.
      Parameters:
      userId - The UserId concerned by the access log. Cannot be null.
      at - The moment when the user exited the parking site, in UTC. Cannot be null.
      Returns:
      the AccessLog entity.
    • 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 - The UserId concerned 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 AccessLog entity.
    • 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 - The UserId concerned 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 AccessLog entity.
    • getUserId

      public java.lang.String getUserId()
      The identifier of the user. This is linked with the getUserIdType() property.
    • getUserIdType

      public UserIdType getUserIdType()
      The UserIdType of the identifier of the user. This is linked with the getUserId() property.
    • getWay

      public AccessDirection getWay()
      The direction (either AccessDirection.IN or AccessDirection.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.