Class Permission

java.lang.Object
energy.eddie.aiida.models.permission.Permission
All Implemented Interfaces:
org.springframework.data.domain.Persistable<UUID>

@Entity public class Permission extends Object implements org.springframework.data.domain.Persistable<UUID>
  • Constructor Details

    • Permission

      public Permission(UUID eddieId, UUID permissionId, String handshakeUrl, String accessToken, UUID userId)
      Create a new permission from the contents of the AIIDA code. Permissions are only persisted once the user accepted them, therefore the status is set to PermissionStatus.ACCEPTED. The details of the permission have to be set before it is persisted.
    • Permission

      public Permission()
      Constructor only for JPA.
  • Method Details

    • getId

      public UUID getId()
      Specified by:
      getId in interface org.springframework.data.domain.Persistable<UUID>
    • isNew

      public boolean isNew()
      Specified by:
      isNew in interface org.springframework.data.domain.Persistable<UUID>
    • startTime

      @Nullable public Instant startTime()
      Returns:
      The UTC timestamp when this permission starts
    • eddieId

      public UUID eddieId()
      Returns:
      The UUID of the EDDIE application that created this permission.
    • id

      public UUID id()
      Returns:
      The UUID of this permission.
      See Also:
    • expirationTime

      @Nullable public Instant expirationTime()
      Returns:
      The UTC timestamp when this permission expires and no more data should be shared.
    • grantTime

      @Nullable public Instant grantTime()
      Returns:
      The UTC timestamp when the customer granted the permission. Will return null until the customer grants the permission. Only available if status is PermissionStatus.ACCEPTED or a later status.
    • revokeTime

      @Nullable public Instant revokeTime()
      Returns:
      The time at which either the EP terminated the permission or the customer revoked the permission. The return value of status() indicates which of the two cases occurred.
    • connectionId

      @Nullable public String connectionId()
      Returns:
      The connectionId that was generated by the EDDIE framework and is sent along with each message to the EP.
    • meterId

      @Nullable public String meterId()
      Returns:
      The optional physical meter ID provided by the eligible party. Used to map flexible connection agreements and control data source selection in AIIDA.
    • minLimitKw

      @Nullable public BigDecimal minLimitKw()
      Resolved from the current connection limit default with the newest start time in the database.
      Returns:
      Optional current default minimum energy consumption or production limit in kilowatts for controllable units.
    • maxLimitKw

      @Nullable public BigDecimal maxLimitKw()
      Resolved from the current connection limit default with the newest start time in the database.
      Returns:
      Optional current default maximum energy consumption or production limit in kilowatts for controllable units.
    • monitoringDataSourceId

      @Nullable public UUID monitoringDataSourceId()
      Returns:
      The data source monitored for connection limit violations, or null if none is assigned.
    • updateMonitoringDataSource

      public void updateMonitoringDataSource(@Nullable UUID dataSourceId)
      Assigns the data source to monitor for connection limit violations, or clears the assignment if null.
    • serviceName

      @Nullable public String serviceName()
      Returns:
      The service name for which this permission is for.
    • displayName

      @Nullable public String displayName()
      Returns:
      The user-chosen display name for this permission. Defaults to the data need's name.
    • inboundMessageFormat

      @Nullable public InboundMessageFormat inboundMessageFormat()
    • status

      public PermissionStatus status()
      Returns:
      The current status of the permission.
    • mqttStreamingConfig

      @Nullable public MqttStreamingConfig mqttStreamingConfig()
      Returns:
      The MQTT streaming configuration for this permission.
    • handshakeUrl

      public String handshakeUrl()
      Returns:
      The URL for the handshake endpoint.
    • accessToken

      public String accessToken()
      Returns:
      The access token for the permission.
    • userId

      public UUID userId()
      Returns:
      The user ID associated with the permission.
    • dataSource

      @Nullable public DataSource dataSource()
      Returns:
      The data source for the permission.
    • dataNeed

      @Nullable public AiidaLocalDataNeed dataNeed()
      Returns:
      The data need for the permission.
    • transmissionEnabled

      public boolean transmissionEnabled()
      Defaults to true and is toggled by PermissionCommand.SetTransmissionEnabled commands from the EP.
      Returns:
      Whether data transmission is currently enabled for this permission.
    • setStatus

      public void setStatus(PermissionStatus newStatus)
    • setStartTime

      public void setStartTime(Instant startTime)
    • setExpirationTime

      public void setExpirationTime(Instant expirationTime)
    • setGrantTime

      public void setGrantTime(Instant grantTime)
    • setRevokeTime

      public void setRevokeTime(Instant revokeTime)
      Set the UTC timestamp when either the EP terminated the permission or the customer revoked the permission. Use setStatus(PermissionStatus) to indicate which of the two cases occurred.
      Parameters:
      revokeTime - The revocation or termination timestamp.
    • setConnectionId

      public void setConnectionId(String connectionId)
    • setMeterId

      public void setMeterId(@Nullable String meterId)
    • setMinLimitKw

      public void setMinLimitKw(@Nullable BigDecimal minLimitKw)
    • setMaxLimitKw

      public void setMaxLimitKw(@Nullable BigDecimal maxLimitKw)
    • setDisplayName

      public void setDisplayName(String displayName)
    • setMqttStreamingConfig

      public void setMqttStreamingConfig(MqttStreamingConfig mqttStreamingConfig)
    • initializeFromDataNeed

      public void initializeFromDataNeed(AiidaLocalDataNeed dataNeed)
      Initializes the permission from the data need by deriving serviceName, displayName and inboundMessageFormat from it.
    • setDataSource

      public void setDataSource(@Nullable DataSource dataSource)
    • updateInboundMessageFormat

      public void updateInboundMessageFormat(@NonNull InboundMessageFormat inboundMessageFormat) throws InvalidInboundPermissionException
      Throws:
      InvalidInboundPermissionException
    • setTransmissionEnabled

      public void setTransmissionEnabled(boolean transmissionEnabled)
    • setTransmissionSchedule

      public void setTransmissionSchedule(org.springframework.scheduling.support.CronExpression transmissionSchedule)
    • effectiveTransmissionSchedule

      @Nullable public org.springframework.scheduling.support.CronExpression effectiveTransmissionSchedule()
      Returns:
      The schedule that should be used to stream data for this permission: the permission's own transmission schedule if set, otherwise the data need's schedule as a fallback
    • isInbound

      public boolean isInbound()
      Returns:
      true if the permission is inbound.
    • supportsConnectionLimits

      public boolean supportsConnectionLimits()
      true if the permission allows the eligible party to send connection limits.
      Returns:
      Whether the permission supports connection limit features such as monitoring.