diff --git a/README.md b/README.md index 8a24e41..3298e55 100644 --- a/README.md +++ b/README.md @@ -116,25 +116,32 @@ for OCPI 2.1.1 to OCPI 2.2 -> OCPI 2.2.1 Functional Modules: - Module | v2023.8.24 | Description + + + Module | v2023.8.24 | Description | -------------------|----|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| - [Locations](https://github.com/ocpi/ocpi/blob/2.2.1/mod_locations.asciidoc) | + | The Location objects live in the CPO back-end system. They describe the charging locations of an operator | - [Sessions](https://github.com/ocpi/ocpi/blob/2.2.1/mod_sessions.asciidoc) | + | The Session object describes one charging session. The Session object is owned by the CPO back-end system, and can be GET from the CPO system, or pushed by the CPO to another system | - [CDRs](https://github.com/ocpi/ocpi/blob/2.2.1/mod_cdrs.asciidoc) | + | A Charge Detail Record is the description of a concluded charging session. The CDR is the only billing-relevant object. CDRs are sent from the CPO to the eMSP after the charging session has ended | - [Tariffs](https://github.com/ocpi/ocpi/blob/2.2.1/mod_tariffs.asciidoc) | + | The Tariffs module gives eMSPs information about the tariffs used by the CPO | - [Tokens](https://github.com/ocpi/ocpi/blob/2.2.1/mod_tokens.asciidoc) | + | The tokens module gives CPOs knowledge of the token information of an eMSP. eMSPs can push Token information to CPOs, CPOs can build a cache of known Tokens. When a request to authorize comes from a Charge Point, the CPO can check against this cache. With this cached information they know to which eMSP they can later send a CDR | - [Commands](https://github.com/ocpi/ocpi/blob/2.2.1/mod_commands.asciidoc) | + | The Commands module enables remote commands to be sent to a Location/EVSE. The following commands are supported: CANCEL_RESERVATION, RESERVE_NOW, START_SESSION , STOP_SESSION, UNLOCK_CONNECTOR | - [Charging Profiles](https://github.com/ocpi/ocpi/blob/2.2.1/mod_charging_profiles.asciidoc)| + | With the ChargingProfiles module, parties (SCSP but also MSPs) can send (Smart) Charging Profiles to a Location/EVSE. It is also possible to request the 'ActiveChargingProfile' from a Location/EVSE | - [Hub Client Info](https://github.com/ocpi/ocpi/blob/2.2.1/mod_hub_client_info.asciidoc) | + | Provides parties connected to a hub with the connection status of other parties that are connected to a hub that they can communicate with. So, CPOs know which eMSP and other parties are online and vice versa | + [Locations](https://github.com/ocpi/ocpi/blob/2.2.1/mod_locations.asciidoc) |

+

| The Location objects live in the CPO back-end system. They describe the charging locations of an operator | + [Sessions](https://github.com/ocpi/ocpi/blob/2.2.1/mod_sessions.asciidoc) |

+

| The Session object describes one charging session. The Session object is owned by the CPO back-end system, and can be GET from the CPO system, or pushed by the CPO to another system | + [CDRs](https://github.com/ocpi/ocpi/blob/2.2.1/mod_cdrs.asciidoc) |

+

| A Charge Detail Record is the description of a concluded charging session. The CDR is the only billing-relevant object. CDRs are sent from the CPO to the eMSP after the charging session has ended | + [Tariffs](https://github.com/ocpi/ocpi/blob/2.2.1/mod_tariffs.asciidoc) |

+

| The Tariffs module gives eMSPs information about the tariffs used by the CPO | + [Tokens](https://github.com/ocpi/ocpi/blob/2.2.1/mod_tokens.asciidoc) |

+

| The tokens module gives CPOs knowledge of the token information of an eMSP. eMSPs can push Token information to CPOs, CPOs can build a cache of known Tokens. When a request to authorize comes from a Charge Point, the CPO can check against this cache. With this cached information they know to which eMSP they can later send a CDR | + [Commands](https://github.com/ocpi/ocpi/blob/2.2.1/mod_commands.asciidoc) |

+

| The Commands module enables remote commands to be sent to a Location/EVSE. The following commands are supported: CANCEL_RESERVATION, RESERVE_NOW, START_SESSION , STOP_SESSION, UNLOCK_CONNECTOR | + [Charging Profiles](https://github.com/ocpi/ocpi/blob/2.2.1/mod_charging_profiles.asciidoc)|

+

| With the ChargingProfiles module, parties (SCSP but also MSPs) can send (Smart) Charging Profiles to a Location/EVSE. It is also possible to request the 'ActiveChargingProfile' from a Location/EVSE | + [Hub Client Info](https://github.com/ocpi/ocpi/blob/2.2.1/mod_hub_client_info.asciidoc) |

+

| Provides parties connected to a hub with the connection status of other parties that are connected to a hub that they can communicate with. So, CPOs know which eMSP and other parties are online and vice versa | Configuration Modules: -Module | v2023.8.24 | Description ------------- |-----------|-------------------------------------------------------------------------------------------------------------------------------------- -[Credentials](https://github.com/ocpi/ocpi/blob/2.2.1/credentials.asciidoc)| + | The credentials module is used to exchange the credentials token that has to be used by parties for authorization of requests | -[Versions](https://github.com/ocpi/ocpi/blob/2.2.1/version_information_endpoint.asciidoc) | + | Via this module, clients can learn which versions of OCPI a server supports, and which modules it supports for each of the versions | +Module | v2023.8.24 | Description | +------------ |-----------|--------------------------------------------------------------------------------------------------------------------------------------| +[Credentials](https://github.com/ocpi/ocpi/blob/2.2.1/credentials.asciidoc)|

+

| The credentials module is used to exchange the credentials token that has to be used by parties for authorization of requests | +[Versions](https://github.com/ocpi/ocpi/blob/2.2.1/version_information_endpoint.asciidoc) |

+

| Via this module, clients can learn which versions of OCPI a server supports, and which modules it supports for each of the versions | + +Roadmap: -Plans for next releases is to enrich Credentials with OCPI Registration process +Functionality | Q7 2023 | +------------ |------------------------------| +[Authentification](https://github.com/ocpi/ocpi/blob/2.2.1/credentials.asciidoc)| +[Authorization](https://github.com/ocpi/ocpi/blob/master/transport_and_format.asciidoc#transport_and_format_authorization_header) | License ======= diff --git a/pom.xml b/pom.xml index 96b4c75..842e553 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ com.extrawest Extrawest-OCPI-2.2.1-CPO-Server - 2023.8.27 + 2023.9.6 Extrawest-OCPI-2.2.1-CPO-Server Extrawest-OCPI-2.2.1-CPO-Server diff --git a/src/main/java/com/extrawest/ocpi/controller/CPOCredentialsController.java b/src/main/java/com/extrawest/ocpi/controller/CPOCredentialsController.java index 1c9d272..ab65408 100644 --- a/src/main/java/com/extrawest/ocpi/controller/CPOCredentialsController.java +++ b/src/main/java/com/extrawest/ocpi/controller/CPOCredentialsController.java @@ -27,7 +27,7 @@ protected CPOCredentialsController(@Autowired CPOCredentialsService cpoCredentia @GetMapping public ResponseEntity getCredentials() { return ResponseEntity.ok(cpoCredentialsService.getCredentials()); - }; + } /** * Provides the server with a credentials object to access the client’s system (i.e. register). @@ -36,7 +36,7 @@ public ResponseEntity getCredentials() { @PostMapping public void postCredentials(@RequestBody @Valid CredentialsDTO credentialsDTO) { cpoCredentialsService.postCredentials(credentialsDTO); - }; + } /** * Provides the server with an updated credentials object to access the client’s system. @@ -45,7 +45,7 @@ public void postCredentials(@RequestBody @Valid CredentialsDTO credentialsDTO) { @PutMapping public void putCredentials(@RequestBody @Valid CredentialsDTO credentialsDTO) { cpoCredentialsService.putCredentials(credentialsDTO); - }; + } /** * Informs the server that its credentials to the client’s system are now invalid (i.e. unregister). @@ -54,5 +54,5 @@ public void putCredentials(@RequestBody @Valid CredentialsDTO credentialsDTO) { @DeleteMapping public void deleteCredentials(@RequestBody @Valid CredentialsDTO credentialsDTO) { cpoCredentialsService.deleteCredentials(credentialsDTO); - }; + } } diff --git a/src/main/java/com/extrawest/ocpi/controller/CPOVersionController.java b/src/main/java/com/extrawest/ocpi/controller/CPOVersionController.java index 9c43379..bfca1bb 100644 --- a/src/main/java/com/extrawest/ocpi/controller/CPOVersionController.java +++ b/src/main/java/com/extrawest/ocpi/controller/CPOVersionController.java @@ -15,7 +15,7 @@ import java.util.List; @RestController -@RequestMapping("/cpo/api/2.2.1/versions") +@RequestMapping("/cpo/api/versions") @Tag(name = "CPOVersion") public class CPOVersionController { @@ -32,7 +32,7 @@ protected CPOVersionController(@Autowired CPOVersionService cpoVersionService) { @GetMapping public ResponseEntity> getVersion() { return ResponseEntity.ok(cpoVersionService.getVersion()); - }; + } /** * Via the version details, the parties can exchange which modules are implemented for a specific version of OCPI, @@ -45,5 +45,5 @@ public ResponseEntity getVersionDetails( @PathVariable(value = "version") VersionNumber version ) { return ResponseEntity.ok(cpoVersionService.getVersionDetails(version)); - }; + } } diff --git a/src/main/java/com/extrawest/ocpi/model/dto/CredentialsDTO.java b/src/main/java/com/extrawest/ocpi/model/dto/CredentialsDTO.java index e8184ef..a7d6603 100644 --- a/src/main/java/com/extrawest/ocpi/model/dto/CredentialsDTO.java +++ b/src/main/java/com/extrawest/ocpi/model/dto/CredentialsDTO.java @@ -2,6 +2,7 @@ import com.extrawest.ocpi.model.vo.CredentialsRole; import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotEmpty; import jakarta.validation.constraints.Size; import lombok.AllArgsConstructor; import lombok.Data; @@ -19,6 +20,6 @@ public class CredentialsDTO { @NotBlank @Size(max = 255) private String url; - @NotBlank + @NotEmpty private List roles; } diff --git a/src/main/java/com/extrawest/ocpi/model/dto/TariffDTO.java b/src/main/java/com/extrawest/ocpi/model/dto/TariffDTO.java index 1d716c1..c8b45f8 100644 --- a/src/main/java/com/extrawest/ocpi/model/dto/TariffDTO.java +++ b/src/main/java/com/extrawest/ocpi/model/dto/TariffDTO.java @@ -7,9 +7,7 @@ import com.extrawest.ocpi.model.vo.TariffElement; import com.extrawest.ocpi.util.Constants; import com.fasterxml.jackson.annotation.JsonProperty; -import jakarta.validation.constraints.NotBlank; -import jakarta.validation.constraints.Pattern; -import jakarta.validation.constraints.Size; +import jakarta.validation.constraints.*; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; @@ -47,7 +45,7 @@ public class TariffDTO { private Price minPrice; @JsonProperty("max_price") private Price maxPrice; - @NotBlank + @NotEmpty private List elements; @JsonProperty("start_date_time") private LocalDateTime startDateTime; @@ -55,7 +53,7 @@ public class TariffDTO { private LocalDateTime endDateTime; @JsonProperty("energy_mix") private EnergyMix energyMix; - @NotBlank + @NotNull @JsonProperty("last_updated") private LocalDateTime lastUpdated; } diff --git a/src/main/java/com/extrawest/ocpi/util/Constants.java b/src/main/java/com/extrawest/ocpi/util/Constants.java index 619b4e4..42c4679 100644 --- a/src/main/java/com/extrawest/ocpi/util/Constants.java +++ b/src/main/java/com/extrawest/ocpi/util/Constants.java @@ -2,7 +2,9 @@ public final class Constants { - public static final String ASCII_REGEXP = "/[:ascii:]/i"; + /* Case Insensitive String. Only printable ASCII allowed. (Non-printable characters like: Carriage returns, + Tabs, Line breaks, etc are not allowed)*/ + public static final String ASCII_REGEXP = "(?i)\\p{Print}+"; private Constants() { }