Repository: incubator-eagle
Updated Branches:
  refs/heads/develop 3ac32770d -> 9d32fb172


[EAGLE-372] Change AlertNotificationEntity#fields type from String to List

https://issues.apache.org/jira/browse/EAGLE-372

We should avoid using String to express complex type in the entity definition.

Author: Zhao, Qingwen <qingwz...@ebay.com>

Closes #265 from qingwen220/EAGLE-372.


Project: http://git-wip-us.apache.org/repos/asf/incubator-eagle/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-eagle/commit/9d32fb17
Tree: http://git-wip-us.apache.org/repos/asf/incubator-eagle/tree/9d32fb17
Diff: http://git-wip-us.apache.org/repos/asf/incubator-eagle/diff/9d32fb17

Branch: refs/heads/develop
Commit: 9d32fb1726785df7a4a7054f155bd50df5f2a77b
Parents: 3ac3277
Author: Zhao, Qingwen <qingwz...@ebay.com>
Authored: Wed Jul 13 11:26:20 2016 +0800
Committer: Zhao, Qingwen <qingwz...@ebay.com>
Committed: Wed Jul 13 11:26:20 2016 +0800

----------------------------------------------------------------------
 eagle-assembly/src/main/bin/eagle-topology-init.sh        |  4 ++--
 .../eagle/alert/entity/AlertNotificationEntity.java       | 10 ++++++----
 2 files changed, 8 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/9d32fb17/eagle-assembly/src/main/bin/eagle-topology-init.sh
----------------------------------------------------------------------
diff --git a/eagle-assembly/src/main/bin/eagle-topology-init.sh 
b/eagle-assembly/src/main/bin/eagle-topology-init.sh
index 6d7f439..365fa99 100755
--- a/eagle-assembly/src/main/bin/eagle-topology-init.sh
+++ b/eagle-assembly/src/main/bin/eagle-topology-init.sh
@@ -183,7 +183,7 @@ curl -silent -u 
${EAGLE_SERVICE_USER}:${EAGLE_SERVICE_PASSWD} -X POST -H 'Conten
        "className": "org.apache.eagle.notification.plugin.AlertEmailPlugin",
        "description": "send alert to email",
        "enabled":true,
-       "fields": 
"[{\"name\":\"sender\"},{\"name\":\"recipients\"},{\"name\":\"subject\"}]"
+       "fields": [{"name":"sender"},{"name":"recipients"},{"name":"subject"}]
      },
      {
        "prefix": "alertNotifications",
@@ -193,7 +193,7 @@ curl -silent -u 
${EAGLE_SERVICE_USER}:${EAGLE_SERVICE_PASSWD} -X POST -H 'Conten
        "className": "org.apache.eagle.notification.plugin.AlertKafkaPlugin",
        "description": "send alert to kafka bus",
        "enabled":true,
-       "fields": 
"[{\"name\":\"kafka_broker\",\"value\":\"sandbox.hortonworks.com:6667\"},{\"name\":\"topic\"}]"
+       "fields": 
[{"name":"kafka_broker","value":"sandbox.hortonworks.com:6667"},{"name":"topic"}]
      },
      {
        "prefix": "alertNotifications",

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/9d32fb17/eagle-core/eagle-policy/eagle-policy-base/src/main/java/org/apache/eagle/alert/entity/AlertNotificationEntity.java
----------------------------------------------------------------------
diff --git 
a/eagle-core/eagle-policy/eagle-policy-base/src/main/java/org/apache/eagle/alert/entity/AlertNotificationEntity.java
 
b/eagle-core/eagle-policy/eagle-policy-base/src/main/java/org/apache/eagle/alert/entity/AlertNotificationEntity.java
index 290e4ab..2782be2 100644
--- 
a/eagle-core/eagle-policy/eagle-policy-base/src/main/java/org/apache/eagle/alert/entity/AlertNotificationEntity.java
+++ 
b/eagle-core/eagle-policy/eagle-policy-base/src/main/java/org/apache/eagle/alert/entity/AlertNotificationEntity.java
@@ -23,6 +23,9 @@ import org.apache.eagle.policy.common.Constants;
 import org.codehaus.jackson.annotate.JsonIgnoreProperties;
 import org.codehaus.jackson.map.annotate.JsonSerialize;
 
+import java.util.List;
+import java.util.Map;
+
 
 @JsonSerialize(include=JsonSerialize.Inclusion.NON_NULL)
 @Table("alertNotifications")
@@ -65,15 +68,14 @@ public class AlertNotificationEntity extends 
TaggedLogAPIEntity {
     }
 
     @Column("d")
-    private String fields;
-    public String getFields() {
+    private List<Map<String, String>> fields;
+    public List<Map<String, String>> getFields() {
         return fields;
     }
 
-    public void setFields(String fields) {
+    public void setFields(List<Map<String, String>> fields) {
         this.fields = fields;
         valueChanged("fields");
     }
 
-
 }

Reply via email to