return "Unknown";
}
static TaskFilterSpec createTaskFilterSpec(ManagedEntity ent)
{
TaskFilterSpec tfs = new TaskFilterSpec();
// only the root initiated tasks
TaskFilterSpecByUsername nameFilter
= new TaskFilterSpecByUsername();
nameFilter.setUserList(new String[] {"Administrator"});
// include tasks initiated by non-users,
// for example, by ScheduledTaskManager.
nameFilter.setSystemUser(true);
tfs.setUserName(nameFilter);
// only the tasks with one entity itself
TaskFilterSpecByEntity entFilter =
new TaskFilterSpecByEntity();
entFilter.setEntity(ent.getMOR());
entFilter.setRecursion(TaskFilterSpecRecursionOption.all);
tfs.setEntity(entFilter);
// only successfully finished tasks
tfs.setState(new TaskInfoState[]{TaskInfoState.success });
// only tasks started within last one month
// strictly speaking, time should be retrieved from server
TaskFilterSpecByTime tFilter =new TaskFilterSpecByTime();
Calendar cal = Calendar.getInstance();
cal.roll(Calendar.MONTH, -1);
tFilter.setBeginTime(cal);
//we ignore the end time here so it gets the latest.
tFilter.setTimeType(TaskFilterSpecTimeOption.startedTime);
tfs.setTime(tFilter);
// Optionally, you limits tasks initiated by scheduled task
// with the setScheduledTask() method.
return tfs;
}