Skip to content

Commit

Permalink
Updated readme, changed model constraints
Browse files Browse the repository at this point in the history
  • Loading branch information
klymenko-galyna-ew committed Sep 7, 2023
1 parent dfd5d32 commit 5bcc3d6
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 29 deletions.
35 changes: 21 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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) | <p style='color:green'>+</p> | 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) | <p style='color:green'>+</p> | 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) | <p style='color:green'>+</p> | 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) | <p style='color:green'>+</p> | 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) | <p style='color:green'>+</p> | 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) | <p style='color:green'>+</p> | 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)| <p style='color:green'>+</p> | 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) | <p style='color:green'>+</p> | 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)| <p style='color:green'>+</p> | 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) | <p style='color:green'>+</p> | 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
=======
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<groupId>com.extrawest</groupId>
<artifactId>Extrawest-OCPI-2.2.1-CPO-Server</artifactId>
<version>2023.8.27</version>
<version>2023.9.6</version>

<name>Extrawest-OCPI-2.2.1-CPO-Server</name>
<description>Extrawest-OCPI-2.2.1-CPO-Server</description>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ protected CPOCredentialsController(@Autowired CPOCredentialsService cpoCredentia
@GetMapping
public ResponseEntity<CredentialsDTO> getCredentials() {
return ResponseEntity.ok(cpoCredentialsService.getCredentials());
};
}

/**
* Provides the server with a credentials object to access the client’s system (i.e. register).
Expand All @@ -36,7 +36,7 @@ public ResponseEntity<CredentialsDTO> 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.
Expand All @@ -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).
Expand All @@ -54,5 +54,5 @@ public void putCredentials(@RequestBody @Valid CredentialsDTO credentialsDTO) {
@DeleteMapping
public void deleteCredentials(@RequestBody @Valid CredentialsDTO credentialsDTO) {
cpoCredentialsService.deleteCredentials(credentialsDTO);
};
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand All @@ -32,7 +32,7 @@ protected CPOVersionController(@Autowired CPOVersionService cpoVersionService) {
@GetMapping
public ResponseEntity<List<VersionResponseDTO>> getVersion() {
return ResponseEntity.ok(cpoVersionService.getVersion());
};
}

/**
* Via the version details, the parties can exchange which modules are implemented for a specific version of OCPI,
Expand All @@ -45,5 +45,5 @@ public ResponseEntity<VersionDetailsResponseDTO> getVersionDetails(
@PathVariable(value = "version") VersionNumber version
) {
return ResponseEntity.ok(cpoVersionService.getVersionDetails(version));
};
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -19,6 +20,6 @@ public class CredentialsDTO {
@NotBlank
@Size(max = 255)
private String url;
@NotBlank
@NotEmpty
private List<CredentialsRole> roles;
}
8 changes: 3 additions & 5 deletions src/main/java/com/extrawest/ocpi/model/dto/TariffDTO.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -47,15 +45,15 @@ public class TariffDTO {
private Price minPrice;
@JsonProperty("max_price")
private Price maxPrice;
@NotBlank
@NotEmpty
private List<TariffElement> elements;
@JsonProperty("start_date_time")
private LocalDateTime startDateTime;
@JsonProperty("end_date_time")
private LocalDateTime endDateTime;
@JsonProperty("energy_mix")
private EnergyMix energyMix;
@NotBlank
@NotNull
@JsonProperty("last_updated")
private LocalDateTime lastUpdated;
}
4 changes: 3 additions & 1 deletion src/main/java/com/extrawest/ocpi/util/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
}
Expand Down

0 comments on commit 5bcc3d6

Please sign in to comment.