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