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
56
57 @Override
58 @Deprecated
59 public ResultEvent getResultEvent(int index) {
60 return getAllResults().get(index);
61 }
62
63 @Override
64 public List<ResultEvent> getResultsOfType(String type) {
65
66 ArrayList<ResultEvent> newList = new ArrayList<ResultEvent>();
67 if (type == null) return newList;
68 for (int i=0; i<results.size(); i++){
69 if (type.equalsIgnoreCase(results.get(i).getType())){
70 newList.add(results.get(i));
71 }
72 }
73 return newList;
74 }
75
76
77
78
79 @Override
80 public Object getAttribute(String key) {
81 return attributes.get(key);
82 }
83
84
85
86
87 @Override
88 public void setAttribute(String key, Object attr) {
89 attributes.put(key, attr);
90 }
91
92 }