RoleMapping theMapping = humanActivity.getRole().getMapping(instance);
theMapping.beforeFirst();
TransactionContext tc;
if(DW_DSN!=null){
tc = new SimpleTransactionContext(DW_DSN);
}else{
tc = instance.getProcessTransactionContext();
}
PerformanceFactDAOType performanceFactDAOType = PerformanceFactDAOType.getInstance(tc);
PerformanceFactDAO performanceFact = performanceFactDAOType.createDAOForInsert();{
performanceFact.setACT_ID(humanActivity.getTracingTag());
performanceFact.setINST_ID(new Long(instance.getInstanceId()));
performanceFact.setROOTINST_ID(new Long(instance.getRootProcessInstanceId()));
performanceFact.setACT_NAME(humanActivity.getName().getText());
performanceFact.setCOST(new Long(humanActivity.getCost()));
performanceFact.setDEF_ID(new Long(humanActivity.getProcessDefinition().getBelongingDefinitionId()));
performanceFact.setDEF_NAME(humanActivity.getProcessDefinition().getName().getText());
performanceFact.setPRSNGTIME(new Long(humanActivity.getElapsedTimeAsLong(instance) / 60000));
performanceFact.setRsrc_Id(theMapping.getEndpoint());
performanceFact.setMODTIME(new Timestamp(GlobalContext.getNow(instance.getProcessTransactionContext()).getTimeInMillis()));
long timeId = 0;{
java.util.Calendar startedTime = humanActivity.getOpenTime(instance);
if(startedTime == null) startedTime = humanActivity.getStartedTime(instance);
int year = startedTime.get(Calendar.YEAR);
int month = startedTime.get(Calendar.MONTH) + 1;
int day = startedTime.get(Calendar.DATE);
timeId += year * 10000;
timeId += month * 100;
timeId += day;
}
performanceFact.setTIME_ID(new Long(timeId));
int DEADLNHT = 0;{
java.util.Calendar startedTime = humanActivity.getEndTime(instance);
java.util.Calendar dueDate = humanActivity.getDueDate(instance);
if(startedTime.compareTo(dueDate) <= 0){
DEADLNHT = 0;
}else{
DEADLNHT = 1;
}
}
performanceFact.setDEADLNHT( new Integer(DEADLNHT));
}
performanceFact.insert();
if(tc instanceof SimpleTransactionContext)
tc.releaseResources();
}
}