blob: 40e0604285bcfe638a9a960c95c26db13196ac6d (
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
51
|
package com.c2kernel.lifecycle.instance.predefined.entitycreation;
import java.util.ArrayList;
import com.c2kernel.collection.MembershipException;
import com.c2kernel.common.ObjectNotFoundException;
import com.c2kernel.graph.model.GraphPoint;
import com.c2kernel.lookup.DomainPath;
import com.c2kernel.property.PropertyDescription;
import com.c2kernel.property.PropertyDescriptionList;
import com.c2kernel.property.PropertyUtility;
public class Aggregation implements java.io.Serializable {
public boolean isDescription;
public ArrayList<AggregationMember> aggregationMemberList = new ArrayList<AggregationMember>();
public String name;
public Aggregation() {
super();
}
public Aggregation(String name, boolean isDescription) {
this();
this.name = name;
this.isDescription = isDescription;
}
public com.c2kernel.collection.Aggregation create() throws MembershipException, ObjectNotFoundException {
com.c2kernel.collection.Aggregation newAgg = isDescription?new com.c2kernel.collection.AggregationDescription(name):new com.c2kernel.collection.AggregationInstance(name);
newAgg.setName(name);
for (AggregationMember thisMem : aggregationMemberList) {
StringBuffer classProps = new StringBuffer();
if (thisMem.itemDescriptionPath != null && thisMem.itemDescriptionPath.length()>0) {
PropertyDescriptionList propList = PropertyUtility.getPropertyDescriptionOutcome(new DomainPath(thisMem.itemDescriptionPath).getSysKey());
for (PropertyDescription pd : propList.list) {
thisMem.props.put(pd.getName(), pd.getDefaultValue());
if (pd.getIsClassIdentifier())
classProps.append((classProps.length()>0?",":"")).append(pd.getName());
}
}
if (thisMem.itemPath != null && thisMem.itemPath.length()>0) {
int syskey = new DomainPath(thisMem.itemPath).getSysKey();
if (syskey == -1)
throw new MembershipException("Cannot find "+thisMem.itemPath+" specified for collection.");
newAgg.addMember(syskey, thisMem.props, classProps.toString(), new GraphPoint(thisMem.geometry.x, thisMem.geometry.y), thisMem.geometry.width, thisMem.geometry.height);
}
}
return newAgg;
}
}
|