Skip to content

Commit 6171427

Browse files
committed
Merge branch 'release/5.0.1'
2 parents 5f44c75 + 3495718 commit 6171427

146 files changed

Lines changed: 8056 additions & 7114 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

solarnet-db-setup/postgres/postgres-init-common.sql

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
/**
2+
* "Natural sort" collation, to sort text with atomic number components and upper case
3+
* before lower case, to match Java standard sorting.
4+
*
5+
* @see https://www.postgresql.org/docs/17/collation.html#ICU-COLLATION-SETTINGS
6+
*/
7+
CREATE COLLATION solarcommon.naturalsort (provider = icu, locale = 'und-u-kf-upper-kn');
8+
19
/**
210
* Reduce a 2d array into a set of 1d arrays.
311
*/

solarnet-db-setup/postgres/postgres-init-datm-core.sql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
CREATE TABLE solardatm.da_datm_meta (
33
stream_id UUID NOT NULL DEFAULT uuid_generate_v4(),
44
node_id BIGINT NOT NULL,
5-
source_id CHARACTER VARYING(64) NOT NULL,
5+
source_id CHARACTER VARYING(64) NOT NULL COLLATE solarcommon.naturalsort,
66
created TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT CURRENT_TIMESTAMP,
77
updated TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT CURRENT_TIMESTAMP,
88
names_i TEXT[],
@@ -17,7 +17,7 @@ CREATE TABLE solardatm.da_datm_meta (
1717
CREATE TABLE solardatm.da_loc_datm_meta (
1818
stream_id UUID NOT NULL DEFAULT uuid_generate_v4(),
1919
loc_id BIGINT NOT NULL,
20-
source_id CHARACTER VARYING(64) NOT NULL,
20+
source_id CHARACTER VARYING(64) NOT NULL COLLATE solarcommon.naturalsort,
2121
created TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT CURRENT_TIMESTAMP,
2222
updated TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT CURRENT_TIMESTAMP,
2323
names_i TEXT[],
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
-- see https://www.postgresql.org/docs/17/collation.html#ICU-COLLATION-SETTINGS
2+
CREATE COLLATION solarcommon.naturalsort (provider = icu, locale = 'und-u-kf-upper-kn');
3+
4+
ALTER TABLE solardatm.da_datm_meta ALTER COLUMN source_id TYPE CHARACTER VARYING(64) COLLATE solarcommon.naturalsort;
5+
ALTER TABLE solardatm.da_loc_datm_meta ALTER COLUMN source_id TYPE CHARACTER VARYING(64) COLLATE solarcommon.naturalsort;

solarnet/cloud-integrations/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ dependencyManagement {
1414
}
1515

1616
description = 'SolarNet: Cloud Integrations'
17-
version = '3.0.0'
17+
version = '3.0.1'
1818

1919
base {
2020
archivesName = 'solarnet-cloud-integrations'

solarnet/cloud-integrations/src/main/java/net/solarnetwork/central/c2c/biz/impl/SolcastIrradianceCloudDatumStreamService.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@
8484
* irradiance API.
8585
*
8686
* @author matt
87-
* @version 2.0
87+
* @version 2.1
8888
*/
8989
public class SolcastIrradianceCloudDatumStreamService extends BaseSolcastCloudDatumStreamService {
9090

@@ -300,6 +300,10 @@ private Collection<GeneralDatum> executeRequest(CloudDatumStreamConfiguration da
300300
CloudIntegrationConfiguration integration, final String latitude, final String longitude,
301301
final Duration resolution, final Map<String, ValueRef> refsByFieldName, Instant startDate,
302302
Instant endDate, final boolean useLiveApi, final Instant now) {
303+
if ( !endDate.isAfter(startDate) ) {
304+
// sometimes happens from split between historic/live
305+
return List.of();
306+
}
303307
// @formatter:off
304308
final UriComponentsBuilder uriBuilder = UriComponentsBuilder
305309
.fromUri(resolveBaseUrl(integration, SolcastCloudIntegrationService.BASE_URI))

solarnet/common-web/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ dependencyManagement {
1616
}
1717

1818
description = 'SolarNet: Common Web'
19-
version = '3.0.0'
19+
version = '3.1.0'
2020

2121
base {
2222
archivesName = 'solarnet-common-web'

solarnet/common-web/src/main/java/net/solarnetwork/central/web/support/WebServiceGlobalControllerSupport.java

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
import org.springframework.dao.TransientDataAccessResourceException;
4545
import org.springframework.http.HttpStatus;
4646
import org.springframework.http.converter.HttpMessageConversionException;
47+
import org.springframework.http.converter.HttpMessageNotWritableException;
4748
import org.springframework.security.access.AccessDeniedException;
4849
import org.springframework.security.authentication.BadCredentialsException;
4950
import org.springframework.security.core.AuthenticationException;
@@ -70,7 +71,7 @@
7071
* Global REST controller support.
7172
*
7273
* @author matt
73-
* @version 1.11
74+
* @version 1.12
7475
*/
7576
@RestControllerAdvice
7677
@Order(1000)
@@ -497,6 +498,40 @@ public Result<?> handleHttpMessageConversionException(HttpMessageConversionExcep
497498
return error("WEB.00200", e.getMessage());
498499
}
499500

501+
/**
502+
* Handle a {@link HttpMessageNotWritableException}.
503+
*
504+
* <p>
505+
* This exception implies a response cannot be written, so just log a
506+
* message.
507+
* </p>
508+
*
509+
* @param e
510+
* the exception
511+
* @param request
512+
* the request
513+
* @since 1.12
514+
*/
515+
@ExceptionHandler(HttpMessageNotWritableException.class)
516+
public void handleHttpMessageNotWritableException(HttpMessageNotWritableException e,
517+
WebRequest request) {
518+
Throwable cause = e;
519+
while ( cause.getCause() != null ) {
520+
cause = cause.getCause();
521+
if ( "org.apache.catalina.connector.ClientAbortException"
522+
.equals(cause.getClass().getName()) ) {
523+
log.debug("ClientAbortException in request {}", requestDescription(request), e);
524+
return;
525+
} else if ( cause instanceof IOException ) {
526+
log.debug("IOException in request {}", requestDescription(request), e);
527+
return;
528+
}
529+
}
530+
531+
log.warn("HttpMessageNotWritableException in request {}; user [{}]", requestDescription(request),
532+
userPrincipalName(request), e);
533+
}
534+
500535
/**
501536
* Handle a {@link ClientAbortException}.
502537
*

solarnet/datum/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ dependencyManagement {
1616
}
1717

1818
description = 'SolarNet: Datum'
19-
version = '5.0.0'
19+
version = '5.1.0'
2020

2121
base {
2222
archivesName = 'solarnet-datum'

solarnet/datum/src/main/java/net/solarnetwork/central/datum/v2/domain/BasicDatumStreamMetadata.java

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
import static net.solarnetwork.util.ObjectUtils.requireNonNullArgument;
2626
import java.io.Serial;
2727
import java.io.Serializable;
28+
import java.util.Objects;
2829
import java.util.UUID;
2930
import net.solarnetwork.domain.datum.DatumSamplesType;
3031
import net.solarnetwork.domain.datum.DatumStreamMetadata;
@@ -33,7 +34,7 @@
3334
* Implementation of {@link DatumStreamMetadata}.
3435
*
3536
* @author matt
36-
* @version 2.0
37+
* @version 2.1
3738
* @since 2.8
3839
*/
3940
public class BasicDatumStreamMetadata implements DatumStreamMetadata, Serializable {
@@ -112,6 +113,31 @@ public BasicDatumStreamMetadata(UUID streamId, String timeZoneId, Object instant
112113
(String[]) statusProperties);
113114
}
114115

116+
@Override
117+
public int hashCode() {
118+
return Objects.hash(streamId);
119+
}
120+
121+
/**
122+
* Compare for equality.
123+
*
124+
* <p>
125+
* Only the {@code streamId} is considered.
126+
* </p>
127+
*
128+
* {@inheritDoc}
129+
*/
130+
@Override
131+
public boolean equals(Object obj) {
132+
if ( this == obj ) {
133+
return true;
134+
}
135+
if ( !(obj instanceof BasicDatumStreamMetadata other) ) {
136+
return false;
137+
}
138+
return Objects.equals(streamId, other.streamId);
139+
}
140+
115141
@Override
116142
public UUID getStreamId() {
117143
return streamId;

solarnet/datum/src/main/java/net/solarnetwork/central/datum/v2/domain/BasicObjectDatumStreamMetadata.java

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
import static net.solarnetwork.util.ObjectUtils.requireNonNullArgument;
2626
import java.io.Serial;
2727
import java.util.Arrays;
28+
import java.util.Objects;
2829
import java.util.UUID;
2930
import net.solarnetwork.central.domain.ObjectDatumIdRelated;
3031
import net.solarnetwork.domain.BasicLocation;
@@ -36,7 +37,7 @@
3637
* Basic implementation of {@link ObjectDatumStreamMetadata}.
3738
*
3839
* @author matt
39-
* @version 1.1
40+
* @version 1.2
4041
* @since 2.8
4142
*/
4243
public class BasicObjectDatumStreamMetadata extends BasicDatumStreamMetadata
@@ -190,6 +191,37 @@ public BasicObjectDatumStreamMetadata(UUID streamId, String timeZoneId, ObjectDa
190191
this.metaJson = metaJson;
191192
}
192193

194+
@Override
195+
public int hashCode() {
196+
final int prime = 31;
197+
int result = super.hashCode();
198+
result = prime * result + Objects.hash(kind);
199+
return result;
200+
}
201+
202+
/**
203+
* Compare for equality.
204+
*
205+
* <p>
206+
* Only the {@code kind} and {@code streamId} are considered.
207+
* </p>
208+
*
209+
* {@inheritDoc}
210+
*/
211+
@Override
212+
public boolean equals(Object obj) {
213+
if ( this == obj ) {
214+
return true;
215+
}
216+
if ( !super.equals(obj) ) {
217+
return false;
218+
}
219+
if ( !(obj instanceof BasicObjectDatumStreamMetadata other) ) {
220+
return false;
221+
}
222+
return kind == other.kind;
223+
}
224+
193225
@Override
194226
public String toString() {
195227
StringBuilder builder = new StringBuilder();

0 commit comments

Comments
 (0)