1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.krms.framework.engine;
17
18 import java.util.ArrayList;
19 import java.util.HashMap;
20 import java.util.List;
21 import java.util.Map;
22
23 import org.kuali.rice.krms.api.engine.EngineResults;
24 import org.kuali.rice.krms.api.engine.ResultEvent;
25
26
27 public class EngineResultsImpl implements EngineResults {
28
29 private List<ResultEvent> results = new ArrayList<ResultEvent>();
30 private Map<String, Object> attributes = new HashMap<String, Object>();
31
32 @Override
33 public void addResult(ResultEvent result) {
34 results.add(result);
35 }
36
37 @Override
38 public List<ResultEvent> getAllResults() {
39 return new ArrayList<ResultEvent>(results);
40 }
41
42 @Override
43 public ResultEvent getResultEvent(int index) {
44
45 return null;
46 }
47
48 @Override
49 public List<ResultEvent> getResultsOfType(String type) {
50
51 ArrayList<ResultEvent> newList = new ArrayList<ResultEvent>();
52 if (type == null) return newList;
53 for (int i=0; i<results.size(); i++){
54 if (type.equalsIgnoreCase(results.get(i).getType())){
55 newList.add(results.get(i));
56 }
57 }
58 return newList;
59 }
60
61
62
63
64 @Override
65 public Object getAttribute(String key) {
66 return attributes.get(key);
67 }
68
69
70
71
72 @Override
73 public void setAttribute(String key, Object attr) {
74 attributes.put(key, attr);
75 }
76
77 }