Skip to content
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

Bump com.spotify.fmt:fmt-maven-plugin from 2.22.1 to 2.23 #49

Merged
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ public abstract class UniqueObjectRepositoryImpl<U extends UniqueObject>

public static String sqlSelectReducedFields(String tableAlias, String mappingPrefix) {
return " "
+ """
+
"""
{{alias}}.uuid {{prefix}}_uuid, {{alias}}.created {{prefix}}_created, {{alias}}.last_modified {{prefix}}_lastModified"""
.replace("{{alias}}", tableAlias)
.replace("{{prefix}}", mappingPrefix);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,8 @@ public List<I> getRandom(int count) throws RepositoryException {
protected String getSqlInsertFields() {
return super.getSqlInsertFields()
+ ", "
+ """
+
"""
description, identifiable_objecttype,
identifiable_type, label, previewfileresource,
preview_hints, split_label, tags_uuids, subjects_uuids
Expand All @@ -438,7 +439,8 @@ protected String getSqlInsertFields() {
protected String getSqlInsertValues() {
return super.getSqlInsertValues()
+ ", "
+ """
+
"""
:description::JSONB, :identifiableObjectType,
:type, :label::JSONB, :previewFileResource,
:previewImageRenderingHints::JSONB, :split_label::TEXT[], :tags_uuids::UUID[], :subjects_uuids::UUID[]
Expand All @@ -452,7 +454,8 @@ protected String getSqlInsertValues() {
public String getSqlSelectReducedFields(String tableAlias, String mappingPrefix) {
return super.getSqlSelectReducedFields(tableAlias, mappingPrefix)
+ ", "
+ """
+
"""
{{alias}}.description {{prefix}}_description,
{{alias}}.identifiable_objecttype {{prefix}}_identifiableObjectType,
{{alias}}.identifiable_type {{prefix}}_type,
Expand Down Expand Up @@ -585,7 +588,8 @@ public List<I> retrieveMultiple(
throws RepositoryException {
StringBuilder sql =
new StringBuilder(
("""
(
"""
SELECT {{fieldsSql}}, {{identifierFields}},
{{imageFileFields}}, get_identifiers(file.uuid) pi_identifiers,
{{urlAliasFields}}, {{tagFields}}, {{subjectFields}}
Expand All @@ -602,7 +606,8 @@ public List<I> retrieveMultiple(
? "%s\n".formatted(getSqlSelectReducedFieldsJoins())
: "")
// regular identifiable joins
+ """
+
"""
LEFT JOIN {{identifierTable}} AS {{identifierAlias}}
ON {{mainAlias}}.uuid = {{identifierAlias}}.identifiable
LEFT JOIN {{imageFileTable}} AS file
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -749,7 +749,8 @@ protected String getSqlInsertValues() {
@Override
public String getSqlSelectAllFields(String tableAlias, String mappingPrefix) {
return super.getSqlSelectAllFields(tableAlias, mappingPrefix)
+ """
+
"""
, {{licenseTable}}.uuid {{licenseMapping}}_uuid,
{{licenseTable}}.label {{licenseMapping}}_label,
{{licenseTable}}.url {{licenseMapping}}_url,
Expand Down Expand Up @@ -812,7 +813,8 @@ parent.item_uuid parent_itemUuid, get_identifiers(parent.item_uuid) parent_itemI
@Override
protected String getSqlSelectAllFieldsJoins() {
return super.getSqlSelectAllFieldsJoins()
+ """
+
"""
LEFT JOIN {{licenseTable}} {{licenseAlias}}
ON {{tableAlias}}.license_uuid = {{licenseAlias}}.uuid
-- creation info creator
Expand Down Expand Up @@ -883,7 +885,8 @@ LEFT JOIN (
@Override
public String getSqlSelectReducedFields(String tableAlias, String mappingPrefix) {
return super.getSqlSelectReducedFields(tableAlias, mappingPrefix)
+ """
+
"""
, %1$s.parent_uuid %2$s_parent_uuid,
%1$s.item_uuid %2$s_item_uuid, get_identifiers(%1$s.item_uuid) item_identifiers,
%3$s.label item_label"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ public List<Webpage> getRootWebpages(UUID uuid) throws RepositoryException {

StringBuilder innerQuery =
new StringBuilder(
"""
"""
SELECT {{webpageAlias}}.*, ww.sortindex wpidx FROM {{webpage}} {{webpageAlias}}
INNER JOIN website_webpages ww ON {{webpageAlias}}.uuid = ww.webpage_uuid
WHERE ww.website_uuid = :uuid
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ public List<CorporateBody> findCollectionRelatedCorporateBodies(
// between corporatebody and project
StringBuilder innerQuery =
new StringBuilder(
"""
"""
SELECT * FROM {{tableName}} {{tableAlias}}
LEFT JOIN rel_entity_entities AS r ON {{tableAlias}}.uuid = r.object_uuid
LEFT JOIN rel_entity_entities AS rel ON r.subject_uuid = rel.subject_uuid
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,8 @@ public String getSqlSelectAllFields(String tableAlias, String mappingPrefix) {
@Override
protected String getSqlSelectAllFieldsJoins() {
return super.getSqlSelectAllFieldsJoins()
+ """
+
"""
LEFT JOIN geolocations AS glbirth ON glbirth.uuid = %1$s.locationofbirth
LEFT JOIN geolocations AS gldeath ON gldeath.uuid = %1$s.locationofdeath
LEFT JOIN (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,8 @@ protected String getSqlInsertValues() {
@Override
public String getSqlSelectAllFields(String tableAlias, String mappingPrefix) {
return getSqlSelectReducedFields(tableAlias, mappingPrefix)
+ """
+
"""
, %1$s.exemplifies_manifestation %2$s_exemplifies_manifestation,
poi.label poi_label, get_identifiers(poi.uuid) poi_identifiers,
%3$s.label %2$s_manifestation_label, get_identifiers(%3$s.uuid) %2$s_manifestation_identifiers
Expand All @@ -249,7 +250,8 @@ poi.label poi_label, get_identifiers(poi.uuid) poi_identifiers,
@Override
protected String getSqlSelectAllFieldsJoins() {
return super.getSqlSelectAllFieldsJoins()
+ """
+
"""
LEFT JOIN %1$s poi ON %2$s.part_of_item = poi.uuid
LEFT JOIN %3$s %4$s ON %4$s.uuid = %2$s.manifestation
"""
Expand Down Expand Up @@ -282,7 +284,8 @@ public String getSqlSelectReducedFields(String tableAlias, String mappingPrefix)
@Override
protected String getSqlSelectReducedFieldsJoins() {
return super.getSqlSelectReducedFieldsJoins()
+ """
+
"""
LEFT JOIN %2$s %3$s ON %3$s.uuid = ANY(%1$s.holder_uuids)
"""
.formatted(tableAlias, AgentRepositoryImpl.TABLE_NAME, "holdertable");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,8 @@ public List<Locale> getLanguagesOfManifestationsForWork(UUID workUuid) {
@Override
protected String getSqlInsertFields() {
return super.getSqlInsertFields()
+ """
+
"""
, composition, dimensions, expressiontypes,
language, manifestationtype, manufacturingtype,
mediatypes, otherlanguages,
Expand All @@ -301,7 +302,8 @@ protected String getSqlInsertFields() {
@Override
protected String getSqlInsertValues() {
return super.getSqlInsertValues()
+ """
+
"""
, :composition, :dimensions, :expressionTypes::mainsubtype[],
:language, :manifestationType, :manufacturingType,
:mediaTypes::varchar[], :otherLanguages::varchar[],
Expand All @@ -316,7 +318,8 @@ protected String getSqlInsertValues() {
@Override
public String getSqlSelectAllFields(String tableAlias, String mappingPrefix) {
return super.getSqlSelectAllFields(tableAlias, mappingPrefix)
+ """
+
"""
, %1$s.composition %2$s_composition, %1$s.dimensions %2$s_dimensions, %1$s.otherlanguages %2$s_otherLanguages,
%1$s.scale %2$s_scale, %1$s.version %2$s_version
"""
Expand All @@ -326,7 +329,8 @@ public String getSqlSelectAllFields(String tableAlias, String mappingPrefix) {
@Override
public String getSqlSelectReducedFields(String tableAlias, String mappingPrefix) {
return super.getSqlSelectReducedFields(tableAlias, mappingPrefix)
+ """
+
"""
, %1$s.expressiontypes %2$s_expressionTypes, %1$s.language %2$s_language, %1$s.manifestationtype %2$s_manifestationType,
%1$s.manufacturingtype %2$s_manufacturingType, %1$s.mediatypes %2$s_mediaTypes,
%1$s.titles %2$s_titles,
Expand All @@ -340,7 +344,8 @@ public String getSqlSelectReducedFields(String tableAlias, String mappingPrefix)
WorkRepositoryImpl.TABLE_ALIAS,
WorkRepositoryImpl.MAPPING_PREFIX)
// parents
+ """
+
"""
mms.title parent_title, mms.sortKey parent_sortKey,
parent.uuid parent_uuid, parent.label parent_label, parent.titles parent_titles, parent.manifestationtype parent_manifestationType,
parent.refid parent_refId, parent.notes parent_notes, parent.created parent_created, parent.last_modified parent_lastModified,
Expand All @@ -350,7 +355,8 @@ parentwork.uuid parentwork_uuid, get_identifiers(parentwork.uuid) parentwork_ide
parentwork.titles parentwork_titles,
"""
// relations
+ """
+
"""
{{entityRelationAlias}}.predicate {{entityRelationMap}}_predicate, {{entityRelationAlias}}.sortindex {{entityRelationMap}}_sortindex,
{{entityRelationAlias}}.additional_predicates {{entityRelationMap}}_additionalPredicates,
max({{entityRelationAlias}}.sortindex) OVER (PARTITION BY {{tableAlias}}.uuid) relation_max_sortindex,
Expand All @@ -363,7 +369,8 @@ parentwork.uuid parentwork_uuid, get_identifiers(parentwork.uuid) parentwork_ide
.replace("{{entityMapping}}", entityRepository.getMappingPrefix())
+ entityRepository.getSqlSelectReducedFields()
// publishing infos
+ """
+
"""
, {{tableAlias}}.publication_info {{mappingPrefix}}_publicationInfo, {{tableAlias}}.production_info {{mappingPrefix}}_productionInfo,
{{tableAlias}}.distribution_info {{mappingPrefix}}_distributionInfo,
-- publisher
Expand All @@ -386,7 +393,8 @@ parentwork.uuid parentwork_uuid, get_identifiers(parentwork.uuid) parentwork_ide
@Override
protected String getSqlSelectReducedFieldsJoins() {
return super.getSqlSelectReducedFieldsJoins()
+ """
+
"""
LEFT JOIN (
manifestation_manifestations mms INNER JOIN manifestations parent
ON parent.uuid = mms.subject_uuid
Expand All @@ -408,7 +416,8 @@ LEFT JOIN (
/* 6-7 */
WorkRepositoryImpl.TABLE_NAME,
WorkRepositoryImpl.TABLE_ALIAS)
+ """
+
"""
LEFT JOIN %2$s %3$s ON %3$s.uuid = ANY (%1$s.publishing_info_agent_uuids)
LEFT JOIN %4$s %5$s ON %5$s.uuid = ANY (%1$s.publishing_info_locations_uuids)
"""
Expand Down Expand Up @@ -552,7 +561,8 @@ protected void basicReduceRowsBiConsumer(Map<UUID, Manifestation> map, RowView r
@Override
public String getSqlUpdateFieldValues() {
return super.getSqlUpdateFieldValues()
+ """
+
"""
, composition=:composition, dimensions=:dimensions, expressiontypes=:expressionTypes::mainsubtype[],
language=:language, manifestationtype=:manifestationType, manufacturingtype=:manufacturingType,
mediatypes=:mediaTypes::varchar[], otherlanguages=:otherLanguages::varchar[],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,8 @@ protected String getSqlInsertValues() {
@Override
public String getSqlSelectReducedFields(String tableAlias, String mappingPrefix) {
return super.getSqlSelectReducedFields(tableAlias, mappingPrefix)
+ """
+
"""
, %1$s.creation_daterange %2$s_creationDateRange
, %1$s.creation_timevalue %2$s_creationTimeValue
, %1$s.first_appeared_date %2$s_firstAppearedDate
Expand All @@ -347,13 +348,15 @@ public String getSqlSelectReducedFields(String tableAlias, String mappingPrefix)
"""
.formatted(tableAlias, mappingPrefix)
// parents
+ """
+
"""
parent.uuid parent_uuid, parent.label parent_label, parent.titles parent_titles,
parent.refid parent_refId, parent.notes parent_notes, parent.created parent_created, parent.last_modified parent_lastModified,
parent.identifiable_objecttype parent_identifiableObjectType, get_identifiers(parent.uuid) parent_identifiers,
"""
// relations
+ """
+
"""
{{entityRelationAlias}}.predicate {{entityRelationMap}}_predicate, {{entityRelationAlias}}.sortindex {{entityRelationMap}}_sortindex,
{{entityRelationAlias}}.additional_predicates {{entityRelationMap}}_additionalPredicates,
max({{entityRelationAlias}}.sortindex) OVER (PARTITION BY {{tableAlias}}.uuid) relation_max_sortindex,
Expand All @@ -370,7 +373,8 @@ parent.identifiable_objecttype parent_identifiableObjectType, get_identifiers(pa
@Override
protected String getSqlSelectReducedFieldsJoins() {
return super.getSqlSelectReducedFieldsJoins()
+ """
+
"""
LEFT JOIN (
work_works wws INNER JOIN works parent
ON parent.uuid = wws.subject_uuid
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ public static String sqlSelectAllFields(String tableAlias, String mappingPrefix)

public static String sqlSelectReducedFields(String tableAlias, String mappingPrefix) {
return UniqueObjectRepositoryImpl.sqlSelectReducedFields(tableAlias, mappingPrefix)
+ """
+
"""
, dbidentifiers2jsonb({{tableAlias}}.identifiers) {{mappingPrefix}}_identifiers,
{{tableAlias}}.label {{mappingPrefix}}_label,
{{tableAlias}}.type {{mappingPrefix}}_subjectType
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,8 @@ protected String getSqlInsertValues() {
@Override
public String getSqlSelectReducedFields(String tableAlias, String mappingPrefix) {
return super.getSqlSelectReducedFields(tableAlias, mappingPrefix)
+ """
+
"""
, {{tableAlias}}.email {{mappingPrefix}}_email,
{{tableAlias}}.enabled {{mappingPrefix}}_enabled,
{{tableAlias}}.firstname {{mappingPrefix}}_firstname,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ public BucketObjectsResponse<Headword> find(BucketObjectsRequest<Headword> bucke
}

String baseQuery =
"""
"""
WITH headwords_list AS (SELECT row_number() OVER (ORDER BY {{sortColumn}}) as num, {{tableAlias}}.uuid, {{selectForLabel}} FROM {{tableName}} AS {{tableAlias}}),
hws AS (SELECT * FROM headwords_list WHERE num <@ int8range((SELECT num FROM headwords_list WHERE uuid = :startUuid), (SELECT num FROM headwords_list WHERE uuid = :endUuid), '[]'))
"""
Expand Down Expand Up @@ -244,7 +244,7 @@ public BucketsResponse<Headword> find(BucketsRequest<Headword> bucketsRequest)
argumentMappings.put("endUuid", endUuid);

sqlQuery.append(
"""
"""
WITH headwords_list AS (SELECT row_number() OVER (ORDER BY {{sortColumn}}) AS num, {{tableAlias}}.uuid, {{selectForLabel}} FROM {{tableName}} AS {{tableAlias}}),
hws AS (SELECT * FROM headwords_list WHERE num <@ int8range((SELECT num FROM headwords_list WHERE uuid = :startUuid), (SELECT num FROM headwords_list WHERE uuid = :endUuid), '[]')),
"""
Expand All @@ -254,7 +254,7 @@ hws AS (SELECT * FROM headwords_list WHERE num <@ int8range((SELECT num FROM hea
.replace("{{tableName}}", tableName));
} else {
sqlQuery.append(
"""
"""
WITH hws AS (SELECT row_number() OVER (ORDER BY {{sortColumn}}) AS num, {{tableAlias}}.uuid, {{selectForLabel}} FROM {{tableName}} AS {{tableAlias}}),
"""
.replace("{{selectForLabel}}", selectForLabel)
Expand All @@ -263,7 +263,7 @@ WITH hws AS (SELECT row_number() OVER (ORDER BY {{sortColumn}}) AS num, {{tableA
.replace("{{tableName}}", tableName));
}
sqlQuery.append(
"""
"""
buckets AS (SELECT {{tableAlias}}.num, {{tableAlias}}.uuid, {{tableAlias}}.label, ntile(:numberOfBuckets) OVER (ORDER BY {{sortColumn}} ASC) AS tile_number FROM hws AS {{tableAlias}}),
buckets_borders_nums AS (SELECT min(num) AS minNum, max(num) AS maxNum, tile_number FROM buckets GROUP BY tile_number ORDER BY tile_number)
SELECT bu.num, bu.uuid, bu.label, bu.tile_number FROM buckets AS bu WHERE bu.num IN (SELECT minNum FROM buckets_borders_nums UNION SELECT maxNum FROM buckets_borders_nums)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -508,7 +508,8 @@ void testGetWhereClauses() {
repo.addFiltering(f, actual, mappings);
String expected =
" "
+ """
+
"""
WHERE (i.split_label::TEXT[] @> :searchTermArray_1::TEXT[]
OR jsonb_path_exists(i.description, ('$.\"de-Latn\" ? (@ like_regex \"' || :searchTerm_2 || '\" flag \"iq\")')::jsonpath))
AND ((i.last_modified > :filtervalue_3))"""
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@
<plugin>
<groupId>com.spotify.fmt</groupId>
<artifactId>fmt-maven-plugin</artifactId>
<version>2.22.1</version>
<version>2.23</version>
<executions>
<execution>
<goals>
Expand Down
Loading