]> git.basschouten.com Git - openhab-addons.git/blob
c8f8e5d468892d74da74b27a59fe20e4db97a2ab
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2023 Contributors to the openHAB project
3  *
4  * See the NOTICE file(s) distributed with this work for additional
5  * information.
6  *
7  * This program and the accompanying materials are made available under the
8  * terms of the Eclipse Public License 2.0 which is available at
9  * http://www.eclipse.org/legal/epl-2.0
10  *
11  * SPDX-License-Identifier: EPL-2.0
12  */
13 package org.openhab.binding.mielecloud.internal.config.exception;
14
15 import java.time.LocalDateTime;
16
17 import org.eclipse.jdt.annotation.NonNullByDefault;
18 import org.eclipse.jdt.annotation.Nullable;
19
20 /**
21  * Exception thrown when there already is an ongoing authorization process.
22  *
23  * @author Björn Lange - Initial Contribution
24  */
25 @NonNullByDefault
26 public final class OngoingAuthorizationException extends RuntimeException {
27     private static final long serialVersionUID = -6742384930140134244L;
28
29     @Nullable
30     private final LocalDateTime ongoingAuthorizationExpiryTimestamp;
31
32     /**
33      * Creates a new {@link OngoingAuthorizationException}.
34      *
35      * @param message Exception message.
36      * @param ongoingAuthorizationExpiryTimestamp Timestamp when the ongoing authorization will expire.
37      */
38     public OngoingAuthorizationException(String message, @Nullable LocalDateTime ongoingAuthorizationExpiryTimestamp) {
39         super(message);
40         this.ongoingAuthorizationExpiryTimestamp = ongoingAuthorizationExpiryTimestamp;
41     }
42
43     /**
44      * Gets the timestamp representing when the ongoing authorization will expire.
45      */
46     @Nullable
47     public LocalDateTime getOngoingAuthorizationExpiryTimestamp() {
48         return ongoingAuthorizationExpiryTimestamp;
49     }
50 }