Merge "Change Enum to String for AlarmNotificationMethodType"

This commit is contained in:
Jenkins 2016-08-05 21:03:17 +00:00 committed by Gerrit Code Review
commit d13ba52bff
2 changed files with 17 additions and 10 deletions

View File

@ -1,6 +1,6 @@
/* /*
* Copyright 2015 FUJITSU LIMITED * Copyright 2015 FUJITSU LIMITED
* (C) Copyright 2016 Hewlett Packard Enterprise Development Company LP * (C) Copyright 2016 Hewlett Packard Enterprise Development LP
* *
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except * 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 * in compliance with the License. You may obtain a copy of the License at
@ -53,8 +53,7 @@ public class NotificationMethodDb
private String name; private String name;
@Column(name = "type", nullable = false) @Column(name = "type", nullable = false)
@Enumerated(EnumType.STRING) private String type;
private AlarmNotificationMethodType type;
@Column(name = "address", length = 512, nullable = false) @Column(name = "address", length = 512, nullable = false)
private String address; private String address;
@ -69,7 +68,7 @@ public class NotificationMethodDb
public NotificationMethodDb(String id, public NotificationMethodDb(String id,
String tenantId, String tenantId,
String name, String name,
AlarmNotificationMethodType type, String type,
String address, String address,
Integer period, Integer period,
DateTime created_at, DateTime created_at,
@ -85,7 +84,7 @@ public class NotificationMethodDb
public NotificationMethodDb(String id, public NotificationMethodDb(String id,
String tenantId, String tenantId,
String name, String name,
AlarmNotificationMethodType type, String type,
String address, String address,
DateTime created_at, DateTime created_at,
DateTime updated_at) { DateTime updated_at) {
@ -102,7 +101,7 @@ public class NotificationMethodDb
return this; return this;
} }
public NotificationMethodDb setType(final AlarmNotificationMethodType type) { public NotificationMethodDb setType(final String type) {
this.type = type; this.type = type;
return this; return this;
} }
@ -130,7 +129,7 @@ public class NotificationMethodDb
return this.name; return this.name;
} }
public AlarmNotificationMethodType getType() { public String getType() {
return this.type; return this.type;
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2014 Hewlett-Packard Development Company, L.P. * (C) Copyright 2014,2016 Hewlett Packard Enterprise Development LP
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -16,6 +16,14 @@
*/ */
package monasca.common.model.alarm; package monasca.common.model.alarm;
public enum AlarmNotificationMethodType { public class AlarmNotificationMethodType {
EMAIL, WEBHOOK, PAGERDUTY;
public static final String EMAIL = "EMAIL";
public static final String WEBHOOK = "WEBHOOK";
public static final String PAGERDUTY = "PAGERDUTY";
public static String valueOf(String alarmType)
{
return alarmType.toUpperCase();
}
} }