--- /dev/null
+/*\r
+ * Copyright (C) 2007-2012 Argeo GmbH\r
+ *\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ */\r
+package org.argeo.slc.core.execution.generator;\r
+\r
+import java.util.ArrayList;\r
+import java.util.HashMap;\r
+import java.util.List;\r
+import java.util.Map;\r
+\r
+/**\r
+ * Default implementation of <code>RunnableDataNode</code>\r
+ *\r
+ */\r
+public class DefaultRunnableDataNode implements RunnableDataNode {\r
+\r
+ private List<RunnableDataNode> children = new ArrayList<RunnableDataNode>();\r
+ \r
+ private RunnableDataNode parent;\r
+ \r
+ /**\r
+ * Data of the RunnableDataNode. Does not contain\r
+ * parent data.\r
+ */\r
+ private Map<String, Object> properData = new HashMap<String, Object>();\r
+ \r
+ private String path;\r
+ \r
+ private String beanName;\r
+\r
+ public boolean isLeaf() {\r
+ return children.size() == 0;\r
+ }\r
+ \r
+ public List<RunnableDataNode> getChildren() {\r
+ return children;\r
+ }\r
+\r
+ public void addChild(RunnableDataNode child) {\r
+ child.setParent(this);\r
+ children.add(child);\r
+ }\r
+ \r
+ public Map<String, Object> getData() {\r
+ Map<String, Object> data = new HashMap<String, Object>();\r
+ if(parent != null) {\r
+ Map<String, Object> parentData = parent.getData();\r
+ if(parentData != null) {\r
+ data.putAll(parentData);\r
+ }\r
+ }\r
+ // entries defined in parentData can be overridden\r
+ // in properData\r
+ if(properData != null) {\r
+ data.putAll(properData);\r
+ }\r
+ return data;\r
+ }\r
+\r
+ public Map<String, Object> getProperData() {\r
+ return properData;\r
+ }\r
+\r
+ public void setProperData(Map<String, Object> properData) {\r
+ this.properData = properData;\r
+ }\r
+\r
+ public String getPath() {\r
+ return path;\r
+ }\r
+\r
+ public void setPath(String path) {\r
+ this.path = path;\r
+ }\r
+\r
+ public String getBeanName() {\r
+ return beanName;\r
+ }\r
+\r
+ public void setBeanName(String beanName) {\r
+ this.beanName = beanName;\r
+ }\r
+\r
+ public void setParent(RunnableDataNode parent) {\r
+ this.parent = parent;\r
+ }\r
+\r
+ public RunnableDataNode getParent() {\r
+ return parent;\r
+ }\r
+\r
+}\r