Class ChoreService

java.lang.Object
io.skipcheck.tm1.client.service.process.ChoreService

public final class ChoreService extends Object
Chores: scheduled runs of processes, as ordered tasks. /Chores, their tasks, and running them now.

A task binds a process (ChoreTaskPatch.Builder#bindProcess) and gives each of its parameters a value; its Step, its place in the chore, is TM1's to number.

Create a daily chore with one task:

// A daily chore at 02:00 UTC, inactive until it's switched on. A task gives
// every parameter of its process a value.
ChoreTaskPatch loadActuals = ChoreTaskPatch.builder()
	.bindProcess(ODataPath.of("Processes").key("Load Sales"))
	.parameters(List.of(ChoreTaskParameterPatch.builder().name("pVersion").value("Actual").build(),
			ChoreTaskParameterPatch.builder().name("pYear").value(2026).build()))
	.build();
return tm1.chores()
	.create(ChorePatch.builder()
		.name("Nightly Load")
		.startTime(OffsetDateTime.parse("2026-01-01T02:00:00Z"))
		.dstSensitive(false)
		.frequency(Duration.ofDays(1))
		.executionMode(ChoreExecutionMode.SINGLE_COMMIT)
		.active(false)
		.tasks(List.of(loadActuals))
		.build());

Add a task at the end, and get the step TM1 gave it:

// A task goes at the end; TM1 numbers the steps from 0
ChoreTaskPatch loadForecast = ChoreTaskPatch.builder()
	.bindProcess(ODataPath.of("Processes").key("Load Sales"))
	.parameters(List.of(ChoreTaskParameterPatch.builder().name("pVersion").value("Forecast").build(),
			ChoreTaskParameterPatch.builder().name("pYear").value(2026).build()))
	.build();
return tm1.chores().addTask("Nightly Load", loadForecast).mapNotNull(ChoreTask::step);

Schedule the chore, by patching Active:

// Scheduling a chore is a patch of Active
return tm1.chores().update("Nightly Load", ChorePatch.builder().active(true).build());
  • Constructor Details

    • ChoreService

      public ChoreService(Tm1Session session)
      A service sending its requests through session.
      Parameters:
      session - the session
  • Method Details

    • list

      @Tm1Endpoint("EntitySet Chores") public reactor.core.publisher.Flux<Chore> list(ODataQuery query)
      GET Chores, streamed.
      Parameters:
      query - what to select, expand, filter and order
      Returns:
      the chores
    • get

      @Tm1Endpoint("EntitySet Chores") public reactor.core.publisher.Mono<Chore> get(String name, ODataQuery query)
      GET Chores('name').
      Parameters:
      name - the chore's name
      query - what to select and expand, such as Tasks($expand=Process)
      Returns:
      the chore, or a Tm1NotFoundException if there's none
    • create

      @Tm1Endpoint("EntitySet Chores") public reactor.core.publisher.Mono<Chore> create(ChorePatch chore)
      POST Chores: creates a chore, with its tasks if the patch has them.
      Parameters:
      chore - the new chore; it needs a name, start time, frequency and execution mode
      Returns:
      the chore as created
    • update

      @Tm1Endpoint("EntitySet Chores") public reactor.core.publisher.Mono<Void> update(String name, ChorePatch patch)
      PATCH Chores('name'): changes the properties the patch sets, Active included, which IBM recommends over the deprecated activate(String). Adding, changing or removing a task changes the chore's ETag too.
      Parameters:
      name - the chore's name
      patch - the changes
      Returns:
      completes when the chore is changed
    • update

      @Tm1Endpoint("EntitySet Chores") public reactor.core.publisher.Mono<Void> update(String name, ChorePatch patch, String etag)
      PATCH Chores('name') with If-Match.
      Parameters:
      name - the chore's name
      patch - the changes
      etag - the ETag the chore was read with (Chore.etag())
      Returns:
      completes when the chore is changed, or a Tm1PreconditionFailedException if it had changed
    • delete

      @Tm1Endpoint("EntitySet Chores") public reactor.core.publisher.Mono<Void> delete(String name)
      DELETE Chores('name'); its processes stay.
      Parameters:
      name - the chore's name
      Returns:
      completes when the chore is deleted
    • tasks

      @Tm1Endpoint("Navigation Chore/Tasks") public reactor.core.publisher.Flux<ChoreTask> tasks(String name, ODataQuery query)
      GET Chores('name')/Tasks, streamed, in step order.
      Parameters:
      name - the chore's name
      query - what to select and expand, such as Process
      Returns:
      the tasks
    • addTask

      @Tm1Endpoint("Navigation Chore/Tasks") public reactor.core.publisher.Mono<ChoreTask> addTask(String name, ChoreTaskPatch task)
      POST Chores('name')/Tasks: adds a task at the end.
      Parameters:
      name - the chore's name
      task - the task: its bound process and a value for each of the process's parameters
      Returns:
      the task as created, with the Step TM1 gave it
    • updateTask

      @Tm1Endpoint("Navigation Chore/Tasks") public reactor.core.publisher.Mono<Void> updateTask(String name, long step, ChoreTaskPatch patch)
      PATCH Chores('name')/Tasks(step): changes a task, such as its parameter values.
      Parameters:
      name - the chore's name
      step - the task's step
      patch - the changes
      Returns:
      completes when the task is changed
    • deleteTask

      @Tm1Endpoint("Navigation Chore/Tasks") public reactor.core.publisher.Mono<Void> deleteTask(String name, long step)
      DELETE Chores('name')/Tasks(step).
      Parameters:
      name - the chore's name
      step - the task's step
      Returns:
      completes when the task is removed
    • taskProcess

      @Tm1Endpoint("Navigation ChoreTask/Process") public reactor.core.publisher.Mono<Process> taskProcess(String name, long step, ODataQuery query)
      GET Chores('name')/Tasks(step)/Process.
      Parameters:
      name - the chore's name
      step - the task's step
      query - what to select
      Returns:
      the process the task runs
    • taskChore

      @Tm1Endpoint("Navigation ChoreTask/Chore") public reactor.core.publisher.Mono<Chore> taskChore(String name, long step, ODataQuery query)
      GET Chores('name')/Tasks(step)/Chore.
      Parameters:
      name - the chore's name
      step - the task's step
      query - what to select
      Returns:
      the task's chore
    • execute

      @Tm1Endpoint("Action Chore/Execute") public reactor.core.publisher.Mono<Void> execute(String name)
      tm1.Execute: runs the chore now, whether or not it's active, and completes when its tasks have run. Needs schema 10.2.2.2.
      Parameters:
      name - the chore's name
      Returns:
      completes when the chore has run
    • activate

      @Deprecated(since="11.8.3") @Tm1Endpoint("Action Chore/Activate") public reactor.core.publisher.Mono<Void> activate(String name)
      Deprecated.
      Deprecated in TM1 schema 11.8.3: patch Active with update(String, ChorePatch).
      tm1.Activate: schedules the chore.
      Parameters:
      name - the chore's name
      Returns:
      completes when it's active
    • deactivate

      @Deprecated(since="11.8.3") @Tm1Endpoint("Action Chore/Deactivate") public reactor.core.publisher.Mono<Void> deactivate(String name)
      Deprecated.
      Deprecated in TM1 schema 11.8.3: patch Active with update(String, ChorePatch).
      tm1.Deactivate: unschedules the chore.
      Parameters:
      name - the chore's name
      Returns:
      completes when it's inactive
    • setServerLocalStartTime

      @Deprecated(since="11.8.3") @Tm1Endpoint("Action Chore/SetServerLocalStartTime") public reactor.core.publisher.Mono<Void> setServerLocalStartTime(String name, LocalDate date, LocalTime time)
      Deprecated.
      Deprecated in TM1 schema 11.8.3: patch StartTime with update(String, ChorePatch).
      tm1.SetServerLocalStartTime: sets the chore's start in the server's time zone. TM1 (11.8) refuses it while the chore is active ("Can't duplicate active chore", code 7): deactivate it first.
      Parameters:
      name - the chore's name
      date - the start date
      time - the start time of day
      Returns:
      completes when it's set