View Javadoc

1   package org.kuali.rice.krms.framework.engine;
2   
3   import java.util.ArrayList;
4   import java.util.List;
5   
6   import org.kuali.rice.krms.api.engine.EngineResults;
7   import org.kuali.rice.krms.api.engine.ResultEvent;
8   
9   public class EngineResultsImpl implements EngineResults {
10  	private List<ResultEvent> results = new ArrayList<ResultEvent>();
11  	
12  	@Override
13  	public void addResult(ResultEvent result) {
14  		results.add(result);
15  	}
16  
17  	@Override
18  	public List<ResultEvent> getAllResults() {		
19  		return new ArrayList<ResultEvent>(results); // shallow copy should be defensive enough
20  	}
21  
22  	@Override
23  	public ResultEvent getResultEvent(int index) {
24  		// TODO Auto-generated method stub
25  		return null;
26  	}
27  
28  	@Override
29  	public List<ResultEvent> getResultsOfType(String type) {
30  		// TODO Auto-generated method stub
31  		ArrayList<ResultEvent> newList = new ArrayList<ResultEvent>();
32  		if (type == null) return newList;
33  		for (int i=0; i<results.size(); i++){
34  			if (type.equalsIgnoreCase(results.get(i).getType())){
35  				newList.add(results.get(i));
36  			}
37  		}
38  		return newList;
39  	}
40  }