Add Period to hibernate notification method

Created a new constructor including the new field. We have both
so we can support with or without passing in the period
which will help us with supporting the old API and the new API.

Once the transition occurs with the new API will remove the old
constructor

Change-Id: Idf0db02f51762633db6ccb60eeca2eb780c70e29
This commit is contained in:
Michael James Hoppal 2016-04-27 10:30:37 -06:00
parent b1b3b3f1d7
commit 64558a1f34
1 changed files with 30 additions and 0 deletions

View File

@ -1,5 +1,6 @@
/*
* Copyright 2015 FUJITSU LIMITED
* (C) Copyright 2016 Hewlett Packard Enterprise Development Company LP
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at
@ -58,10 +59,29 @@ public class NotificationMethodDb
@Column(name = "address", length = 512, nullable = false)
private String address;
@Column(name = "period", nullable = false)
private Integer period;
public NotificationMethodDb() {
super();
}
public NotificationMethodDb(String id,
String tenantId,
String name,
AlarmNotificationMethodType type,
String address,
Integer period,
DateTime created_at,
DateTime updated_at) {
super(id, created_at, updated_at);
this.tenantId = tenantId;
this.name = name;
this.type = type;
this.address = address;
this.period = period;
}
public NotificationMethodDb(String id,
String tenantId,
String name,
@ -74,6 +94,7 @@ public class NotificationMethodDb
this.name = name;
this.type = type;
this.address = address;
this.period = 0;
}
public NotificationMethodDb setAddress(final String address) {
@ -96,6 +117,11 @@ public class NotificationMethodDb
return this;
}
public NotificationMethodDb setPeriod(final Integer period) {
this.period = period;
return this;
}
public String getTenantId() {
return this.tenantId;
}
@ -112,6 +138,10 @@ public class NotificationMethodDb
return this.address;
}
public Integer getPeriod() {
return this.period;
}
public interface Queries {
String NOTIFICATION_BY_TENANT_ID_AND_NAME = "NotificationMethod.finByTenantIdAndName";
String DELETE_BY_ID = "NotificationMethod.deleteById";