}
public WorkflowProcess createXPDLObject(WorkflowProcesses wps,
String type,
boolean addToCollection) {
WorkflowProcess wp = (WorkflowProcess) wps.generateNewElement();
adjustType(wp, type);
JaWETypes jts = JaWEManager.getInstance().getJaWEController().getJaWETypes();
boolean hasTemplate = jts.hasTemplateId(type);
if (hasTemplate) {
jts.fillFromTemplate(wp, type);
}
String id = wp.getId();
if (!hasTemplate || id.equals("") || wps.getWorkflowProcess(id) != null) {
if (id.equals("")) {
id = JaWEManager.getInstance().getIdFactory().generateUniqueId(wps);
} else {
id = JaWEManager.getInstance().getIdFactory().generateSimilarOrIdenticalUniqueId(wps, new HashSet(), id);
}
int i = 0;
while (wps.getWorkflowProcess(id) != null) {
id = id + String.valueOf(++i);
}
wp.setId(id);
}
if (!hasTemplate || wp.getName().equals("")) {
//CUSTOM
String num = id.substring("process".length());
wp.setName("Workflow Process " + num);
//END CUSTOM
}
wp.getProcessHeader().setCreated(Utils.getCurrentDateAndTime());
wp.getProcessHeader().setDurationUnitHOUR();
wp.getRedefinableHeader().setAuthor(XMLUtil.getPackage(wps).getRedefinableHeader().getAuthor());
adjustXPDLObject(wp, type);
if (addToCollection) {
wps.add(wp);