-
Notifications
You must be signed in to change notification settings - Fork 0
feature/FDP-3269 move all the dto files into the repository #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: JKruisheer <kruisheer@outlook.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR consolidates all DTO (Data Transfer Object) files from multiple repositories into a single repository to simplify dependency management and code organization across the OpenSmartGridPlatform project.
- Movement of DTO files from various repositories into a centralized location
- Addition of test utility classes for DTO building and testing
- Consolidation of smart metering DTOs to improve code reusability
Reviewed Changes
Copilot reviewed 280 out of 281 changed files in this pull request and generated 10 comments.
| File | Description |
|---|---|
| SmartMeteringDeviceDtoBuilder.java | Test utility builder for creating SmartMeteringDeviceDto instances |
| DateBuilder.java | Test utility builder for creating Date instances |
| Multiple DTO files | Production DTOs for various smart metering operations and responses |
| result = prime * result + this.friday.hashCode(); | ||
| result = prime * result + this.monday.hashCode(); | ||
| result = prime * result + this.saturday.hashCode(); | ||
| result = prime * result + this.sunday.hashCode(); | ||
| result = prime * result + this.thursday.hashCode(); | ||
| result = prime * result + this.tuesday.hashCode(); | ||
| result = prime * result + this.wednesday.hashCode(); | ||
| result = prime * result + this.weekProfileName.hashCode(); |
Copilot
AI
Jul 18, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The hashCode() method calls hashCode() on potentially null fields without null checks. This will cause NullPointerException if any of the day profile fields are null.
| result = prime * result + this.friday.hashCode(); | |
| result = prime * result + this.monday.hashCode(); | |
| result = prime * result + this.saturday.hashCode(); | |
| result = prime * result + this.sunday.hashCode(); | |
| result = prime * result + this.thursday.hashCode(); | |
| result = prime * result + this.tuesday.hashCode(); | |
| result = prime * result + this.wednesday.hashCode(); | |
| result = prime * result + this.weekProfileName.hashCode(); | |
| result = prime * result + (this.friday == null ? 0 : this.friday.hashCode()); | |
| result = prime * result + (this.monday == null ? 0 : this.monday.hashCode()); | |
| result = prime * result + (this.saturday == null ? 0 : this.saturday.hashCode()); | |
| result = prime * result + (this.sunday == null ? 0 : this.sunday.hashCode()); | |
| result = prime * result + (this.thursday == null ? 0 : this.thursday.hashCode()); | |
| result = prime * result + (this.tuesday == null ? 0 : this.tuesday.hashCode()); | |
| result = prime * result + (this.wednesday == null ? 0 : this.wednesday.hashCode()); | |
| result = prime * result + (this.weekProfileName == null ? 0 : this.weekProfileName.hashCode()); |
| if (!this.friday.equals(other.friday)) { | ||
| return false; | ||
| } | ||
| if (!this.monday.equals(other.monday)) { | ||
| return false; | ||
| } | ||
| if (!this.saturday.equals(other.saturday)) { | ||
| return false; | ||
| } | ||
| if (!this.sunday.equals(other.sunday)) { | ||
| return false; | ||
| } | ||
| if (!this.thursday.equals(other.thursday)) { | ||
| return false; | ||
| } | ||
| if (!this.tuesday.equals(other.tuesday)) { | ||
| return false; | ||
| } | ||
| if (!this.wednesday.equals(other.wednesday)) { | ||
| return false; | ||
| } | ||
| if (!this.weekProfileName.equals(other.weekProfileName)) { |
Copilot
AI
Jul 18, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The equals() method calls equals() on potentially null fields without null checks. This will cause NullPointerException if any of the day profile fields are null.
| if (!this.friday.equals(other.friday)) { | |
| return false; | |
| } | |
| if (!this.monday.equals(other.monday)) { | |
| return false; | |
| } | |
| if (!this.saturday.equals(other.saturday)) { | |
| return false; | |
| } | |
| if (!this.sunday.equals(other.sunday)) { | |
| return false; | |
| } | |
| if (!this.thursday.equals(other.thursday)) { | |
| return false; | |
| } | |
| if (!this.tuesday.equals(other.tuesday)) { | |
| return false; | |
| } | |
| if (!this.wednesday.equals(other.wednesday)) { | |
| return false; | |
| } | |
| if (!this.weekProfileName.equals(other.weekProfileName)) { | |
| if (this.friday == null) { | |
| if (other.friday != null) { | |
| return false; | |
| } | |
| } else if (!this.friday.equals(other.friday)) { | |
| return false; | |
| } | |
| if (this.monday == null) { | |
| if (other.monday != null) { | |
| return false; | |
| } | |
| } else if (!this.monday.equals(other.monday)) { | |
| return false; | |
| } | |
| if (this.saturday == null) { | |
| if (other.saturday != null) { | |
| return false; | |
| } | |
| } else if (!this.saturday.equals(other.saturday)) { | |
| return false; | |
| } | |
| if (this.sunday == null) { | |
| if (other.sunday != null) { | |
| return false; | |
| } | |
| } else if (!this.sunday.equals(other.sunday)) { | |
| return false; | |
| } | |
| if (this.thursday == null) { | |
| if (other.thursday != null) { | |
| return false; | |
| } | |
| } else if (!this.thursday.equals(other.thursday)) { | |
| return false; | |
| } | |
| if (this.tuesday == null) { | |
| if (other.tuesday != null) { | |
| return false; | |
| } | |
| } else if (!this.tuesday.equals(other.tuesday)) { | |
| return false; | |
| } | |
| if (this.wednesday == null) { | |
| if (other.wednesday != null) { | |
| return false; | |
| } | |
| } else if (!this.wednesday.equals(other.wednesday)) { | |
| return false; | |
| } | |
| if (this.weekProfileName == null) { | |
| if (other.weekProfileName != null) { | |
| return false; | |
| } | |
| } else if (!this.weekProfileName.equals(other.weekProfileName)) { |
| } | ||
|
|
||
| @Override | ||
| public int compareTo(final WeekProfileDto other) { |
Copilot
AI
Jul 18, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The compareTo() method calls compareTo() on potentially null weekProfileName without null checks. This will cause NullPointerException if weekProfileName is null.
| public int compareTo(final WeekProfileDto other) { | |
| public int compareTo(final WeekProfileDto other) { | |
| if (this.weekProfileName == null && other.weekProfileName == null) { | |
| return 0; | |
| } | |
| if (this.weekProfileName == null) { | |
| return -1; | |
| } | |
| if (other.weekProfileName == null) { | |
| return 1; | |
| } |
| result = prime * result + this.seasonProfileName.hashCode(); | ||
| result = prime * result + this.seasonStart.hashCode(); | ||
| result = prime * result + this.weekProfile.hashCode(); |
Copilot
AI
Jul 18, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The hashCode() method calls hashCode() on potentially null fields without null checks. This will cause NullPointerException if seasonProfileName, seasonStart, or weekProfile are null.
| result = prime * result + this.seasonProfileName.hashCode(); | |
| result = prime * result + this.seasonStart.hashCode(); | |
| result = prime * result + this.weekProfile.hashCode(); | |
| result = prime * result + (this.seasonProfileName == null ? 0 : this.seasonProfileName.hashCode()); | |
| result = prime * result + (this.seasonStart == null ? 0 : this.seasonStart.hashCode()); | |
| result = prime * result + (this.weekProfile == null ? 0 : this.weekProfile.hashCode()); |
| if (!this.seasonProfileName.equals(other.seasonProfileName)) { | ||
| return false; | ||
| } | ||
| if (!this.seasonStart.equals(other.seasonStart)) { | ||
| return false; | ||
| } | ||
| if (!this.weekProfile.equals(other.weekProfile)) { |
Copilot
AI
Jul 18, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The equals() method calls equals() on potentially null fields without null checks. This will cause NullPointerException if seasonProfileName, seasonStart, or weekProfile are null.
| if (!this.seasonProfileName.equals(other.seasonProfileName)) { | |
| return false; | |
| } | |
| if (!this.seasonStart.equals(other.seasonStart)) { | |
| return false; | |
| } | |
| if (!this.weekProfile.equals(other.weekProfile)) { | |
| if (this.seasonProfileName == null) { | |
| if (other.seasonProfileName != null) { | |
| return false; | |
| } | |
| } else if (!this.seasonProfileName.equals(other.seasonProfileName)) { | |
| return false; | |
| } | |
| if (this.seasonStart == null) { | |
| if (other.seasonStart != null) { | |
| return false; | |
| } | |
| } else if (!this.seasonStart.equals(other.seasonStart)) { | |
| return false; | |
| } | |
| if (this.weekProfile == null) { | |
| if (other.weekProfile != null) { | |
| return false; | |
| } | |
| } else if (!this.weekProfile.equals(other.weekProfile)) { |
| private FaultResponseDto(final Builder builder) { | ||
| super(OsgpResultTypeDto.NOT_OK, null, null); | ||
|
|
||
| Objects.requireNonNull("Message is not allowed to be null", builder.message); |
Copilot
AI
Jul 18, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The arguments to Objects.requireNonNull() are reversed. The first argument should be the object to check, and the second should be the message.
| Objects.requireNonNull("Message is not allowed to be null", builder.message); | |
| Objects.requireNonNull(builder.message, "Message is not allowed to be null"); |
| * Copyright 2023 Alliander N.V. | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 |
Copilot
AI
Jul 18, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file uses a different license header format (Apache License 2.0 copyright notice) compared to other files in the same directory that use SPDX-FileCopyrightText format. License headers should be consistent across the project.
| * Copyright 2023 Alliander N.V. | |
| * | |
| * Licensed under the Apache License, Version 2.0 (the "License"); | |
| * you may not use this file except in compliance with the License. | |
| * You may obtain a copy of the License at | |
| * | |
| * http://www.apache.org/licenses/LICENSE-2.0 | |
| * SPDX-FileCopyrightText: 2023 Alliander N.V. | |
| * SPDX-License-Identifier: Apache-2.0 |
| @@ -0,0 +1,23 @@ | |||
| // Copyright 2014-2017 Smart Society Services B.V. | |||
Copilot
AI
Jul 18, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file uses a different license header format compared to other files in the same directory that use SPDX-FileCopyrightText format. License headers should be consistent across the project.
| // Copyright 2014-2017 Smart Society Services B.V. |
|
|
||
| /** Creates instances, for testing purposes only. */ | ||
| public class SmartMeteringDeviceDtoBuilder { | ||
| private static int counter = 0; | ||
|
|
||
| public SmartMeteringDeviceDto build() { | ||
| counter += 1; |
Copilot
AI
Jul 18, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The static counter field is not thread-safe. If multiple threads use this builder concurrently, it could lead to race conditions. Consider using AtomicInteger or synchronization.
| /** Creates instances, for testing purposes only. */ | |
| public class SmartMeteringDeviceDtoBuilder { | |
| private static int counter = 0; | |
| public SmartMeteringDeviceDto build() { | |
| counter += 1; | |
| import java.util.concurrent.atomic.AtomicInteger; | |
| /** Creates instances, for testing purposes only. */ | |
| public class SmartMeteringDeviceDtoBuilder { | |
| private static AtomicInteger counter = new AtomicInteger(0); | |
| public SmartMeteringDeviceDto build() { | |
| counter.incrementAndGet(); |
|
|
||
| /** Creates instances, for testing purposes only. */ | ||
| public class DateBuilder { | ||
| private static int counter = 0; | ||
|
|
||
| public Date build() { | ||
| counter += 1; | ||
| return new Date(24L * 60 * 60 * 1000 * counter); |
Copilot
AI
Jul 18, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The static counter field is not thread-safe. If multiple threads use this builder concurrently, it could lead to race conditions. Consider using AtomicInteger or synchronization.
| /** Creates instances, for testing purposes only. */ | |
| public class DateBuilder { | |
| private static int counter = 0; | |
| public Date build() { | |
| counter += 1; | |
| return new Date(24L * 60 * 60 * 1000 * counter); | |
| import java.util.concurrent.atomic.AtomicInteger; | |
| /** Creates instances, for testing purposes only. */ | |
| public class DateBuilder { | |
| private static AtomicInteger counter = new AtomicInteger(0); | |
| public Date build() { | |
| int currentCounter = counter.incrementAndGet(); | |
| return new Date(24L * 60 * 60 * 1000 * currentCounter); |
Signed-off-by: JKruisheer <kruisheer@outlook.com>
Signed-off-by: JKruisheer <kruisheer@outlook.com>
Signed-off-by: JKruisheer <kruisheer@outlook.com>
Signed-off-by: JKruisheer <kruisheer@outlook.com>
Signed-off-by: JKruisheer <kruisheer@outlook.com>
Signed-off-by: JKruisheer <kruisheer@outlook.com>
Signed-off-by: JKruisheer <kruisheer@outlook.com>
No description provided.