[Canonical page](<https://docs.dhtmlx.com/planning-engine/java/api/suggest/roster/>)
[Full documentation index](<https://docs.dhtmlx.com/planning-engine/llms.txt>)


# Roster

The skill-free view of a project's accepted state: its scheduled leaf tasks, its resources and its active assignments. Each list is in model order. [`Project#roster`](<https://docs.dhtmlx.com/planning-engine/java/api/project-roster.md>) returns a new instance, and [`SkillLayer.validatePool`](<https://docs.dhtmlx.com/planning-engine/java/api/skill-layer-slots.md#skilllayervalidatepool>) takes one. Use it to build your own [`Slot`](<https://docs.dhtmlx.com/planning-engine/java/api/suggest/slot.md>) list for [`Project#suggestAssignments`](<https://docs.dhtmlx.com/planning-engine/java/api/project-suggest-assignments.md>).

## Declaration

```java
public class Roster extends ValueRecord implements DeepCloneable<Roster>
```

## Constructors

### Roster()

```java
public Roster()
```

Creates a roster with three empty lists.

## Fields

| Field | Type | Default | Description |
|---|---|---|---|
| `tasks` | [`Vec<Id>`](<https://docs.dhtmlx.com/planning-engine/java/api/support/vec.md>) | empty | IDs of the scheduled leaf tasks. Summary tasks aren't listed. |
| `resources` | [`Vec<Id>`](<https://docs.dhtmlx.com/planning-engine/java/api/support/vec.md>) | empty | IDs of the resources. |
| `assignments` | [`Vec<RosterAssignment>`](<https://docs.dhtmlx.com/planning-engine/java/api/suggest/roster.md#rosterassignment>) | empty | The active assignments. |

Each ID is the [`Id`](<https://docs.dhtmlx.com/planning-engine/java/api/data/id.md>) value from the project's input data.

## Methods

### withTasks

```java
public Roster withTasks(Vec<Id> value)
public Roster withTasks(Collection<? extends Id> value)
```

Sets `tasks` and returns this instance for chaining. The `Collection` overload copies the items into a new `Vec`, so `List.of(...)` works. `null` stays `null`.

**Returns**: this `Roster`.

### withResources

```java
public Roster withResources(Vec<Id> value)
public Roster withResources(Collection<? extends Id> value)
```

Sets `resources` and returns this instance for chaining. The `Collection` overload copies the items into a new `Vec`. `null` stays `null`.

**Returns**: this `Roster`.

### withAssignments

```java
public Roster withAssignments(Vec<RosterAssignment> value)
public Roster withAssignments(Collection<? extends RosterAssignment> value)
```

Sets `assignments` and returns this instance for chaining. The `Collection` overload copies the items into a new `Vec`. `null` stays `null`.

**Returns**: this `Roster`.

### deepClone

```java
public Roster deepClone()
```

Returns a copy with new `tasks`, `resources` and `assignments` lists. Each `RosterAssignment` is cloned with its own `deepClone()`. `Id` values are immutable and are shared.

**Returns**: a new `Roster`.

### copy

```java
public Roster copy()
```

Returns a shallow copy. The copy and the original share the three lists.

**Returns**: a new `Roster`.

### equals, hashCode, toString

```java
public boolean equals(Object other)
public int hashCode()
public String toString()
```

Inherited from [`ValueRecord`](<https://docs.dhtmlx.com/planning-engine/java/api/support/value-record.md>). Two rosters are equal when all three fields are equal. `toString()` lists the fields, for logging.

## RosterAssignment

One active assignment in a [`Roster`](<https://docs.dhtmlx.com/planning-engine/java/api/suggest/roster.md#roster>): the assignment ID, its task and its resource.

```java
public class RosterAssignment extends ValueRecord implements DeepCloneable<RosterAssignment>
```

| Member | Type | Default | Description |
|---|---|---|---|
| `id` | [`Id`](<https://docs.dhtmlx.com/planning-engine/java/api/data/id.md>) | `null` | Assignment ID. |
| `task` | [`Id`](<https://docs.dhtmlx.com/planning-engine/java/api/data/id.md>) | `null` | ID of the assigned task. |
| `resource` | [`Id`](<https://docs.dhtmlx.com/planning-engine/java/api/data/id.md>) | `null` | ID of the booked resource. |
| `RosterAssignment()` | constructor | | Creates an instance with every field `null`. |
| `withId(Id)`, `withTask(Id)`, `withResource(Id)` | `RosterAssignment` | | Set the field and return this instance for chaining. |
| `deepClone()`, `copy()` | `RosterAssignment` | | Return a copy with the same field values. All fields are immutable `Id` values, so both copies are independent. |

`equals`, `hashCode` and `toString` are inherited from [`ValueRecord`](<https://docs.dhtmlx.com/planning-engine/java/api/support/value-record.md>) and compare or list all three fields.

## Example

```java
import java.util.List;
import org.dhtmlx.plen.*;

public class RosterExample {
  public static void main(String[] args) throws Exception {
    Moment monday = Moment.fromYmdHm(2026, 8, 10, 8, 0);
    ProjectData data = new ProjectData()
        .withTasks(List.of(
            new TaskData(Id.str("a")).withStartDate(monday).withDuration(2.0),
            new TaskData(Id.str("b")).withStartDate(monday).withDuration(2.0)))
        .withResources(List.of(
            new ResourceData().withId(Id.str("dev1")),
            new ResourceData().withId(Id.str("dev2"))))
        .withAssignments(List.of(
            new AssignmentData().withId(Id.str("x")).withTask(Id.str("a")).withResource(Id.str("dev1")).withValue(1.0)));

    Project project = new Project();
    project.solve(data, new SolveOptions());

    Roster roster = project.roster();
    System.out.println(roster.tasks.size() + " tasks, " + roster.resources.size() + " resources");
    for (RosterAssignment a : roster.assignments) {
      System.out.println(a.id + ": " + a.task + " -> " + a.resource);
    }
  }
}
```

## Related

- [`Project#roster`](<https://docs.dhtmlx.com/planning-engine/java/api/project-roster.md>) - the call that returns it
- [`Slot`](<https://docs.dhtmlx.com/planning-engine/java/api/suggest/slot.md>) - the slots you build from it
- [`SkillLayer.slots`](<https://docs.dhtmlx.com/planning-engine/java/api/skill-layer-slots.md>) - builds slots from skills instead
- [Skills and requirements](<https://docs.dhtmlx.com/planning-engine/java/resources-and-assignment/skills-and-requirements.md>) - building slots from a worker pool
