}
for (String tn : taskNames)
{
String attrKey = "deadline_" + tn;
ProcessDeadline pid = null;
for (ProcessInstanceAttribute attr : processInstance.getProcessAttributes()) {
if (attr.getKey() == null) {
logger.info("Attribute key is null! Process instance: " + processInstance.getInternalId());
}
if (attrKey.equals(attr.getKey())) {
pid = (ProcessDeadline) attr;
break;
}
}
if (pid == null) {
pid = new ProcessDeadline();
pid.setKey("deadline_" + tn);
pid.setProcessInstance(processInstance);
processInstance.getProcessAttributes().add(pid);
}
pid.setProfileName(profileName);
pid.setNotifyUsersWithLogin(notifyUsersWithLogin);
pid.setNotifyUsersWithRole(notifyUsersWithRole);
pid.setSkipAssignee("true".equalsIgnoreCase(skipAssignee));
pid.setTemplateName(templateName);
pid.setTaskName(tn);
pid.setAlreadyNotified(false);
pid.setDueDate(dueDate);
}
ctx.getProcessInstanceDAO().saveProcessInstance(processInstance);
return STATUS_OK;