Package org.apache.sling.installer.api.tasks

# Class ChangeStateTask

java.lang.Object
org.apache.sling.installer.api.tasks.InstallTask
org.apache.sling.installer.api.tasks.ChangeStateTask

All Implemented Interfaces:
  `Comparable<InstallTask>`

public class ChangeStateTask extends InstallTask
Simple general task, setting the state of a registered resource.

Since:
  1.2

## Field Summary

### Fields inherited from class org.apache.sling.installer.api.tasks.InstallTask

`ASYNC_ATTR_NAME`

## Constructor Summary

Constructors
Constructor
Description
`ChangeStateTask(TaskResourceGroup r, ResourceState s)`
Change the state of the task
`ChangeStateTask(TaskResourceGroup r, ResourceState s, String error)`
Change the state of the task
`ChangeStateTask(TaskResourceGroup r, ResourceState s, Map<String,Object> addAttributes, String[] removeAttributes)`
Change the state of the task
`ChangeStateTask(TaskResourceGroup r, ResourceState s, Map<String,Object> addAttributes, String[] removeAttributes, String error)`
Change the state of the task

## Method Summary

Modifier and Type
Method
Description
`void`
`execute(InstallationContext ctx)`
This is the heart of the task - it performs the actual task.
`String`
`getSortKey()`
Tasks are sorted according to this key.

### Methods inherited from class org.apache.sling.installer.api.tasks.InstallTask

`compareTo, equals, getResource, getResourceGroup, hashCode, isAsynchronousTask, setFinishedState, setFinishedState, setFinishedState, toString`

### Methods inherited from class java.lang.Object

`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

## Constructor Details

### ChangeStateTask

public ChangeStateTask(TaskResourceGroup r, ResourceState s)
Change the state of the task

Parameters:
  `r` - The resource group to change.
  `s` - The new state.

### ChangeStateTask

public ChangeStateTask(TaskResourceGroup r, ResourceState s, String error)
Change the state of the task

Parameters:
  `r` - The resource group to change.
  `s` - The new state.
  `error` - An optional description on why the state is changed.
Since:
  1.4

### ChangeStateTask

public ChangeStateTask(TaskResourceGroup r, ResourceState s, Map<String,Object> addAttributes, String[] removeAttributes)
Change the state of the task

Parameters:
  `r` - The resource group to change.
  `s` - The new state.,
  `addAttributes` - An optional map of attributes to set before the state is changed.
  `removeAttributes` - A optional list of attributes to remove before the state is changed.
Since:
  1.3

### ChangeStateTask

public ChangeStateTask(TaskResourceGroup r, ResourceState s, Map<String,Object> addAttributes, String[] removeAttributes, String error)
Change the state of the task

Parameters:
  `r` - The resource group to change.
  `s` - The new state.,
  `addAttributes` - An optional map of attributes to set before the state is changed.
  `removeAttributes` - A optional list of attributes to remove before the state is changed.
  `error` - An optional description on why the state is changed.
Since:
  1.4

## Method Details

### execute

public void execute(InstallationContext ctx)
Description copied from class: `InstallTask`
This is the heart of the task - it performs the actual task.

Specified by:
  `execute` in class `InstallTask`
Parameters:
  `ctx` - The installation context.
See Also:
  - `InstallTask.execute(org.apache.sling.installer.api.tasks.InstallationContext)`

### getSortKey

public String getSortKey()
Description copied from class: `InstallTask`
Tasks are sorted according to this key. Therefore this key must uniquely identify this task. A typical sort key contains the entity id of the resource in execution.

Specified by:
  `getSortKey` in class `InstallTask`
Returns:
  The sorting key.