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
28
29
30
31 public class EngineResultsImpl implements EngineResults {
32
33 private List<ResultEvent> results = new ArrayList<ResultEvent>();
34 private Map<String, Object> attributes = new HashMap<String, Object>();
35
36 @Override
37 public void addResult(ResultEvent result) {
38 results.add(result);
39 }
40
41
42
43
44
45 @Override
46 public List<ResultEvent> getAllResults() {
47 return new ArrayList<ResultEvent>(results);
48 }
49
50
51
52
53
54
55 @Override
56 public ResultEvent getResultEvent(int index) {
57
58 return null;
59 }
60
61 @Override
62 public List<ResultEvent> getResultsOfType(String type) {
63
64 ArrayList<ResultEvent> newList = new ArrayList<ResultEvent>();
65 if (type == null) return newList;
66 for (int i=0; i<results.size(); i++){
67 if (type.equalsIgnoreCase(results.get(i).getType())){
68 newList.add(results.get(i));
69 }
70 }
71 return newList;
72 }
73
74
75
76
77 @Override
78 public Object getAttribute(String key) {
79 return attributes.get(key);
80 }
81
82
83
84
85 @Override
86 public void setAttribute(String key, Object attr) {
87 attributes.put(key, attr);
88 }
89
90 }