Skip to content

Commit 1e0feeb

Browse files
Merge branch 'dev' into df/#1392-cff-version
2 parents 834bbb4 + ad22242 commit 1e0feeb

File tree

24 files changed

+779
-612
lines changed

24 files changed

+779
-612
lines changed

.github/workflows/ci.yml

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,13 @@ jobs:
8888
env:
8989
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.MAVENCENTRAL_SIGNINGKEY }}
9090
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.MAVENCENTRAL_SIGNINGPASS }}
91-
ORG_GRADLE_PROJECT_user: ${{ secrets.MAVENCENTRAL_USER }}
92-
ORG_GRADLE_PROJECT_password: ${{ secrets.MAVENCENTRAL_PASS }}
91+
ORG_GRADLE_PROJECT_mavenCentralUser: ${{ github.actor == 'sebastian-peter' && secrets.MAVENCENTRAL_USER ||
92+
github.actor == 'danielfeismann' && secrets.MAVENCENTRAL_DANIEL_USER }}
93+
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ github.actor == 'sebastian-peter' && secrets.MAVENCENTRAL_PASS ||
94+
github.actor == 'danielfeismann' && secrets.MAVENCENTRAL_DANIEL_PASS }}
95+
9396
run: |
97+
echo "Using MavenCentral Token of GitHub Actor: ${{ github.actor }}"
9498
if [ "${GITHUB_REF}" == "refs/heads/main" ]; then
9599
currentVersion=$(./gradlew -q currentVersion)
96100
else
@@ -100,3 +104,18 @@ jobs:
100104
echo "currentVersion=$currentVersion"
101105
102106
./gradlew publish -PdeployVersion=$currentVersion
107+
108+
109+
#MavenCentral Staging
110+
- name: MavenCentral Staging
111+
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/dev'
112+
env:
113+
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.MAVENCENTRAL_SIGNINGKEY }}
114+
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.MAVENCENTRAL_SIGNINGPASS }}
115+
ORG_GRADLE_PROJECT_mavenCentralUser: ${{ github.actor == 'sebastian-peter' && secrets.MAVENCENTRAL_USER ||
116+
github.actor == 'danielfeismann' && secrets.MAVENCENTRAL_DANIEL_USER }}
117+
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ github.actor == 'sebastian-peter' && secrets.MAVENCENTRAL_PASS ||
118+
github.actor == 'danielfeismann' && secrets.MAVENCENTRAL_DANIEL_PASS }}
119+
120+
run: |
121+
./gradlew stagingAtMavenCentralPortal

CHANGELOG.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
66

77
## [Unreleased/Snapshot]
88

