메뉴 건너뛰기

Cloudera, BigData, Semantic IoT, Hadoop, NoSQL

Cloudera CDH/CDP 및 Hadoop EcoSystem, Semantic IoT등의 개발/운영 기술을 정리합니다. gooper@gooper.com로 문의 주세요.


-------------------CustomViewChangedEventListener.java----------------

package com.gooper.drool_test;


import java.util.ArrayList;

import java.util.List;


import org.kie.api.runtime.rule.Row;

import org.kie.api.runtime.rule.ViewChangedEventListener;


/*

 * 쿼리 변경 이벤트를 처리하기 위한 구현체

 */

public class CustomViewChangedEventListener implements ViewChangedEventListener {


private List<ServerInfo> updatedServers;

private List<ServerInfo> deletedServers;

private List<ServerInfo> currentServers;

public CustomViewChangedEventListener() {

updatedServers = new ArrayList<ServerInfo>();

deletedServers = new ArrayList<ServerInfo>();

currentServers = new ArrayList<ServerInfo>();

}

@Override

public void rowDeleted(Row row) {

deletedServers.add((ServerInfo)row.get("$server_info"));

}


@Override

public void rowInserted(Row row) {

currentServers.add((ServerInfo)row.get("$server_info"));

}


@Override

public void rowUpdated(Row row) {

updatedServers.add((ServerInfo)row.get("$server_info"));

}

public List<ServerInfo> getUpdatedServers() {

return updatedServers;

}


public List<ServerInfo> getDeletedServers() {

return deletedServers;

}


public List<ServerInfo> getCurrentServers() {

return currentServers;

}


}


위로