}
public Participant createXPDLObject(Participants ps,
String type,
boolean addToCollection) {
Participant par = (Participant) ps.generateNewElement();
adjustType(par, type);
JaWETypes jts = JaWEManager.getInstance().getJaWEController().getJaWETypes();
boolean hasTemplate = jts.hasTemplateId(type);
if (hasTemplate) {
jts.fillFromTemplate(par, type);
}
String id = par.getId();
if (!hasTemplate || id.equals("") || ps.getParticipant(id) != null) {
if (id.equals("")) {
id = JaWEManager.getInstance().getIdFactory().generateUniqueId(ps);
} else {
id = JaWEManager.getInstance().getIdFactory().generateSimilarOrIdenticalUniqueId(ps, new HashSet(), id);
}
int i = 0;
while (ps.getParticipant(id) != null) {
id = id + String.valueOf(++i);
}
par.setId(id);
}
if (!hasTemplate || par.getName().equals("")) {
//CUSTOM
String num = id.substring("participant".length());
par.setName("Participant " + num);
//END CUSTOM
}
if (type == null || type.equals("")) {
type = JaWEConstants.PARTICIPANT_TYPE_ROLE;
}
if (type.equals(JaWEConstants.PARTICIPANT_TYPE_HUMAN)) {
par.getParticipantType().setTypeHUMAN();
} else if (type.equals(JaWEConstants.PARTICIPANT_TYPE_ROLE)) {
par.getParticipantType().setTypeROLE();
} else if (type.equals(JaWEConstants.PARTICIPANT_TYPE_ORGANIZATIONAL_UNIT)) {
par.getParticipantType().setTypeORGANIZATIONAL_UNIT();
} else if (type.equals(JaWEConstants.PARTICIPANT_TYPE_RESOURCE)) {
par.getParticipantType().setTypeRESOURCE();
} else if (type.equals(JaWEConstants.PARTICIPANT_TYPE_RESOURCE_SET)) {
par.getParticipantType().setTypeRESOURCE_SET();
} else if (type.equals(JaWEConstants.PARTICIPANT_TYPE_SYSTEM)) {
par.getParticipantType().setTypeSYSTEM();
}
adjustXPDLObject(par, type);
if (addToCollection) {