9+
### Added
10+
- Enhanced check for invalid field names in sources [#1383](https://github.com/ie3-institute/PowerSystemDataModel/issues/1383)
11+
- Enhancing value retrieval in `TimeSeriesSource` [1280](https://github.com/ie3-institute/PowerSystemDataModel/issues/1280)
12+
13+
### Fixed
14+
15+
### Changed
16+
17+
## [8.0.0] - 2025-07-22
18+
919
### Added
1020
- Extend Validation to EnergyManagement Systems. [#1356](https://github.com/ie3-institute/PowerSystemDataModel/issues/1356)
1121
- Added `CITATION.cff` [#1380](https://github.com/ie3-institute/PowerSystemDataModel/issues/1380)
@@ -373,7 +383,8 @@ coordinates or multiple exactly equal coordinates possible
373383
- CsvDataSource now stops trying to get an operator for empty operator uuid field in entities
374384
- CsvDataSource now parsing multiple geoJson strings correctly
375385

376-
[Unreleased/Snapshot]: https://github.com/ie3-institute/powersystemdatamodel/compare/7.0.0...HEAD
386+
[Unreleased/Snapshot]: https://github.com/ie3-institute/powersystemdatamodel/compare/8.0.0...HEAD
387+
[8.0.0]: https://github.com/ie3-institute/powersystemdatamodel/compare/7.0.0...8.0.0
377388
[7.0.0]: https://github.com/ie3-institute/powersystemdatamodel/compare/6.0.0...7.0.0
378389
[6.0.0]: https://github.com/ie3-institute/powersystemdatamodel/compare/5.1.0...6.0.0
379390
[5.1.0]: https://github.com/ie3-institute/powersystemdatamodel/compare/5.0.1...5.1.0

build.gradle

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ ext {
1818
//version (changing these should be considered thoroughly!)
1919
javaVersion = JavaVersion.VERSION_17
2020
groovyVersion = "4.0"
21-
groovyBinaryVersion = "4.0.27"
21+
groovyBinaryVersion = "4.0.28"
2222

2323
junitVersion = '1.12.0'
2424
testcontainersVersion = '1.21.3'
@@ -41,7 +41,8 @@ apply from: scriptsLocation + 'spotless.gradle'
4141
apply from: scriptsLocation + 'checkJavaVersion.gradle'
4242
apply from: scriptsLocation + 'documentation.gradle'
4343
apply from: scriptsLocation + 'jacoco.gradle' // jacoco java code coverage
44-
apply from: scriptsLocation + 'mavenCentralPublish.gradle'
44+
apply from: scriptsLocation + 'uploadToMavenCentralPortal.gradle' // upload for deploy
45+
apply from: scriptsLocation + 'stagingAtMavenCentralPortal.gradle' // stage for deploy
4546
apply from: scriptsLocation + 'sonarqube.gradle'
4647
apply from: scriptsLocation + 'vcs.gradle'
4748
apply from: scriptsLocation + 'semVer.gradle'
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
tasks.register('stagingAtMavenCentralPortal') {
2+
group = 'publishing'
3+
description = 'Stages uploaded artifacts to Maven Central Portal for manual approval'
4+
5+
doLast {
6+
def username = project.getProperty('mavenCentralUser')
7+
def password = project.getProperty('mavenCentralPassword')
8+
def deployVersion = project.findProperty('deployVersion') ?: project.version
9+
10+
if (!username || !password) {
11+
throw new GradleException("Sonatype credentials not found. Set sonatypeUser and sonatypePassword properties or environment variables.")
12+
}
13+
14+
// Request API for repo key
15+
def repositoryString = providers.exec {
16+
commandLine 'curl',
17+
'-u', "${username}:${password}",
18+
'https://ossrh-staging-api.central.sonatype.com/manual/search/repositories'
19+
}.getStandardOutput().getAsText().get()
20+
21+
def repositoryGroovy = new groovy.json.JsonSlurper().parseText(repositoryString)
22+
def key = repositoryGroovy.repositories[0].key
23+
24+
// Stage via curl
25+
def stageResult = providers.exec {
26+
ignoreExitValue true
27+
commandLine 'curl',
28+
'-u', "${username}:${password}",
29+
'-i', '-X', 'POST', "https://ossrh-staging-api.central.sonatype.com/manual/upload/repository/$key"
30+
}
31+
32+
if (stageResult.result.get().exitValue == 0) {
33+
println "✓ Staging successful!"
34+
println "Check status at: https://central.sonatype.com/publishing/deployments"
35+
} else {
36+
throw new GradleException("Staging failed")
37+
}
38+
}
39+
}

gradle/scripts/mavenCentralPublish.gradle renamed to gradle/scripts/uploadToMavenCentralPortal.gradle

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,11 @@ tasks.register("javadocJar", Jar) {
1111
from { tasks.named("javadoc", Javadoc).get().destinationDir }
1212
}
1313

14-
if (project.hasProperty('user') && project.hasProperty('password') && project.hasProperty('deployVersion')) {
14+
if (project.hasProperty('mavenCentralUser') && project.hasProperty('mavenCentralPassword') && project.hasProperty('deployVersion')) {
1515

1616
// snapshot version differs from normal version
1717
String versionString = project.getProperty('deployVersion')
1818

19-
2019
publishing {
2120
publications {
2221
create("mavenJava", MavenPublication) {
@@ -73,12 +72,11 @@ if (project.hasProperty('user') && project.hasProperty('password') && project.ha
7372
}
7473
repositories {
7574
maven {
76-
def releasesRepoUrl = "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/"
77-
def snapshotsRepoUrl = "https://s01.oss.sonatype.org/content/repositories/snapshots/"
78-
url = versionString.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl
75+
name = "MavenCentral"
76+
url = "https://ossrh-staging-api.central.sonatype.com/service/local/staging/deploy/maven2/"
7977
credentials {
80-
username project.getProperty('user')
81-
password project.getProperty('password')
78+
username = project.findProperty('mavenCentralUser')
79+
password = project.findProperty('mavenCentralPassword')
8280
}
8381
}
8482
}

src/main/java/edu/ie3/datamodel/io/factory/Factory.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,10 +174,11 @@ public Try<Void, ValidationException> validate(
174174
+ "' are possible (NOT case-sensitive!):\n"
175175
+ possibleOptions));
176176
} else {
177+
// find all unused fields
177178
Set<String> unused = getUnusedFields(harmonizedActualFields, validFieldSets);
178179

179180
if (!unused.isEmpty()) {
180-
log.debug(
181+
log.info(
181182
"The following additional fields were found for entity class of '{}': {}",
182183
entityClass.getSimpleName(),
183184
unused);

src/main/java/edu/ie3/datamodel/io/factory/input/participant/SystemParticipantInputEntityFactory.java

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,23 +30,26 @@ public abstract class SystemParticipantInputEntityFactory<
3030
T extends SystemParticipantInput, D extends SystemParticipantEntityData>
3131
extends AssetInputEntityFactory<T, D> {
3232

33+
private static final String NODE = "node";
34+
3335
private static final String Q_CHARACTERISTICS = "qCharacteristics";
3436

3537
public static final String CONTROLLING_EM = "controllingEm";
3638

39+
@SafeVarargs
3740
protected SystemParticipantInputEntityFactory(Class<? extends T>... allowedClasses) {
3841
super(allowedClasses);
3942
}
4043

4144
@Override
4245
protected List<Set<String>> getFields(Class<?> entityClass) {
4346
List<Set<String>> fields = new ArrayList<>(super.getFields(entityClass));
44-
for (Set<String> set : fields) set.add(Q_CHARACTERISTICS);
45-
46-
List<Set<String>> withEm =
47-
fields.stream().map(f -> (Set<String>) expandSet(f, CONTROLLING_EM)).toList();
4847

49-
fields.addAll(withEm);
48+
for (Set<String> set : fields) {
49+
set.add(Q_CHARACTERISTICS);
50+
set.add(NODE);
51+
set.add(CONTROLLING_EM);
52+
}
5053

5154
return fields;
5255
}

src/main/java/edu/ie3/datamodel/io/source/TimeSeriesSource.java

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,22 @@ public abstract IndividualTimeSeries<V> getTimeSeries(ClosedInterval<ZonedDateTi
5252

5353
public abstract Optional<V> getValue(ZonedDateTime time);
5454

55+
/**
56+
* Method to retrieve the value of the given time or the last timestamp before the given time.
57+
*
58+
* @param time given time
59+
* @return an option for a value
60+
*/
61+
public Optional<V> getValueOrLast(ZonedDateTime time) {
62+
Optional<V> value = getValue(time);
63+
64+
if (value.isEmpty()) {
65+
return getPreviousTimeBasedValue(time).map(TimeBasedValue::getValue);
66+
}
67+
68+
return value;
69+
}
70+
5571
public abstract Optional<TimeBasedValue<V>> getPreviousTimeBasedValue(ZonedDateTime time);
5672

5773
/**
@@ -61,4 +77,12 @@ public abstract IndividualTimeSeries<V> getTimeSeries(ClosedInterval<ZonedDateTi
6177
* @return a list of time keys
6278
*/
6379
public abstract List<ZonedDateTime> getTimeKeysAfter(ZonedDateTime time);
80+
81+
/**
82+
* Method to return all last known time keys before a given timestamp.
83+
*
84+
* @param time given time
85+
* @return an option for the time key
86+
*/
87+
public abstract Optional<ZonedDateTime> getLastTimeKeyBefore(ZonedDateTime time);
6488
}

src/main/java/edu/ie3/datamodel/io/source/csv/CsvTimeSeriesSource.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,11 @@ public List<ZonedDateTime> getTimeKeysAfter(ZonedDateTime time) {
142142
return timeSeries.getTimeKeysAfter(time);
143143
}
144144

145+
@Override
146+
public Optional<ZonedDateTime> getLastTimeKeyBefore(ZonedDateTime time) {
147+
return timeSeries.getPreviousDateTime(time);
148+
}
149+
145150
// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
146151

147152
/**

src/main/java/edu/ie3/datamodel/io/source/sql/SqlTimeSeriesSource.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,15 @@ public List<ZonedDateTime> getTimeKeysAfter(ZonedDateTime time) {
199199
.toList();
200200
}
201201

202+
@Override
203+
public Optional<ZonedDateTime> getLastTimeKeyBefore(ZonedDateTime time) {
204+
return dataSource
205+
.executeQuery(
206+
queryForValueBefore, ps -> ps.setTimestamp(1, Timestamp.from(time.toInstant())))
207+
.map(valueFactory::extractTime)
208+
.max(ZonedDateTime::compareTo);
209+
}
210+
202211
// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
203212

204213
/** Creates a set of TimeBasedValues from database */

0 commit comments

Comments
 (0)