]> git.argeo.org Git - gpl/argeo-slc.git/blob - runtime/org.argeo.slc.core/src/main/java/org/argeo/slc/core/execution/generator/DefaultRunnableDataNode.java
Improve SystemCall
[gpl/argeo-slc.git] / runtime / org.argeo.slc.core / src / main / java / org / argeo / slc / core / execution / generator / DefaultRunnableDataNode.java
1 package org.argeo.slc.core.execution.generator;
2
3 import java.util.ArrayList;
4 import java.util.HashMap;
5 import java.util.List;
6 import java.util.Map;
7
8 /**
9 * Default implementation of <code>RunnableDataNode</code>
10 *
11 */
12 public class DefaultRunnableDataNode implements RunnableDataNode {
13
14 private List<RunnableDataNode> children = new ArrayList<RunnableDataNode>();
15
16 private RunnableDataNode parent;
17
18 /**
19 * Data of the RunnableDataNode. Does not contain
20 * parent data.
21 */
22 private Map<String, Object> properData = new HashMap<String, Object>();
23
24 private String path;
25
26 private String beanName;
27
28 public boolean isLeaf() {
29 return children.size() == 0;
30 }
31
32 public List<RunnableDataNode> getChildren() {
33 return children;
34 }
35
36 public void addChild(RunnableDataNode child) {
37 child.setParent(this);
38 children.add(child);
39 }
40
41 public Map<String, Object> getData() {
42 Map<String, Object> data = new HashMap<String, Object>();
43 if(parent != null) {
44 Map<String, Object> parentData = parent.getData();
45 if(parentData != null) {
46 data.putAll(parentData);
47 }
48 }
49 // entries defined in parentData can be overridden
50 // in properData
51 if(properData != null) {
52 data.putAll(properData);
53 }
54 return data;
55 }
56
57 public Map<String, Object> getProperData() {
58 return properData;
59 }
60
61 public void setProperData(Map<String, Object> properData) {
62 this.properData = properData;
63 }
64
65 public String getPath() {
66 return path;
67 }
68
69 public void setPath(String path) {
70 this.path = path;
71 }
72
73 public String getBeanName() {
74 return beanName;
75 }
76
77 public void setBeanName(String beanName) {
78 this.beanName = beanName;
79 }
80
81 public void setParent(RunnableDataNode parent) {
82 this.parent = parent;
83 }
84
85 public RunnableDataNode getParent() {
86 return parent;
87 }
88
89 }