Skip to content
Closed
Show file tree
Hide file tree
Changes from all 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
67 changes: 12 additions & 55 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -375,57 +375,14 @@
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>com.google.code.maven-replacer-plugin</groupId>
<artifactId>replacer</artifactId>
<version>1.5.3</version>
<executions>
<execution>
<id>add-request-interface</id>
<phase>generate-resources</phase>
<goals>
<goal>replace</goal>
</goals>
<configuration>
<filesToInclude>${basedir}/src/main/resources/OCPP-2.0.1_part3_JSON_schemas/*Request.json</filesToInclude>
<preserveDir>false</preserveDir>
<outputDir>${project.build.directory}/generated-resources</outputDir>
<replacements>
<replacement>
<token>"definitions"</token>
<value>"javaInterfaces" : ["de.rwth.idsg.ocpp.jaxb.RequestType"],
"definitions"</value>
</replacement>
</replacements>
</configuration>
</execution>
<execution>
<id>add-response-interface</id>
<phase>generate-resources</phase>
<goals>
<goal>replace</goal>
</goals>
<configuration>
<filesToInclude>${basedir}/src/main/resources/OCPP-2.0.1_part3_JSON_schemas/*Response.json</filesToInclude>
<preserveDir>false</preserveDir>
<outputDir>${project.build.directory}/generated-resources</outputDir>
<replacements>
<replacement>
<token>"definitions"</token>
<value>"javaInterfaces" : ["de.rwth.idsg.ocpp.jaxb.ResponseType"],
"definitions"</value>
</replacement>
</replacements>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.jsonschema2pojo</groupId>
<artifactId>jsonschema2pojo-maven-plugin</artifactId>
<version>1.2.1</version>
<configuration>
<sourceDirectory>${project.build.directory}/generated-resources</sourceDirectory>
<sourcePaths>
<sourcePath>${basedir}/src/main/resources/OCPP-2.0.1_part3_JSON_schemas</sourcePath>
</sourcePaths>
<outputDirectory>${project.build.directory}/generated-sources</outputDirectory>
<targetPackage>ocpp._2020._03</targetPackage>
<generateBuilders>true</generateBuilders>
Expand All @@ -437,7 +394,7 @@
</configuration>
<executions>
<execution>
<phase>process-resources</phase>
<phase>generate-sources</phase>
<goals>
<goal>generate</goal>
</goals>
Expand Down Expand Up @@ -472,24 +429,24 @@
<database>
<type>MYSQL</type>
<containerImage>mysql:8.0</containerImage>
<username>root</username> <!-- Use root because of permissions -->
<username>root</username> &lt;!&ndash; Use root because of permissions &ndash;&gt;
<password>${db-password}</password>
<databaseName>${db-schema}</databaseName>
</database>
<flyway>
<!-- https://github.com/steve-community/steve/issues/157 -->
&lt;!&ndash; https://github.com/steve-community/steve/issues/157 &ndash;&gt;
<initSql>SET default_storage_engine=InnoDB;</initSql>
<!-- we need this because of extensions. they have a higher version number
&lt;!&ndash; we need this because of extensions. they have a higher version number
namespace reserved (e.g. 8.x.x). new migrations in core version should
be executed in the extended version as well -->
be executed in the extended version as well &ndash;&gt;
<outOfOrder>true</outOfOrder>

<!-- Because maven produces this warning after upgrading from 4.2.0 to 5.1.0:
&lt;!&ndash; Because maven produces this warning after upgrading from 4.2.0 to 5.1.0:
[WARNING] Could not find schema history table `stevedb`.`flyway_schema_history`, but found
`stevedb`.`schema_version` instead. You are seeing this message because Flyway changed its
default for flyway.table in version 5.0.0 to flyway_schema_history and you are still relying
on the old default (schema_version). Set flyway.table=schema_version in your configuration to
fix this. This fallback mechanism will be removed in Flyway 6.0.0. -->
fix this. This fallback mechanism will be removed in Flyway 6.0.0. &ndash;&gt;
<table>schema_version</table>

<cleanDisabled>true</cleanDisabled>
Expand All @@ -504,7 +461,7 @@
<location>filesystem:src/main/resources/db/migration</location>
</locations>
</flyway>
<!-- Generator parameters -->
&lt;!&ndash; Generator parameters &ndash;&gt;
<jooq>
<generator>
<database>
Expand All @@ -517,7 +474,7 @@
<forcedTypes>
<forcedType>
<name>BOOLEAN</name>
<!-- https://github.com/jOOQ/jOOQ/issues/7719 -->
&lt;!&ndash; https://github.com/jOOQ/jOOQ/issues/7719 &ndash;&gt;
<includeTypes>(?i:(TINY|SMALL|MEDIUM|BIG)?INT(UNSIGNED)?\(1\))</includeTypes>
</forcedType>
<forcedType>
Expand Down
55 changes: 55 additions & 0 deletions src/main/java/de/rwth/idsg/steve/service/ChargeboxService.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
/*
* SteVe - SteckdosenVerwaltung - https://github.com/steve-community/steve
* Copyright (C) 2013-2025 SteVe Community Team
* All Rights Reserved.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.rwth.idsg.steve.service;

import de.rwth.idsg.steve.repository.ChargePointRepository;
import de.rwth.idsg.steve.repository.dto.ChargePoint;
import de.rwth.idsg.steve.web.dto.ChargePointForm;
import de.rwth.idsg.steve.web.dto.ChargePointQueryForm;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
@RequiredArgsConstructor
public class ChargeboxService {

private final ChargePointRepository chargePointRepository;

public List<ChargePoint.Overview> getOverview(ChargePointQueryForm form) {
return chargePointRepository.getOverview(form);
}

public ChargePoint.Details getDetails(int chargeBoxPk) {
return chargePointRepository.getDetails(chargeBoxPk);
}

public int addChargePoint(ChargePointForm form) {
return chargePointRepository.addChargePoint(form);
}

public void updateChargePoint(ChargePointForm form) {
chargePointRepository.updateChargePoint(form);
}

public void deleteChargePoint(int chargeBoxPk) {
chargePointRepository.deleteChargePoint(chargeBoxPk);
}
}
37 changes: 37 additions & 0 deletions src/main/java/de/rwth/idsg/steve/service/ReservationService.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package de.rwth.idsg.steve.service;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Missing license header (fails license-maven-plugin)

Add the standard project license header.

+/*
+ * SteVe - SteckdosenVerwaltung - https://github.com/steve-community/steve
+ * Copyright (C) 2013-2025 SteVe Community Team
+ * All Rights Reserved.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ */
 package de.rwth.idsg.steve.service;
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
package de.rwth.idsg.steve.service;
/*
* SteVe - SteckdosenVerwaltung - https://github.com/steve-community/steve
* Copyright (C) 2013-2025 SteVe Community Team
* All Rights Reserved.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.rwth.idsg.steve.service;
🧰 Tools
🪛 GitHub Actions: analyze and review code

[warning] 1-1: Missing license header.

🤖 Prompt for AI Agents
In src/main/java/de/rwth/idsg/steve/service/ReservationService.java at line 1,
the file is missing the standard project license header required by the
license-maven-plugin. Add the appropriate license header comment block at the
very top of the file before the package declaration to comply with the project's
licensing requirements.


import de.rwth.idsg.steve.repository.ReservationRepository;
import de.rwth.idsg.steve.repository.dto.InsertReservationParams;
import de.rwth.idsg.steve.repository.dto.Reservation;
import de.rwth.idsg.steve.web.dto.ReservationForm;
import de.rwth.idsg.steve.web.dto.ReservationQueryForm;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
@RequiredArgsConstructor
public class ReservationService {

private final ReservationRepository reservationRepository;

public List<Reservation> getReservations(ReservationQueryForm form) {
return reservationRepository.getReservations(form);
}

public int addReservation(ReservationForm form) {
InsertReservationParams params = InsertReservationParams.builder()
.idTag(form.getIdTag())
.chargeBoxId(form.getChargeBoxId())
.connectorId(form.getConnectorId())
.startTimestamp(form.getStartTimestamp())
.expiryTimestamp(form.getExpiryTimestamp())
.build();
return reservationRepository.insert(params);
}

public void deleteReservation(int reservationId) {
reservationRepository.delete(reservationId);
}
}
37 changes: 37 additions & 0 deletions src/main/java/de/rwth/idsg/steve/service/UserService.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package de.rwth.idsg.steve.service;

import de.rwth.idsg.steve.repository.UserRepository;
import de.rwth.idsg.steve.repository.dto.User;
import de.rwth.idsg.steve.web.dto.UserForm;
import de.rwth.idsg.steve.web.dto.UserQueryForm;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
@RequiredArgsConstructor
public class UserService {

private final UserRepository userRepository;

public List<User.Overview> getUsers(UserQueryForm form) {
return userRepository.getOverview(form);
}

public User.Details getUser(int userPk) {
return userRepository.getDetails(userPk);
}

public void addUser(UserForm form) {
userRepository.add(form);
}
Comment on lines +26 to +28
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Return inserted PK from addUser like other services

Other services return the generated PK (addChargePoint returns int, addReservation returns int). Returning the PK improves API ergonomics and consistency.

-    public void addUser(UserForm form) {
-        userRepository.add(form);
-    }
+    public int addUser(UserForm form) {
+        return userRepository.add(form);
+    }

Additionally, consider marking write methods transactional (see next comment).

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
public void addUser(UserForm form) {
userRepository.add(form);
}
public int addUser(UserForm form) {
return userRepository.add(form);
}
🤖 Prompt for AI Agents
In src/main/java/de/rwth/idsg/steve/service/UserService.java around lines 26 to
28, the addUser method currently returns void but should return the generated
primary key (PK) like other service methods for consistency and better API
ergonomics. Modify the method to return an int representing the inserted user's
PK by capturing the return value from userRepository.add(form). Also, ensure the
method signature reflects this return type change.


public void updateUser(UserForm form) {
userRepository.update(form);
}

public void deleteUser(int userPk) {
userRepository.delete(userPk);
}
}
Loading
Loading