priority = new Integer(priorityStr);
}catch(Exception e){
}
}
final WorkListDAO wl;
Long taskId;
if(reservedTaskId!=null){
taskId = new Long(reservedTaskId);
wl = (WorkListDAO) tc.findSynchronizedDAO("BPM_WORKLIST", "taskId", taskId, WorkListDAO.class);
}
else{
taskId = UniqueKeyGenerator.issueWorkItemKey(tc);
wl = (WorkListDAO) tc.createSynchronizedDAO("BPM_WORKLIST", "taskId", taskId, WorkListDAO.class);
}
if(dueDate!=null)
wl.setDueDate(dueDate.getTime());
else
wl.setDueDate(null);
String definitionName = (String)parameterMap.get("definitionName");
String instanceName = (String)parameterMap.get("instanceName");
String instanceId = (String)parameterMap.get(KeyedParameter.INSTANCEID);
/* if(definitionName!=null){
wl.setProcessDefinitionName(definitionName);
}
if(instanceName!=null){
wl.setProcessInstanceName(instanceName);
}
*/
wl.setPriority(priority);
wl.setTool(""+parameterMap.get(KeyedParameter.TOOL));
wl.setEndpoint(userId);
//modified
Timestamp startedTime;
// if(tc.getProcessManager().getGenericContext().containsKey("initiationTime")){
// String startedTimeInStr = (String)tc.getProcessManager().getGenericContext().get("initiationTime");
// startedTime = new Timestamp(Long.parseLong(startedTimeInStr));
// }else
startedTime = new Timestamp(now.getTimeInMillis());
wl.setStartDate(startedTime);
//end
wl.setTitle(""+parameterMap.get(KeyedParameter.TITLE));
wl.setTrcTag(""+parameterMap.get(KeyedParameter.TRACINGTAG));
wl.setInstId(new Long(""+parameterMap.get(KeyedParameter.INSTANCEID)));
wl.setRootInstId(new Long(""+parameterMap.get(KeyedParameter.ROOTINSTANCEID)));
wl.setDefId(new Long(""+parameterMap.get(KeyedParameter.PROCESSDEFINITION)));
wl.setDefName(""+parameterMap.get(KeyedParameter.PROCESSDEFINITIONNAME));
wl.setRoleName(""+parameterMap.get("roleName"));
wl.setRefRoleName(""+parameterMap.get("referenceRoleName"));
wl.setResName(""+parameterMap.get("resourceName"));
int i=1;
while(parameterMap.containsKey("dispatchParam" + i)){
wl.set("DispatchParam" +i, ""+parameterMap.get("dispatchParam" + i));
i++;
}
if(parameterMap.containsKey("executionScope")){
wl.setExecScope((String)parameterMap.get("executionScope"));
}
if(parameterMap.containsKey("extValue1")){
wl.set("EXT1", parameterMap.get("extValue1"));
}
if(parameterMap.containsKey("extValue2")){
wl.set("EXT2", parameterMap.get("extValue2"));
}
if(parameterMap.containsKey("extValue3")){
wl.set("EXT3", parameterMap.get("extValue3"));
}
if(parameterMap.containsKey("extValue4")){
wl.set("EXT4", parameterMap.get("extValue4"));
}
if(parameterMap.containsKey("extValue5")){
wl.set("EXT5", parameterMap.get("extValue5"));
}
if(parameterMap.containsKey("extValue6")){
wl.set("EXT6", parameterMap.get("extValue6"));
}
if(parameterMap.containsKey("extValue7")){
wl.set("EXT7", parameterMap.get("extValue7"));
}
if(parameterMap.containsKey("extValue8")){
wl.set("EXT8", parameterMap.get("extValue8"));
}
if(parameterMap.containsKey("extValue9")){
wl.set("EXT9", parameterMap.get("extValue9"));
}
if(parameterMap.containsKey("extValue10")){
wl.set("EXT10", parameterMap.get("extValue10"));
}
//dispatching option//////
try{
int dispatchingOption = Integer.parseInt((String)parameterMap.get(KeyedParameter.DISPATCHINGOPTION));
wl.setDispatchOption(dispatchingOption);
}catch(Exception e){
wl.setDispatchOption(Role.DISPATCHINGOPTION_ALL);
}
//parameterMap.remove(KeyedParameter.DISPATCHINGOPTION);
//
setExtendedFields(wl, parameterMap);
//status//////
String defaultStatus = parameterMap.containsKey(KeyedParameter.DEFAULT_STATUS) ?
""+parameterMap.get(KeyedParameter.DEFAULT_STATUS)
:
(isReservation ? DefaultWorkList.WORKITEM_STATUS_RESERVED : DefaultWorkList.WORKITEM_STATUS_NEW);
wl.setStatus(defaultStatus);
//
//parameter map////// don't use parameter map anymore
//if(!DAOFactory.getInstance(tc).getDBMSProductName().startsWith("DB2")){
// ByteArrayOutputStream bao = new ByteArrayOutputStream();