package org.argeo.slc.core.test.tree;\r
\r
+import java.util.ArrayList;\r
import java.util.Date;\r
import java.util.List;\r
import java.util.Map;\r
import org.apache.commons.logging.Log;\r
import org.apache.commons.logging.LogFactory;\r
import org.argeo.slc.SlcException;\r
+import org.argeo.slc.core.attachment.Attachment;\r
+import org.argeo.slc.core.attachment.AttachmentsEnabled;\r
import org.argeo.slc.core.structure.tree.TreeSPath;\r
import org.argeo.slc.structure.StructureAware;\r
import org.argeo.slc.structure.StructureElement;\r
* structure.\r
*/\r
public class TreeTestResult implements TestResult, StructureAware<TreeSPath>,\r
- Comparable<TreeTestResult> {\r
+ Comparable<TreeTestResult>, AttachmentsEnabled {\r
private Log log = LogFactory.getLog(TreeTestResult.class);\r
\r
private List<TestResultListener<TreeTestResult>> listeners = new Vector<TestResultListener<TreeTestResult>>();\r
\r
private SortedMap<TreeSPath, PartSubList> resultParts = new TreeMap<TreeSPath, PartSubList>();\r
private SortedMap<TreeSPath, StructureElement> elements = new TreeMap<TreeSPath, StructureElement>();\r
+ private List<Attachment> attachments = new ArrayList<Attachment>();\r
\r
private Map<String, String> attributes = new TreeMap<String, String>();\r
\r
this.warnIfAlreadyClosed = warnIfAlreadyClosed;\r
}\r
\r
+ public List<Attachment> getAttachments() {\r
+ return attachments;\r
+ }\r
+\r
+ public void setAttachments(List<Attachment> attachments) {\r
+ this.attachments = attachments;\r
+ }\r
+\r
+ public void addAttachment(Attachment attachment) {\r
+ attachments.add(attachment);\r
+ synchronized (listeners) {\r
+ for (TestResultListener<TreeTestResult> listener : listeners) {\r
+ if (listener instanceof TreeTestResultListener)\r
+ ((TreeTestResultListener) listener).addAttachment(this,\r
+ attachment);\r
+ }\r
+ }\r
+ }\r
+\r
}\r