Project

General

Profile

1
package eu.dnetlib.msro.workflows.nodes.contexts;
2

    
3
import java.util.Map;
4

    
5
import com.google.common.collect.Maps;
6
import org.dom4j.DocumentHelper;
7
import org.dom4j.Element;
8

    
9
public class ContextDesc {
10

    
11
	private String id;
12
	private String label;
13
	private String type;
14
	private String xml;
15
	private Map<String, ContextPart> categories = Maps.newLinkedHashMap();
16
	private Map<String, String> dbEntries = Maps.newLinkedHashMap();
17

    
18
	public ContextDesc(final String id, final String label, final String type) {
19
		this.id = id;
20
		this.label = label;
21
		this.type = type;
22
	}
23

    
24
	public String getId() {
25
		return id;
26
	}
27

    
28
	public void setId(final String id) {
29
		this.id = id;
30
	}
31

    
32
	public String getLabel() {
33
		return label;
34
	}
35

    
36
	public void setLabel(final String label) {
37
		this.label = label;
38
	}
39

    
40
	public String getType() {
41
		return type;
42
	}
43

    
44
	public void setType(final String type) {
45
		this.type = type;
46
	}
47

    
48
	public String getXml() {
49
		return xml;
50
	}
51

    
52
	public void setXml(final String xml) {
53
		this.xml = xml;
54
	}
55

    
56
	public Map<String, ContextPart> getCategories() {
57
		return categories;
58
	}
59

    
60
	public void setCategories(final Map<String, ContextPart> categories) {
61
		this.categories = categories;
62
	}
63

    
64
	public Map<String, String> getDbEntries() {
65
		return dbEntries;
66
	}
67

    
68
	public void setDbEntries(final Map<String, String> dbEntries) {
69
		this.dbEntries = dbEntries;
70
	}
71

    
72
	public Element asDomElement() {
73
		final Element ctxElem = DocumentHelper.createElement("context");
74
		ctxElem.addAttribute("id", getId());
75
		ctxElem.addAttribute("label", getLabel());
76
		ctxElem.addAttribute("type", getType());
77

    
78
		for (ContextPart part : getCategories().values()) {
79
			ctxElem.add(part.asDomElement("category"));
80
		}
81

    
82
		return ctxElem;
83
	}
84

    
85
}
(1-1/6)