}
public ActivitySet createXPDLObject(ActivitySets ass,
String type,
boolean addToCollection) {
ActivitySet as = (ActivitySet) ass.generateNewElement();
JaWETypes jts = JaWEManager.getInstance().getJaWEController().getJaWETypes();
boolean hasTemplate = jts.hasTemplateId(type);
adjustType(as, type);
if (hasTemplate) {
jts.fillFromTemplate(as, type);
}
String id = as.getId();
if (!hasTemplate || id.equals("") || ass.getActivitySet(id) != null) {
if (id.equals("")) {
id = JaWEManager.getInstance().getIdFactory().generateUniqueId(ass);
} else {
id = JaWEManager.getInstance().getIdFactory().generateSimilarOrIdenticalUniqueId(ass, new HashSet(), id);
}
int i = 0;
while (ass.getActivitySet(id) != null) {
id = id + String.valueOf(++i);
}
as.setId(id);
}
adjustXPDLObject(as, type);
if (addToCollection) {