Skip to content
Draft
Show file tree
Hide file tree
Changes from 12 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions rao-runner-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@
<artifactId>junit-jupiter</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<scope>test</scope>
</dependency>
Comment thread
coderabbitai[bot] marked this conversation as resolved.
</dependencies>

</project>
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
import com.farao_community.farao.rao_runner.api.resource.RaoFailureResponse;
import com.farao_community.farao.rao_runner.api.resource.RaoRequest;
import com.farao_community.farao.rao_runner.api.resource.RaoSuccessResponse;
import com.farao_community.farao.rao_runner.api.resource.TimeCoupledRaoRequest;
import com.farao_community.farao.rao_runner.api.resource.TimeCoupledRaoSuccessResponse;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.datatype.jdk8.Jdk8Module;
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
Expand Down Expand Up @@ -54,7 +56,12 @@ public <T> byte[] toJsonMessage(T jsonApiObject) {
}

private ResourceConverter createConverter() {
ResourceConverter converter = new ResourceConverter(objectMapper, RaoRequest.class, RaoSuccessResponse.class, RaoFailureResponse.class);
ResourceConverter converter = new ResourceConverter(
objectMapper,
RaoRequest.class, RaoSuccessResponse.class,
TimeCoupledRaoRequest.class, TimeCoupledRaoSuccessResponse.class,
RaoFailureResponse.class
);
converter.disableSerializationOption(SerializationFeature.INCLUDE_META);
return converter;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/*
* Copyright (c) 2026, RTE (http://www.rte-france.com)
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
package com.farao_community.farao.rao_runner.api;

/**
* @author Vincent Bochet {@literal <vincent.bochet at rte-france.com>}
*/
public final class RaoRunnerConstants {
private RaoRunnerConstants() {

}

public static final String TIME_COUPLED_ROUTING_KEY = "TIME-COUPLED";
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
/*
* Copyright (c) 2026, RTE (http://www.rte-france.com)
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
package com.farao_community.farao.rao_runner.api.resource;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.github.jasminb.jsonapi.annotations.Id;

import java.time.Instant;
import java.util.Optional;

/**
* @author Vincent Bochet {@literal <vincent.bochet at rte-france.com>}
*/
@JsonDeserialize(builder = AbstractRaoRequest.AbstractRaoRequestBuilder.class)
public abstract class AbstractRaoRequest {

@Id
private final String id;
private final String runId;
private final String raoParametersFileUrl;
private final String resultsDestination;
private final Instant targetEndInstant;
private final String eventPrefix;

protected AbstractRaoRequest(AbstractRaoRequestBuilder builder) {
this.id = builder.id;
this.runId = builder.runId;
this.raoParametersFileUrl = builder.raoParametersFileUrl;
this.resultsDestination = builder.resultsDestination;
this.targetEndInstant = builder.targetEndInstant;
this.eventPrefix = builder.eventPrefix;
}

public abstract static class AbstractRaoRequestBuilder<T extends AbstractRaoRequestBuilder> {
private String id;
private String runId;
private String raoParametersFileUrl;
private String resultsDestination;
private Instant targetEndInstant;
private String eventPrefix;

@JsonProperty("id")
public T withId(String id) {
this.id = id;
return (T) this;
}

@JsonProperty("runId")
public T withRunId(String runId) {
this.runId = runId;
return (T) this;
}

@JsonProperty("raoParametersFileUrl")
public T withRaoParametersFileUrl(String raoParametersFileUrl) {
this.raoParametersFileUrl = raoParametersFileUrl;
return (T) this;
}

@JsonProperty("resultsDestination")
public T withResultsDestination(String resultsDestination) {
this.resultsDestination = resultsDestination;
return (T) this;
}

@JsonProperty("targetEndInstant")
public T withTargetEndInstant(Instant targetEndInstant) {
this.targetEndInstant = targetEndInstant;
return (T) this;
}

@JsonProperty("eventPrefix")
public T withEventPrefix(String eventPrefix) {
this.eventPrefix = eventPrefix;
return (T) this;
}
}

public String getId() {
return id;
}

public String getRunId() {
return runId;
}

public String getRaoParametersFileUrl() {
return raoParametersFileUrl;
}

public Optional<String> getResultsDestination() {
return Optional.ofNullable(resultsDestination);
}

public Optional<Instant> getTargetEndInstant() {
return Optional.ofNullable(targetEndInstant);
}

public Optional<String> getEventPrefix() {
return Optional.ofNullable(eventPrefix);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,74 +9,42 @@
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.github.jasminb.jsonapi.annotations.Id;
import com.github.jasminb.jsonapi.annotations.Type;
import org.apache.commons.lang3.builder.ToStringBuilder;

import java.time.Instant;
import java.util.Optional;

/**
* @author Mohamed BenRejeb {@literal <mohamed.ben-rejeb at rte-france.com>}
*/
@Type("rao-request")
@JsonDeserialize(builder = RaoRequest.RaoRequestBuilder.class)
public final class RaoRequest {
public final class RaoRequest extends AbstractRaoRequest {

@Id
private final String id;
private final String runId;
private final String instant;
private final String networkFileUrl;
private final String cracFileUrl;
private final String refprogFileUrl;
private final String realGlskFileUrl;
private final String raoParametersFileUrl;
private final String virtualhubsFileUrl;
private final String resultsDestination;
private final Instant targetEndInstant;
private final String eventPrefix;

private RaoRequest(RaoRequestBuilder builder) {
this.id = builder.id;
this.runId = builder.runId;
super(builder);
this.instant = builder.instant;
this.networkFileUrl = builder.networkFileUrl;
this.cracFileUrl = builder.cracFileUrl;
this.refprogFileUrl = builder.refprogFileUrl;
this.realGlskFileUrl = builder.realGlskFileUrl;
this.raoParametersFileUrl = builder.raoParametersFileUrl;
this.virtualhubsFileUrl = builder.virtualhubsFileUrl;
this.resultsDestination = builder.resultsDestination;
this.targetEndInstant = builder.targetEndInstant;
this.eventPrefix = builder.eventPrefix;
}

public static class RaoRequestBuilder {
private String id;
private String runId;
public static class RaoRequestBuilder extends AbstractRaoRequestBuilder<RaoRequestBuilder> {
private String instant;
private String networkFileUrl;
private String cracFileUrl;
private String refprogFileUrl;
private String realGlskFileUrl;
private String raoParametersFileUrl;
private String virtualhubsFileUrl;
private String resultsDestination;
private Instant targetEndInstant;
private String eventPrefix;

@JsonProperty("id")
public RaoRequestBuilder withId(String id) {
this.id = id;
return this;
}

@JsonProperty("runId")
public RaoRequestBuilder withRunId(String runId) {
this.runId = runId;
return this;
}

@JsonProperty("instant")
public RaoRequestBuilder withInstant(String instant) {
Expand Down Expand Up @@ -108,50 +76,18 @@ public RaoRequestBuilder withRealGlskFileUrl(String realGlskFileUrl) {
return this;
}

@JsonProperty("raoParametersFileUrl")
public RaoRequestBuilder withRaoParametersFileUrl(String raoParametersFileUrl) {
this.raoParametersFileUrl = raoParametersFileUrl;
return this;
}

@JsonProperty("virtualhubsFileUrl")
public RaoRequestBuilder withVirtualhubsFileUrl(String virtualhubsFileUrl) {
this.virtualhubsFileUrl = virtualhubsFileUrl;
return this;
}

@JsonProperty("resultsDestination")
public RaoRequestBuilder withResultsDestination(String resultsDestination) {
this.resultsDestination = resultsDestination;
return this;
}

@JsonProperty("targetEndInstant")
public RaoRequestBuilder withTargetEndInstant(Instant targetEndInstant) {
this.targetEndInstant = targetEndInstant;
return this;
}

@JsonProperty("eventPrefix")
public RaoRequestBuilder withEventPrefix(String eventPrefix) {
this.eventPrefix = eventPrefix;
return this;
}

@JsonCreator
public RaoRequest build() {
return new RaoRequest(this);
}
}

public String getId() {
return id;
}

public String getRunId() {
return runId;
}

public Optional<String> getInstant() {
return Optional.ofNullable(instant);
}
Expand All @@ -172,26 +108,10 @@ public Optional<String> getRealGlskFileUrl() {
return Optional.ofNullable(realGlskFileUrl);
}

public String getRaoParametersFileUrl() {
return raoParametersFileUrl;
}

public Optional<String> getVirtualhubsFileUrl() {
return Optional.ofNullable(virtualhubsFileUrl);
}

public Optional<String> getResultsDestination() {
return Optional.ofNullable(resultsDestination);
}

public Optional<Instant> getTargetEndInstant() {
return Optional.ofNullable(targetEndInstant);
}

public Optional<String> getEventPrefix() {
return Optional.ofNullable(eventPrefix);
}

@Override
public String toString() {
return ToStringBuilder.reflectionToString(this);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
/*
* Copyright (c) 2026, RTE (http://www.rte-france.com)
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
package com.farao_community.farao.rao_runner.api.resource;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.github.jasminb.jsonapi.annotations.Type;
import org.apache.commons.lang3.builder.ToStringBuilder;

import java.util.List;

/**
* @author Vincent Bochet {@literal <vincent.bochet at rte-france.com>}
*/
@Type("time-coupled-rao-request")
@JsonDeserialize(builder = TimeCoupledRaoRequest.RaoRequestBuilder.class)
public final class TimeCoupledRaoRequest extends AbstractRaoRequest {

private final String icsFileUrl;
private final List<TimedInput> timedInputs;

private TimeCoupledRaoRequest(RaoRequestBuilder builder) {
super(builder);
this.icsFileUrl = builder.icsFileUrl;
this.timedInputs = builder.timedInputs;
}

public static class RaoRequestBuilder extends AbstractRaoRequestBuilder<RaoRequestBuilder> {
private String icsFileUrl;
private List<TimedInput> timedInputs;

@JsonProperty("icsFileUrl")
public RaoRequestBuilder withIcsFileUrl(String icsFileUrl) {
this.icsFileUrl = icsFileUrl;
return this;
}

@JsonProperty("timedInputs")
public RaoRequestBuilder withTimedInputs(List<TimedInput> timedInputs) {
this.timedInputs = timedInputs;
return this;
}

@JsonCreator
public TimeCoupledRaoRequest build() {
return new TimeCoupledRaoRequest(this);
}
}

public String getIcsFileUrl() {
return icsFileUrl;
}

public List<TimedInput> getTimedInputs() {
return timedInputs;
}

@Override
public String toString() {
return ToStringBuilder.reflectionToString(this);
}
}
Loading
Loading