summaryrefslogtreecommitdiff
path: root/src/main/java/com/c2kernel/lifecycle/instance/predefined/entitycreation/AggregationMember.java
blob: 64215dafd19ecf4ac14f6a0e84506a3f16594bf0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
package com.c2kernel.lifecycle.instance.predefined.entitycreation;

import org.w3c.dom.Element;
import org.w3c.dom.NodeList;
import org.w3c.dom.Text;

import com.c2kernel.utils.CastorHashMap;
import com.c2kernel.utils.KeyValuePair;

public class AggregationMember implements java.io.Serializable {

    public int slotNo;
    public String itemDescriptionPath;
    public String itemPath;
    public Geometry geometry;
    public CastorHashMap props = new CastorHashMap();


    public AggregationMember() {
        super();
    }

    public AggregationMember(int slotNo, String itemDescPath, String itemPath, Geometry geometry) {
        this.slotNo = slotNo;
        this.itemDescriptionPath = itemDescPath;
        this.itemPath = itemPath;
        this.geometry = geometry;
    }

	public AggregationMember(Element memElem) {
		Element geom = (Element)memElem.getElementsByTagName("Geometry").item(0);
		this.slotNo = Integer.parseInt(memElem.getAttribute("slotNo"));
		this.itemDescriptionPath = memElem.getAttribute("itemDescriptionPath");
		this.itemPath = memElem.getAttribute("itemPath");
		this.geometry = new Geometry(Integer.parseInt(geom.getAttribute("x")), Integer.parseInt(geom.getAttribute("y")), 
						Integer.parseInt(geom.getAttribute("width")), Integer.parseInt(geom.getAttribute("height")));
		NodeList cmpnl = memElem.getElementsByTagName("MemberProperty");
		for (int l=0; l<cmpnl.getLength(); l++) {
			Element p = (Element)cmpnl.item(l);
			props.put(p.getAttribute("name"), ((Text)p.getFirstChild()).getData());
		}	        				
	}
    public KeyValuePair[] getKeyValuePairs() {
        return props.getKeyValuePairs();
    }

    public void setKeyValuePairs(KeyValuePair[] pairs) {
    	props.setKeyValuePairs(pairs);
    }
}