1 /*******************************************************************************
2 * ============LICENSE_START========================================================================
3 * ONAP : ccsdk feature sdnr wt
4 * =================================================================================================
5 * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
6 * =================================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
8 * in compliance with the License. You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software distributed under the License
13 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
14 * or implied. See the License for the specific language governing permissions and limitations under
16 * ============LICENSE_END==========================================================================
17 ******************************************************************************/
18 package org.onap.ccsdk.features.sdnr.wt.devicemanager.base.toggleAlarmFilter;
20 public class NotificationWithServerTimeStamp<T2> {
21 private final T2 alarmNotification;
22 private T2 contraAlarmNotification;
23 private final long timestampStart;
24 private long timestamp;
26 public NotificationWithServerTimeStamp(T2 n) {
27 this(n, System.currentTimeMillis());
30 public NotificationWithServerTimeStamp(T2 n, long ts) {
31 this.alarmNotification = n;
32 this.contraAlarmNotification = null;
34 this.timestampStart=ts;
37 @SuppressWarnings("unused")
38 public long getStartTime() {
39 return this.timestampStart;
41 public void refresh() {
42 this.refresh(System.currentTimeMillis());
45 public void refresh(long ts) {
49 public void setContraEvent(T2 notification) {
50 this.contraAlarmNotification = notification;
54 public void clrContraEvent() {
55 this.contraAlarmNotification = null;
59 public boolean isStable(long now) {
60 return this.timestamp + NotificationDelayFilter.getDelay() < now;
63 @SuppressWarnings("unused")
64 public T2 getAlarmNotification() {
65 return this.alarmNotification;
68 public T2 getContraAlarmNotification() {
69 return this.contraAlarmNotification;
73 public String toString() {
74 return "NotificationWithServerTimeStamp [alarmNotification=" + alarmNotification
75 + ", contraAlarmNotification=" + contraAlarmNotification + ", timestampStart=" + timestampStart
76 + ", timestamp=" + timestamp + "]";