Classes for Workflows and Schedules

Both object types administer tasks. As numerous settings can be specified for them, specific classes are available.

This page includes the following:

Adding Tasks to Workflows

Open the relevant workflow. You get the tasks that should be inserted in the workflow by using the class AddJobPlanTask. Then you use the class JobPlanTask to modify the properties. The example that is shown below includes some of the various methods that are available. For example, a calendar condition is added to the task FILE.INCOME. The task MM.CLOSING only starts when this task shows the status ENDED_OK. You define these predecessor conditions with the method addDependencies that connects the two tasks to each other. Now you can integrate the tasks in the workflow by using the method addTask. The method closeJobPlanTasks is helpful for connecting tasks that do neither have a predecessor nor a successor with a workflow's start and end. Using method format has the effect that tasks are clearly arranged.

Note: For compatibility reasons, the class names still show the name JobPlan that has been used prior to AE v8 instead of the new name workflow.

OpenObject open = new OpenObject(new UC4ObjectName("MM.DAY"));
uc4.sendRequestAndWait(open);

JobPlan jobplan = (JobPlan) open.getUC4Object();

AddJobPlanTask add1 = new AddJobPlanTask(new UC4ObjectName("FILE.INCOME"));
uc4.sendRequestAndWait(add1);
AddJobPlanTask add2 = new AddJobPlanTask(new UC4ObjectName("MM.CLOSING"));
uc4.sendRequestAndWait(add2);
AddJobPlanTask add3 = new AddJobPlanTask(new UC4ObjectName("MM.GROUP"));
uc4.sendRequestAndWait(add3);

JobPlanTask task1 = add1.getJobPlanTask();
JobPlanTask task2 = add2.getJobPlanTask();
JobPlanTask task3 = add3.getJobPlanTask();

UC4ObjectName cale = new UC4ObjectName("FIRM_CALENDAR");
UC4ObjectName calekey = new UC4ObjectName("WORKING_DAYS");
CalendarCondition calecond = new CalendarCondition(cale, calekey);

task1.calendar().addCalendarCondition(calecond);
task2.dependencies().addDependency(task1,TaskState.ENDED_OK);

jobplan.addTask(task1);
jobplan.addTask(task2);
jobplan.addTask(task3);

jobplan.closeJobPlanTasks(null);
jobplan.format();

SaveObject save = new SaveObject(jobplan);
uc4.sendRequestAndWait(save);
uc4.sendRequestAndWait(new CloseObject(jobplan));

Adding Tasks to Schedules

Tasks are added to Schedules in the same way that they are added to workflows. Only class names and methods are different.

OpenObject open = new OpenObject(new UC4ObjectName("JAPI_JSCH"));
uc4.sendRequestAndWait(open);


Schedule schedule = (Schedule) open.getUC4Object();

AddScheduleTask add1 = new AddScheduleTask(new UC4ObjectName("MM.DAY"));
uc4.sendRequestAndWait(add1);
AddScheduleTask add2 = new AddScheduleTask(new UC4ObjectName("MM.WEEK"));
uc4.sendRequestAndWait(add2);

ScheduleTask task1 = add1.getScheduleTask();
ScheduleTask task2 = add2.getScheduleTask();

task1.setStartTime(new Time("08:00"));
task2.setStartTime(new Time("10:30"));

UC4ObjectName cale = new UC4ObjectName("FIRM_CALENDAR");
UC4ObjectName calekey = new UC4ObjectName("WORKING_DAYS");
CalendarCondition calecond = new CalendarCondition(cale, calekey);
task1.calendar().addCalendarCondition(calecond);

schedule.addTask(task1);
schedule.addTask(task2);


SaveObject save = new SaveObject(schedule);
uc4.sendRequestAndWait(save);
uc4.sendRequestAndWait(new CloseObject(schedule));

See also:

Object Classes Classes for Activities Classes for Statistics and Reports Classes for the Administration Perspective