com.aliyun.openservices.log.common.DashboardBasedJobConfiguration Maven / Gradle / Ivy
package com.aliyun.openservices.log.common;
import com.alibaba.fastjson.annotation.JSONField;
import com.aliyun.openservices.log.internal.Unmarshaller;
import com.aliyun.openservices.log.util.JsonUtils;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import java.util.List;
abstract class DashboardBasedJobConfiguration extends JobConfiguration {
@JSONField
private String dashboard;
@JSONField
private List notificationList;
public String getDashboard() {
return dashboard;
}
public void setDashboard(String dashboard) {
this.dashboard = dashboard;
}
public List getNotificationList() {
return notificationList;
}
public void setNotificationList(List notificationList) {
this.notificationList = notificationList;
}
abstract Notification makeQualifiedNotification(NotificationType type);
@Override
public void deserialize(JSONObject value) {
dashboard = value.getString("dashboard");
notificationList = JsonUtils.readList(value, "notificationList", new Unmarshaller() {
@Override
public Notification unmarshal(JSONArray value, int index) {
JSONObject item = value.getJSONObject(index);
NotificationType notificationType = NotificationType.fromString(item.getString("type"));
if (notificationType == null) {
// For bwc
return null;
}
Notification notification = makeQualifiedNotification(notificationType);
notification.deserialize(item);
return notification;
}
});
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy