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


# LoadProfileOptions

Options for [`Project#loadProfile`](<https://docs.dhtmlx.com/planning-engine/java/api/project-load-profile.md>). They hold the [`ProfileQuery`](<https://docs.dhtmlx.com/planning-engine/java/api/resources/profile-query.md>) that selects the range, resources, basis and task lists of the [`LoadProfile`](<https://docs.dhtmlx.com/planning-engine/java/api/resources/load-profile.md>), and the baseline the call expects. Create one with `new LoadProfileOptions(query)`, then chain the fluent `withX` setters.

## Declaration

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

## Constructors

### LoadProfileOptions(ProfileQuery)

```java
public LoadProfileOptions(ProfileQuery query)
```

Creates options for the given query, with `baselineId` set to `null`.

**Parameters**

| Name | Type | Description |
|---|---|---|
| `query` | [`ProfileQuery`](<https://docs.dhtmlx.com/planning-engine/java/api/resources/profile-query.md>) | What the profile covers. Required |

## Fields

| Field | Type | Default | Description |
|---|---|---|---|
| `query` | [`ProfileQuery`](<https://docs.dhtmlx.com/planning-engine/java/api/resources/profile-query.md>) | set by the constructor | Range, resources, basis and task lists of the profile. |
| `baselineId` | `String` | `null` | The baseline the call expects. `null` skips the check. |

### query

```java
public ProfileQuery query = null;
```

The [`ProfileQuery`](<https://docs.dhtmlx.com/planning-engine/java/api/resources/profile-query.md>) that describes the profile: `from` and `to`, an optional resource list, an optional `basis`, and which task ids each bucket lists. It sets the shape of the returned [`LoadProfile`](<https://docs.dhtmlx.com/planning-engine/java/api/resources/load-profile.md>). The field must not be `null` when the options are passed to `Project#loadProfile`.

### baselineId

```java
public String baselineId = null;
```

A baseline token taken from the latest [`ScheduleResult.baselineId`](<https://docs.dhtmlx.com/planning-engine/java/api/results/schedule-result.md#baselineid>). When it isn't `null` and doesn't name the project's current baseline, `Project#loadProfile` throws a [`ProjectException`](<https://docs.dhtmlx.com/planning-engine/java/api/errors/project-exception.md>) with code `STALE_BASELINE`. This keeps a profile from being read over a baseline that changed after the caller last solved.

## Methods

### withQuery, withBaselineId

```java
public LoadProfileOptions withQuery(ProfileQuery value)
public LoadProfileOptions withBaselineId(String value)
```

Each setter assigns its field and returns this instance for chaining.

**Returns** - this `LoadProfileOptions`.

### deepClone

```java
public LoadProfileOptions deepClone()
```

Returns a copy with its own `ProfileQuery`.

**Returns** - a new `LoadProfileOptions` with the same values.

**Errors** - throws `NullPointerException` when `query` is `null`.

### copy

```java
public LoadProfileOptions copy()
```

Returns a shallow copy. The copy shares the `query` object with this instance.

**Returns** - a new `LoadProfileOptions` with the same field values.

### 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 `LoadProfileOptions` are equal when their public fields are equal. `toString()` lists the fields in the form `LoadProfileOptions{query=…, baselineId=…}`.

## Example

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

public class LoadProfileOptionsExample {
  public static void main(String[] args) throws Exception {
    ProjectData data = new ProjectData()
        .withTasks(List.of(
            new TaskData(Id.str("a")).withStartDate(Moment.fromYmdHm(2026, 1, 1, 0, 0)).withDuration(2.0)))
        .withResources(List.of(new ResourceData().withId(Id.str("dev"))))
        .withAssignments(List.of(
            new AssignmentData().withTask(Id.str("a")).withResource(Id.str("dev")).withValue(1.0)));
    data.config.useCalendars = false;

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

    ProfileQuery query = new ProfileQuery(Moment.fromYmdHm(2026, 1, 1, 0, 0), Moment.fromYmdHm(2026, 1, 4, 0, 0))
        .withResources(List.of(Id.str("dev")))
        .withTasks(ProfileTasks.ALL);
    LoadProfileOptions options = new LoadProfileOptions(query)
        .withBaselineId(solved.baselineId);

    LoadProfile profile = project.loadProfile(options);
    System.out.println(profile.resources.get(0).buckets.size()); // 3
  }
}
```

## Related

- [`Project#loadProfile`](<https://docs.dhtmlx.com/planning-engine/java/api/project-load-profile.md>) - the call that takes these options
- [`ProfileQuery`](<https://docs.dhtmlx.com/planning-engine/java/api/resources/profile-query.md>) - what the profile covers
- [`LoadProfile`](<https://docs.dhtmlx.com/planning-engine/java/api/resources/load-profile.md>) - what `loadProfile` returns
- [Resource load](<https://docs.dhtmlx.com/planning-engine/java/resources-and-assignment/resource-load.md#pinning-the-profile-to-a-baseline>) - pinning the profile to a baseline
