From 64558a1f342a7008cd042b019cc79a476f63c805 Mon Sep 17 00:00:00 2001 From: Michael James Hoppal Date: Wed, 27 Apr 2016 10:30:37 -0600 Subject: [PATCH] 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 --- .../hibernate/db/NotificationMethodDb.java | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/java/monasca-common-hibernate/src/main/java/monasca/common/hibernate/db/NotificationMethodDb.java b/java/monasca-common-hibernate/src/main/java/monasca/common/hibernate/db/NotificationMethodDb.java index e22f69ad..41988148 100644 --- a/java/monasca-common-hibernate/src/main/java/monasca/common/hibernate/db/NotificationMethodDb.java +++ b/java/monasca-common-hibernate/src/main/java/monasca/common/hibernate/db/NotificationMethodDb.java @@ -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";